750 | | == 4.4 Preparing the SD card == #sdprep |
751 | | licenses, image file, openflow.conf |
752 | | == 4.5 OpenFLow Commands == #ofcom |
753 | | instantiating vswitches/datapaths |
| 779 | This section is comprised of steps 3 and 4. Technically, it's better explained as three steps: |
| 780 | |
| 781 | '''''1. Copy license to SD card'''''. The switch will refuse to boot from an SD card without the proper license file. Each license file should be named after a particular switch's serial ID, which can be found on a silver stcker on the lower righthand corner on the front of the device, or through the `show ver` command: |
| 782 | {{{ |
| 783 | > sh ver |
| 784 | Date 2010/07/26 15:42:50 UTC |
| 785 | Model: AX3640S-48T2XW |
| 786 | S/W: OS-L3L Ver. 11.1.C |
| 787 | H/W: Main board |
| 788 | AX-3640-48T2XWE-L [WA13CL48T2XVS400E05A005:80330300:307:1B514-1B512] |
| 789 | Module slot1 PS-M(AC) |
| 790 | AX-F2430-PSA01 [WA0PSA010000C110005A005] |
| 791 | Module slot2 FAN-M |
| 792 | AX-F2430-FAN01 [WA2FAN010000C140005A005] |
| 793 | }}} |
| 794 | The string in square brackets right underneath "H/W: Main board" is the full serial number of the switch. |
| 795 | |
| 796 | In this case, the proper license for this switch would be named 'WA13CL48T2XVS400E05A005.dat'. This should be renamed to 'license.dat' before being saved to the card. |
| 797 | |
| 798 | '''''2. Copy firmware image file to card'''''. The firmware is named 'k.img'. This doesn't need to be renamed. |
| 799 | |
| 800 | '''''3. Create openflow.conf'''''. Create a new file named 'openflow.conf' and save it to the card. |
| 801 | |
| 802 | With the three files saved, the card is ready for use. |
| 803 | [[BR]] |
| 804 | == 4.5 Flashing the switch == #flash |
| 805 | The switch has an SD slot next to the serial port. Slap the card in and reboot the switch with a `reload` as user admin. |
| 806 | {{{ |
| 807 | sw-sb09-da# reload |
| 808 | Dump information extracted? (y/n): y |
| 809 | old dump file(rmdump 07/21 21:16) delete OK? (y/n): y |
| 810 | }}} |
| 811 | If connected by serial, you should be able to see the following startup sequence, which should take about 2 minutes: |
| 812 | {{{ |
| 813 | sw-sb09-da# |
| 814 | ROM 00.03.52 |
| 815 | ....................................................................................... |
| 816 | |
| 817 | BOOT 00.03.00 |
| 818 | Loading from dev2 100% |
| 819 | |
| 820 | |
| 821 | login: |
| 822 | }}} |
| 823 | |
| 824 | 'Loading from dev2' indicates that the switch has successfully found, and is booting off of, the firmware on the SD card. |
| 825 | |
| 826 | === errors === |
| 827 | If you forget the license, or use the wrong one (e.g. one whose name doesn't match the serial ID of the switch), The switch will restart in the ROM prompt. |
| 828 | |
| 829 | The switch may also boot with the default image if the image on the SD card is corrupt. This is usually indicated by the message "Loading from dev0" and not recognizing [#ofcom OpenFlow specific commands]. |
| 830 | |
| 831 | The worst case scenario is a corrupted SD card. This may be caused by various reasons, including buggy firmware, improper restart, or using a card over 128MB. Symptoms include: |
| 832 | |
| 833 | * the device not starting up/loading the default image |
| 834 | * scrambled/truncated filenames (e.g. 'openflow.conf' showing up as 'openf~l.con') |
| 835 | * inability to create virtual switches |
| 836 | |
| 837 | The most surefire way to fix this is to reformat the SD card. The easiest way to do it is to use a Windows machine. When the card shows up under "Devices", right click and go to 'Format'. A window saying "Format Secure Digital Storage Device" should pop up. Set "Allocation Unit size" to "default allocation size", and click 'Start'. You may need to confirm that you want to reformat the card. The card should be good to go in about a minute or so. |
| 838 | |
| 839 | [[BR]] |
| 840 | [#index return to main index] |
| 841 | [[BR]] |
| 842 | [[BR]] |
| 843 | |
| 844 | == 4.6 OpenFLow Commands == #ofcom |
| 845 | === Index === #ofindex |
| 846 | these are the sub-sections to this section: |
| 847 | [#ofback 4.6.1. Background] [[BR]] |
| 848 | [#setv 4.6.2. Virtual switch instantiation] [[BR]] |
| 849 | [#delvsi 4.6.3. Virtual switch deletion] [[BR]] |
| 850 | [#ctvsi 4.6.4. Manipulating virtual switches] [[BR]] |
| 851 | [#ofmon 4.6.5. Monitoring OpenFlow stats] [[BR]] |
| 852 | [#others 4.6.6. other commands] [[BR]] |
| 853 | |
| 854 | The !OpenFlow capable firmware supports a suite of commands that can be used to configure !OpenFlow datapaths. These commands are located in /usr/local/bin/; try greping (is that a word?) for "vsi", or "port" for a list of commands. |
| 855 | |
| 856 | Once the switch is booted up, we can move to the final step of actually instantiating virtual switches using these commands. |
| 857 | |
| 858 | [[BR]] |
| 859 | === 4.6.2. Virtual switch instantiation === #setv |
| 860 | |
| 861 | '''setvsi''' [[BR]] |
| 862 | |
| 863 | sw-sb-01's data VLAns are all !OpenFlow virtual switches instantiated using the command `setvsi`. `setvsi` takes on the following minimal syntax: |
| 864 | {{{ |
| 865 | setvsi <VLAN ID> <ports> tcp <IP addr:port> dpid <datapath ID> |
| 866 | }}} |
| 867 | |
| 868 | * <VLAN ID> - the VLAN ID of the VLAn you want to overlay a virtual switch onto |
| 869 | * <ports> - the ports, without the '0/', that are going to be part of the virtual switch |
| 870 | * <IP addr:port> - IP address of the !OpenFlow controller you want the virtual switch to listen to, and port number (default is 6633) |
| 871 | * <datapath ID> - 12-digit hex value defining the MAC address for the virtual switch. Always begins with '0x' |
| 872 | |
| 873 | a full synopsis can be found by typing "setvsi" at the CLI. |
| 874 | |
| 875 | setvsi basically echos the whole command into openflow.conf. This is handy since you can follow the exact commands used to instantiate the virtual switches on a particular switch by simply doing a `cat /mnt/openflow.conf`. |
| 876 | |
| 877 | '''implementation''' [[BR]] |
| 878 | Here's sw-sb-01's conf file: |
| 879 | {{{ |
| 880 | sw-sb-01> cat /mnt/openflow.conf |
| 881 | setvsi 12 31,32,48.12 tcp 172.16.0.4:6633 dpid 0x001010123132 |
| 882 | setvsi 14 33,34,48.14 tcp 172.16.0.4:6633 dpid 0x001010143134 |
| 883 | setvsi 20 35,36,48.20 tcp 172.16.0.4:6633 dpid 0x001010203230 |
| 884 | setvsi 22 37,38,48.22 tcp 172.16.0.4:6633 dpid 0x001010223232 |
| 885 | setvsi 24 39,40,48.24 tcp 172.16.0.4:6633 dpid 0x001010243234 |
| 886 | setvsi 26 41,42,48.26 tcp 172.16.0.4:6633 dpid 0x001010263236 |
| 887 | }}} |
| 888 | |
| 889 | Each line is the exact command that was typed at the prompt. As you can see, sw-sb-01 has 6 virtual switches overlaying VLANs 12,14,20,22,24,and 26. All of them are pointed towards IP address 172.16.0.4, the ORBIT !OpenFlow controller. |
| 890 | |
| 891 | '''ORBIT DPID conventions''' [[BR]] |
| 892 | There are a few home-brew conventions that are used for the dpid's: |
| 893 | * first 3 bytes are always '001010' |
| 894 | * the 4th byte is the VLAN ID, in decimal |
| 895 | * the last two bytes are the VLAN ID in ascii hex notation. ASCII maps decimal 0-9 to hex 30-39. |
| 896 | |
| 897 | So, for example, if we have VLAN 12, the last 3 bytes will be '12', '31', and '32'. That's the dpid from the first setvsi line in the terminal output above. |
| 898 | |
| 899 | '''trunk ports''' [[BR]] |
| 900 | If you look at the list of ports from the conf file above, you'll notice that all of them end with "48.n", n being the VLAN ID for the virtual switch being instantiated. This value lets the switch know which VLAN ID to tag the traffic to/from a particular datapath with on a particular trunk port. For example, "48.12" means "tag virtual switch 12's traffic with VLAN ID 12 on trunk port 0/48." This is needed if you are using trunking the switch. |
| 901 | |
| 902 | [[BR]] |
| 903 | [#ofindex return to section index] [[BR]] |
| 904 | [#index return to main index] |
| 905 | [[BR]] |
| 906 | === 4.6.3. Virtual switch deletion === #delvsi |
| 907 | `deletevsi` deletes a certain virtual switch instantiation. The syntax is as follows: |
| 908 | {{{ |
| 909 | deletevsi <VLAN ID> |
| 910 | }}} |
| 911 | |
| 912 | nice and simple. |
| 913 | |
| 914 | [[BR]] |
| 915 | === 4.6.4. Manipulating virtual switches === #ctvsi |
| 916 | You don't want to have to keep deleting and redoing virtual switches just to add or remove ports from an instantiation. |
| 917 | * `addport <VLAN ID> <port>` - add ports to virtual switch for VLAN of <VLAN ID> |
| 918 | * `deleteport <VLAN ID> <port>` - delete ports from virtual switch for VLAN of <VLAN ID> |
| 919 | |
| 920 | Nor do you want to keep setvsi-ing them because you didn't want a virtual switch one moment, and then you wanted it the next. |
| 921 | * `disablevsi <VLAN ID>` - temporarily disable the virtual switch. As far as the switch is concerned, it's not there when it's disabled. |
| 922 | * `enablevsi <VLAN ID>` - enable a disabled virtual switch. |
| 923 | |
| 924 | [[BR]] |
| 925 | [#ofindex return to section index] [[BR]] |
| 926 | [#index return to main index] |
| 927 | [[BR]] |
| 928 | === 4.6.5. Monitoring !OpenFlow stats === #ofmon |
| 929 | There are a few commands to pull stats about flows, virtual switches, ect. |
| 930 | * `showswitch <VLAN ID|cr> <detail|cr>` - displays virtual switch information. VLAN ID and "detail" are optional parameters. |
| 931 | * `showflow <VLAN ID|cr> <detail|cr>` - display current flows. Same deal with parameters. |
| 932 | * `showofinfo` - display all !OpenFlow and system (akin to doing a dmesg and sysctl -a back-to-back) stats |
| 933 | |
| 934 | '''example''' [[BR]] |
| 935 | Displaying all datapaths: |
| 936 | {{{ |
| 937 | sw-sb-01> showswitch |
| 938 | vlan ports secure channel |
| 939 | ---- ----- -------------- |
| 940 | 12 31, 32, 48.12 connected |
| 941 | 14 33, 34, 48.14 connected |
| 942 | 20 35, 36, 48.20 connected |
| 943 | 22 37, 38, 48.22 connected |
| 944 | 24 39, 40, 48.24 connected |
| 945 | 26 41, 42, 48.26 connected |
| 946 | }}} |
| 947 | Here you can see that all of the virtual switches are registered ("connected") with the controller. |
| 948 | Now, if you want to focus on one virtual switch, say VLAN 12: |
| 949 | {{{ |
| 950 | sw-sb-01> showswitch 12 detail |
| 951 | Virtual switch 12 |
| 952 | Datapath ID : 68989104434(0x1010123132) |
| 953 | Datapath name: sw-sb-01 |
| 954 | Port : gigabitethernet 0/31 (link down) |
| 955 | gigabitethernet 0/32 (link down) |
| 956 | gigabitethernet 0/48.12 (link up, 1G full) |
| 957 | Conn mode : tcp |
| 958 | Controller : 172.16.0.4:6633 (connected) |
| 959 | Exact match : 01-24, 49-50 hw 0 / hw max 3046 |
| 960 | 25-48 hw 0 / hw max 3046 |
| 961 | Exact match : sw 0 / sw max 131072 |
| 962 | Wildcard : sw 1 / sw max 100 |
| 963 | Emerg : sw 0 / sw max 100 |
| 964 | Packet buff : 256 packets / 4294967295 MB |
| 965 | Miss sendlen : 128 bytes |
| 966 | Wcard mode : S/W only |
| 967 | Counter type : Packet Counter |
| 968 | MAC learning : On |
| 969 | Min EQ : 0 |
| 970 | Max EQ : 7 |
| 971 | Default EQ : 4 |
| 972 | VSI Enable : yes |
| 973 | }}} |
| 974 | |
| 975 | === 4.6.6. other commands === #others |
| 976 | I really haven't used the other commands e.g, for queue manipulation, so I can't really describe them. But here's the list of what I believe is all the commands for !OpenFlow datapath manipulation: |
| 977 | {{{ |
| 978 | -r-xr-xr-x 1 root wheel 221139 Jun 9 05:20 addport |
| 979 | -r-xr-xr-x 1 root wheel 211566 Jun 9 05:20 deleteflow |
| 980 | -r-xr-xr-x 1 root wheel 221162 Jun 9 05:20 deleteport |
| 981 | -r-xr-xr-x 1 root wheel 202225 Jun 9 05:20 deletevsi |
| 982 | -r-xr-xr-x 1 root wheel 202579 Jun 9 05:20 disablevsi |
| 983 | -r-xr-xr-x 1 root wheel 202513 Jun 9 05:20 enablevsi |
| 984 | -r-xr-xr-x 1 root wheel 521925 Jun 9 05:20 max-queue-rate |
| 985 | -r-xr-xr-x 1 root wheel 436 Jun 9 05:20 ofconf_mng.sh |
| 986 | -r-xr-xr-x 1 root wheel 202688 Jun 9 05:20 settrace |
| 987 | -r-xr-xr-x 1 root wheel 231122 Jun 9 05:20 setvsi |
| 988 | -r-xr-xr-x 1 root wheel 229570 Jun 9 05:20 showflow |
| 989 | -r-xr-xr-x 1 root wheel 2146 Jun 9 05:20 showofinfo |
| 990 | -r-xr-xr-x 1 root wheel 232831 Jun 9 05:20 showswitch |
| 991 | }}} |
| 992 | |
| 993 | |
| 994 | [[BR]] |
| 995 | [#ofindex return to section index] [[BR]] |
| 996 | [#index return to main index] |
| 997 | |
| 998 | |
| 999 | |