= The virtual switch = Not to be mistaken for [wiki:Documentation/OpenFlow/VartualSwitch vartual switches], virtual switches, or !OpenFlow switches, are the main service offered by the !OpenFlow capable switch. Several virtual switches may exist on a single physical device, or a single virtual switch may encompass a whole switch. In the latter case the switch will just be referred to as an !OpenFlow switch. Each virtual switch may be assigned a controller and a set of flow tables, and are associated with their !OpenFlow VLANs. == Overview == This article contains the following topics: * Definitions of Legacy VLANs, !OpenFlow VLANs, and virtual switches * CLI commands used in virtual switching * Virtual switch setup * The official NEC guide for the !OpenFlow capable IP8800/S3640 (attachment) == Legacy VLANs, !OpenFlow VLANs, and virtual switches == Legacy VLANs, !OpenFlow VLANs, and virtual switches all seem to serve a similar function: to provide a means to split up broadcast domains at the data link layer. This may cause some confusion as to what the exact differences are between these things. * '' Legacy VLANs '' are the familiar technology usually associated with 802.1q, and can be configured in any standard switch. * '' !OpenFlow VLANs '' are legacy VLANs on which the virtual switches will run as overlay infrastructure. the VLAN number becomes the virtual switch's '' VLAN ID '' that can be used to pull up a specific switch's information using the `showswitch` or `showflow` commands. * '' Virtual switches '' are VLANs that implement !OpenFlow protocol and have !OpenFlow controllers, flow tables, and '' datapath identifiers '' (basically the virtual switch's "name," the 12-digit hex number labeled as the dpid in the manual) associated with them. they will not function without the controller. == CLI Commands == The commands regarding virtual switching will not be found among the usual list of commands when you type `?` at the terminal. This is the list of commands used in virtual switching that is accessible from the CLI: * ` setvsi ` - Creates an instance of virtual switch. Comes with parameters. * ` deletevsi ` - Deletes an instance of virtual switch. * ` showswitch ` - Gives you a list of virtual switches running on your switch. * ` showflow ` - Gives you information about the flow tables applied to the virtual switches. ''' The !OpenFlow commands can be used even when you aren't in privileged mode. This may be a security issue worth considering. ''' == Setup == The following list can be followed as a guideline for setting up virtual switches. 1. Disable spanning tree protocol 1. Create VLANs 1. Assign ports to VLANs 1. Use `setvsi` to create virtual switches from the ports assigned to VLANs The details can be found in the NEC !OpenFlow capable switch guide attached to this article. == Example Setup - the weird .conf file incident == One method to rewrite the !OpenFlow configuration is to delete openflow.conf directly through the switch, then use the `setvsi` command to set the new virtual switches up. Usually this is unnecessary, but it happened to be effective when old configurations did not seem to go away despite editing the .conf file using a PC. 1. Delete the old .conf file. {{{ > cd /mnt/ > rm openflow.conf remove 'openflow.conf'? y }}} 2. use `setvsi` to generate virtual switches: {{{ > setvsi 1 1,3,5,7,9,11,13,15,2.1 tcp 172.16.4.224 dpid 0x0123456789ab > setvsi 2 17,19,21,23,25,27,29,31,2.2 tcp 172.16.4.180 dpid 0x012345678abc > setvsi 3 33,35,37,39,41,43,45,47,2.3 tcp 172.16.4.64 dpid 0x01234567abcd }}} The changes should take effect immediately. To confirm this, use the `showswitch` command: {{{ > showswitch vlan ports secure channel ---- ----- -------------- 1 1, 3, 5, 7, 9, 11, 13, 15, 2.1 disconnected 2 17, 19, 21, 23, 25, 27, 29, 31, 2.2 disconnected 3 33, 35, 37, 39, 41, 43, 45, 47, 2.3 disconnected }}} Details about specific virtual switches may be found by appending ` [detail]` to the command. The updated contents of openflow.conf: {{{ setvsi 1 1,3,5,7,9,11,13,15,2.1 tcp 172.16.4.224 dpid 0x0123456789ab setvsi 2 17,19,21,23,25,27,29,31,2.2 tcp 172.16.4.180 dpid 0x012345678abc setvsi 3 33,35,37,39,41,43,45,47,2.3 tcp 172.16.4.64 dpid 0x01234567abcd }}} However, it seems like it is not possible to set `double-wide-mode`, or `no-save` through the CLI. These have to be added by editing openflow.conf using the PC. There seems to be no need for 1:1 mapping between VLANs and virtual switches. Here, VLAN 5 encompasses ports 18.20.22.and 24: {{{ # setvsi 5 18,20,48.5 tcp 172.16.4.16 dpid 0x0123456abcde # showswitch 5 detail Virtual switch 5 Datapath ID : 1251000106206(0x123456abcde) Port : gigabitethernet 0/18 (link down) gigabitethernet 0/20 (link down) gigabitethernet 0/48.5 (link up, 100M full) Conn mode : tcp Controller : 172.16.4.16:6633 (disconnected) Exact match : 01-24, 49-50 hw 0 / hw max 1510 25-48 hw 0 / hw max 1512 Exact match : sw 0 / sw max 131072 Wildcard : sw 0 / sw max 100 Packet buff : 256 packets / 4294967295 MB Miss sendlen: 128 bytes }}} Virtual switch 5 is running on ports 18 and 20. VLANs not associated with virtual switches will behave as regular switches. [wiki:Documentation/OpenFlow/ go back to OpenFlow index]