Merge "ONOS Node rolling restart test"
diff --git a/TestON/drivers/common/api/controller/trexclientdriver.py b/TestON/drivers/common/api/controller/trexclientdriver.py
index 50c8c39..1150d4c 100644
--- a/TestON/drivers/common/api/controller/trexclientdriver.py
+++ b/TestON/drivers/common/api/controller/trexclientdriver.py
@@ -364,15 +364,18 @@
:param ports: List of ports ids to monitor
:param time_interval: Interval between read
- :return: Statistics read while traffic is active
+ :return: Statistics read while traffic is active, or empty result if no
+ ports provided.
"""
-
results = {
port_id: {"rx_bps": [], "tx_bps": [], "rx_pps": [], "tx_pps": []}
for port_id in ports
}
results["duration"] = []
+ if not ports:
+ return results
+
prev = {
port_id: {
"opackets": 0,
diff --git a/TestON/drivers/common/cli/hostdriver.py b/TestON/drivers/common/cli/hostdriver.py
index c2d80ed..d1c17fa 100644
--- a/TestON/drivers/common/cli/hostdriver.py
+++ b/TestON/drivers/common/cli/hostdriver.py
@@ -171,10 +171,10 @@
self.handle.expect( self.prompt )
self.handle.sendline( "ssh {}@{}".format( self.options[ 'username' ],
self.options[ 'ip' ] ) )
- i = self.handle.expect( [ "password:|Password:", self.prompt, pexpect.TIMEOUT ], timeout=30 )
+ i = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=30 )
if i == 0:
- self.handle.sendline( self.options[ 'password' ] )
- j = self.handle.expect( [ "password:|Password:", self.prompt, pexpect.TIMEOUT ], timeout=10 )
+ self.handle.sendline( self.pwd )
+ j = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=10 )
if j != 1:
main.log.error( "Incorrect password" )
return main.FALSE
@@ -539,14 +539,21 @@
try:
main.log.info( self.name + ": Sending: " + cmd )
self.handle.sendline( cmd )
- i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ],
+ i = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ],
timeout=wait + 5 )
response = self.handle.before
if debug:
main.log.debug( response )
- if i == 1:
+ if i == 0:
+ self.handle.sendline( self.pwd )
+ j = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=10 )
+ if j != 1:
+ main.log.error( "Incorrect password" )
+ return main.FALSE
+ if i == 2:
main.log.error( self.name + ": timeout when waiting for response" )
main.log.error( self.name + ": response: " + str( response ) )
+ main.log.debug( self.prompt )
return response
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -555,3 +562,4 @@
except Exception:
main.log.exception( self.name + ": uncaught exception!" )
main.cleanAndExit()
+ self.clearBuffer()
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index 678bc50..89edfb3 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -358,7 +358,7 @@
except Exception:
main.log.error( self.name + ": failed to get host MAC address" )
- def runCmdOnHost( self, hostName, cmd ):
+ def runCmdOnHost( self, hostName, cmd, debug=False ):
"""
Run shell command on specified host and return output
Required:
@@ -367,7 +367,7 @@
"""
hostComponent = self.hosts[ hostName ]
if hostComponent:
- return hostComponent.command( cmd )
+ return hostComponent.command( cmd, debug )
return None
def assignSwController( self, sw, ip, port="6653", ptcp="" ):
@@ -1074,13 +1074,13 @@
intf = hosts[host]['interfaces'][0].get( 'name' )
hostIp = self.getIPAddress( host, iface=intf ) or hosts[host]['interfaces'][0].get( 'ips', False )
if hostIp:
- flushCmd = "sudo ip neigh flush all"
+ flushCmd = "sudo /sbin/ip neigh flush all"
intfStr = "-i {}".format( intf ) if intf else ""
srcIp = "-S {}".format( hostIp if isinstance( hostIp, types.StringType ) else hostIp[0] ) if intf else ""
- cmd = "sudo arping -c 1 -w {} {} {} {}".format( wait, intfStr, srcIp, dstIp )
+ cmd = "sudo /usr/sbin/arping -c 1 -w {} {} {} {}".format( wait, intfStr, srcIp, dstIp )
main.log.debug( "Sending IPv4 arping from host {}".format( host ) )
elif self.getIPAddress( host, proto='IPV6' ):
- flushCmd = "sudo ip -6 neigh flush all"
+ flushCmd = "sudo /sbin/ip -6 neigh flush all"
intf = hosts[host]['interfaces'][0]['name']
cmd = "ndisc6 -r 1 -w {} {} {}".format( wait, dstIp6, intf )
main.log.debug( "Sending IPv6 ND from host {}".format( host ) )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 8e6a90a..f041871 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -36,6 +36,7 @@
shreya@onlab.us
jeremyr@opennetworking.org
"""
+import ipaddress
import pexpect
import re
import json
@@ -1364,7 +1365,7 @@
main.log.exception( self.name + ": Uncaught exception" )
return None
- def verifyHostIp( self, hostList=[], prefix="" ):
+ def verifyHostIp( self, hostList=[], prefix="", prefixLength=24 ):
"""
Description:
Verify that all hosts have IP address assigned to them
@@ -1379,19 +1380,28 @@
"""
try:
hosts = self.hosts()
- hosts = json.loads( hosts )
+ hosts = json.loads( hosts, "utf-8" )
if not hostList:
hostList = [ host[ "id" ] for host in hosts ]
+ hostList = [ str( h.lower() ) for h in hostList ]
for host in hosts:
hostId = host[ "id" ]
- if hostId not in hostList:
+ hostId = str( hostId.lower() )
+ match = False
+ for onosHostId in hostList:
+ if onosHostId == hostId:
+ match = True
+ if not match:
continue
ipList = host[ "ipAddresses" ]
main.log.debug( self.name + ": IP list on host " + str( hostId ) + ": " + str( ipList ) )
if not ipList:
main.log.warn( self.name + ": Failed to discover any IP addresses on host " + str( hostId ) )
else:
- if not any( ip.startswith( str( prefix ) ) for ip in ipList ):
+ # if no hostIp in subnet: Get warning otherwise remove hostId from hostList
+ subnetString = u"%s/%s" % (prefix, prefixLength)
+ subnet = ipaddress.ip_network( subnetString, strict=False )
+ if not any( ipaddress.ip_address( ip ) in subnet for ip in ipList ):
main.log.warn( self.name + ": None of the IPs on host " + str( hostId ) + " has prefix " + str( prefix ) )
else:
main.log.debug( self.name + ": Found matching IP on host " + str( hostId ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
index 427917f..f9575fe 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.params
@@ -100,7 +100,7 @@
<expected_max_dropped>0</expected_max_dropped>
<expected_max_latency>1500</expected_max_latency>
<!-- Verify the 90th percentile instead of 99.9th because of latency introduced by TRex SW Mode -->
- <expected_90_percentile_latency>150</expected_90_percentile_latency>
+ <expected_90_percentile_latency>200</expected_90_percentile_latency>
</RT_FROM_UE>
<BE_FROM_PDN>
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
index fcb4b7c..6fc1ba9 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/dependencies/QOSTest.py
@@ -20,7 +20,7 @@
up4 = UP4()
trex = Trex()
# Get the P4RT client connected to UP4 in the first available ONOS instance
- up4.setup(main.Cluster.active(0).p4rtUp4)
+ up4.setup(main.Cluster.active(0).p4rtUp4, no_host=True)
trex.setup(main.TRexClient)
main.step("Program PDRs and FARs via UP4")
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.tucson b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.tucson
new file mode 100644
index 0000000..ae0bb35
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.tucson
@@ -0,0 +1,96 @@
+<PARAMS>
+ <testcases>1,3,4,6,7,9,101,103,104,106,107,109,201,203,204,206,207,209,301,303,304,306,307,309,601,602,606,620,621,622,630,640,652,653</testcases>
+
+ <GRAPH>
+ <nodeCluster>pairedleaves</nodeCluster>
+ <builds>20</builds>
+ <jobName>SRRouting-tofino</jobName>
+ <branch>master</branch>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <useCommonConf>False</useCommonConf>
+ <useCommonTopo>True</useCommonTopo>
+ <useBmv2>True</useBmv2>
+ <bmv2SwitchType>stratum</bmv2SwitchType>
+ <switchPrefix></switchPrefix>
+ <stratumRoot>~/stratum</stratumRoot>
+ <confName>tucson</confName>
+ <topology>trellis_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py,stratum.py</lib>
+ </DEPENDENCY>
+
+ <jsonFileSuffix>.tucson</jsonFileSuffix>
+
+ <persistent_setup>True</persistent_setup>
+
+ <kubernetes>
+ <appName>onos-classic</appName>
+ <namespace>tost</namespace>
+ </kubernetes>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,fpm,lldpprovider,hostprovider,netcfghostprovider,drivers.bmv2,pipelines.fabric,org.stratumproject.fabric-tna,drivers.barefoot,segmentrouting,t3</cellApps>
+ </ENV>
+
+ <EXTERNAL_APPS>
+ </EXTERNAL_APPS>
+
+ <ONOS_Configuration>
+ <org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+ <enableMessageLog>true</enableMessageLog>
+ </org.onosproject.grpc.ctl.GrpcChannelControllerImpl>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.routeservice.impl>DEBUG</org.onosproject.routeservice.impl>
+ <org.onosproject.routeservice.store>DEBUG</org.onosproject.routeservice.store>
+ <org.onosproject.routing.fpm>DEBUG</org.onosproject.routing.fpm>
+ <org.onosproject.fpm>DEBUG</org.onosproject.fpm>
+ </ONOS_Logging>
+ <ONOS_Logging_Reset>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ </ONOS_Logging_Reset>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>30</LinkDiscovery>
+ <SwitchDiscovery>45</SwitchDiscovery>
+ <TrafficDiscovery>10</TrafficDiscovery>
+ <OnosDiscovery>45</OnosDiscovery>
+ <loadNetcfgSleep>5</loadNetcfgSleep>
+ <startMininetSleep>25</startMininetSleep>
+ <dhcpSleep>150</dhcpSleep>
+ <balanceMasterSleep>10</balanceMasterSleep>
+ </timers>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+ <TOPO>
+ <internalIpv4Hosts>h1,h2,h3,mgmt</internalIpv4Hosts>
+ <switchNum>2</switchNum>
+ <linkNum>2</linkNum>
+ </TOPO>
+
+ <ALARM>
+ <minPassPercent>100</minPassPercent>
+ </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo.0x2.tucson b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo.0x2.tucson
new file mode 100644
index 0000000..5aa179c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo.0x2.tucson
@@ -0,0 +1,186 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>jenkins</user>
+ <password></password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <home>~/onos</home> # defines where onos home is on the build machine. Defaults to "~/onos/" if empty.
+ <COMPONENTS>
+ <kubeConfig>~/.kube/dev-pairedleaves-tucson</kubeConfig> # If set, will attempt to use this file for setting up port-forwarding
+ <useDocker>True</useDocker> # Whether to use docker for ONOS nodes
+ <docker_prompt>\$</docker_prompt>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost>True</diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username>karaf</karaf_username>
+ <karaf_password>karaf</karaf_password>
+ <karafPrompt_username>karaf</karafPrompt_username>
+ <karafPrompt_password>karaf</karafPrompt_password>
+ <web_user>karaf</web_user>
+ <web_pass>karaf</web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home>~/onos/</onos_home> # defines where onos home is on the target cell machine. Defaults to entry in "home" if empty.
+ <nodes> 3 </nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Leaf1>
+ <host>10.76.28.70</host>
+ <user>root</user>
+ <password>onl</password>
+ <type>StratumOSSwitchDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <shortName>leaf1</shortName>
+ <port1>1</port1>
+ <link1>Host1</link1>
+ <onosConfigPath></onosConfigPath>
+ <onosConfigFile></onosConfigFile>
+ </COMPONENTS>
+ </Leaf1>
+
+ <Leaf2>
+ <host>10.76.28.71</host>
+ <user>root</user>
+ <password>onl</password>
+ <type>StratumOSSwitchDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <shortName>leaf2</shortName>
+ <port1>2</port1>
+ <link1>Host2</link1>
+ <onosConfigPath></onosConfigPath>
+ <onosConfigFile></onosConfigFile>
+ </COMPONENTS>
+ </Leaf2>
+
+ <Compute1>
+ <host>10.76.28.74</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>6</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>False</dhcp>
+ <ip>10.32.11.2</ip>
+ <shortName>h1</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>pairbond</ifaceName>
+ <scapy_path>/usr/bin/scapy</scapy_path>
+ <routes>
+ <route1>
+ <network>10.32.11.126</network>
+ <netmask>25</netmask>
+ <gw>10.32.11.126</gw>
+ <interface>pairbond</interface>
+ </route1>
+ </routes>
+ <sudo_required>true</sudo_required>
+ </COMPONENTS>
+ </Compute1>
+
+ <Compute2>
+ <host>10.76.28.72</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>7</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>False</dhcp>
+ <ip>10.32.11.3</ip>
+ <shortName>h2</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>pairbond</ifaceName>
+ <scapy_path>/usr/bin/scapy</scapy_path>
+ <routes>
+ <route1>
+ <network>10.32.11.126</network>
+ <netmask>25</netmask>
+ <gw>10.32.11.126</gw>
+ <interface>pairbond</interface>
+ </route1>
+ </routes>
+ <sudo_required>true</sudo_required>
+ </COMPONENTS>
+ </Compute2>
+
+ <Compute3>
+ <host>10.76.28.68</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>8</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>False</dhcp>
+ <ip>10.32.11.194</ip>
+ <shortName>h3</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>eno2</ifaceName>
+ <scapy_path>/usr/bin/scapy</scapy_path>
+ <routes>
+ <route1>
+ <network>10.32.11.254</network>
+ <netmask>26</netmask>
+ <gw>10.32.11.254</gw>
+ <interface>26</interface>
+ </route1>
+ </routes>
+ <sudo_required>true</sudo_required>
+ </COMPONENTS>
+ </Compute3>
+
+ <ManagmentServer>
+ <host>10.76.28.66</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>False</dhcp>
+ <ip>10.32.11.1</ip>
+ <shortName>mgmt</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>pairbond</ifaceName>
+ <scapy_path>/usr/bin/scapy</scapy_path>
+ <routes>
+ <route1>
+ <network>10.32.11.126</network>
+ <netmask>25</netmask>
+ <gw>10.32.11.126</gw>
+ <interface>pairbond</interface>
+ </route1>
+ </routes>
+ <sudo_required>true</sudo_required>
+
+ </COMPONENTS>
+ </ManagmentServer>
+
+ <NetworkBench>
+ <host>10.76.28.66</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>NetworkDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </NetworkBench>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index fd6f018..bcf9728 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -80,6 +80,7 @@
# if static route flag add routes
# these routes are topology specific
+ # these should be in the params file
if static:
if ipv4:
lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
@@ -105,7 +106,7 @@
# Run the test with physical devices
lib.connectToPhysicalNetwork( main )
- lib.saveOnosDiagnostics( main )
+ # lib.saveOnosDiagnostics( main )
# wait some time for onos to install the rules!
main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] ))
time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host
new file mode 100644
index 0000000..db6e183
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host
@@ -0,0 +1,16 @@
+{
+ "onos":
+ {
+ "A4:23:05:01:A2:F2/None": "10.32.11.2",
+ "A4:23:05:01:A2:F3/None": "10.32.11.3",
+ "3C:EC:EF:47:B6:09/None": "10.32.11.194",
+ "66:72:77:60:68:A2/None": "10.32.11.1"
+ },
+ "network":
+ {
+ "h1": "10.32.11.2",
+ "h2": "10.32.11.3",
+ "h3": "10.32.11.194",
+ "mgmt": "10.32.11.1"
+ }
+}