= The virtual switch = Virtual switches are what makes !OpenFlow overlay networks possible. When created, a virtual switch will behave as an !OpenFlow device, manipulating packets according to the flow table information it recieves from the controller. by default, there are no virtual switches set up on the IP8800. You have to create them either by specifying them in openflow.conf or by using the command `setvsi` through the CLI. Here we talk about the latter way of creating virtual switches. == Overview == This article covers: * Virtual switch setup from CLI (as opposed to directly editing openflow.conf) * Making the switch and controller work * The official NEC guide for the !OpenFlow capable IP8800/S3640 (attachment) == CLI Commands == The commands for virtual switching will not be found among the usual list of commands that are listed when you type `?` at the terminal. Command completion doesn't work either, so you have to type out the whole command. In addition, if `no-save` was specified in openflow.conf, you will not be able to use `setvsi` or `deletevsi` from the CLI. The detailed list of commands and their uses are found on the NEC guide. == Setup: SW-SB09 == VLAN 28 on the switch used in the Sandbox 9 setup is made to run a virtual switch. The current port configurations: * ports 1-12 : CM (VLAN 3) * ports 13-24 : Control (VLAN 27) * ports 25-36 : Data (VLAN 28) * ports 37-48 : Trunk The ports were assigned to the VLANs using the CLI (details [wiki:Documentation/OpenFlow/CLISetup here]). To start the virtual switch on VLAN 28 (ports 25-36), in the CLI type: {{{ setvsi 28 25-36 tcp 172.16.100.1:6633 dpid 0x012345678987 }}} This starts a virtual switch with the VLAN ID 28 encompassing all 12 VLAN 28 ports, that uses a TCP connection to the controller at port 6633. == Important notes about virtual switches (7/8) == * Because a virtual switch uses the VLAN ID of the legacy VLAN it overlays, you can't have one virtual switch encompass the ports belonging to more than one VLAN. * If you have a group of ports, and they share a VLAN, if even one port out of the group is configured to be a virtual switch, the whole group of ports cease to function as a regular switch. * If some ports of the switch are meant to be left as legacy switches, it seems better to not include the trunk info when using the `setvsi` command. Including the trunk port in setvsi when there is no controller will mess up functionality of the trunk as well. == some experimentation with Ruby sockets (8/4) == The switch will keep trying to contact a controller, regardless of whether the controller is active. This happens once every 15 seconds or so, and can be seen with a very simple script that listens on TCP 6633 (the default !OpenFlow port) on the console's !OpenFlow VLAN interface, which has the IP address 172.16.100.1: {{{ #!/usr/bin/ruby -w require 'socket' # allow the switch to try to establish a connection ofpsock = TCPserver.new("172.16.100.1", 6633) #listen to see what port the switch is using while (session = ofpsock.accept) t = Time.now # to see interval of messages peer = session.peeraddr puts "#{peer[1]} #{peer[2]} #{t.to_s.split[3]}" session.close end }}} You get: {{{ 55354 172.16.100.10 20:53:22 55353 172.16.100.10 20:53:37 55352 172.16.100.10 20:53:52 55351 172.16.100.10 20:54:07 ... }}} The first and second columns show the port and IP address of the peer, respectively. 172.16.100.10 is the VLAN interface IP address for the Openflow VLAN on the switch, so you know it is the !OpenFlow switch trying to establish a connection with the controller. [[BR]] [[BR]] [wiki:Documentation/OpenFlow/ go back to OpenFlow index]