You are here: Home Documents Extensions

Extensions

using Extensions
(verified 2010 May. / EOS 4.3.0 / DCS-7120T-4S 03.01)

Extension

Arista has Extension feature. SHOW EXTENSIONS and EXTENSIONS commands are ready to control it. In this document, we make Hello World Extension to show how to add a command to EOS CLI and management of extension.

We serve Hello World extension as hello.swix file on Resources folder. It uses SWI (software image extension) format. See more detail of SWIX format is here, To see how to make a EOS CLI command is also here.

Extension management

Hello World extension sample is located on Resources folder.

file name : hello.swix
MD5 checksum : 8d0c2f040f741566925842abe768eee6

 

Here is the typical life cycle of Extensions

  1. place it by COPY command
  2. install it by EXTENSION command
  3. uninstall by NO EXTENSION command
  4. delete it by DELETE command

We show this here, step by step.

Body of extensions

Extension files are located under /mnt/flash/.extensions/ directory. You can see them from bash.

bash-3.2# ls -l .extensions/
total 4
-rwxrwx--- 1 root eosadmin 3246 May 13 19:59 hello.swix
bash-3.2#

In this document, there are EOS CLI operations and bash based operations in same place and these are written as the similar appearance. The command prompt may help you identify it. So "localhost#" means EOS CLI, "bash-3.2#" means bash operation. )

We always test the EOS CLI operation in enable mode but some command such as SHOW EXTENSIONS is also to run in non-privilege mode.

Place Extensions

SHOW EXTENSIONS command

show extensions command shows existent of extensions and installation status. In initial state - there is no extension - it shows like this;

localhost#show extensions
No extensions are available
localhost#show installed-extensions
No extensions are installed
localhost#

SHOW EXTENSIONS command lists extensions under /mnt/flash/.extensions directory.

SHOW INSTALLED-EXTENSIONS command also shows installed extensions of this system. It is also empty in initial.

COPY command

Let us copy Hello World extension to extension directory. There are several ways to import files from the outside of the box. This time, we copy a file from USB memory by COPY command with "extension:" parameter  (don't forget to add ":" carefully).

localhost#copy usb1:hello.swix extension:
localhost#

Do SHOW EXTENSIONS command again and check the SWIX file is there.

localhost#show extensions
Name Version/Release Status RPMs
------------------------------------------ ------------------------- ------ ----
hello.swix 1.0/0 A, NI 1

A: available | NA: not available | I: installed | NI: not installed | F: forced
localhost#

Above "Status" column has A(available) and NI(not installed) values. And SHOW EXTENSIONS DETAIL command is ready to see more detail of the SWIX package.

localhost#show extensions detail  
Name: hello.swix
Version: 1.0
Release: 0
Presence: available
Status: not installed
Vendor:
Summary: Hello is a minimum example of EOS command
RPMS: hello-1.0-0.noarch.rpm 1.0/0
Total size: 1255 bytes
Description:
Hello is a minimum example of EOS command.
It will be installed as HogeCli.py file under CliPlugin directory.

localhost#

Files

You can check hello.swi file had been copied to /mnt/flash/.extensions/ directory as follows;

bash-3.2# ls -l .extensions/
total 4
-rwxrwx--- 1 root eosadmin 3246 May 13 19:59 hello.swix
bash-3.2#

Install it

EXTENSION command

EXTENSION command installs the specified SWIX under extensions directory.

localhost#extension hello.swix
localhost#

After the installation, SHOW EXTENSIONS command helps you to check the result.

localhost#show extensions

Name Version/Release Status RPMs
------------------------------------------ ------------------------- ------ ----
hello.swix 1.0/0 A, I 1

A: available | NA: not available | I: installed | NI: not installed | F: forced
localhost#

The "Status" value changed from NI (not installed) to I (installed). And SHOW INSTALLED-EXTENSIONS command result is also changed.

localhost#show installed-extensions
hello.swix
localhost#

Files

Hello World extension installs Python files under /usr/lib/python2.5/site-packages/CliPlugin directory as follows;

bash-3.2# pwd
/usr/lib/python2.5/site-packages/CliPlugin
bash-3.2# ls -l Hello*
-rw-r--r-- 1 root root 321 May 13 2010 HelloCli.py
-rw-r--r-- 1 root root 467 May 13 2010 HelloCli.pyc
-rw-r--r-- 1 root root 467 May 13 2010 HelloCli.pyo
bash-3.2#

Execution test

Hello World extension adds hello command to EOS. So just try it. But installed commands will be recognized by EOS CLI shell which starts after the installation.

Easiest way to check it, login again and test it.

localhost#hello
World.

localhost#

Permanent setup

If the extension had been activated but it is temporary effect. To make the extension persistent, use COPY command as follows;

localhost#copy installed-extensions boot-extensions
localhost#

SHOW BOOT-EXTENSIONS command shows the result.

localhost#show boot-extensions
hello.swix
localhost#

Files

boot-extensions information is stored in /mnt/flash/boot-extensions file as follows;

bash-3.2# cat boot-extensions
hello.swix
bash-3.2#

Uninstall it

NO EXTENSIONS command

NO EXTENSIONS command does un-install the extension from the system.

localhost#no extension
localhost#

SHOW EXTENSIONS command shows the result.

localhost#show extensions
Name Version/Release Status RPMs
------------------------------------------ ------------------------- ------ ----
hello.swix 1.0/0 A, NI 1

A: available | NA: not available | I: installed | NI: not installed | F: forced
localhost#

The "Status" value changed from I (installed) to NI (not installed). And it is interesting, the status is A (Available). It just means hello.swix file are exist under Extensions directory.

SHOW INSTALLED-EXTENSIONS command shows there is no extensions are installed.

localhost#show installed-extensions
No extensions are installed
localhost#

Clean up something

If you make the extension to permanent by boot-extensions file, need to clear it by separately.

localhost#copy installed-extensions boot-extensions
localhost#

After this operation, /mnt/flash/boot-extensions file will be empty. (Of course if you have any other extensions, it remains.)

Delete it

DELETE command

DELETE command is the pair of COPY command in the series of the operation. It deletes SWIX file under Extensions directory ( /mnt/flash/.extensions/).

localhost#delete extension:hello.swix
localhost#
If you check the extensions status, there is no info to show.
localhost#show extensions
No extensions are available
localhost#
.extensions directory should be empty.
bash-3.2# ls -l 
/mnt/flash/.extensions/
total 0
bash-3.2#

By the way, it is possible to delete the extension that is not-installed yet. In that case, SHOW EXTENSIONS command shows that "Status" is NA (not available), but also I (installed), as follows;

localhost#show extensions
Name Version/Release Status RPMs
------------------------------------------ ------------------------- ------ ----
hello.swix 1.0/0 NA, I 1

A: available | NA: not available | I: installed | NI: not installed | F: forced
localhost#

Clean up something

If you forget to overwrite boot-extensions file by installed-extensions file before delete the extension, it will make following inconsistency after the next restarting of the switch, as follows;

localhost#show extensions
Name Version/Release Status RPMs
------------------------------------------ ------------------------- ------ ----
hello.swix Error: extension is not available

A: available | NA: not available | I: installed | NI: not installed | F: forced
localhost#

There is an error message that means this extension should be exist under extension directory but there is not. Because boot-extensions still keeps old "hello.swix" information. Therefore, in this situation, SHOW BOOT-EXTENSIONS command shows hello.swix straightforward.

localhost#show boot-extensions
hello.swix
localhost#

(It is my opinion, it is better to remove the deleted extension's info from boot-extensions file automatically.)

Filed under: