Added option for which cli the command will execute
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 6a31a60..76c74b9 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -370,23 +370,23 @@
def pingallHosts( self, hostList, pingType='ipv4' ):
"""
- Ping all specified hosts with a specific ping type
-
- Acceptable pingTypes:
- - 'ipv4'
+ Ping all specified hosts with a specific ping type
+
+ Acceptable pingTypes:
+ - 'ipv4'
- 'ipv6'
-
+
Acceptable hostList:
- ['h1','h2','h3','h4']
-
- Returns main.TRUE if all hosts specified can reach
+
+ Returns main.TRUE if all hosts specified can reach
each other
-
+
Returns main.FALSE if one or more of hosts specified
cannot reach each other"""
-
+
if pingType == "ipv4":
- cmd = " ping -c 1 -i 1 -W 8 "
+ cmd = " ping -c 1 -i 1 -W 8 "
elif pingType == "ipv6":
cmd = " ping6 -c 1 -i 1 -W 8 "
else:
@@ -395,17 +395,17 @@
try:
main.log.info( "Testing reachability between specified hosts" )
-
+
isReachable = main.TRUE
for host in hostList:
listIndex = hostList.index(host)
# List of hosts to ping other than itself
pingList = hostList[:listIndex] + hostList[(listIndex+1):]
-
+
for temp in pingList:
# Current host pings all other hosts specified
- pingCmd = str(host) + cmd + str(temp)
+ pingCmd = str(host) + cmd + str(temp)
self.handle.sendline( pingCmd )
i = self.handle.expect( [ pingCmd, pexpect.TIMEOUT ] )
j = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
@@ -414,11 +414,11 @@
main.log.info( str(host) + " -> " + str(temp) )
else:
main.log.info( str(host) + " -> X ("+str(temp)+") "
- " Destination Unreachable" )
+ " Destination Unreachable" )
# One of the host to host pair is unreachable
isReachable = main.FALSE
- return isReachable
+ return isReachable
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 1d7f227..1733649 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -10,6 +10,7 @@
name,
host1,
host2,
+ onosNode=0,
host1Id="",
host2Id="",
mac1="",
@@ -101,15 +102,16 @@
return main.FALSE
# Discover hosts using arping
- main.log.info( itemName + ": Discover host using arping" )
- main.Mininet1.arping( host=host1 )
- main.Mininet1.arping( host=host2 )
- host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
- host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
+ if not main.hostsData:
+ main.log.info( itemName + ": Discover host using arping" )
+ main.Mininet1.arping( host=host1 )
+ main.Mininet1.arping( host=host2 )
+ host1 = main.CLIs[ 0 ].getHost( mac=h1Mac )
+ host2 = main.CLIs[ 0 ].getHost( mac=h2Mac )
# Adding host intents
main.log.info( itemName + ": Adding host intents" )
- intent1 = main.CLIs[ 0 ].addHostIntent( hostIdOne=h1Id,
+ intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
hostIdTwo=h2Id )
intentsId.append( intent1 )
time.sleep( 5 )
@@ -191,6 +193,7 @@
name,
host1,
host2,
+ onosNode=0,
deviceId1="",
deviceId2="",
port1="",
@@ -278,7 +281,7 @@
# Adding bidirectional point intents
main.log.info( itemName + ": Adding point intents" )
- intent1 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId1,
+ intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
egressDevice=deviceId2,
portIngress=port1,
portEgress=port2,
@@ -295,7 +298,7 @@
intentsId.append( intent1 )
time.sleep( 5 )
- intent2 = main.CLIs[ 0 ].addPointIntent( ingressDevice=deviceId2,
+ intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
egressDevice=deviceId1,
portIngress=port2,
portEgress=port1,
@@ -387,6 +390,7 @@
def singleToMultiIntent( main,
name,
hostNames,
+ onosNode=0,
devices="",
ports=None,
ethType="",
@@ -530,7 +534,8 @@
main.log.debug( "There is no MAC in device - " + ingressDevice )
srcMac = ""
- intentsId.append( main.CLIs[ 0 ].addSinglepointToMultipointIntent(
+ intentsId.append(
+ main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
ingressDevice=ingressDevice,
egressDeviceList=egressDeviceList,
portIngress=portIngress,
@@ -545,6 +550,7 @@
tcpSrc="",
tcpDst="" ) )
+ time.sleep( 10 )
pingResult = pingallHosts( main, hostNames )
# Check intents state
@@ -619,6 +625,7 @@
def multiToSingleIntent( main,
name,
hostNames,
+ onosNode=0,
devices="",
ports=None,
ethType="",
@@ -760,7 +767,8 @@
main.log.debug( "There is no MAC in device - " + egressDevice )
dstMac = ""
- intentsId.append( main.CLIs[ 0 ].addMultipointToSinglepointIntent(
+ intentsId.append(
+ main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
ingressDeviceList=ingressDeviceList,
egressDevice=egressDevice,
portIngressList=portIngressList,
@@ -919,11 +927,17 @@
def checkIntentState( main, intentsId ):
intentResult = main.TRUE
+ results = []
main.log.info( itemName + ": Checking intents state" )
for i in range( main.numCtrls ):
- intentResult = intentResult and \
- main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+ intentResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+ results.append( intentResult )
+
+ if all( result == main.TRUE for result in results ):
+ main.log.info( itemName + ": Intents are installed correctly" )
+ else:
+ main.log.error( itemName + ": Intents are NOT installed correctly" )
return intentResult
diff --git a/TestON/tests/FuncIntent/FuncIntent.py b/TestON/tests/FuncIntent/FuncIntent.py
index ace4e65..0cf1127 100644
--- a/TestON/tests/FuncIntent/FuncIntent.py
+++ b/TestON/tests/FuncIntent/FuncIntent.py
@@ -256,6 +256,25 @@
onpass="Successfully discovered hosts",
onfail="Failed to discover hosts" )
+ def CASE14( self, main ):
+ """
+ Stop mininet
+ """
+ main.log.report( "Stop Mininet topology" )
+ main.log.case( "Stop Mininet topology" )
+
+ main.step( "Stopping Mininet Topology" )
+ topoResult = main.Mininet1.stopNet( )
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully stop mininet",
+ onfail="Failed to stop mininet" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanup()
+ main.exit()
+
def CASE1001( self, main ):
"""
Add host intents between 2 host:
@@ -366,24 +385,23 @@
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="VLAN1: Add vlan host intent successful",
+ onpass="VLAN1: Add vlan host" +
+ " intent successful",
onfail="VLAN1: Add vlan host intent failed" )
+
stepResult = main.TRUE
main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
stepResult = main.wrapper.hostIntent( main,
name='VLAN2',
host1='h13',
- host2='h20',
- host1Id='',
- host2Id='',
- sw1='s5',
- sw2='s2',
- expectedLink=18 )
+ host2='h20' )
utilities.assert_equals( expect=main.FALSE,
actual=stepResult,
- onpass="VLAN2: Add inter vlan host intent successful",
- onfail="VLAN2: Add inter vlan host intent failed" )
+ onpass="VLAN2: Add inter vlan host" +
+ " intent successful",
+ onfail="VLAN2: Add inter vlan host" +
+ " intent failed" )
def CASE1002( self, main ):
"""
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
deleted file mode 100644
index 1e4cfc1..0000000
--- a/TestON/tests/PingallExample/PingallExample.params
+++ /dev/null
@@ -1,12 +0,0 @@
-<PARAMS>
- <testcases>1,2,3</testcases>
- <ENV>
- <cellName>SingleHA</cellName>
- </ENV>
- <Git>xe</Git>
-
- <CTRL>
- <ip1>10.128.30.11</ip1>
- <port1>6633</port1>
- </CTRL>
-</PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
deleted file mode 100644
index c03b0f1..0000000
--- a/TestON/tests/PingallExample/PingallExample.py
+++ /dev/null
@@ -1,171 +0,0 @@
-"""
-Description: This test is an example of a simple single node ONOS test
-
-List of test cases:
-CASE1: Compile ONOS and push it to the test machine
-CASE2: Assign mastership to controller
-CASE3: Pingall
-"""
-class PingallExample:
-
- def __init__( self ):
- self.default = ''
-
- def CASE1( self, main ):
- """
- CASE1 is to compile ONOS and push it to the test machines
-
- Startup sequence:
- git pull
- mvn clean install
- onos-package
- cell <name>
- onos-verify-cell
- onos-install -f
- onos-wait-for-start
- """
- desc = "ONOS Single node cluster restart HA test - initialization"
- main.log.report( desc )
- main.case( "Setting up test environment" )
-
- # load some vairables from the params file
- PULLCODE = False
- if main.params[ 'Git' ] == 'True':
- PULLCODE = True
- cellName = main.params[ 'ENV' ][ 'cellName' ]
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
-
- main.step( "Applying cell variable to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
-
- main.log.report( "Uninstalling ONOS" )
- main.ONOSbench.onosUninstall( ONOS1Ip )
-
- cleanInstallResult = main.TRUE
- gitPullResult = main.TRUE
-
- main.step( "Compiling the latest version of ONOS" )
- if PULLCODE:
- main.step( "Git checkout and pull master" )
- main.ONOSbench.gitCheckout( "master" )
- gitPullResult = main.ONOSbench.gitPull()
-
- main.step( "Using mvn clean & install" )
- cleanInstallResult = main.TRUE
- if gitPullResult == main.TRUE:
- cleanInstallResult = main.ONOSbench.cleanInstall()
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
- main.ONOSbench.getVersion( report=True )
-
- cellResult = main.ONOSbench.setCell( cellName )
- verifyResult = main.ONOSbench.verifyCell()
- main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
-
- main.step( "Installing ONOS package" )
- onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
- node=ONOS1Ip )
-
- main.step( "Checking if ONOS is up yet" )
- for i in range( 2 ):
- onos1Isup = main.ONOSbench.isup( ONOS1Ip )
- if onos1Isup:
- break
- if not onos1Isup:
- main.log.report( "ONOS1 didn't start!" )
-
- # TODO: if it becomes an issue, we can retry this step a few times
-
- cliResult = main.ONOScli1.startOnosCli( ONOS1Ip )
-
- case1Result = ( cleanInstallResult and packageResult and
- cellResult and verifyResult and
- onos1InstallResult and
- onos1Isup and cliResult )
-
- utilities.assert_equals( expect=main.TRUE, actual=case1Result,
- onpass="Test startup successful",
- onfail="Test startup NOT successful" )
-
- if case1Result == main.FALSE:
- main.cleanup()
- main.exit()
-
- # Starting the mininet using the old way
- main.step( "Starting Mininet ..." )
- netIsUp = main.Mininet1.startNet()
- if netIsUp:
- main.log.info("Mininet CLI is up")
- else:
- main.log.info("Mininet CLI is down")
-
- def CASE2( self, main ):
- """
- Assign mastership to controller
- """
- import re
-
- main.log.report( "Assigning switches to controller" )
- main.case( "Assigning Controller" )
- main.step( "Assign switches to controller" )
-
- ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
- ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
-
- for i in range( 1, 14 ):
- main.Mininet1.assignSwController(
- sw=str( i ),
- ip1=ONOS1Ip,
- port1=ONOS1Port )
-
- mastershipCheck = main.TRUE
- for i in range( 1, 14 ):
- response = main.Mininet1.getSwController( "s" + str( i ) )
- try:
- main.log.info( str( response ) )
- except Exception:
- main.log.info( repr( response ) )
- if re.search( "tcp:" + ONOS1Ip, response ):
- mastershipCheck = mastershipCheck and main.TRUE
- else:
- mastershipCheck = main.FALSE
- if mastershipCheck == main.TRUE:
- main.log.report( "Switch mastership assigned correctly" )
- utilities.assert_equals(
- expect=main.TRUE,
- actual=mastershipCheck,
- onpass="Switch mastership assigned correctly",
- onfail="Switches not assigned correctly to controllers" )
-
- def CASE3( self, main ):
- """
- Install forwarding app, Pingall and unistall the app
- """
- import time
-
- main.log.report( "Run Pingall" )
- main.case( "Run Pingall" )
-
- # install onos-app-fwd
- main.step( "Activate reactive forwarding app" )
- main.ONOScli1.activateApp( "org.onosproject.fwd" )
-
- # REACTIVE FWD test
- main.step( "Run the pingall command in Mininet" )
- pingResult = main.FALSE
- time1 = time.time()
- pingResult = main.Mininet1.pingall()
- time2 = time.time()
- main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
-
- # uninstall onos-app-fwd
- main.step( "Deactivate reactive forwarding app" )
- main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
-
- utilities.assert_equals( expect=main.TRUE, actual=pingResult,
- onpass="All hosts are reachable",
- onfail="Some pings failed" )
diff --git a/TestON/tests/PingallExample/PingallExample.topo b/TestON/tests/PingallExample/PingallExample.topo
deleted file mode 100644
index 3eda540..0000000
--- a/TestON/tests/PingallExample/PingallExample.topo
+++ /dev/null
@@ -1,47 +0,0 @@
-<TOPOLOGY>
- <COMPONENT>
-
- <ONOSbench>
- <host>10.128.30.10</host>
- <user>admin</user>
- <password></password>
- <type>OnosDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOSbench>
-
- <ONOScli1>
- <host>10.128.30.10</host>
- <user>admin</user>
- <password></password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOScli1>
-
- <ONOS1>
- <host>10.128.30.11</host>
- <user>admin</user>
- <password></password>
- <type>OnosDriver</type>
- <connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1>
-
- <Mininet1>
- <host>10.128.30.9</host>
- <user>admin</user>
- <password></password>
- <type>MininetCliDriver</type>
- <connect_order>4</connect_order>
- <COMPONENTS>
- #Specify the Option for mininet
- <arg1> --topo=tree,3,3 </arg1>
- <arg2> </arg2>
- <arg3> </arg3>
- <controller> remote </controller>
- </COMPONENTS>
- </Mininet1>
-
- </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/PingallExample/__init__.py b/TestON/tests/PingallExample/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/PingallExample/__init__.py
+++ /dev/null