Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Downloading and Executing OpEN Applications

Overview

This section presents details on how to download and run applications on the Broadcom switch. Commands are provided in the NOS CLI to perform these operations.

Transferring Application Files To or From the Switch

Use the 'copy' command to transfer application executable files to or from the switch. The command allows the administrator to specify the 'nvram:application' as the source or destination for file transfers. Various protocols for the transfer are provided depending on the features included in the version of the NOS running on the switch.

An example invocation of the copy command to download an application file to the switch's file system using TFTP follows:

(ICOS Routing) #copy tftp://10.1.1.23/user-app nvram:application user-appl 

Displaying Application Files on the Switch

The content of the file system directory that contains OpEN application files is displayed with the 'show application files' command.

(ICOS Routing) #show application files
OpEN Application Process Directory contents:
      114058 agent_example
       16312 boxs_example
       17890 interface_exampl
       19894 intf_stats_examp
       17709 lag_example
       15082 link_status_exam
       38101 lldp_example
       77340 openr_example
        9782 sdkportregbyname
        9678 sdkregbyname
       10443 tx_pkt_example
       18130 vlan_example
       14937 vlan_status_exam
Total bytes for all files = 379356
(ICOS Routing) #

Running Applications on the Switch

Applications are configured for execution by installing them using the 'application install' command. This creates an entry in the OpEN Application Table for the application. Note that we use the copy running-config nvram:startup command to save this configuration to NVRAM for subsequent boots.

(ICOS Routing) #config
(ICOS Routing) (Config)#application install vlan_example start-on-boot
(ICOS Routing) (Config)#exit
(ICOS Routing) #copy system:running-config nvram:startup-config
(ICOS Routing) #

The executable file implementing the application need not be present in the switch's file system to be installed in the OpEN Application Table. This allows entries to be pre-configured before the application files are transferred to the switch.

The contents of the OpEN Application Table is displayed with the 'show application' command:

(ICOS Routing) (Config)#show application
OpEN Application Table contains 1 entries.
Name             StartOnBoot AutoRestart CPU Sharing Max Memory
---------------- ----------- ----------- ----------- ----------
vlan_example     No          No          0           0

Parameters controlling how the application is executed are set using optional parameters of the 'application install' command.

(ICOS Routing) (Config)#application install app_name ?
<cr>                     Press enter to execute the command.
auto-restart             Configure application to automatically restart if its
                         process exits.
cpu-sharing              Limits the amount of CPU capacity the application
                         uses.
max-megabytes            Limits amount of memory the application can use.
start-on-boot            Configure application to automatically start on boot
                         up.

The parameters set in the OpEN Application Table are in effect for all processes spawned by the application file installed (in the case where the application spawns child processes).

The applications installed in the OpEN Application Table and their settings are saved as part of the configuration. In order to have an application start at initialization, the administrator installs the application with the start-on-boot option enabled and saves the configuration. The application will automatically be started when the saved configuration is applied on subsequent boots.

Starting or Stopping Applications Manually

Applications can be started and stopped by the administrator via CLI commands. The application must be installed in the OpEN Application Table. A running application's processes are terminated when the stop command is used.

 
(ICOS Routing) #show application
OpEN Application Table contains 2 entries.
Name             StartOnBoot AutoRestart CPU Sharing Max Memory
---------------- ----------- ----------- ----------- ----------
vlan_example     No          No          0           0
vlan_status_exam No          No          0           0
(ICOS Routing) #application start vlan_status_exam 
[8018]:[8018] /mnt/fastpath/user-apps/vlan_status_exam
Monitoring VLAN Status for 60 seconds.
ICOS version = 1.2.0.0
OPEN version = 1.0.0.0
Created VLAN Table.
Application started.
(ICOS Routing) #
(ICOS Routing) #application stop vlan_status_exam
Application stopped.
(ICOS Routing) #
!! Process 8018 terminated(9) !!
(ICOS Routing) #

Deleting Application Files From the Switch

Application files are removed from the switch file system using the 'erase' command.

(ICOS Routing) #erase application user-appl