Skip to content

Run virtual machine

Mike Lazar edited this page Jan 16, 2020 · 204 revisions

You can use virtualization software to evaluate and test OPX. A virtual machine (VM) uses the same software binaries as those executed on hardware devices. The only exceptions are the hardware abstraction layer components — the system device interface (SDI) and switch abstraction interface (SAI) implementations.

The OPX VM executable is an automated tool that allows for rapid setup and running of an OPX VM instance. The opx_vagrant.tgz compressed file contains opx_base.box and the Vagrant configuration file.

What you need to do

  • Install VirtualBox on the platform of your choice
  • Create virtual machine
  • Connect to Vagrant box
  • Setup network adapters

All host platforms

Install VirtualBox, then ensure the installed directory is added to the PATH and VT-x is enabled in the BIOS for all CPUs.

Microsoft Windows only

OpenSSH is only required to connect to the VM — no need to run an SSH server.

1. Install OpenSSH and ensure the installed directory is added to the PATH.

2. Install pscp and ensure the installed directory is added to the PATH.

Create virtual machine

All host files work identical for Windows, Linux, and Mac OS X. Use the examples to create, delete, restart, delete all instances, or restart a session. Use the --help option with commands to view available options.

1. Download the OPX VM for your specific host platform:

  • vm.exe — standalone executable for Windows host (Windows 7 and 10)
  • lvm — standalone executable for Linux host (tested Ubuntu 16.04 LTS)
  • mvm — standalone executable for Mac OS X host (Mac OS Sierra)

2. Copy the host-specific executable to a local directory.

3. Run the executable.

Create VM instance

vm.exe create <vm_name> --gui 

Power off a VM session

vm.exe poweroff <vm_name>

Restart existing VM session

vm.exe restart <vm_name>

Delete specific VM

vm.exe delete <vm_name>

Delete all existing VMs

vm.exe cleanVms

The VM tool is able to download onie-recovery and onie-installer files from an URL. Users can optionally use local copies of these files. Here are two examples:

Use URL to get a specific .iso and .bin files:

vm.exe create vm1 --iso http://<your_url>/onie-kvm_x86_64-r0.iso --bin  http://<your_url>/OPX-installerXX_x86_64.bin

Use local copies of the files:

vm.exe create vm1 --iso c:\temp\onie-kvm_x86_64-r0.iso --bin c:\opx-onie-installer.bin

Connect to Vagrant box

Vagrant boxes for various OPX releases are available on app.vagrantup.com. Search for the keyword opx and select virtualbox as provider.

All official OPX boxes are labeled as opx/<version>\.

Setup VM network adapters

By default, the VM is configured with a single adapter which corresponds to eth0 (Management port). Configure supplementary virtual network adapters for data plane networking.

  • Use N+1 Virtual Network Adapters for the VM — N for the simulated NPU ports and one for the management port (eth0). 'eth0' corresponds to the first adapter attached to the VM, e101-001-0 to the second adapter and so on, and e101-00N-1 to adapter N+1.

  • Use the same type of network adapter for all virtual network adapters (including adapter 1 for the management port). Intel PRO/1000 MT Desktop (82540EM) is recommended for VirtualBox. The PCI enumeration for interfaces may otherwise cause the "standard" interface naming to be off (for example, eth0 assigned to adapter 2 rather than 1).

  • Set the VM network adapters in promiscuous mode (VirtualBox) — use the Allow All option in the advanced adapter settings. The OPX code reassigns the MAC addresses of e101-00N-0 based on the MAC address of eth0. See the /etc/opx/base_port_physical_mapping_table.xml file for corresponding offsets — the field mac_offset of the front-panel-port records.

  • Check that the /lib/udev/rules.d/80-dn-virt-intf.rules and /user/bin/opx-vport.sh (applies to release 2.2.0 and above) files are present on your device — otherwise copy the files and reboot.

  • For Virtual Box, set the network adapters "Internal Network" to simulate point-to-point links between data interfaces. Use the same name for the internal network at both endpoints, and different names for different links.

See rules.d for more information. The udev rules rename eth devices, N > 0 to e101-00N-0 (interface names for simulated NPU ports).

After reboot, the ip link show command should only show eth0. There should not be other interfaces named ethN (eth1, eth2, and so on).

Clone this wiki locally