Package TestON :: Package drivers :: Package common :: Package cli :: Module onosclidriver :: Class OnosCliDriver
[hide private]
[frames] | no frames]

Class OnosCliDriver

source code


Instance Methods [hide private]
 
__init__(self)
Initialize client
source code
 
connect(self, **connectargs)
Creates ssh handle for ONOS cli.
source code
 
disconnect(self)
Called when Test is complete to disconnect the ONOS handle.
source code
 
logout(self)
Sends 'logout' command to ONOS cli...
source code
 
setCell(self, cellname)
Calls 'cell <name>' to set the environment variables on ONOSbench
source code
 
startOnosCli(self, ONOSIp, karafTimeout="", commandlineTimeout=10, onosStartTimeout=60)
karafTimeout is an optional argument.
source code
 
log(self, cmdStr, level="")
log the commands in the onos CLI.
source code
 
sendline(self, cmdStr, debug=False)
Send a completely user specified string to the onos> prompt.
source code
 
addNode(self, nodeId, ONOSIp, tcpPort="")
Adds a new cluster node by ID and address information.
source code
 
removeNode(self, nodeId)
Removes a cluster by ID...
source code
 
nodes(self, jsonFormat=True)
List the nodes currently visible...
source code
 
topology(self)
Definition: Returns the output of topology command.
source code
 
featureInstall(self, featureStr)
Installs a specified feature by issuing command:...
source code
 
featureUninstall(self, featureStr)
Uninstalls a specified feature by issuing command:...
source code
 
deviceRemove(self, deviceId)
Removes particular device from storage
source code
 
devices(self, jsonFormat=True)
Lists all infrastructure devices or switches...
source code
 
balanceMasters(self)
This balances the devices across all controllers by issuing command: 'onos> onos:balance-masters' If required this could be extended to return devices balanced output.
source code
 
checkMasters(self, jsonFormat=True)
Returns the output of the masters command.
source code
 
checkBalanceMasters(self, jsonFormat=True)
Uses the master command to check that the devices' leadership is evenly divided
source code
 
links(self, jsonFormat=True)
Lists all core links...
source code
 
ports(self, jsonFormat=True)
Lists all ports...
source code
 
roles(self, jsonFormat=True)
Lists all devices and the controllers with roles assigned to them...
source code
 
getRole(self, deviceId)
Given the a string containing the json representation of the "roles" cli command and a partial or whole device id, returns a json object containing the roles output for the first device whose id contains "device_id"
source code
 
rolesNotNull(self)
Iterates through each device and checks if there is a master assigned...
source code
 
paths(self, srcId, dstId)
Returns string of paths, and the cost.
source code
 
hosts(self, jsonFormat=True)
Lists all discovered hosts...
source code
 
getHost(self, mac)
Return the first host from the hosts api whose 'id' contains 'mac'
source code
 
getHostsId(self, hostList)
Obtain list of hosts Issues command: 'onos> hosts'
source code
 
addHostIntent(self, hostIdOne, hostIdTwo)
Required: * hostIdOne: ONOS host id for host1 * hostIdTwo: ONOS host id for host2 Description: Adds a host-to-host intent ( bidirectional ) by specifying the two hosts.
source code
 
addOpticalIntent(self, ingressDevice, egressDevice)
Required:...
source code
 
