This is a layer 2 switch application with virtual slicing function. The slicing function allows us to create multiple layer 2 domains. This is similar to MAC-based VLAN but there is no limitation on VLAN ID space.
- Ruby 2.0.0 or higher (RVM).
- Open vSwitch (
apt-get install openvswitch-switch).
git clone https://github.com/trema/routing_switch.git
cd routing_switch
bundle install --binstubsTo run without virtual slicing, run lib/routing_switch.rb as
follows:
./bin/trema run lib/routing_switch.rb -c trema.confTo run with virtual slicing support, run lib/routing_switch.rb with
-- --slicing options as follows:
./bin/trema run lib/routing_switch.rb -c trema.conf -- --slicingIn another terminal, you can create virtual slices with the following command:
./bin/slice add fooThen add hosts to the slice with the following command:
./bin/slice add_host --mac 11:11:11:11:11:11 --port 0x1:1 --slice fooTo start the REST API server:
./bin/rackupRead this for details.
| Description | Method | URI |
|---|---|---|
| Create a slice | POST | /slices |
| Delete a slice | DELETE | /slices |
| List slices | GET | /slices |
| Shows a slice | GET | /slices/:slice_id |
| Add a port to a slice | POST | /slices/:slice_id/ports |
| Delete a port from a slice | DELETE | /slices/:slice_id/ports |
| List ports | GET | /slices/:slice_id/ports |
| Shows a port | GET | /slices/:slice_id/ports/:port_id |
| Adds a host to a slice | POST | /slices/:slice_id/ports/:port_id/mac_addresses |
| Deletes a host from a slice | DELETE | /slices/:slice_id/ports/:port_id/mac_addresses |
| List MAC addresses | GET | /slices/:slice_id/ports/:port_id/mac_addresses |
| Shows a MAC address | GET | /slices/:slice_id/ports/:port_id/mac_addresses/:mac_address |