Skip to content

Latest commit

 

History

History
304 lines (249 loc) · 13.3 KB

deploy-to-physical-switch.md

File metadata and controls

304 lines (249 loc) · 13.3 KB

Installing and Booting OpenSwitch

Introduction

OpenSwitch is designed to work on ONIE based white-box switches. The build system from OpenSwitch produces ONIE installer images, and you can check the hardware compatibility lists to find if your hardware is supported.

You can get an image by building it yourself or downloading a pre-built one from the download section.

OpenSwitch Installer Architecture

The ONIE specification leaves it up to the NOS to define the layout of the partitions. OpenSwitch uses three partitions on ONIE-based hardware: two partitions are for dual OpenSwitch installation and one partition for persistent configuration. The size of the partitions is defined by the target platform.

+--------------------+
|                    |  Configuration partition:
|  OpenSwitch Conf   |  Preserved across installations
|                    |
+--------------------+
|                    |
|  OpenSwitch Diags  |  Diagnostics Partition
|                    |
+--------------------+
|                    |
|  OpenSwitch 1      |  Primary Image Partition
|                    |
+--------------------+
|                    |
|  OpenSwitch 2      |  Secondary Image Partition
|                    |
+--------------------+

Image Partitions

The two image partitions are used for dual-image boot purposes. During the initial installation the NOS is deployed to the first partition, and in subsequent updates or installations the new image will be installed on the inactive partition.

NOTE: OpenSwitch currently does not implement automatic rollback in case a newly-installed image fails to boot.

Configuration Partition

The configuration partition stores the permanent configuration of the switch and will be preserved across image installations. It also stores the grubenv file that notifies the installed grub about which is the active image partition.

Diagnostics Partition

The diagnostics partition stores the crash dumps and logs which will be preserver across reboots and image installations.

Installing

There are several ways to install OpenSwitch (described below).

Installing using ONIE provisioning mechanisms

Since the images generated by OpenSwitch are ONIE-compatible installers, you can follow ONIE Quick Start Guide to identify a provisioning mechanism that suits your needs.

Installing manually from ONIE

Using USB device

Follow these steps:

For this guide, Windows laptop running Windows 7 Enterprise is used.

Prerequisites:

  1. USB to Serial adapter should be used. For this case, Belkin Serial Adapter, model F5U257 is used. The corresponding driver for Windows 7 Enterprise can be found at http://www.belkin.com/us/support-article?articleNum=4644
  2. Connect the USB to serial adapter to the Windows laptop and install the driver.
  3. Make sure the new device shows up in Device Manager under Ports (COM & LPT) as Belkin USB-to-Serial-Adapter(COMx) x after COM will vary based on the USB port to which it is connected.
  4. Copy the onie installer openswitch-onie-installer-x86_64-as5712_54x-<> (eg.openswitch-onie-installer-x86_64-as5712_54x-0.3.0+2016030718) to a USB device. This can be downloaded from https://archive.openswitch.net/artifacts/periodic/master/&lt;version&gt;/as5712/

Follow these steps:

  1. Connect the windows laptop to 5712 switch using the USB to Serial adapter

  2. Using putty, choose below: Serial line : COM4 Speed : 115200

  3. Once connected to the switch, reboot the switch

  4. Wait for the menu

+----------------------------------------------------------------------------+
| OpenSwitch Primary Image                                                   |
| OpenSwitch Secondary Image                                                 |
| OpenSwitch Development -- NFS root                                         |
|*ONIE                                                                       |
| DIAG: Accton Diagnostic                                                    |
|                                                                            |
+----------------------------------------------------------------------------+

Select ONIE, then ONIE: Rescue

+----------------------------------------------------------------------------+
| ONIE: Install OS                                                           |
|*ONIE: Rescue                                                               |
| ONIE: Uninstall OS                                                         |
| ONIE: Update ONIE                                                          |
| ONIE: Embed ONIE                                                           |
|                                                                            |
|                                                                            |
+----------------------------------------------------------------------------+

In the ONIE prompt, run fdisk -l as below

 ONIE:/ #

 ONIE:/ # fdisk -l

Disk /dev/sda: 8048 MB, 8048869376 bytes
100 heads, 38 sectors/track, 4136 cylinders
Units = cylinders of 3800 * 512 = 1945600 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1        4137     7860223+ ee EFI GPT

Disk /dev/sdb: 258 MB, 258998272 bytes
255 heads, 63 sectors/track, 31 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1   *           1          32      252896+  c Win95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys=(30, 254, 63) logical=(31, 124, 29)

Pick the partition that has the flash drive inserted (/dev/sdb1 in this case) and mount it:

ONIE:/ # mkdir /mnt/usb_drive_mount_point
ONIE:/ # mount /dev/sdb1 /mnt/usb_drive_mount_point/

Copy the onie installer file to a folder

ONIE:/ # ls /mnt/usb_drive_mount_point/
openswitch-onie-installer-x86_64-as5712_54x-0.3.0+2016030718

mkdir /onie-installer/
cp  /mnt/usb_drive_mount_point/openswitch-onie-installer-x86_64-as5712_54x-0.3.0+2016030718 /onie-installer/

Run the installer:

ONIE:/onie-installer # ./openswitch-onie-installer-x86_64-as5712_54x-0.3.0\+2016030718

