= The virtual switch = Not to be mistaken for [wiki:Documentation/OpenFlow/VartualSwitch vartual switches], virtual switches, or !OpenFlow switches, are a example of the virtualization capabilities of !OpenFlow. They are similar to VLANs in both configuration and behavior but are dictated by !OpenFlow controllers and flow tables. 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 covers the following topics: * CLI commands used in virtual switching * Virtual switch setup == 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. == 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 == Example setup == 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. 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]