About the Guest Shell

In addition to the NX-OS CLI and Bash access on the underlying Linux environment, the Cisco Nexus 9000 Series devices support access to a decoupled execution space running within a Linux Container (LXC) called the "guest shell".

From within the guest shell the network-admin has the following capabilities:

  • Access to the network.
  • Access to Cisco Nexus 9000 bootflash.
  • Access to Cisco Nexus 9000 CLI.
  • Access to Cisco onePK APIs.
  • The ability to install and run python scripts.
  • The ability to install and run 64-bit Linux applications.

Decoupling the execution space from the native host system allows customization of the Linux environment to suit the needs of the applications without impacting the host system or applications running in other Linux Containers.

On NX-OS devices, Linux Containers are installed and managed with the virtual-service commands. The guest shell will appear in the virtual-service show command output.

Accessing the Guest Shell

switch# show virtual-service list

Virtual Service List:

Name                    Status             Package Name
-----------------------------------------------------------------------
guestshell+             Activated          guestshell.ova

switch# run guestshell pwd
/home/guestshell
switch# 

In Cisco NX-OS, the guest shell is accessible to the network-admin. It is automatically enabled in the system and can be accessed using the run guestshell command. Consistent with the run bash command, these commands can be issued within the guest shell with the run guestshell command form of the NX-OS CLI command.

You can also enter the guest shell with the command guestshell and run commands from the guest shell prompt.

switch# guestshell
[guestshell@guestshell ~]$ pwd
/home/guestshell
[guestshell@guestshell ~]$ exit
logout
switch# 

If guestshell has been disabled, you can enable it using guestshell enable as shown in the example. It may take 30 to 40 seconds to reach the "Activated" state.

switch# guestshell enable
switch# guestshell
[guestshell@guestshell ~]$

Using Python in the Guest Shell

switch# guestshell
[guestshell@guestshell ~]$ python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello world")
Hello world
>>> quit()

[guestshell@guestshell ~]$ python helloworld.py
Hello world
[guestshell@guestshell ~]$

In the guest shell, you can use Python interactively or you can run Python scripts, as shown in the example.

Installing Additional Packages in the Guest Shell

[guestshell@guestshell ~]$ sudo su
[root@guestshell guestshell]# pip install Markdown
Collecting Markdown
  Downloading Markdown-2.6.2-py2.py3-none-any.whl (157kB)
    100% |################################| 159kB 1.8MB/s
Installing collected packages: Markdown
Successfully installed Markdown-2.6.2
[root@guestshell guestshell]# pip list | grep Markdown
Markdown (2.6.2)
[root@guestshell guestshell]#

The pip Python package manager is included in the guest shell to allow the network-admin to install new Python packages, as shown in the example.

To install new Python packages, you must first enter the root shell using the sudo su command.

Limitations of the Guest Shell

APIs Not Supported in the Guest Shell

The following API methods are not supported in the Guest Shell:

  • bcm_sdk_shell_all_unit(str="")
  • getIfNamesGivenBitmap(modObj, unit, bitmap)
  • getVxlanMcastGroup(vnseg)
  • getVxlanVtepIp()
  • getSGOifList(source, group)
  • isInterfaceinLacpIState(interface)