Changes between Version 13 and Version 14 of Internal/OpenFlow/QuantaSetup


Ignore:
Timestamp:
Mar 2, 2011, 1:09:08 AM (13 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/QuantaSetup

    v13 v14  
    1 = Setting up the Quanta LB4G =
    2 Unlike the IP8800, This is a purely !OpenFlow switch, unable to do anything without a controller. The steps can be found documented elsewhere (ref. below), but we repeat the steps just in case things change. 
    3 
    4 == 1. Preparation ==
    5 === 1.1 References ===
     1[#bottom jump to bottom] [[BR]]
     2= The Quanta LB9A/u-boot primer =
     3This page is meant to be a "handbook" of sorts that give you a general picture and a HOW-TO of the various technicalities associated with configuring the Quanta LB9A, a switch that, when set up properly, becomes a "purely !OpenFlow" switch that must be connected to a controller to function as a network device.   
     4
     5== Index == #index
     6...more like quick links.
     7 [#I I Prep work] - some things to keep around and in mind when working with these switches[[BR]]
     8 [#II II LB9A facilities] - the bootloader, firmware and their modes, hardware, and how to get to them[[BR]]
     9 [#III III A u-boot Primer] - using the bootloader to configure and troubleshoot[[BR]]
     10 [#IV IV OpenFlow Switching] - setting up !OpenFlow mode[[BR]]
     11 
     12== I. Preparations == #I
     13The following things are good to have on hand.
     14=== 1.1 References ===
    615Flashing the firmware
    716 * http://openflowswitch.org/wk/index.php/LB4GImageSetup
     
    1120 * http://www.openflowswitch.org/wk/index.php/IndigoReleaseNotes - the actual HOWTO for turning the box into an !OpenFlow switch
    1221[[BR]]
    13 === 1.2 Prerequisites ===
    14  * OS on PC: Ubuntu
    15  * packages on PC: ckermit, xinetd, tftpd-hpa
    16 
    17 == 2. Installation == 
    18 === 2.1 Connecting to the switch ===
    19  A serial connection can be set up between the switch and a machine using a RJ-45 to RS-232 cable. Surprisingly, a Cisco cable will work for this. Connect the RJ-45 end to the port labeled "Con" on the switch, and the other end to the PC. Next, start a session from a shell with kermit as root:
     22=== 1.2 Prerequisites ===
     23 * A PC running some *nix with a serial port
     24 * null modem cable 
     25 * packages on PC: ckermit, openssh 
     26
     27== II LB9A facilities == #II
     28The Quanta switch is basically a Linux box with a bunch of ports. Out of the box, the Quanta comes with two versions of customized Linux, one pre-installed on the on-board flash, and the other, on the removable cf card. The flash and cf card are the two primary forms of memory found on the switch that we really need to care about. One can chose which image to load through u-boot, the second-stage boot loader provided with the switch. In either case, the Linux base for the Quanta is comprised of the kernel image (uImage), the filesystem (uInitrd2m), and device tree (LB9A.dtb). The primary differences between the two images are:
     29
     30 * The image on the flash underlies a diagnostics test interface
     31 * The image on the cf card underlies !XorPlus, a switching firmware that allows the Quanta to be configured as a regular switch
     32 * The image on th cf card also allows access to a older version of the !OpenFlow interface, along with the system shell
     33
     34What follows next is a overview of the two images and u-boot. Note, usage of u-boot is covered in greater detail in [#III section 3]. 
     35
     36=== 2.1 The cf card image ===
     37This is the image loaded by default when the switch is powered on. It can also be loaded from u-boot with the command `run cfcard_bootcmd`.
     38
     39After a good chunk of it loads, you are given three choices:
     40{{{
     41    Please choose which to start: Pica8 XorPlus, OpenFlow, or System shell:
     42        (Will choose default entry if no input in 10 seconds.)
     43        [1]  Pica8 XorPlus   * default
     44        [2]  OpenFlow
     45        [3]  System shell
     46}}}
     47
     48As seen in the above "screenshot", XorPlus will be automatically loaded after 10 seconds, giving you the standard switch CLI. !XorPlus is a full-fledged switch configuration interface; Documentation for using XorPlus can be downloaded from the [http://www.pica8.org/documents/user-guide Pica8 website].
     49
     50The second choice, "!OpenFlow", gives you an outdated version of the Indigo interface, the "pure OpenFlow" switch firmware. The interface is essentially a standard Linux shell, plus !OpenFlow facilities such as `of-bcm-cli`. 
     51
     52The last choice, "System shell", lets you access the base system using the ash shell. This last mode is useful if you need to access the cf card contents (e.g. to try different versions of firmware without erasing stuff/dealing with flashing the switch).
     53
     54
     55=== 2.2 The flash image ===
     56This image can be loaded form the u-boot prompt with the command `run flash_bootcmd`. As far as I can tell, the sole purpose of this image is to provide a diagnostics test facility. The following prompt shows up after the standard boot-up procedures: 
     57
     58{{{
     59     Diagnostic Test Main Menu v1.3 (LB9A - Linux)
     60
     61[1  ]  File Management
     62[2  ]  Board Information
     63[3  ]  Diagnostic Test
     64[4  ]  Manufacturing Test Mode Set
     65[5  ]  Test Error Log File Management
     66[6  ]  PING
     67[7  ]  Reset
     68[8  ]  For Vibration Test     
     69
     70 Enter your choice:
     71
     72}}}
     73There isn't much I can tell you about this interface, except that option [1 ] doesn't do anything, [7 ] reboots the switch, and [8 ] might be unsafe to do on a hard, inclined surface^1^.
     74
     75=== 2.3 u-boot ===
     76u-boot is the second-stage boot loader that comes with the switch. It has enough smarts to allow you to flash the switch and inspect/configure various boot options, and in the case of !OpenFlow, set parameters that the switch will use to connect to the controller.   
     77
     78To enter the u-boot prompt, you have to interrupt the boot process when you see the u-boot banner.The easiest way to do this is to have a serial connection to the switch so you can see it boot. This can be set up using a RJ-45 to RS-232 cable. A Cisco cable will also work for this. Connect the RJ-45 end to the port labeled "Con" on a switch, and the other end to the PC. Next, start a session from a shell with kermit as root:
    2079
    2180{{{
     
    2685}}}
    2786
     87Then power on/reboot the switch. If you see the U-Boot banner, you can stop the boot process by hitting any key. This should lead you to the '=>' u-boot prompt:
     88
     89{{{
     90U-Boot 1.3.0 (Sep  9 2010 - 16:00:13)
     91
     92CPU:   8541, Version: 1.1, (0x80720011)
     93Core:  E500, Version: 2.0, (0x80200020)
     94Clock Configuration:
     95       CPU: 825 MHz, CCB: 330 MHz,
     96
     97...
     98
     99Net:   TSEC0, TSEC1
     100IDE:   Bus 0: OK
     101  Device 0: Model: CF Card Firm: Ver2.35 Ser#: 14EF0707040600187736
     102            Type: Hard Disk
     103            Capacity: 1923.9 MB = 1.8 GB (3940272 x 512)
     104Hit any key to stop autoboot:  0
     105=>
     106}}}
     107
     108u-boot is configured by creating and modifying environment variables. These can be anything from a single variable to a multi-line script of many variables, parameters, and flags. Several commands that are good to know for working with u-boot are:
     109
     110 * `?` - list available commands
     111 * `help` - get more information about a command
     112 * `printenv` - list current environment variables
     113 * `setenv` - make changes to / create new environment variables
     114 * `saveenv` - save changes to environment variables
     115 * `copy` - use tftp to copy files to flash
     116 * `imls` - list images in flash
     117 * `flinfo` - print flash memory contents 
     118
     119This list is by no means exhaustive, even with respect to the commands that we mention throughout this page. Which brings us to the next section, the u-boot primer. 
     120
     121== III A u-boot Primer == #III
     122This section is a HOW-TO for using u-boot with respect to the Quanta, e.g. variables, scripts, and memory maps unique to this switch. !OpenFlow related u-boot stuff can be found in the [#IV next section].
     123
     124=== 3.1 Environment variables ===
     125As mentioned in the last section, u-boot is configured through environment variables. The command `printenv` lets you see all of them:
     126
     127{{{
     128=> printenv
     129flash_bootcmd=setenv bootargs root=/dev/ram console=ttyS0,$baudrate; bootm ffd00000 ff000000 ffee0000
     130cfcard_bootcmd=setenv bootargs root=/dev/ram console=ttyS0,$baudrate; ext2load ide 0:1 0x1000000 /uImage;ext2load ide 0:1 0x2000000 /uInitrd2m;ext2load ide 0:1 0x400000 /LB9A.dtb;bootm 1000000 2000000 400000
     131bootdelay=5
     132baudrate=115200
     133loads_echo=1
     134ipaddr=192.168.2.1
     135serverip=192.168.2.12
     136rootpath=/nfsroot
     137gatewayip=192.168.2.254
     138netmask=255.255.255.0
     139hostname=LB9A_X
     140bootfile=eldk-quanta
     141loadaddr=4000000
     142ethact=TSEC0
     143bootcmd=run cfcard_bootcmd
     144ethaddr=60:eb:69:21:5b:e3
     145eth1addr=60:eb:69:21:5b:e4
     146stdin=serial
     147stdout=serial
     148stderr=serial
     149
     150Environment size: 644/8188 bytes
     151
     152}}}
     153Each entry is a line of the form [variable name]=[parameters]. the parameters can be a combination of u-boot commands and other variables in a way similar to a simple shell script. 
     154
     155For example, note the first two entries in the "screen shot" above:
     156{{{
     157<entry 1> flash_bootcmd=setenv bootargs root=/dev/ram console=ttyS0,$baudrate; bootm ffd00000 ff000000 ffee0000
     158<entry 2> cfcard_bootcmd=setenv bootargs root=/dev/ram console=ttyS0,$baudrate; ext2load ide 0:1 0x1000000 /uImage;ext2load ide 0:1 0x2000000/uInitrd2m;ext2load ide 0:1 0x400000 /LB9A.dtb;bootm 1000000 2000000 400000
     159}}}   
     160they were part of the `run` commands mentioned earlier. The parameters to these variables create another variable called "bootargs" using command `setenv`. What follows are the parameters for this new variable:
     161 * `root=/dev/ram` - probably specifies where the root filesystem should be loaded^2^
     162 * `console=ttyS0` - set console
     163 * `$baudrate` - use the parameters specified in the variable "baudrate"
     164The parameters that follow the semicolon after `$baudrate` differ a bit for the two variables. For the cfcard entry the `ext2load` cammands specifies where to fetch the kernel, ramdisk, and device tree files from, and finally issues the command `bootm` to load the image. 
     165
     166
     167== IV OpenFlow Switching == #IV
     168== 4.1 Installation == 
     169=== 4.1.1 Connecting to the switch ===
     170 A serial connection can be set up between the switch and a machine using a RJ-45 to RS-232 cable. Surprisingly, a Cisco cable will work for this. Connect the RJ-45 end to the port labeled "Con" on the switch, and the other end to the PC. Next, start a session from a shell with kermit as root:
     171
     172{{{
     173kermit -l /dev/ttyS0
     174set carrier-watch off
     175set baud 115200
     176connect
     177}}}
     178
    28179Fire up the switch. If you see the U-Boot banner, you can stop the boot process (hit ctrl-c) so you can copy/burn the images onto flash.
    29180
    30 === 2.2 updating u-boot ===
     181=== 4.2 updating u-boot ===
    31182This step is comprised of the following steps:
    32183 1. change network settings of switch
     
    37188The switch for SB9 will be images via nfs with console.sb9 as the server. This is to prevent users from bricking the switch by playing with u-boot.
    38189
    39 === 2.2.1. change network settings ===
     190=== 4.2.1 change network settings ===
    40191The network settings are hard-wired into the switch via environment variables. The default settings statically set the switch's IP to a 192.168.X.X address block, which you might want to change depending on your network setup. This can be done using command `setenv`. While all environment variables can be viewed with `printenv`, the four variables of our interest are:
    41192
     
    55206}}}
    56207
    57 === 2.2.2. updating u-boot/copying files to flash ===
     208=== 4.2.2 updating u-boot/copying files to flash ===
    58209Once the networking variables are set, you can start copying the necessary files to the switch using `copy`. `copy` uses tftp to fetch the images:
    59210
     
    67218The first line updates u-boot. The next three fetch the kernel image, root filesystem, and device tree, respectively.
    68219
    69 === 2.2.3. modifying boot parameters ===
     220=== 4.2.3 modifying boot parameters ===
    70221''This section covers booting the switch using a manually loaded root filesystem from on-board flash. To use NFS, refer to the next section, 2.2.4.''
    71222[[BR]][[BR]]
     
    87238'''Note:''' The bootcmd parameter will be the proper value if the switch is restarted after u-boot is updated (a.k.a. after the 1st `copy` command). This, however, resets all of your networking variables, so you'd have to re-do the steps in 2.2.1. Basically, it is up to the tastes of whoever is re-imaging the switches to either manually set the bootcmd variable or reset all of the network parameters after reboot.
    88239
    89 === 2.2.4. Using NFS with DHCP. ===
     240=== 4.2.4 Using NFS with DHCP. ===
    90241Reference articles:
    91242 * http://www.openflow.org/wk/index.php/IndigoQuickStartLB4G#NFS
     
    1322834. Save your settings with `saveenv`.
    133284
    134 == 3. Configuration ==
     285== 4.3 Configuration ==
    135286The Quanta is pretty much just a modified, minimal Linux box with a bunch of ports. Upon startup, you will be at the Linux shell as root.
    136287 * eth0 and eth1 as given by `ifconfig -a` are eth1 and eth2 on the faceplate, respectively. The interfaces can be manipulated as with any Linux box using `ifconfig`.
    137288 * The ssh server (dropbear) is enabled by default. Telnet can be started by invoking telnetd. In either case the default username is `root`, and password is `OpenFlow`.
    138289
    139 === 3.1. Using the !OpenFlow CLI (OF-BCM) ===
     290=== 4.3.1 Using the !OpenFlow CLI (OF-BCM) ===
    140291OF-BCM is the !OpenFlow command line supplied with the image. It can be started manually:
    141292{{{
     
    154305}}}
    155306
    156 === 3.2. Key files ===
     307=== 4.3.2 Key files ===
    157308 The !OpenFlow components of the switch rely on the following:
    158309 * `/etc/rc.sh` - system startup script: bring up `lo`, mounts filesystems, loads kernel modules, ect
     
    162313 * `/etc/find-env` - defines many of the system variables
    163314
     315
     316===== -- ===== #bottom
    164317