Fix FUNCintent pingallHost | TCP issues
Change-Id: I91102f81d6c8130e1d54a1b35adfb7e57c14712b
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index b73e9aa..58d5f34 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -25,46 +25,46 @@
sw2="",
expectedLink=0 ):
"""
- Description:
- Verify add-host-intent
- Steps:
- - Discover hosts
- - Add host intents
- - Check intents
+ Description:
+ Verify add-host-intent
+ Steps:
+ - Discover hosts
+ - Add host intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
- Verify flows
+ - Check topology
- Ping hosts
- - Reroute
- - Link down
- - Verify flows
- - Check topology
- - Ping hosts
- - Link up
- - Verify flows
- - Check topology
- - Ping hosts
- - Remove intents
- Required:
- name - Type of host intent to add eg. IPV4 | VLAN | Dualstack
- host1 - Name of first host
- host2 - Name of second host
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
- host2Id - ONOS id of the second host
- mac1 - Mac address of first host
- mac2 - Mac address of the second host
- vlan1 - Vlan tag of first host, defaults to -1
- vlan2 - Vlan tag of second host, defaults to -1
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
- Return:
- Returns main.TRUE if all verification passed, otherwise return
- main.FALSE; returns main.FALSE if there is a key error
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of host intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Name of first host
+ host2 - Name of second host
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
+ host2Id - ONOS id of the second host
+ mac1 - Mac address of first host
+ mac2 - Mac address of the second host
+ vlan1 - Vlan tag of first host, defaults to -1
+ vlan2 - Vlan tag of second host, defaults to -1
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ Return:
+ Returns main.TRUE if all verification passed, otherwise return
+ main.FALSE; returns main.FALSE if there is a key error
"""
# Assert variables
@@ -235,53 +235,53 @@
expectedLink=0 ):
"""
- Description:
- Verify add-point-intent
- Steps:
- - Get device ids | ports
- - Add point intents
- - Check intents
+ Description:
+ Verify add-point-intent
+ Steps:
+ - Get device ids | ports
+ - Add point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
- Verify flows
+ - Check topology
- Ping hosts
- - Reroute
- - Link down
- - Verify flows
- - Check topology
- - Ping hosts
- - Link up
- - Verify flows
- - Check topology
- - Ping hosts
- - Remove intents
- Required:
- name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
- host1 - Name of first host
- host2 - Name of second host
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- deviceId1 - ONOS device id of the first switch, the same as the
- location of the first host eg. of:0000000000000001/1,
- located at device 1 port 1
- deviceId2 - ONOS device id of the second switch
- port1 - The port number where the first host is attached
- port2 - The port number where the second host is attached
- ethType - Ethernet type eg. IPV4, IPV6
- mac1 - Mac address of first host
- mac2 - Mac address of the second host
- bandwidth - Bandwidth capacity
- lambdaAlloc - Allocate lambda, defaults to False
- ipProto - IP protocol
- ip1 - IP address of first host
- ip2 - IP address of second host
- tcp1 - TCP port of first host
- tcp2 - TCP port of second host
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Name of first host
+ host2 - Name of second host
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ deviceId1 - ONOS device id of the first switch, the same as the
+ location of the first host eg. of:0000000000000001/1,
+ located at device 1 port 1
+ deviceId2 - ONOS device id of the second switch
+ port1 - The port number where the first host is attached
+ port2 - The port number where the second host is attached
+ ethType - Ethernet type eg. IPV4, IPV6
+ mac1 - Mac address of first host
+ mac2 - Mac address of the second host
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ip1 - IP address of first host
+ ip2 - IP address of second host
+ tcp1 - TCP port of first host
+ tcp2 - TCP port of second host
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
"""
assert main, "There is no main variable"
@@ -354,12 +354,6 @@
checkFlowsState( main )
# Ping hosts
- firstPingResult = pingallHosts( main, hostNames )
- if not firstPingResult:
- main.log.debug( "First ping failed, there must be" +
- " something wrong with ONOS performance" )
-
- # Ping hosts again...
pingResult = pingResult and pingallHosts( main, hostNames )
# Test rerouting if these variables exist
@@ -418,6 +412,243 @@
return stepResult
+def pointIntentTcp( main,
+ name,
+ host1,
+ host2,
+ onosNode=0,
+ deviceId1="",
+ deviceId2="",
+ port1="",
+ port2="",
+ ethType="",
+ mac1="",
+ mac2="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ip1="",
+ ip2="",
+ tcp1="",
+ tcp2="",
+ sw1="",
+ sw2="",
+ expectedLink=0 ):
+
+ """
+ Description:
+ Verify add-point-intent only for TCP
+ Steps:
+ - Get device ids | ports
+ - Add point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Name of first host
+ host2 - Name of second host
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ deviceId1 - ONOS device id of the first switch, the same as the
+ location of the first host eg. of:0000000000000001/1,
+ located at device 1 port 1
+ deviceId2 - ONOS device id of the second switch
+ port1 - The port number where the first host is attached
+ port2 - The port number where the second host is attached
+ ethType - Ethernet type eg. IPV4, IPV6
+ mac1 - Mac address of first host
+ mac2 - Mac address of the second host
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ip1 - IP address of first host
+ ip2 - IP address of second host
+ tcp1 - TCP port of first host
+ tcp2 - TCP port of second host
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ assert main, "There is no main variable"
+ assert name, "variable name is empty"
+ assert host1 and host2, "You must specify hosts"
+
+ global itemName
+ itemName = name
+ host1 = host1
+ host2 = host2
+ hostNames = [ host1, host2 ]
+ intentsId = []
+
+ iperfResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+ onosNode = int( onosNode )
+
+ # Adding bidirectional point intents
+ main.log.info( itemName + ": Adding point intents" )
+ intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
+ egressDevice=deviceId2,
+ portIngress=port1,
+ portEgress=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc=tcp1,
+ tcpDst="" )
+
+ intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
+ egressDevice=deviceId1,
+ portIngress=port2,
+ portEgress=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc=tcp2,
+ tcpDst="" )
+
+ intent3 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
+ egressDevice=deviceId2,
+ portIngress=port1,
+ portEgress=port2,
+ ethType=ethType,
+ ethSrc=mac1,
+ ethDst=mac2,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip1,
+ ipDst=ip2,
+ tcpSrc="",
+ tcpDst=tcp2 )
+
+ intent4 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
+ egressDevice=deviceId1,
+ portIngress=port2,
+ portEgress=port1,
+ ethType=ethType,
+ ethSrc=mac2,
+ ethDst=mac1,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ip2,
+ ipDst=ip1,
+ tcpSrc="",
+ tcpDst=tcp1 )
+ intentsId.append( intent1 )
+ intentsId.append( intent2 )
+ intentsId.append( intent3 )
+ intentsId.append( intent4 )
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ # Verify flows
+ checkFlowsState( main )
+
+ # Run iperf to both host
+ iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
+ host2, 10 )
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # link down
+ linkDownResult = link( main, sw1, sw2, "down" )
+ intentResult = intentResult and checkIntentState( main, intentsId )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink )
+
+ # Run iperf to both host
+ iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
+ host2, 10 )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and iperfResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # link up
+ linkUpResult = link( main, sw1, sw2, "up" )
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+ # Verify flows
+ checkFlowsState( main )
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+
+ # Run iperf to both host
+ iperfResult = iperfResult and main.Mininet1.iperftcp( host1,
+ host2, 10 )
+
+ intentResult = checkIntentState( main, intentsId )
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and iperfResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+
+ stepResult = iperfResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return stepResult
+
def singleToMultiIntent( main,
name,
hostNames,
@@ -435,58 +666,58 @@
sw2="",
expectedLink=0 ):
"""
- Verify Single to Multi Point intents
- NOTE:If main.hostsData is not defined, variables data should be passed in the
- same order index wise. All devices in the list should have the same
- format, either all the devices have its port or it doesn't.
- eg. hostName = [ 'h1', 'h2' ,.. ]
- devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
- ports = [ '1', '1', ..]
- ...
- Description:
- Verify add-single-to-multi-intent iterates through the list of given
- host | devices and add intents
- Steps:
- - Get device ids | ports
- - Add single to multi point intents
- - Check intents
+ Verify Single to Multi Point intents
+ NOTE:If main.hostsData is not defined, variables data should be passed
+ in the same order index wise. All devices in the list should have the same
+ format, either all the devices have its port or it doesn't.
+ eg. hostName = [ 'h1', 'h2' ,.. ]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
+ ports = [ '1', '1', ..]
+ ...
+ Description:
+ Verify add-single-to-multi-intent iterates through the list of given
+ host | devices and add intents
+ Steps:
+ - Get device ids | ports
+ - Add single to multi point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
- Verify flows
+ - Check topology
- Ping hosts
- - Reroute
- - Link down
- - Verify flows
- - Check topology
- - Ping hosts
- - Link up
- - Verify flows
- - Check topology
- - Ping hosts
- - Remove intents
- Required:
- name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
- hostNames - List of host names
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- devices - List of device ids in the same order as the hosts
- in hostNames
- ports - List of port numbers in the same order as the device in
- devices
- ethType - Ethernet type eg. IPV4, IPV6
- macs - List of hosts mac address in the same order as the hosts in
- hostNames
- bandwidth - Bandwidth capacity
- lambdaAlloc - Allocate lambda, defaults to False
- ipProto - IP protocol
- ipAddresses - IP addresses of host in the same order as the hosts in
- hostNames
- tcp - TCP ports in the same order as the hosts in hostNames
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ hostNames - List of host names
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ devices - List of device ids in the same order as the hosts
+ in hostNames
+ ports - List of port numbers in the same order as the device in
+ devices
+ ethType - Ethernet type eg. IPV4, IPV6
+ macs - List of hosts mac address in the same order as the hosts in
+ hostNames
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ipAddresses - IP addresses of host in the same order as the hosts in
+ hostNames
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
"""
assert main, "There is no main variable"
@@ -678,57 +909,57 @@
sw2="",
expectedLink=0 ):
"""
- Verify Single to Multi Point intents
- NOTE:If main.hostsData is not defined, variables data should be passed in the
- same order index wise. All devices in the list should have the same
- format, either all the devices have its port or it doesn't.
- eg. hostName = [ 'h1', 'h2' ,.. ]
- devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
- ports = [ '1', '1', ..]
- ...
- Description:
- Verify add-multi-to-single-intent
- Steps:
- - Get device ids | ports
- - Add multi to single point intents
- - Check intents
+ Verify Single to Multi Point intents
+ NOTE:If main.hostsData is not defined, variables data should be passed in the
+ same order index wise. All devices in the list should have the same
+ format, either all the devices have its port or it doesn't.
+ eg. hostName = [ 'h1', 'h2' ,.. ]
+ devices = [ 'of:0000000000000001', 'of:0000000000000002', ...]
+ ports = [ '1', '1', ..]
+ ...
+ Description:
+ Verify add-multi-to-single-intent
+ Steps:
+ - Get device ids | ports
+ - Add multi to single point intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
- Verify flows
+ - Check topology
- Ping hosts
- - Reroute
- - Link down
- - Verify flows
- - Check topology
- - Ping hosts
- - Link up
- - Verify flows
- - Check topology
- - Ping hosts
- - Remove intents
- Required:
- name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
- hostNames - List of host names
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- devices - List of device ids in the same order as the hosts
- in hostNames
- ports - List of port numbers in the same order as the device in
- devices
- ethType - Ethernet type eg. IPV4, IPV6
- macs - List of hosts mac address in the same order as the hosts in
- hostNames
- bandwidth - Bandwidth capacity
- lambdaAlloc - Allocate lambda, defaults to False
- ipProto - IP protocol
- ipAddresses - IP addresses of host in the same order as the hosts in
- hostNames
- tcp - TCP ports in the same order as the hosts in hostNames
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ hostNames - List of host names
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ devices - List of device ids in the same order as the hosts
+ in hostNames
+ ports - List of port numbers in the same order as the device in
+ devices
+ ethType - Ethernet type eg. IPV4, IPV6
+ macs - List of hosts mac address in the same order as the hosts in
+ hostNames
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ ipAddresses - IP addresses of host in the same order as the hosts in
+ hostNames
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
"""
assert main, "There is no main variable"
@@ -904,11 +1135,11 @@
return stepResult
-def pingallHosts( main, hostList, pingType="ipv4" ):
+def pingallHosts( main, hostList ):
# Ping all host in the hosts list variable
print "Pinging : ", hostList
pingResult = main.TRUE
- pingResult = main.Mininet1.pingallHosts( hostList, pingType )
+ pingResult = main.Mininet1.pingallHosts( hostList )
return pingResult
def getHostsData( main ):
@@ -1090,7 +1321,7 @@
return main.TRUE
-def checkLeaderChange( leaders1 , leaders2 ):
+def checkLeaderChange( leaders1, leaders2 ):
"""
Checks for a change in intent partition leadership.