addPointIntent(self, ingressDevice, egressDevice, portIngress="", portEgress="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="")
Required: * ingressDevice: device id of ingress device * egressDevice: device id of egress device Optional: * ethType: specify ethType * ethSrc: specify ethSrc ( i.e.
source code
 
addMultipointToSinglepointIntent(self, ingressDeviceList, egressDevice, portIngressList=None, portEgress="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst="")
Note: This function assumes the format of all ingress devices is same.
source code
 
addSinglepointToMultipointIntent(self, ingressDevice, egressDeviceList, portIngress="", portEgressList=None, ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst="")
Note: This function assumes the format of all egress devices is same.
source code
 
addMplsIntent(self, ingressDevice, egressDevice, ingressPort="", egressPort="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", ingressLabel="", egressLabel="", priority="")
Required: * ingressDevice: device id of ingress device * egressDevice: device id of egress device Optional: * ethType: specify ethType * ethSrc: specify ethSrc ( i.e.
source code
 
removeIntent(self, intentId, app='org.onosproject.cli', purge=False, sync=False)
Remove intent for specified application id and intent id Optional args:- -s or --sync: Waits for the removal before returning -p or --purge: Purge the intent from the store after removal
source code
 
purgeWithdrawnIntents(self)
Purges all WITHDRAWN Intents
source code
 
routes(self, jsonFormat=False)
NOTE: This method should be used after installing application:...
source code
 
intents(self, jsonFormat=True)
Optional:...
source code
 
getIntentState(self, intentsId, intentsJson=None)
Check intent state.
source code
 
checkIntentState(self, intentsId, expectedState='INSTALLED')
Description: Check intents state Required: intentsId - List of intents ID to be checked Optional: expectedState - Check the expected state(s) of each intents state in the list.
source code
 
flows(self, jsonFormat=True)
Optional:...
source code
 
checkFlowsState(self)
Description: Check the if all the current flows are in ADDED state or PENDING_ADD state Return: returnValue - Returns main.TRUE only if all flows are in ADDED state or PENDING_ADD, return main.FALSE otherwise.
source code
 
pushTestIntents(self, dpidSrc, dpidDst, numIntents, numMult="", appId="", report=True)
Description:...
source code
 
intentsEventsMetrics(self, jsonFormat=True)
Description:Returns topology metrics...
source code
 
topologyEventsMetrics(self, jsonFormat=True)
Description:Returns topology metrics...
source code
 
getAllIntentsId(self)
Description:...
source code
 
FlowAddedCount(self, deviceId)
Determine the number of flow rules for the given device id that are in the added state
source code
 
getAllDevicesId(self)
Use 'devices' function to obtain list of all devices and parse the result to obtain a list of all device id's.
source code
 
getAllNodesId(self)
Uses 'nodes' function to obtain list of all nodes and parse the result of nodes to obtain just the node id's.
source code
 
getDevice(self, dpid=None)
Return the first device from the devices api whose 'id' contains 'dpid' Return None if there is no match
source code
 
checkStatus(self, ip, numoswitch, numolink, logLevel="info")
Checks the number of switches & links that ONOS sees against the supplied values.
source code
 
deviceRole(self, deviceId, onosNode, role="master")
Calls the device-role cli command.
source code
 
clusters(self, jsonFormat=True)
Lists all clusters...
source code
 
electionTestLeader(self)
CLI command to get the current leader for the Election test application...
source code
 
electionTestRun(self)
CLI command to run for leadership of the Election test application.
source code
 
electionTestWithdraw(self)
* CLI command to withdraw the local node from leadership election for * the Election test application.
source code
 
getDevicePortsEnabledCount(self, dpid)
Get the count of all enabled ports on a particular device/switch
source code
 
getDeviceLinksActiveCount(self, dpid)
Get the count of all enabled ports on a particular device/switch
source code
 
getAllIntentIds(self)
Return a list of all Intent IDs
source code
 
intentSummary(self)
Returns a dictionary containing the current intent states and the count
source code
 
leaders(self, jsonFormat=True)
Returns the output of the leaders command.
source code
 
leaderCandidates(self, jsonFormat=True)
Returns the output of the leaders -c command.
source code
 
specificLeaderCandidate(self, topic)
Returns a list in format [leader,candidate1,candidate2,...] for a given topic parameter and an empty list if the topic doesn't exist If no leader is elected leader in the returned list will be "none" Returns None if there is a type error processing the json object
source code
 
pendingMap(self, jsonFormat=True)
Returns the output of the intent Pending map.
source code
 
partitions(self, jsonFormat=True)
Returns the output of the raft partitions command for ONOS.
source code
 
apps(self, jsonFormat=True)
Returns the output of the apps command for ONOS.
source code
 
appStatus(self, appName)
Uses the onos:apps cli command to return the status of an application.
source code
 
app(self, appName, option)
Interacts with the app command for ONOS.
source code
 
activateApp(self, appName, check=True)
Activate an app that is already installed in ONOS...
source code
 
deactivateApp(self, appName, check=True)
Deactivate an app that is already activated in ONOS...
source code
 
uninstallApp(self, appName, check=True)
Uninstall an app that is already installed in ONOS...
source code
 
appIDs(self, jsonFormat=True)
Show the mappings between app id and app names given by the 'app-ids' cli command
source code
 
appToIDCheck(self)
This method will check that each application's ID listed in 'apps' is the same as the ID listed in 'app-ids'.
source code
 
getCfg(self, component=None, propName=None, short=False, jsonFormat=True)
Get configuration settings from onos cli Optional arguments: component - Optionally only list configurations for a specific component.
source code
 
setCfg(self, component, propName, value=None, check=True)
Set/Unset configuration settings from ONOS cli Required arguments: component - The case sensitive name of the component whose property is to be set propName - The case sensitive name of the property to be set/unset Optional arguments: value - The value to set the property to.
source code
 
setTestAdd(self, setName, values)
CLI command to add elements to a distributed set.
source code
 
setTestRemove(self, setName, values, clear=False, retain=False)
CLI command to remove elements from a distributed set.
source code
 
setTestGet(self, setName, values="")
CLI command to get the elements in a distributed set.
source code
 
setTestSize(self, setName)
CLI command to get the elements in a distributed set.
source code
 
counters(self, jsonFormat=True)
Command to list the various counters in the system.
source code
 
counterTestAddAndGet(self, counter, delta=1, inMemory=False)
CLI command to add a delta to then get a distributed counter.
source code
 
counterTestGetAndAdd(self, counter, delta=1, inMemory=False)
CLI command to get a distributed counter then add a delta to it.
source code
 
summary(self, jsonFormat=True)
Description: Execute summary command in onos Returns: json object ( summary -j ), returns main.FALSE if there is no output
source code
 
execute(self, **execparams)
It facilitates the command line execution of a given command. (Inherited from TestON.drivers.common.clidriver.CLI)
source code
 
onfail(self) (Inherited from TestON.drivers.common.clidriver.CLI) source code
 
remove_contol_chars(self, response) (Inherited from TestON.drivers.common.clidriver.CLI) source code
 
runAsSudoUser(self, handle, pwd, default) (Inherited from TestON.drivers.common.clidriver.CLI) source code
 
secureCopy(self, user_name, ip_address, filepath, pwd, dst_path)
Connection will establish to the remote host using ssh. (Inherited from TestON.drivers.common.clidriver.CLI)
source code

Inherited from component.Component: __getattr__, cleanup, close_log_handles, config, experimentRun, get_version

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialize client

Overrides: object.__init__

connect(self, **connectargs)

source code 

Creates ssh handle for ONOS cli.

Overrides: component.Component.connect

disconnect(self)

source code 

Called when Test is complete to disconnect the ONOS handle.

Overrides: component.Component.disconnect

logout(self)

source code 

Sends 'logout' command to ONOS cli
Returns main.TRUE if exited CLI and
        main.FALSE on timeout (not guranteed you are disconnected)
        None on TypeError
        Exits test on unknown error or pexpect exits unexpectedly

setCell(self, cellname)

source code 

Calls 'cell <name>' to set the environment variables on ONOSbench

Before issuing any cli commands, set the environment variable first.

startOnosCli(self, ONOSIp, karafTimeout="", commandlineTimeout=10, onosStartTimeout=60)

source code 

karafTimeout is an optional argument. karafTimeout value passed by user would be used to set the current karaf shell idle timeout. Note that when ever this property is modified the shell will exit and the subsequent login would reflect new idle timeout. Below is an example to start a session with 60 seconds idle timeout ( input value is in milliseconds ):

tValue = "60000" main.ONOScli1.startOnosCli( ONOSIp, karafTimeout=tValue )

Note: karafTimeout is left as str so that this could be read and passed to startOnosCli from PARAMS file as str.

log(self, cmdStr, level="")

source code 

log the commands in the onos CLI. returns main.TRUE on success returns main.FALSE if Error occurred Available level: DEBUG, TRACE, INFO, WARN, ERROR Level defaults to INFO

Overrides: component.Component.log

sendline(self, cmdStr, debug=False)

source code 

Send a completely user specified string to the onos> prompt. Use this function if you have a very specific command to send.

Warning: There are no sanity checking to commands sent using this method.

addNode(self, nodeId, ONOSIp, tcpPort="")

source code 

Adds a new cluster node by ID and address information.
Required:
    * nodeId
    * ONOSIp
Optional:
    * tcpPort

removeNode(self, nodeId)

source code 

Removes a cluster by ID
Issues command: 'remove-node [<node-id>]'
Required:
    * nodeId

nodes(self, jsonFormat=True)

source code 

List the nodes currently visible
Issues command: 'nodes'
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

topology(self)

source code 

Definition:
    Returns the output of topology command.
Return:
    topology = current ONOS topology

featureInstall(self, featureStr)

source code 

Installs a specified feature by issuing command:
    'feature:install <feature_str>'
NOTE: This is now deprecated, you should use the activateApp method
      instead

featureUninstall(self, featureStr)

source code 

Uninstalls a specified feature by issuing command:
    'feature:uninstall <feature_str>'
NOTE: This is now deprecated, you should use the deactivateApp method
      instead

deviceRemove(self, deviceId)

source code 

Removes particular device from storage

TODO: refactor this function

devices(self, jsonFormat=True)

source code 

Lists all infrastructure devices or switches
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

checkMasters(self, jsonFormat=True)

source code 

Returns the output of the masters command.
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

checkBalanceMasters(self, jsonFormat=True)

source code 

Uses the master command to check that the devices' leadership is evenly divided

Dependencies: checkMasters() and summary()

Returns main.True if the devices are balanced Returns main.False if the devices are unbalanced Exits on Exception Returns None on TypeError

links(self, jsonFormat=True)

source code 

Lists all core links
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

ports(self, jsonFormat=True)

source code 

Lists all ports
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

roles(self, jsonFormat=True)

source code 

Lists all devices and the controllers with roles assigned to them
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

getRole(self, deviceId)

source code 

Given the a string containing the json representation of the "roles" cli command and a partial or whole device id, returns a json object containing the roles output for the first device whose id contains "device_id"

Returns: A dict of the role assignments for the given device or None if no match

rolesNotNull(self)

source code 

Iterates through each device and checks if there is a master assigned
Returns: main.TRUE if each device has a master
         main.FALSE any device has no master

paths(self, srcId, dstId)

source code 

Returns string of paths, and the cost. Issues command: onos:paths <src> <dst>

hosts(self, jsonFormat=True)

source code 

Lists all discovered hosts
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

getHost(self, mac)

source code 

Return the first host from the hosts api whose 'id' contains 'mac'

Note: mac must be a colon separated mac address, but could be a
      partial mac address

Return None if there is no match

getHostsId(self, hostList)

source code 

Obtain list of hosts
Issues command: 'onos> hosts'

Required:
    * hostList: List of hosts obtained by Mininet
IMPORTANT:
    This function assumes that you started your
    topology with the option '--mac'.
    Furthermore, it assumes that value of VLAN is '-1'
Description:
    Converts mininet hosts ( h1, h2, h3... ) into
    ONOS format ( 00:00:00:00:00:01/-1 , ... )

addHostIntent(self, hostIdOne, hostIdTwo)

source code 

Required:
    * hostIdOne: ONOS host id for host1
    * hostIdTwo: ONOS host id for host2
Description:
    Adds a host-to-host intent ( bidirectional ) by
    specifying the two hosts.
Returns:
    A string of the intent id or None on Error

addOpticalIntent(self, ingressDevice, egressDevice)

source code 

Required:
    * ingressDevice: device id of ingress device
    * egressDevice: device id of egress device
Optional:
    TODO: Still needs to be implemented via dev side
Description:
    Adds an optical intent by specifying an ingress and egress device
Returns:
    A string of the intent id or None on error

addPointIntent(self, ingressDevice, egressDevice, portIngress="", portEgress="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="")

source code 

Required:
    * ingressDevice: device id of ingress device
    * egressDevice: device id of egress device
Optional:
    * ethType: specify ethType
    * ethSrc: specify ethSrc ( i.e. src mac addr )
    * ethDst: specify ethDst ( i.e. dst mac addr )
    * bandwidth: specify bandwidth capacity of link
    * lambdaAlloc: if True, intent will allocate lambda
      for the specified intent
    * ipProto: specify ip protocol
    * ipSrc: specify ip source address
    * ipDst: specify ip destination address
    * tcpSrc: specify tcp source port
    * tcpDst: specify tcp destination port
Description:
    Adds a point-to-point intent ( uni-directional ) by
    specifying device id's and optional fields
Returns:
    A string of the intent id or None on error

NOTE: This function may change depending on the
      options developers provide for point-to-point
      intent via cli

addMultipointToSinglepointIntent(self, ingressDeviceList, egressDevice, portIngressList=None, portEgress="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst="")

source code 

Note:
    This function assumes the format of all ingress devices
    is same. That is, all ingress devices include port numbers
    with a "/" or all ingress devices could specify device
    ids and port numbers seperately.
Required:
    * ingressDeviceList: List of device ids of ingress device
        ( Atleast 2 ingress devices required in the list )
    * egressDevice: device id of egress device
Optional:
    * ethType: specify ethType
    * ethSrc: specify ethSrc ( i.e. src mac addr )
    * ethDst: specify ethDst ( i.e. dst mac addr )
    * bandwidth: specify bandwidth capacity of link
    * lambdaAlloc: if True, intent will allocate lambda
      for the specified intent
    * ipProto: specify ip protocol
    * ipSrc: specify ip source address
    * ipDst: specify ip destination address
    * tcpSrc: specify tcp source port
    * tcpDst: specify tcp destination port
    * setEthSrc: action to Rewrite Source MAC Address
    * setEthDst: action to Rewrite Destination MAC Address
Description:
    Adds a multipoint-to-singlepoint intent ( uni-directional ) by
    specifying device id's and optional fields
Returns:
    A string of the intent id or None on error

NOTE: This function may change depending on the
      options developers provide for multipoint-to-singlepoint
      intent via cli

addSinglepointToMultipointIntent(self, ingressDevice, egressDeviceList, portIngress="", portEgressList=None, ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst="")

source code 

Note:
    This function assumes the format of all egress devices
    is same. That is, all egress devices include port numbers
    with a "/" or all egress devices could specify device
    ids and port numbers seperately.
Required:
    * EgressDeviceList: List of device ids of egress device
        ( Atleast 2 eress devices required in the list )
    * ingressDevice: device id of ingress device
Optional:
    * ethType: specify ethType
    * ethSrc: specify ethSrc ( i.e. src mac addr )
    * ethDst: specify ethDst ( i.e. dst mac addr )
    * bandwidth: specify bandwidth capacity of link
    * lambdaAlloc: if True, intent will allocate lambda
      for the specified intent
    * ipProto: specify ip protocol
    * ipSrc: specify ip source address
    * ipDst: specify ip destination address
    * tcpSrc: specify tcp source port
    * tcpDst: specify tcp destination port
    * setEthSrc: action to Rewrite Source MAC Address
    * setEthDst: action to Rewrite Destination MAC Address
Description:
    Adds a singlepoint-to-multipoint intent ( uni-directional ) by
    specifying device id's and optional fields
Returns:
    A string of the intent id or None on error

NOTE: This function may change depending on the
      options developers provide for singlepoint-to-multipoint
      intent via cli

addMplsIntent(self, ingressDevice, egressDevice, ingressPort="", egressPort="", ethType="", ethSrc="", ethDst="", bandwidth="", lambdaAlloc=False, ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", ingressLabel="", egressLabel="", priority="")

source code 

Required:
    * ingressDevice: device id of ingress device
    * egressDevice: device id of egress device
Optional:
    * ethType: specify ethType
    * ethSrc: specify ethSrc ( i.e. src mac addr )
    * ethDst: specify ethDst ( i.e. dst mac addr )
    * bandwidth: specify bandwidth capacity of link
    * lambdaAlloc: if True, intent will allocate lambda
      for the specified intent
    * ipProto: specify ip protocol
    * ipSrc: specify ip source address
    * ipDst: specify ip destination address
    * tcpSrc: specify tcp source port
    * tcpDst: specify tcp destination port
    * ingressLabel: Ingress MPLS label
    * egressLabel: Egress MPLS label
Description:
    Adds MPLS intent by
    specifying device id's and optional fields
Returns:
    A string of the intent id or None on error

NOTE: This function may change depending on the
      options developers provide for MPLS
      intent via cli

removeIntent(self, intentId, app='org.onosproject.cli', purge=False, sync=False)

source code 

Remove intent for specified application id and intent id
Optional args:-
-s or --sync: Waits for the removal before returning
-p or --purge: Purge the intent from the store after removal

Returns:
    main.False on error and
    cli output otherwise

routes(self, jsonFormat=False)

source code 

NOTE: This method should be used after installing application:
      onos-app-sdnip
Optional:
    * jsonFormat: enable output formatting in json
Description:
    Obtain all routes in the system

intents(self, jsonFormat=True)

source code 

Optional:
    * jsonFormat: enable output formatting in json
Description:
    Obtain intents currently installed

getIntentState(self, intentsId, intentsJson=None)

source code 

Check intent state. Accepts a single intent ID (string type) or a list of intent IDs. Returns the state(string type) of the id if a single intent ID is accepted. Returns a dictionary with intent IDs as the key and its corresponding states as the values Parameters: intentId: intent ID (string type) intentsJson: parsed json object from the onos:intents api Returns: state = An intent's state- INSTALL,WITHDRAWN etc. stateDict = Dictionary of intent's state. intent ID as the keys and state as the values.

checkIntentState(self, intentsId, expectedState='INSTALLED')

source code 

Description:
    Check intents state
Required:
    intentsId - List of intents ID to be checked
Optional:
    expectedState - Check the expected state(s) of each intents
                    state in the list.
                    *NOTE: You can pass in a list of expected state,
                    Eg: expectedState = [ 'INSTALLED' , 'INSTALLING' ]
Return:
    Returns main.TRUE only if all intent are the same as expected states
    , otherwise, returns main.FALSE.

flows(self, jsonFormat=True)

source code 

Optional:
    * jsonFormat: enable output formatting in json
Description:
    Obtain flows currently installed

pushTestIntents(self, dpidSrc, dpidDst, numIntents, numMult="", appId="", report=True)

source code 

Description:
    Push a number of intents in a batch format to
    a specific point-to-point intent definition
Required:
    * dpidSrc: specify source dpid
    * dpidDst: specify destination dpid
    * numIntents: specify number of intents to push
Optional:
    * numMult: number multiplier for multiplying
      the number of intents specified
    * appId: specify the application id init to further
      modularize the intents
    * report: default True, returns latency information

intentsEventsMetrics(self, jsonFormat=True)

source code 

Description:Returns topology metrics
Optional:
    * jsonFormat: enable json formatting of output

topologyEventsMetrics(self, jsonFormat=True)

source code 

Description:Returns topology metrics
Optional:
    * jsonFormat: enable json formatting of output

getAllIntentsId(self)

source code 

Description:
    Obtain all intent id's in a list

getAllDevicesId(self)

source code 

Use 'devices' function to obtain list of all devices and parse the result to obtain a list of all device id's. Returns this list. Returns empty list if no devices exist List is ordered sequentially

This function may be useful if you are not sure of the device id, and wish to execute other commands using the ids. By obtaining the list of device ids on the fly, you can iterate through the list to get mastership, etc.

getAllNodesId(self)

source code 

Uses 'nodes' function to obtain list of all nodes
and parse the result of nodes to obtain just the
node id's.
Returns:
    list of node id's

checkStatus(self, ip, numoswitch, numolink, logLevel="info")

source code 

Checks the number of switches & links that ONOS sees against the
supplied values. By default this will report to main.log, but the
log level can be specified.

Params: ip = ip used for the onos cli
        numoswitch = expected number of switches
        numolink = expected number of links
        logLevel = level to log to. Currently accepts
        'info', 'warn' and 'report'


logLevel can

Returns: main.TRUE if the number of switches and links are correct,
         main.FALSE if the number of switches and links is incorrect,
         and main.ERROR otherwise

deviceRole(self, deviceId, onosNode, role="master")

source code 

Calls the device-role cli command.
deviceId must be the id of a device as seen in the onos devices command
onosNode is the ip of one of the onos nodes in the cluster
role must be either master, standby, or none

Returns:
    main.TRUE or main.FALSE based on argument verification and
    main.ERROR if command returns and error

clusters(self, jsonFormat=True)

source code 

Lists all clusters
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

electionTestLeader(self)

source code 

CLI command to get the current leader for the Election test application
NOTE: Requires installation of the onos-app-election feature
Returns: Node IP of the leader if one exists
         None if none exists
         Main.FALSE on error

electionTestRun(self)

source code 

CLI command to run for leadership of the Election test application.
NOTE: Requires installation of the onos-app-election feature
Returns: Main.TRUE on success
         Main.FALSE on error

electionTestWithdraw(self)

source code 

* CLI command to withdraw the local node from leadership election for
* the Election test application.
#NOTE: Requires installation of the onos-app-election feature
Returns: Main.TRUE on success
         Main.FALSE on error

leaders(self, jsonFormat=True)

source code 

Returns the output of the leaders command.
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

leaderCandidates(self, jsonFormat=True)

source code 

Returns the output of the leaders -c command.
Optional argument:
    * jsonFormat - boolean indicating if you want output in json

apps(self, jsonFormat=True)

source code 

Returns the output of the apps command for ONOS. This command lists information about installed ONOS applications

appStatus(self, appName)

source code 

Uses the onos:apps cli command to return the status of an application.
Returns:
    "ACTIVE" - If app is installed and activated
    "INSTALLED" - If app is installed and deactivated
    "UNINSTALLED" - If app is not installed
    None - on error

app(self, appName, option)

source code 

Interacts with the app command for ONOS. This command manages application inventory.

activateApp(self, appName, check=True)

source code 

Activate an app that is already installed in ONOS
appName is the hierarchical app name, not the feature name
If check is True, method will check the status of the app after the
command is issued
Returns main.TRUE if the command was successfully sent
        main.FALSE if the cli responded with an error or given
            incorrect input

deactivateApp(self, appName, check=True)

source code 

Deactivate an app that is already activated in ONOS
appName is the hierarchical app name, not the feature name
If check is True, method will check the status of the app after the
command is issued
Returns main.TRUE if the command was successfully sent
        main.FALSE if the cli responded with an error or given
            incorrect input

uninstallApp(self, appName, check=True)

source code 

Uninstall an app that is already installed in ONOS
appName is the hierarchical app name, not the feature name
If check is True, method will check the status of the app after the
command is issued
Returns main.TRUE if the command was successfully sent
        main.FALSE if the cli responded with an error or given
            incorrect input

appToIDCheck(self)

source code 

This method will check that each application's ID listed in 'apps' is
the same as the ID listed in 'app-ids'. The check will also check that
there are no duplicate IDs issued. Note that an app ID should be
a globaly unique numerical identifier for app/app-like features. Once
an ID is registered, the ID is never freed up so that if an app is
reinstalled it will have the same ID.

Returns: main.TRUE  if the check passes and
         main.FALSE if the check fails or
         main.ERROR if there is some error in processing the test

getCfg(self, component=None, propName=None, short=False, jsonFormat=True)

source code 

Get configuration settings from onos cli
Optional arguments:
    component - Optionally only list configurations for a specific
                component. If None, all components with configurations
                are displayed. Case Sensitive string.
    propName - If component is specified, propName option will show
               only this specific configuration from that component.
               Case Sensitive string.
    jsonFormat - Returns output as json. Note that this will override
                 the short option
    short - Short, less verbose, version of configurations.
            This is overridden by the json option
returns:
    Output from cli as a string or None on error

setCfg(self, component, propName, value=None, check=True)

source code 

Set/Unset configuration settings from ONOS cli
Required arguments:
    component - The case sensitive name of the component whose
                property is to be set
    propName - The case sensitive name of the property to be set/unset
Optional arguments:
    value - The value to set the property to. If None, will unset the
            property and revert it to it's default value(if applicable)
    check - Boolean, Check whether the option was successfully set this
            only applies when a value is given.
returns:
    main.TRUE on success or main.FALSE on failure. If check is False,
    will return main.TRUE unless there is an error

setTestAdd(self, setName, values)

source code 

CLI command to add elements to a distributed set.
Arguments:
    setName - The name of the set to add to.
    values - The value(s) to add to the set, space seperated.
Example usages:
    setTestAdd( "set1", "a b c" )
    setTestAdd( "set2", "1" )
returns:
    main.TRUE on success OR
    main.FALSE if elements were already in the set OR
    main.ERROR on error

setTestRemove(self, setName, values, clear=False, retain=False)

source code 

CLI command to remove elements from a distributed set.
Required arguments:
    setName - The name of the set to remove from.
    values - The value(s) to remove from the set, space seperated.
Optional arguments:
    clear - Clear all elements from the set
    retain - Retain only the  given values. (intersection of the
             original set and the given set)
returns:
    main.TRUE on success OR
    main.FALSE if the set was not changed OR
    main.ERROR on error

setTestGet(self, setName, values="")

source code 

CLI command to get the elements in a distributed set.
Required arguments:
    setName - The name of the set to remove from.
Optional arguments:
    values - The value(s) to check if in the set, space seperated.
returns:
    main.ERROR on error OR
    A list of elements in the set if no optional arguments are
        supplied OR
    A tuple containing the list then:
        main.FALSE if the given values are not in the set OR
        main.TRUE if the given values are in the set OR

setTestSize(self, setName)

source code 

CLI command to get the elements in a distributed set.
Required arguments:
    setName - The name of the set to remove from.
returns:
    The integer value of the size returned or
    None on error

counters(self, jsonFormat=True)

source code 

Command to list the various counters in the system.
returns:
    if jsonFormat, a string of the json object returned by the cli
    command
    if not jsonFormat, the normal string output of the cli command
    None on error

counterTestAddAndGet(self, counter, delta=1, inMemory=False)

source code 

CLI command to add a delta to then get a distributed counter.
Required arguments:
    counter - The name of the counter to increment.
Optional arguments:
    delta - The long to add to the counter
    inMemory - use in memory map for the counter
returns:
    integer value of the counter or
    None on Error

counterTestGetAndAdd(self, counter, delta=1, inMemory=False)

source code 

CLI command to get a distributed counter then add a delta to it.
Required arguments:
    counter - The name of the counter to increment.
Optional arguments:
    delta - The long to add to the counter
    inMemory - use in memory map for the counter
returns:
    integer value of the counter or
    None on Error