ONIE:/onie-installer # ./openswitch-onie-installer-x86_64-as5712_54x-0.3.0\+2016030718

OpenSwitch ONIE installer (version 1.0) for Accton AS5712 54x

Initializing Intel(R) Boot Agent GE v1.5.43
PXE 2.1 Build 092 (WfM 2.0)
Press Ctrl+S to enter the Setup Menu..

--- Installing OpenSwitch GRUB ---
Installation finished. No error reported.

OpenSwitch installation completed

Rebooting...

Once rebooted, login as root and check the version. It should match with the one that was installed:

root@switch:~# vtysh
switch# show version
OpenSwitch 0.3.0 (Build: 0.3.0+2016030718-0.3.0-20160307180748-dev)
switch#

Using tftp

Follow these steps:

  1. Boot your Switch into ONIE Rescue OS mode.
  2. Copy the OpenSwitch ONIE installer file to your TFTP directory.
  3. Enter the following commands:
tftp -g -r <onie-installer-file> -l <onie-installer-file> <tftp-server>
chmod +x <onie-installer-file>
./<onie-file> # will reboot automatically

If there was a previously installed version of OpenSwitch, the installer will identify the inactive partition and will install there (preserving the configuration partition). If you want to perform a clean installation that removes the configuration partition and installs on the first image partition, you can set the variable OPS_CLEAN_INSTALL to true before invoking the installer. For example:

export OPS_CLEAN_INSTALL=true
./<onie-installer-file>

Updating an existing installed OpenSwitch image

Since OpenSwitch uses a dual image partition you can copy the to the file system inside a running OpenSwitch installation and run the following commands to install a new image on the inactive partition:

chmod +x <onie-installer-file>
./<onie-installer-file>

In this scenario the switch won't reboot automatically and you have to reboot manually. Clean installation is not possible from inside a running OpenSwitch image, and you will have to reboot into ONIE mode to perform it if required. If you want to reboot into ONIE installation mode, the OpenSwitch Linux shell offers a command that will trigger a reboot into ONIE install mode:

systemctl isolate onie-install

Uninstalling OS and Restoring an image

If you want to uninstall the OS on the switch and restore with a newer OPS image. Please follow these steps:

1. Type "reboot" and the switch should reboot.

2. Wait for the menu

```bash
+----------------------------------------------------------------------------+
| OpenSwitch Primary Image                                                   |
| OpenSwitch Secondary Image                                                 |
| OpenSwitch Development -- NFS root                                         |
|*ONIE                                                                       |
| DIAG: Accton Diagnostic                                                    |
|                                                                            |
+----------------------------------------------------------------------------+
```

3. Select ONIE, then ONIE: Uninstall OS

```bash
+----------------------------------------------------------------------------+
| ONIE: Install OS                                                           |
| ONIE: Rescue                                                               |
|*ONIE: Uninstall OS                                                         |
| ONIE: Update ONIE                                                          |
| ONIE: Embed ONIE                                                           |
|                                                                            |
|                                                                            |
+----------------------------------------------------------------------------+
```
You will see the following messages:
```
scsi 6:0:0:0: Direct-Access     ATP      ATP IG eUSB      1100 PQ: 0 ANSI: 6 B2
sd 6:0:0:0: [sda] 15720448 512-byte logical blocks: (8.04 GB/7.49 GiB)
sd 6:0:0:0: [sda] Write Protect is off
sd 6:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sd 6:0:0:0: [sda] Attached SCSI disk
Info: Mounting LABEL=ONIE-BOOT on /mnt/onie-boot ...
Info: Using eth0 MAC address: 48:0f:cf:af:c3:b4
Info: eth0:  Checking link... up.
Info: Trying DHCPv4 on interface: eth0
ONIE: Using DHCPv4 addr: eth0: 120.91.29.245 / 255.255.255.128
Starting: dropbear ssh daemon... done.
Starting: telnetd... done.
discover: Uninstall mode detected.  Running uninstaller.
Erasing internal mass storage device: /dev/sda4 (128MB)
  Percent complete: 100%
Erase complete.
Deleting partition 4 from /dev/sda
Erasing internal mass storage device: /dev/sda5 (1024MB)
  Percent complete: 100%
Erase complete.
Deleting partition 5 from /dev/sda
Erasing internal mass storage device: /dev/sda6 (2048MB)
  Percent complete: 100%
Erase complete.
Deleting partition 6 from /dev/sda
Erasing internal mass storage device: /dev/sda7 (2048MB)
  Percent complete: 100%
Erase complete.
Deleting partition 7 from /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
Uninstall complete.  Rebooting...
umount: can't remount rootfs read-only
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system reboot
Restarting system.
machine restart
```
4. You will be at the ONIE prompt, now either follow the steps mentioned in Using tftp
   or manually boot the switch using the onie installer.

Troubleshooting installation issues

  • After using "onie-install" if you see the following error message: "Detected incorrect number of partitions, please clean your ONIE installation or perform an OPS clean install" If you get this error message then you will need to do a clean install on your switch. To perform a clean installation of openswitch that will remove the previous configuration
    export OPS_CLEAN_INSTALL=true
    ./<onie-installer-file>
  • To debug the installation script you can use:
    sh -x ./<onie-installer-file>