Added option for which cli the command will execute
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 ):
"""