Stratum Support for Segement Rounting Suite
- Add Stratum Bmv2 switch support for SRDhcpRelay and SRRouting tests
- Add Support for 0x1 topology on a Stratum Tofino HW switch
- Support for dockerized mininet with Stratum BMv2 switches
- Update scapy driver to work with newer versions of scapy
- Simple parsing for scapy ping output
- Add support for fetching and installing external onos apps
- Add support for onos-diagnostics profiles
- Move onos log levels to params file
- Add onos cfg settings to SR tests
Change-Id: I7c4a71484c8fd5735da9ef09b96d8990283b199b
(cherry picked from commit bef6d9bd943996483fed32130cb30ad26a06aac0)
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
index 97d83a1..1d44485 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
@@ -20,6 +20,7 @@
<stratumRoot>~/stratum</stratumRoot>
<topology>trellis_fabric.py</topology>
<lib>routinglib.py,trellislib.py</lib>
+ <conf>bgpdbgp1.conf,bgpdbgp2.conf,bgpdr1.conf,bgpdr2.conf,dhcpd6.conf,dhcpd.conf,zebradbgp1.conf,zebradbgp2.conf</conf>
<trellisOar>/home/sdn/segmentrouting-oar-3.0.0-SNAPSHOT.oar</trellisOar>
</DEPENDENCY>
@@ -28,6 +29,21 @@
<cellApps>drivers,openflow,fpm,netcfghostprovider,drivers.bmv2,pipelines.fabric</cellApps>
</ENV>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
<GIT>
<pull>False</pull>
<branch>master</branch>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
index e1e7395..f530cf9 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.stratum
@@ -17,14 +17,17 @@
<useCommonTopo>True</useCommonTopo>
<useBmv2>True</useBmv2>
<bmv2SwitchType>stratum</bmv2SwitchType>
+ <switchPrefix>bmv2</switchPrefix>
<stratumRoot>~/stratum</stratumRoot>
<topology>trellis_fabric.py</topology>
<lib>routinglib.py,trellislib.py</lib>
+ <conf>bgpdbgp1.conf,bgpdbgp2.conf,bgpdr1.conf,bgpdr2.conf,dhcpd6.conf,dhcpd.conf,zebradbgp1.conf,zebradbgp2.conf</conf>
</DEPENDENCY>
<MN_DOCKER>
- <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -it -d</args>
+ <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -it -d</args>
<name>trellis_mininet</name>
+ <home>/home/root/</home>
</MN_DOCKER>
<ENV>
@@ -32,6 +35,34 @@
<cellApps>drivers,segmentrouting,openflow,fpm,netcfghostprovider,drivers.bmv2,pipelines.fabric</cellApps>
</ENV>
+ <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.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+ <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+ <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+ <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+ <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+ <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+ <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+ <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+ <org.onosproject.drivers.stratum>DEBUG</org.onosproject.drivers.stratum>
+ <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+ </ONOS_Logging>
+
<GIT>
<pull>False</pull>
<branch>master</branch>
@@ -50,6 +81,11 @@
<startup>10</startup>
</SLEEP>
+ <TOPO>
+ <switchNum>1</switchNum>
+ <linkNum>0</linkNum>
+ </TOPO>
+
<ALARM>
<minPassPercent>100</minPassPercent>
</ALARM>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.tofino b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.tofino
new file mode 100644
index 0000000..c495160
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params.tofino
@@ -0,0 +1,97 @@
+<PARAMS>
+ <testcases>1</testcases>
+
+ <GRAPH>
+ <nodeCluster>Fabric</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <useCommonConf>False</useCommonConf>
+ <useCommonTopo>True</useCommonTopo>
+ <useBmv2>True</useBmv2>
+ <bmv2SwitchType>stratum</bmv2SwitchType>
+ <switchPrefix>tofino</switchPrefix>
+ <stratumRoot>~/stratum</stratumRoot>
+ <topology>trellis_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py</lib>
+ </DEPENDENCY>
+
+ <jsonFileSuffix>.hw</jsonFileSuffix>
+
+ <MN_DOCKER>
+ <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -it -d</args>
+ <name>trellis_mininet</name>
+ <home>/home/root/</home>
+ </MN_DOCKER>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting,openflow,fpm,netcfghostprovider,drivers.bmv2,pipelines.fabric,drivers.barefoot</cellApps>
+ </ENV>
+
+ <EXTERNAL_APPS>
+ <fabric-tofino>https://oss.sonatype.org/content/groups/public/org/opencord/fabric-tofino/1.1.0/fabric-tofino-1.1.0.oar</fabric-tofino>
+ </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.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+ <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+ <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+ <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+ <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+ <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+ <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+ <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+ <org.onosproject.drivers.barefoot>DEBUG</org.onosproject.drivers.barefoot>
+ <org.opencord.fabric.tofino>DEBUG</org.opencord.fabric.tofino>
+ <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+ </ONOS_Logging>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+ <TOPO>
+ <switchNum>1</switchNum>
+ <linkNum>0</linkNum>
+ </TOPO>
+
+ <ALARM>
+ <minPassPercent>100</minPassPercent>
+ </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.0x1.physical b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.0x1.physical
new file mode 100644
index 0000000..2e2fb6f
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.0x1.physical
@@ -0,0 +1,102 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <home></home> # defines where onos home is on the build machine. Defaults to "~/onos/" if empty.
+ <COMPONENTS>
+ <cluster_name></cluster_name> # Used as a prefix for cluster components. Defaults to 'ONOS'
+ <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+ <karaf_username></karaf_username>
+ <karaf_password></karaf_password>
+ <web_user></web_user>
+ <web_pass></web_pass>
+ <rest_port></rest_port>
+ <prompt></prompt> # TODO: we technically need a few of these, one per component
+ <onos_home></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>
+
+ <SwitchLeaf1>
+ <host>10.128.13.232</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>
+ <port2>2</port2>
+ <link2>Host2</link2>
+ <onosConfigPath>~/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/</onosConfigPath>
+ <onosConfigFile>tofino-onos-netcfg.json</onosConfigFile>
+ </COMPONENTS>
+ </SwitchLeaf1>
+
+ <Host1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>HostDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ <mac>3c:fd:fe:a8:ea:31</mac>
+ <inband>false</inband>
+ <ip>10.0.2.1</ip>
+ <shortName>h1</shortName>
+ <port1>0</port1>
+ <link1>SwitchLeaf1</link1>
+ <interfaceName>ens6f1</interfaceName>
+ <routes>
+ <route1>
+ <network>10.0.2.0</network>
+ <netmask>24</netmask>
+ <gw></gw>
+ <interface></interface>
+ </route1>
+ </routes>
+ </COMPONENTS>
+ </Host1>
+
+ <Host2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>HostDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ <mac>3c:fd:fe:a8:ea:30</mac>
+ <inband>false</inband>
+ <ip>10.0.2.2</ip>
+ <shortName>h2</shortName>
+ <port1>0</port1>
+ <link1>SwitchLeaf1</link1>
+ <interfaceName>ens6f0</interfaceName>
+ <routes>
+ <route1>
+ <network>10.0.2.0</network>
+ <netmask>24</netmask>
+ <gw></gw>
+ <interface></interface>
+ </route1>
+ </routes>
+ </COMPONENTS>
+ </Host2>
+
+ <NetworkBench>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>NetworkDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </NetworkBench>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
index 3368950..984ba6b 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -36,7 +36,9 @@
# topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR', 28 )
self.topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 53, 53 )
self.switchNames = {}
+ self.switchNames[ '0x1' ] = [ "leaf1" ]
self.switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
+ main.switchType = "ovs"
def runTest( self, main, test_idx, topology, onosNodes, description, vlan = [] ):
skipPackage = False
@@ -48,44 +50,27 @@
if not init and onosNodes == main.Cluster.numCtrls:
skipPackage = True
- main.case( '%s, with %s and %d ONOS instance%s' %
- ( description, self.topo[ topology ][ 3 ], onosNodes, 's' if onosNodes > 1 else '' ) )
+ main.case( '%s, with %s, %s switches and %d ONOS instance%s' %
+ ( description, self.topo[ topology ][ 3 ], main.switchType, onosNodes, 's' if onosNodes > 1 else '' ) )
main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
main.Cluster.setRunningNode( onosNodes )
run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
if main.useBmv2:
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
else:
translator.bmv2ToOfdpa( main )
- run.loadJson( main )
+ suf = main.params.get( 'jsonFileSuffix', None)
+ if suf:
+ run.loadJson( main, suffix=suf )
+ else:
+ run.loadJson( main )
run.loadChart( main )
if hasattr( main, 'Mininet1' ):
- if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
- main.log.info( "Creating Mininet Docker" )
- main.Mininet1.dockerPrompt = '#'
- # Start docker container
- handle = main.Mininet1.handle
- handle.sendline( "docker run %s %s" % ( main.params[ 'MN_DOCKER' ][ 'args' ], main.params[ 'MN_DOCKER' ][ 'name' ] ) )
- handle.expect( main.Mininet1.bashPrompt )
- output = handle.before + handle.after
- main.log.debug( repr(output) )
- startStr = main.params[ 'MN_DOCKER' ][ 'name' ]
- endStr = main.Mininet1.user_name
- start = output.find( startStr ) + len( startStr )
- end = output.find( endStr )
- containerId = output[start:end].strip()
- main.log.debug( repr( containerId ) )
-
- handle = main.Mininet1.handle
- handle.sendline( "docker attach %s " % containerId ) # Strip?
- handle.expect( main.Mininet1.dockerPrompt )
- main.log.debug( handle.before + handle.after )
- # We should be good to go
- main.Mininet1.prompt = main.Mininet1.dockerPrompt
- main.Mininet1.sudoRequired = False
-
+ run.mnDockerSetup( main ) # optionally create and setup docker image
# Run the test with Mininet
mininet_args = ' --spine=%d --leaf=%d' % ( self.topo[ topology ][ 0 ], self.topo[ topology ][ 1 ] )
@@ -94,27 +79,14 @@
if len( vlan ) > 0 :
mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
if main.useBmv2:
- switchType = main.params[ 'DEPENDENCY' ].get( 'bmv2SwitchType', 'stratum' )
- mininet_args += ' --switch %s' % switchType
- main.log.info( "Using %s switch" % switchType )
+ mininet_args += ' --switch %s' % main.switchType
+ main.log.info( "Using %s switch" % main.switchType )
run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
- if main.useBmv2:
- filename = "onos-netcfg.json"
- for switch in main.Mininet1.getSwitches(switchRegex=r"(StratumBmv2Switch)|(Bmv2Switch)").keys():
- path = "/tmp/mn-stratum/%s/" % switch
- main.ONOSbench1.handle.sendline( "sudo sed -i 's/localhost/%s/g' %s%s" % ( main.Mininet1.ip_address, path, filename ) )
- main.ONOSbench1.handle.expect( main.ONOSbench1.prompt )
- main.log.debug( main.ONOSbench1.handle.before + main.ONOSbench1.handle.after )
- main.ONOSbench1.handle.sendline( "sudo sed -i 's/device:%s/device:bmv2:%s/g' %s%s" % ( switch, switch, path, filename ) )
- main.ONOSbench1.handle.expect( main.ONOSbench1.prompt )
- main.log.debug( main.ONOSbench1.handle.before + main.ONOSbench1.handle.after )
- main.ONOSbench1.onosNetCfg( main.ONOSserver1.ip_address, path, filename )
-
else:
# Run the test with physical devices
- run.connectToPhysicalNetwork( main, self.switchNames[ topology ] )
+ run.connectToPhysicalNetwork( main )
run.checkFlows( main, minFlowCount=self.topo[ topology ][ 5 if main.useBmv2 else 4 ] * self.topo[ topology ][ 1 ], sleep=5 )
if main.useBmv2:
@@ -126,22 +98,3 @@
run.pingAll( main )
run.cleanup( main )
- if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
- main.log.info( "Deleting Mininet Docker" )
-
- # Detach from container
- handle = main.Mininet1.handle
- try:
- handle.sendline( "exit" ) # ctrl-p ctrk-q to detach from container
- import time
- time.sleep(5)
- handle.expect( main.Mininet1.dockerPrompt )
- main.log.debug( handle.before + handle.after )
- main.Mininet1.prompt = main.Mininet1.bashPrompt
- handle.expect( main.Mininet1.prompt )
- main.log.debug( handle.before + handle.after )
- main.Mininet1.sudoRequired = True
- except Exception as e:
- main.log.error( e )
-
- # We should be good to go
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json.hw b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json.hw
new file mode 100644
index 0000000..38dbc9a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/CASE01.json.hw
@@ -0,0 +1,35 @@
+{
+ "ports":{
+ "device:tofino:leaf1/168":{
+ "interfaces":[
+ {
+ "ips":[
+ "10.0.2.254/24"
+ ],
+ "vlan-untagged":10
+ }
+ ]
+ },
+ "device:tofino:leaf1/160":{
+ "interfaces":[
+ {
+ "ips":[
+ "10.0.2.254/24"
+ ],
+ "vlan-untagged":10
+ }
+ ]
+ }
+ },
+ "devices":{
+ "device:tofino:leaf1":{
+ "segmentrouting":{
+ "isEdgeRouter":true,
+ "routerMac":"00:90:fb:64:cc:9e",
+ "ipv4NodeSid":1,
+ "ipv4Loopback":"10.128.13.232",
+ "adjacencySids":[]
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/tofino-onos-netcfg.json b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/tofino-onos-netcfg.json
new file mode 100644
index 0000000..5cc17ed
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/json/tofino-onos-netcfg.json
@@ -0,0 +1,12 @@
+{
+ "devices": {
+ "device:tofino:leaf1": {
+ "basic": {
+ "name": "leaf1",
+ "managementAddress": "grpc://10.128.13.232:28000?device_id=1",
+ "driver": "stratum-tofino",
+ "pipeconf": "org.opencord.fabric.tofino.montara_sde_9_0_0"
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
index a991004..85c0e30 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRClusterRestart/SRClusterRestart.params
@@ -28,6 +28,21 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params
index 719f5f6..e52c4a7 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params
@@ -31,6 +31,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum
new file mode 100644
index 0000000..e727787
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/SRDhcprelay.params.stratum
@@ -0,0 +1,86 @@
+<PARAMS>
+ <testcases>1,2,11,12,21,22,31,41,51,61,71</testcases>
+
+ <GRAPH>
+ <nodeCluster>Fabric</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <useCommonConf>False</useCommonConf>
+ <useCommonTopo>True</useCommonTopo>
+ <useBmv2>True</useBmv2>
+ <bmv2SwitchType>stratum</bmv2SwitchType>
+ <stratumRoot>~/stratum</stratumRoot>
+ <topology>trellis_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py</lib>
+ <conf>dhcpd.conf,dhcpd6.conf,bgpdr1.conf,bgpdr2.conf,bgpdbgp1.conf,zebradbgp1.conf,bgpdbgp2.conf,zebradbgp2.conf</conf>
+ </DEPENDENCY>
+
+ <MN_DOCKER>
+ <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -v /lib/modules:/lib/modules -it -d</args>
+ <name>trellis_mininet</name>
+ <home>/home/root/</home>
+ </MN_DOCKER>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,openflow,segmentrouting,fpm,dhcprelay,netcfghostprovider,routeradvertisement,drivers.bmv2,pipelines.fabric</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <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.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+ <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+ <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+ <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+ <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+ <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+ <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+ <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+ <org.onosproject.drivers.stratum>DEBUG</org.onosproject.drivers.stratum>
+ <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+ </ONOS_Logging>
+
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+ <ALARM>
+ <minPassPercent>63</minPassPercent>
+ </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
index 46220de..a2ceb25 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDhcprelay/dependencies/SRDhcprelayTest.py
@@ -47,12 +47,15 @@
run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
else:
translator.bmv2ToOfdpa( main )
run.loadJson( main )
run.loadHost( main )
if hasattr( main, 'Mininet1' ):
+ run.mnDockerSetup( main )
# Run the test with Mininet
if dualHomed:
mininet_args = ' --spine=2 --leaf=4 --dual-homed'
@@ -70,8 +73,8 @@
if len( vlan ) > 0 :
mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
if main.useBmv2:
- mininet_args += ' --switch bmv2'
- main.log.info( "Using BMv2 switch" )
+ mininet_args += ' --switch %s' % main.switchType
+ main.log.info( "Using %s switch" % main.switchType )
run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
else:
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
index f15f207..fdd3a93 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
index 376898b..ea42a59 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/SRDynamicConf.params
@@ -30,6 +30,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
index 4e1703e..78f3e6a 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamicConf/dependencies/SRDynamicConfTest.py
@@ -73,7 +73,9 @@
# TODO: Generate json and chart dynamically, according to topologies and scenarios
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
else:
translator.bmv2ToOfdpa( main )
run.loadJson( main )
@@ -85,7 +87,9 @@
intfCfg = "%s%s%s.json" % ( main.configPath, main.forJson, TAG )
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main, intfCfg )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=intfCfg )
else:
translator.bmv2ToOfdpa( main, intfCfg )
with open( intfCfg ) as cfg:
@@ -95,7 +99,9 @@
defaultIntfCfg = "%s%s%s_ports.json" % ( main.configPath, main.forJson, topology )
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main, defaultIntfCfg )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix, cfgFile=defaultIntfCfg )
else:
translator.bmv2ToOfdpa( main, defaultIntfCfg )
with open( defaultIntfCfg ) as cfg:
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
index 577edac..b87d333 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
index 8e0bbbf..de88e07 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRLinkFailure/SRLinkFailure.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params
index 4f61954..1fb91da 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params
@@ -32,6 +32,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params.flex b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params.flex
index fa4d15c..ba58a59 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params.flex
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/SRMulticast.params.flex
@@ -30,6 +30,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
index 39897d5..1802221 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRMulticast/dependencies/SRMulticastTest.py
@@ -42,7 +42,9 @@
main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
else:
translator.bmv2ToOfdpa( main )
lib.loadJson( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
index a991004..89f758c 100755
--- a/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SROnosFailure/SROnosFailure.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
index 1d057b3..557f03d 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
@@ -32,6 +32,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.flex b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.flex
index 7d2bd17..4b26f3b 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.flex
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.flex
@@ -30,6 +30,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
new file mode 100644
index 0000000..f01fbf2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params.stratum
@@ -0,0 +1,98 @@
+<PARAMS>
+ <testcases>101,102,103,104,105,106,107,108,109,201,202,203,204,205,206,207,208,209,301,302,303,304,305,306,307,308,309,601,602,603,604,605,606,620,621,622,630,640,641,642,643,651,652,653,660,661,662,663,664,665</testcases>
+
+ <GRAPH>
+ <nodeCluster>Fabric</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>7</size>
+ <max>7</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <useCommonConf>False</useCommonConf>
+ <useCommonTopo>True</useCommonTopo>
+ <useBmv2>True</useBmv2>
+ <bmv2SwitchType>stratum</bmv2SwitchType>
+ <stratumRoot>~/stratum</stratumRoot>
+ <topology>hagg_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py,trellis_fabric.py</lib>
+ <conf>bgpdbgp1.conf,bgpdbgp2.conf,bgpdr1.conf,bgpdr2.conf,dhcpd6.conf,dhcpd.conf,zebradbgp1.conf,zebradbgp2.conf</conf>
+ </DEPENDENCY>
+
+ <MN_DOCKER>
+ <args>--privileged --net host --rm -v topo:/topo -v ~/mininet/custom:/home/root/mininet/custom -v /var/run/openvswitch/:/var/run/openvswitch/ -v /tmp/mn-stratum:/tmp -v /tmp/mn_conf/:/home/root --hostname mn-stratum -v /etc/network/interfaces:/etc/network/interfaces -v /lib/modules:/lib/modules -it -d</args>
+ <name>trellis_mininet</name>
+ <home>/home/root/</home>
+ </MN_DOCKER>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,openflow,segmentrouting,fpm,dhcprelay,netcfghostprovider,routeradvertisement,t3,hostprobingprovider,drivers.bmv2,pipelines.fabric</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <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.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ <org.onosproject.p4runtime>DEBUG</org.onosproject.p4runtime>
+ <org.onosproject.protocols.p4runtime>DEBUG</org.onosproject.protocols.p4runtime>
+ <org.onosproject.drivers.p4runtime>DEBUG</org.onosproject.drivers.p4runtime>
+ <org.onosproject.protocols.grpc>DEBUG</org.onosproject.protocols.grpc>
+ <org.onosproject.protocols.gnmi>DEBUG</org.onosproject.protocols.gnmi>
+ <org.onosproject.protocols.gnoi>DEBUG</org.onosproject.protocols.gnoi>
+ <org.onosproject.drivers.gnoi>DEBUG</org.onosproject.drivers.gnoi>
+ <org.onosproject.drivers.gmni>DEBUG</org.onosproject.drivers.gmni>
+ <org.onosproject.drivers.stratum>DEBUG</org.onosproject.drivers.stratum>
+ <org.onosproject.bmv2>DEBUG</org.onosproject.bmv2>
+ </ONOS_Logging>
+
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>30</LinkDiscovery>
+ <SwitchDiscovery>45</SwitchDiscovery>
+ <OnosDiscovery>45</OnosDiscovery>
+ <loadNetcfgSleep>5</loadNetcfgSleep>
+ <startMininetSleep>25</startMininetSleep>
+ <dhcpSleep>150</dhcpSleep>
+ <balanceMasterSleep>10</balanceMasterSleep>
+ </timers>
+
+ <TOPO>
+ <internalIpv4Hosts>h1v4,h2v4,h3v4,h4v4,h5v4,h6v4,h7v4,h8v4,h9v4,h10v4,h11v4,h12v4,h13v4</internalIpv4Hosts>
+ <internalIpv6Hosts>h1v6,h2v6,h3v6,h4v6,h5v6,h6v6,h7v6,h8v6,h9v6,h10v6,h11v6,h12v6,h13v6</internalIpv6Hosts>
+ <externalIpv4Hosts>rh1v4,rh2v4</externalIpv4Hosts>
+ <externalIpv6Hosts>rh1v6,rh11v6,rh2v6,rh22v6</externalIpv6Hosts>
+ <staticIpv4Hosts>rh5v4</staticIpv4Hosts>
+ <staticIpv6Hosts>rh5v6</staticIpv6Hosts>
+ <switchNum>10</switchNum>
+ <linkNum>48</linkNum>
+ </TOPO>
+
+ <ALARM>
+ <minPassPercent>80</minPassPercent>
+ </ALARM>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
index f379896..5ca5f40 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -508,6 +508,7 @@
main.case( "Bring down all switches then recover" )
setupTest( main, test_idx=601, external=False )
main.Cluster.next().CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
totalSwitches = int( main.params[ 'TOPO' ][ 'switchNum' ] )
@@ -527,6 +528,7 @@
onpass="All switches stopped",
onfail="Failed to stop all switches" )
+ main.log.debug( "sleeping %i seconds" % float( 60 ) )
time.sleep( 60 )
lib.verifyTopology( main, 0, 0, main.Cluster.numCtrls )
# Bring up all switches
@@ -542,8 +544,10 @@
main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
lib.verifyTopology( main, totalSwitches, totalLinks, main.Cluster.numCtrls )
main.log.debug( main.Cluster.next().summary() )
+ main.log.debug( "sleeping %i seconds" % float( 60 ) )
time.sleep( 60 )
main.log.debug( main.Cluster.next().summary() )
+ main.log.debug( "sleeping %i seconds" % float( 60 ) )
time.sleep( 60 )
main.log.debug( main.Cluster.next().summary() )
verifyPing( main )
@@ -935,6 +939,7 @@
lib.restoreLinkBatch( main, linksToRemove, 48, 10 )
lib.enablePortBatch( main, portsToDisable, 10, 48 )
main.Network.discoverHosts( hostList=main.disconnectedIpv4Hosts + main.disconnectedIpv6Hosts )
+ main.log.debug( "sleeping %i seconds" % float( 10 ) )
time.sleep( 10 )
main.disconnectedIpv4Hosts = []
main.disconnectedIpv6Hosts = []
@@ -1054,6 +1059,7 @@
switches ) )
setupTest( main, test_idx=640 )
main.Cluster.next().CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
instance = main.Cluster.controllers[ nodeIndex ]
@@ -1154,6 +1160,7 @@
switches ) )
setupTest( main, test_idx=641 )
main.Cluster.next().CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
instance = main.Cluster.controllers[ nodeIndex ]
@@ -1208,6 +1215,7 @@
main.case( "Drop ONOS instance and links at the same time" )
setupTest( main, test_idx=642, onosNodes=3 )
main.Cluster.active( 0 ).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
verify( main )
portsToDisable = [ [ "of:0000000000000001", 1 ], [ "of:0000000000000103", 1 ],
@@ -1255,6 +1263,7 @@
main.case( "Drop ONOS instances and bring up links at the same time" )
setupTest( main, test_idx=643, onosNodes=3 )
main.Cluster.active( 0 ).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
verify( main )
portsToDisable = [ [ "of:0000000000000001", 1 ], [ "of:0000000000000103", 1 ],
@@ -1296,6 +1305,7 @@
main.case( "Move a single-homed host to another port in the same DAAS" )
setupTest( main, test_idx=651, onosNodes=3 )
main.Cluster.active( 0 ).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
verify( main )
# Move an untagged IPv4 host on DAAS-1
@@ -1353,6 +1363,7 @@
main.case( "Move a dual-homed host from porst 1A and 1B to ports 2A and 2B with the same MAC and IP" )
setupTest( main, test_idx=652, onosNodes=3 )
main.Cluster.active( 0 ).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
verify( main )
@@ -1406,6 +1417,7 @@
main.case( "Move a dual-homed host from porst 1A and 1B to ports 2A and 2B with the same IP and different MAC" )
setupTest( main, test_idx=653, onosNodes=3 )
main.Cluster.active( 0 ).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
verify( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index 0b13a61..2868b57 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -64,10 +64,13 @@
main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ]
if main.useBmv2:
# Translate configuration file from OVS-OFDPA to BMv2 driver
- translator.ofdpaToBmv2( main )
+ translator.bmv2ToOfdpa( main ) # Try to cleanup if switching between switch types
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
else:
translator.bmv2ToOfdpa( main )
lib.loadJson( main )
+ main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
lib.loadHost( main )
@@ -84,19 +87,22 @@
lib.loadCount( main )
if hasattr( main, 'Mininet1' ):
+ lib.mnDockerSetup( main )
# Run the test with Mininet
mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
1 if ipv4 else 0 )
if main.useBmv2:
- mininet_args += ' --switch bmv2'
- main.log.info( "Using BMv2 switch" )
+ mininet_args += ' --switch %s' % main.switchType
+ main.log.info( "Using %s switch" % main.switchType )
lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
+ main.log.debug( "Waiting %i seconds for ONOS to discover dataplane" % float( main.params[ "timers" ][ "startMininetSleep" ] ))
time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
else:
# Run the test with physical devices
lib.connectToPhysicalNetwork( 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' ] ) )
def verifyPingInternal( main, ipv4=True, ipv6=True, disconnected=True ):
@@ -240,11 +246,13 @@
# Kill node
lib.killOnos( main, [ ctrl ], switches, links, ( numCtrls - 1 ) )
main.Cluster.active(0).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % mastershipSleep )
time.sleep( mastershipSleep )
verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
# Recover node
lib.recoverOnos( main, [ ctrl ], switches, links, numCtrls )
main.Cluster.active(0).CLI.balanceMasters()
+ main.log.debug( "sleeping %i seconds" % mastershipSleep )
time.sleep( mastershipSleep )
verify( main, ipv4, ipv6, disconnected, internal, external, countFlowsGroups )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
index 541c836..a0b85f8 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRSanity/SRSanity.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
index 8e0bbbf..de88e07 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.params
@@ -28,6 +28,22 @@
<branch>master</branch>
</GIT>
+ <ONOS_Configuration>
+ </ONOS_Configuration>
+
+ <ONOS_Logging>
+ <org.onosproject.events>TRACE</org.onosproject.events>
+ <org.onosproject.segmentrouting>DEBUG</org.onosproject.segmentrouting>
+ <org.onosproject.driver>DEBUG</org.onosproject.driver>
+ <org.onosproject.net.flowobjective.impl>DEBUG</org.onosproject.net.flowobjective.impl>
+ <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>
+ <org.onosproject.mcast>DEBUG</org.onosproject.mcast>
+ </ONOS_Logging>
+
+
<CTRL>
<port>6653</port>
</CTRL>
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile b/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile
index 1843055..4b714c5 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile
@@ -1,6 +1,32 @@
FROM opennetworking/mn-stratum
-RUN install_packages python-pip openvswitch-switch
-#RUN apt-get update && apt-get install -y python-pip
+ENV HOME /home/root
+WORKDIR $HOME
+RUN ln -s /root/* .
+RUN chmod 777 $HOME
+
+RUN install_packages python-pip openvswitch-switch vim quagga isc-dhcp-server isc-dhcp-client iptables vlan
RUN pip install ipaddress
+
+RUN ln -s $HOME /var/run/quagga
+RUN ln -s /usr/sbin/zebra /usr/lib/quagga/zebra
+RUN ln -s /usr/sbin/bgpd /usr/lib/quagga/bgpd
+
+# try to ensure dhclient can write pid files
+RUN chmod 777 /run
+RUN ls -al $HOME
+# Issue with Uubuntu/Apparmour
+RUN mv /sbin/dhclient /usr/local/bin/ \
+&& touch /var/lib/dhcp/dhcpd.leases
+
+# Install custom mininet branch
+run install_packages git sudo lsb-release
+RUN git clone https://github.com/jhall11/mininet.git \
+&& cd mininet \
+&& git branch -v -a \
+&& git checkout -b dynamic_topo origin/dynamic_topo \
+&& cd util \
+&& alias sudo='' \
+&& apt-get update \
+&& ./install.sh -3fvn
ENTRYPOINT bash
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index efd8868..dd2b870 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -49,6 +49,7 @@
main.cleanAndExit()
from tests.dependencies.Network import Network
main.Network = Network()
+ main.physicalNet = False
main.testSetUp.envSetupDescription( False )
stepResult = main.FALSE
try:
@@ -63,6 +64,11 @@
main.useBmv2 = main.params[ 'DEPENDENCY' ][ 'useBmv2' ] == 'True'
else:
main.useBmv2 = False
+ if main.useBmv2:
+ main.switchType = main.params[ 'DEPENDENCY' ].get( 'bmv2SwitchType', 'stratum' )
+ else:
+ main.switchType = "ovs"
+
main.configPath = main.path + ( "/.." if main.useCommonConf else "" ) + "/dependencies/"
main.bmv2Path = "/tools/dev/mininet/"
main.forJson = "json/"
@@ -103,8 +109,16 @@
- Connect to cli
"""
# main.scale[ 0 ] determines the current number of ONOS controller
- if not main.apps:
- main.log.error( "App list is empty" )
+ try:
+ if main.params.get( 'EXTERNAL_APPS' ):
+ for app, url in main.params[ 'EXTERNAL_APPS' ].iteritems():
+ main.log.info( "Downloading %s app from %s" )
+ main.ONOSbench.onosFetchApp( url )
+ if not main.apps:
+ main.log.error( "App list is empty" )
+ except Exception as e:
+ main.log.debug( e )
+ main.cleanAndExit()
main.log.info( "Cluster size: " + str( main.Cluster.numCtrls ) )
main.log.info( "Cluster ips: " + ', '.join( main.Cluster.getIps() ) )
main.dynamicHosts = [ 'in1', 'out1' ]
@@ -135,37 +149,35 @@
if not appInstallResult:
main.cleanAndExit()
- for ctrl in main.Cluster.active():
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.segmentrouting" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.driver" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.net.flowobjective.impl" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.routeservice.impl" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.routeservice.store" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.routing.fpm" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.fpm" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.events" )
- ctrl.CLI.logSet( "DEBUG", "org.onosproject.mcast" )
+ # FIXME: move to somewhere else?
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix' )
+ # TODO: Support other pipeconfs/making this configurable
+ if switchPrefix == "tofino":
+ # It seems to take some time for the pipeconfs to be loaded
+ ctrl = main.Cluster.next()
+ for i in range( 120 ):
+ try:
+ main.log.debug( "Checking to see if pipeconfs are loaded" )
+ output = ctrl.CLI.sendline( "pipeconfs" )
+ if "tofino" in output:
+ main.log.debug( "Took around %s seconds for the pipeconf to be loaded" % i )
+ break
+ time.sleep( 1 )
+ except Exception as e:
+ main.log.error( e )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.p4runtime" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.protocols.p4runtime" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.drivers.p4runtime" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.protocols.grpc" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.protocols.gnmi" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.protocols.gnoi" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.drivers.gnoi" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.drivers.gmni" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.drivers.stratum" )
- ctrl.CLI.logSet( "TRACE", "org.onosproject.bmv2" )
+ Testcaselib.setOnosLogLevels( main )
+ Testcaselib.setOnosConfig( main )
@staticmethod
def loadCount( main ):
- with open("%s/count/%s.count" % (main.configPath, main.cfgName)) as count:
- main.count = json.load(count)
+ with open( "%s/count/%s.count" % ( main.configPath, main.cfgName ) ) as count:
+ main.count = json.load( count )
@staticmethod
- def loadJson( main ):
- with open( "%s%s.json" % ( main.configPath + main.forJson,
- main.cfgName ) ) as cfg:
+ def loadJson( main, suffix='' ):
+ with open( "%s%s.json%s" % ( main.configPath + main.forJson,
+ main.cfgName, suffix ) ) as cfg:
main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
@staticmethod
@@ -173,7 +185,7 @@
try:
with open( "%s%s.chart" % ( main.configPath + main.forChart,
main.cfgName ) ) as chart:
- main.pingChart = json.load(chart)
+ main.pingChart = json.load( chart )
except IOError:
main.log.warn( "No chart file found." )
@@ -203,6 +215,7 @@
@staticmethod
def startMininet( main, topology, args="" ):
+ main.log.info( "Copying mininet topology file to mininet machine" )
copyResult = main.ONOSbench.scp( main.Mininet1,
main.topoPath + main.topology,
main.Mininet1.home + "custom",
@@ -217,6 +230,22 @@
import re
controllerIPs = [ ctrl.ipAddress for ctrl in main.Cluster.runningNodes ]
index = 0
+ destDir = "~/"
+ if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
+ destDir = "/tmp/mn_conf/"
+ # Try to ensure the destination exists
+ main.log.info( "Create folder for network config files" )
+ handle = main.Mininet1.handle
+ handle.sendline( "mkdir -p %s" % destDir )
+ handle.expect( [ main.Mininet1.prompt, main.Mininet1.dockerPrompt ] )
+ main.log.debug( handle.before + handle.after )
+ # Make sure permissions are correct
+ handle.sendline( "sudo chown %s:%s %s" % ( main.Mininet1.user_name, main.Mininet1.user_name, destDir ) )
+ handle.expect( [ main.Mininet1.prompt, main.Mininet1.dockerPrompt ] )
+ main.log.debug( handle.before + handle.after )
+ handle.sendline( "sudo chmod -R a+rwx %s" % ( destDir ) )
+ handle.expect( [ main.Mininet1.prompt, main.Mininet1.dockerPrompt ] )
+ main.log.debug( handle.before + handle.after )
for conf in main.topologyConf.split(","):
# Update zebra configurations with correct ONOS instance IP
if conf in [ "zebradbgp1.conf", "zebradbgp2.conf" ]:
@@ -229,7 +258,7 @@
f.write( s )
copyResult = copyResult and main.ONOSbench.scp( main.Mininet1,
main.configPath + main.forConfig + conf,
- "~/",
+ destDir,
direction="to" )
copyResult = copyResult and main.ONOSbench.scp( main.Mininet1,
main.ONOSbench.home + main.bmv2Path + main.bmv2,
@@ -246,8 +275,6 @@
main.step( "Starting Mininet Topology" )
arg = "--onos-ip=%s %s" % (",".join([ctrl.ipAddress for ctrl in main.Cluster.runningNodes]), args)
main.topology = topology
- #switchType = " --switch=stratum"
- #arg += switchType
topoResult = main.Mininet1.startNet(
topoFile=main.Mininet1.home + "custom/" + main.topology, args=arg )
stepResult = topoResult
@@ -258,25 +285,73 @@
# Exit if topology did not load properly
if not topoResult:
main.cleanAndExit()
+ if main.useBmv2:
+ # Upload the net-cfg file created for each switch
+ filename = "onos-netcfg.json"
+ switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
+ for switch in main.Mininet1.getSwitches( switchRegex=r"(StratumBmv2Switch)|(Bmv2Switch)" ).keys():
+ path = "/tmp/mn-stratum/%s/" % switch
+ dstPath = "/tmp/"
+ dstFileName = "%s-onos-netcfg.json" % switch
+ main.ONOSbench1.scp( main.Mininet1,
+ "%s%s" % ( path, filename ),
+ "%s%s" % ( dstPath, dstFileName ),
+ "from" )
+ main.ONOSbench1.handle.sendline( "sudo sed -i 's/localhost/%s/g' %s%s" % ( main.Mininet1.ip_address, dstPath, dstFileName ) )
+ # Configure managementAddress
+ main.ONOSbench1.handle.sendline( "sudo sed -i 's/localhost/%s/g' %s%s" % ( main.Mininet1.ip_address, dstPath, dstFileName ) )
+ main.ONOSbench1.handle.expect( main.ONOSbench1.prompt )
+ main.log.debug( main.ONOSbench1.handle.before + main.ONOSbench1.handle.after )
+ # Configure device id
+ main.ONOSbench1.handle.sendline( "sudo sed -i 's/device:%s/device:%s:%s/g' %s%s" % ( switch, switchPrefix, switch, dstPath, dstFileName ) )
+ main.ONOSbench1.handle.expect( main.ONOSbench1.prompt )
+ main.log.debug( main.ONOSbench1.handle.before + main.ONOSbench1.handle.after )
+ # Configure device name
+ main.ONOSbench1.handle.sendline( "sudo sed -i '/\"basic\"/a\ \"name\": \"%s\",' %s%s" % ( switch, dstPath, dstFileName ) )
+ main.ONOSbench1.handle.expect( main.ONOSbench1.prompt )
+ main.log.debug( main.ONOSbench1.handle.before + main.ONOSbench1.handle.after )
+ main.ONOSbench1.onosNetCfg( main.ONOSserver1.ip_address, dstPath, dstFileName )
+ # Make sure hosts make some noise
+ Testcaselib.discoverHosts( main )
+
+ @staticmethod
+ def discoverHosts( main ):
+ # TODO add option to only select specific hosts
+ if hasattr( main, "Mininet1" ):
+ network = main.Mininet1
+ elif hasattr( main, "NetworkBench" ):
+ network = main.NetworkBench
+ else:
+ main.log.warn( "Could not find component for test network, skipping host discovery" )
+ return
+ network.discoverHosts()
@staticmethod
def connectToPhysicalNetwork( main ):
main.step( "Connecting to physical netowrk" )
+ main.physicalNet = True
topoResult = main.NetworkBench.connectToNet()
stepResult = topoResult
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="Successfully loaded topology",
- onfail="Failed to load topology" )
+ onpass="Successfully connected to topology",
+ onfail="Failed to connect to topology" )
# Exit if topology did not load properly
if not topoResult:
main.cleanAndExit()
+ # Perform any optional setup
+ for switch in main.NetworkBench.switches:
+ if hasattr( switch, "setup" ):
+ switch.setup() # We might not need this
+
main.step( "Assign switches to controllers." )
- assignResult = main.TRUE
+ stepResult = main.TRUE
switches = main.NetworkBench.getSwitches()
pool = []
for name in switches.keys():
+ # NOTE: although this terminology is ovsdb centric, we can use this function for other switches too
+ # e.g. push onos net-cfg for stratum switches
thread = main.Thread( target=main.NetworkBench.assignSwController,
name="assignSwitchToController",
args=[ name, main.Cluster.getIps(), '6653' ] )
@@ -293,7 +368,6 @@
# Check devices
Testcaselib.checkDevices( main, switches=int( main.params[ 'TOPO' ][ 'switchNum' ] ) )
- time.sleep( float( main.params[ "timers" ][ "connectToNetSleep" ] ) )
# Connecting to hosts that only have data plane connectivity
main.step( "Connecting inband hosts" )
stepResult = main.Network.connectInbandHosts()
@@ -301,6 +375,7 @@
actual=stepResult,
onpass="Successfully connected inband hosts",
onfail="Failed to connect inband hosts" )
+ Testcaselib.discoverHosts( main )
@staticmethod
def saveOnosDiagnostics( main ):
@@ -408,8 +483,8 @@
utilities.assertEquals(
expect=True,
actual=( count > minFlowCount ),
- onpass="Flow count looks correct: " + str( count ),
- onfail="Flow count looks wrong: " + str( count ) )
+ onpass="Flow count looks correct; found %s, expecting at least %s" % ( count, minFlowCount ),
+ onfail="Flow count looks wrong; found %s, expecting at least %s" % ( count, minFlowCount ) )
main.step( "Check whether all flow status are ADDED" )
flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -450,7 +525,7 @@
@staticmethod
def checkFlowsByDpid( main, dpid, minFlowCount, sleep=10 ):
main.step(
- " Check whether the flow count of device %s is bigger than %s" % ( dpid, minFlowCount ) )
+ "Check whether the flow count of device %s is bigger than %s" % ( dpid, minFlowCount ) )
count = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowAddedCount,
main.FALSE,
args=( dpid, minFlowCount ),
@@ -467,7 +542,7 @@
@staticmethod
def checkFlowEqualityByDpid( main, dpid, flowCount, sleep=10 ):
main.step(
- " Check whether the flow count of device %s is equal to %s" % ( dpid, flowCount ) )
+ "Check whether the flow count of device %s is equal to %s" % ( dpid, flowCount ) )
count = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowAddedCount,
main.FALSE,
args=( dpid, flowCount, False, 1 ),
@@ -484,7 +559,7 @@
@staticmethod
def checkGroupEqualityByDpid( main, dpid, groupCount, sleep=10):
main.step(
- " Check whether the group count of device %s is equal to %s" % ( dpid, groupCount ) )
+ "Check whether the group count of device %s is equal to %s" % ( dpid, groupCount ) )
count = utilities.retry( main.Cluster.active( 0 ).CLI.checkGroupAddedCount,
main.FALSE,
args=( dpid, groupCount, False, 1),
@@ -547,6 +622,12 @@
utilities.assert_equals( expect=expect, actual=pa,
onpass="IPv6 connectivity successfully tested",
onfail="IPv6 connectivity failed" )
+ elif main.physicalNet:
+ pa = main.NetworkBench.pingallHostsUnidirectional( src, dst, acceptableFailed=acceptableFailed, useScapy=True )
+ utilities.assert_equals( expect=expect, actual=pa,
+ onpass="IP connectivity successfully tested",
+ onfail="IP connectivity failed" )
+
else:
pa = main.Network.pingallHostsUnidirectional( src, dst, acceptableFailed=acceptableFailed )
utilities.assert_equals( expect=expect, actual=pa,
@@ -564,7 +645,8 @@
if ("v4" in hosts[0]):
pa = utilities.retry( main.Network.pingallHosts,
main.FALSE if expect else main.TRUE,
- args=(hosts,),
+ args=(hosts, ),
+ kwargs={ 'ipv6': False },
attempts=retryAttempts,
sleep=sleep )
utilities.assert_equals( expect=expect, actual=pa,
@@ -575,13 +657,19 @@
utilities.assert_equals( expect=expect, actual=pa,
onpass="IPv6 connectivity successfully tested",
onfail="IPv6 connectivity failed" )
+ elif main.physicalNet:
+ pa = main.Network.pingallHosts( hosts, ipv6=True, useScapy=True )
+ utilities.assert_equals( expect=expect, actual=pa,
+ onpass="IP connectivity successfully tested",
+ onfail="IP connectivity failed" )
else:
pa = main.Network.pingallHosts( hosts )
utilities.assert_equals( expect=expect, actual=pa,
onpass="IP connectivity successfully tested",
onfail="IP connectivity failed" )
- if skipOnFail and pa != expect:
+ if pa != expect:
Testcaselib.saveOnosDiagnostics( main )
+ if skipOnFail and pa != expect:
Testcaselib.cleanup( main, copyKarafLog=False )
main.skipCase()
@@ -764,6 +852,8 @@
if portUp:
ctrl.CLI.portstate( dpid=dpid1, port=port1, state='Enable' )
ctrl.CLI.portstate( dpid=dpid2, port=port2, state='Enable' )
+ main.log.info(
+ "Waiting %s seconds for link up to be discovered" % sleep )
time.sleep( sleep )
result = ctrl.CLI.checkStatus( numoswitch=switches,
@@ -919,6 +1009,7 @@
for ctrl in main.Cluster.active():
main.ONOSbench.onosStop( ctrl.ipAddress )
+ Testcaselib.mnDockerTeardown( main )
@staticmethod
def verifyNodes( main ):
@@ -985,6 +1076,7 @@
onfail="Error killing ONOS instance" )
main.Cluster.runningNodes[ i ].active = False
main.Cluster.reset()
+ main.log.debug( "sleeping %i seconds" % ( sleep ) )
time.sleep( sleep )
if len( nodes ) < main.Cluster.numCtrls:
@@ -1004,6 +1096,7 @@
else:
sleep = float( sleep )
[ main.ONOSbench.onosStart( main.Cluster.runningNodes[ i ].ipAddress ) for i in nodes ]
+ main.log.debug( "sleeping %i seconds" % ( sleep ) )
time.sleep( sleep )
for i in nodes:
isUp = main.ONOSbench.isup( main.Cluster.runningNodes[ i ].ipAddress )
@@ -1135,7 +1228,7 @@
main.FALSE,
kwargs={ 'hostList': [ hostName ],
'prefix': ip,
- 'update': False },
+ 'update': True },
attempts=attempts,
sleep=sleep )
utilities.assert_equals( expect=main.TRUE, actual=ipResult,
@@ -1224,7 +1317,16 @@
mininetName = mininetNames[ scapyNames.index( scapyName ) ]
else:
mininetName = None
- scapyHandle.startHostCli( mininetName )
+ if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
+ scapyHandle.mExecDir = "/tmp"
+ scapyHandle.hostHome = main.params[ "MN_DOCKER" ][ "home" ]
+ main.log.debug( "start mn host component in docker" )
+ scapyHandle.startHostCli( mininetName,
+ execDir="/tmp",
+ hostHome=main.params[ "MN_DOCKER" ][ "home" ] )
+ else:
+ main.log.debug( "start mn host component" )
+ scapyHandle.startHostCli( mininetName )
else:
main.Network.createHostComponent( scapyName )
scapyHandle = getattr( main, scapyName )
@@ -1416,6 +1518,7 @@
main.Cluster.active( 0 ).REST.setNetCfg( json.loads( cfg ),
subjectClass="ports" )
# Wait for the host to get RA for setting up default gateway
+ main.log.debug( "sleeping %i seconds" % ( 5 ) )
time.sleep( 5 )
main.Mininet1.discoverHosts( [ hostName, ] )
@@ -1466,6 +1569,7 @@
main.Cluster.active( 0 ).REST.setNetCfg( json.loads( cfg ),
subjectClass="ports" )
# Wait for the host to get RA for setting up default gateway
+ main.log.debug( "sleeping %i seconds" % ( 5 ) )
time.sleep( 5 )
main.Mininet1.discoverHosts( [ hostName, ] )
@@ -1479,3 +1583,114 @@
vlan = hostName.split( "/" )[ -1 ]
del main.expectedHosts[ "onos" ][ hostName ]
main.expectedHosts[ "onos" ][ "{}/{}".format( macAddr.upper(), vlan ) ] = ip
+
+ @staticmethod
+ def mnDockerSetup( main ):
+ """
+ Optionally start and setup docker image for mininet
+ """
+ if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
+
+ main.log.info( "Creating Mininet Docker" )
+ handle = main.Mininet1.handle
+ main.Mininet1.dockerPrompt = '#'
+
+ confDir = "/tmp/mn_conf/"
+ # Try to ensure the destination exists
+ main.log.info( "Create folder for network config files" )
+ handle.sendline( "mkdir -p %s" % confDir )
+ handle.expect( main.Mininet1.prompt )
+ main.log.debug( handle.before + handle.after )
+ # Make sure permissions are correct
+ handle.sendline( "sudo chown %s:%s %s" % ( main.Mininet1.user_name, main.Mininet1.user_name, confDir ) )
+ handle.sendline( "sudo chmod -R a+rwx %s" % ( confDir ) )
+ handle.expect( main.Mininet1.prompt )
+ main.log.debug( handle.before + handle.after )
+ # Start docker container
+ handle.sendline( "docker run --name trellis_mininet %s %s" % ( main.params[ 'MN_DOCKER' ][ 'args' ], main.params[ 'MN_DOCKER' ][ 'name' ] ) )
+ handle.expect( main.Mininet1.bashPrompt )
+ output = handle.before + handle.after
+ main.log.debug( repr(output) )
+
+ handle.sendline( "docker attach trellis_mininet" )
+ handle.expect( main.Mininet1.dockerPrompt )
+ main.log.debug( handle.before + handle.after )
+ handle.sendline( "sysctl -w net.ipv4.ip_forward=0" )
+ handle.sendline( "sysctl -w net.ipv4.conf.all.forwarding=0" )
+ handle.expect( main.Mininet1.dockerPrompt )
+ main.log.debug( handle.before + handle.after )
+ # We should be good to go
+ main.Mininet1.prompt = main.Mininet1.dockerPrompt
+ main.Mininet1.sudoRequired = False
+
+ # Fow when we create component handles
+ main.Mininet1.mExecDir = "/tmp"
+ main.Mininet1.hostHome = main.params[ "MN_DOCKER" ][ "home" ]
+ main.Mininet1.hostPrompt = "/home/root#"
+
+ @staticmethod
+ def mnDockerTeardown( main ):
+ """
+ Optionally stop and cleanup docker image for mininet
+ """
+
+ if hasattr( main, 'Mininet1' ):
+ if 'MN_DOCKER' in main.params and main.params['MN_DOCKER']['args']:
+ main.log.info( "Deleting Mininet Docker" )
+
+ # Detach from container
+ handle = main.Mininet1.handle
+ try:
+ handle.sendline( "exit" ) # ctrl-p ctrk-q to detach from container
+ main.log.debug( "sleeping %i seconds" % ( 5 ) )
+ time.sleep(5)
+ handle.expect( main.Mininet1.dockerPrompt )
+ main.log.debug( handle.before + handle.after )
+ main.Mininet1.prompt = main.Mininet1.bashPrompt
+ handle.expect( main.Mininet1.prompt )
+ main.log.debug( handle.before + handle.after )
+ main.Mininet1.sudoRequired = True
+ except Exception as e:
+ main.log.error( e )
+
+ @staticmethod
+ def setOnosConfig( main ):
+ """
+ Read and Set onos configurations from the params file
+ """
+ main.step( "Set ONOS configurations" )
+ config = main.params.get( 'ONOS_Configuration' )
+ if config:
+ main.log.debug( config )
+ checkResult = main.TRUE
+ for component in config:
+ for setting in config[ component ]:
+ value = config[ component ][ setting ]
+ check = main.Cluster.next().setCfg( component, setting, value )
+ main.log.info( "Value was changed? {}".format( main.TRUE == check ) )
+ checkResult = check and checkResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=checkResult,
+ onpass="Successfully set config",
+ onfail="Failed to set config" )
+ else:
+ main.log.warn( "No configurations were specified to be changed after startup" )
+
+ @staticmethod
+ def setOnosLogLevels( main ):
+ """
+ Read and Set onos log levels from the params file
+ """
+ main.step( 'Set logging levels' )
+ logging = True
+ try:
+ logs = main.params.get( 'ONOS_Logging', False )
+ if logs:
+ for namespace, level in logs.items():
+ for ctrl in main.Cluster.active():
+ ctrl.CLI.logSet( level, namespace )
+ except AttributeError:
+ logging = False
+ utilities.assert_equals( expect=True, actual=logging,
+ onpass="Set log levels",
+ onfail="Failed to set log levels" )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/cfgtranslator.py b/TestON/tests/USECASE/SegmentRouting/dependencies/cfgtranslator.py
index f38603e..5e95efe 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/cfgtranslator.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/cfgtranslator.py
@@ -28,6 +28,7 @@
# Translate configuration JSON file from BMv2 driver to OFDPA-OVS driver.
def bmv2ToOfdpa( main, cfgFile="" ):
+ didRE = r"device:(?P<swType>bmv2|tofino):(?P<swRole>leaf|spine)(?P<swNum>[1-9][0-9]*)(/(?P<portNum>[0-9]+))?"
if not cfgFile:
cfgFile = "%s%s.json" % ( main.configPath + main.forJson,
main.cfgName )
@@ -36,9 +37,9 @@
if 'ports' in netcfg.keys():
for port in netcfg[ 'ports' ].keys():
- searchObj = re.search( "device:bmv2:leaf([1-9][0-9]*)/([0-9]+)", port )
+ searchObj = re.search( didRE, port )
if searchObj:
- new_port = 'of:' + searchObj.group( 1 ).zfill( 16 ) + '/' + searchObj.group( 2 )
+ new_port = 'of:' + searchObj.group( 'swNum' ).zfill( 16 ) + '/' + searchObj.group( 'portNum' )
netcfg[ 'ports' ][ new_port ] = netcfg[ 'ports' ].pop( port )
if 'hosts' in netcfg.keys():
@@ -46,32 +47,31 @@
if type( hostCfg[ 'basic' ][ 'locations' ] ) is list:
new_locations = []
for location in hostCfg[ 'basic' ][ 'locations' ]:
- searchObj = re.search( "device:bmv2:leaf([1-9][0-9]*)/([0-9]+)", location )
+ searchObj = re.search( didRE, location )
if searchObj:
- new_locations.append( 'of:' + searchObj.group( 1 ).zfill( 16 ) + '/' + searchObj.group( 2 ) )
+ new_locations.append( 'of:' + searchObj.group( 'swNum' ).zfill( 16 ) + '/' + searchObj.group( 'portNum' ) )
else:
new_locations.append( location )
netcfg[ 'hosts' ][ host ][ 'basic' ][ 'locations' ] = new_locations
else:
location = hostCfg[ 'basic' ][ 'locations' ]
- searchObj = re.search( "device:bmv2:leaf([1-9][0-9]*)/([0-9]+)", location )
+ searchObj = re.search( didRE, location )
if searchObj:
- new_location = 'of:' + searchObj.group( 1 ).zfill( 16 ) + '/' + searchObj.group( 2 )
+ new_location = 'of:' + searchObj.group( 'swNum' ).zfill( 16 ) + '/' + searchObj.group( 'portNum' )
netcfg[ 'hosts' ][ host ][ 'basic' ][ 'locations' ] = new_location
if 'devices' in netcfg.keys():
for device in netcfg[ 'devices' ].keys():
- searchObj = re.search( "device:bmv2:(leaf|spine)([1-9][0-9]*)", device )
+ searchObj = re.search( didRE, device )
new_device = device
if searchObj:
- new_device = 'of:' + searchObj.group( 2 ).zfill( 16 )
+ new_device = 'of:' + searchObj.group( 'swNum' ).zfill( 16 )
netcfg[ 'devices' ][ new_device ] = netcfg[ 'devices' ].pop( device )
if 'pairDeviceId' in netcfg[ 'devices' ][ new_device ][ SR_APP ].keys():
- searchObj = re.search( "device:bmv2:leaf([1-9][0-9]*)",
- netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ])
+ searchObj = re.search( didRE, netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ])
if searchObj:
netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ] = 'of:' + \
- searchObj.group( 1 ).zfill( 16 )
+ searchObj.group( 'swNum' ).zfill( 16 )
if 'basic' in netcfg[ 'devices' ][ new_device ].keys():
netcfg[ 'devices' ][ new_device ][ 'basic' ].update( { 'driver': 'ofdpa-ovs' } )
@@ -79,17 +79,18 @@
if DHCP_APP_ID in netcfg[ 'apps' ].keys():
for i, dhcpcfg in enumerate( netcfg[ 'apps' ][ DHCP_APP_ID ][ 'default' ] ):
if 'dhcpServerConnectPoint' in dhcpcfg.keys():
- searchObj = re.search( "device:bmv2:leaf([1-9][0-9]*)/([0-9]+)",
- dhcpcfg[ 'dhcpServerConnectPoint' ] )
+ searchObj = re.search( didRE, dhcpcfg[ 'dhcpServerConnectPoint' ] )
if searchObj:
netcfg[ 'apps' ][ DHCP_APP_ID ][ 'default' ][ i ][ 'dhcpServerConnectPoint' ] = \
- 'of:' + searchObj.group( 1 ).zfill(16) + '/' + searchObj.group( 2 )
+ 'of:' + searchObj.group( 'swNum' ).zfill(16) + '/' + searchObj.group( 'portNum' )
with open( cfgFile, 'w' ) as cfg:
- cfg.write( json.dumps( netcfg, indent=4, separators=( ',', ':' ) ) )
+ cfg.write( json.dumps( netcfg, indent=4, separators=( ',', ':' ), sort_keys=True ) )
# Translate configuration JSON file from OFDPA-OVS driver to BMv2 driver.
-def ofdpaToBmv2( main, cfgFile="" ):
+def ofdpaToBmv2( main, switchPrefix="bmv2", cfgFile="" ):
+ didRE= r"device:(?P<swType>bmv2|tofino):(?P<swRole>leaf|spine)(?P<swNum>[1-9][0-9]*)(/(?P<portNum>[0-9]+))?"
+ didRE = r"of:0*(?P<swNum>[1-9][0-9]*)(/(?P<portNum>[0-9]+))?"
if not cfgFile:
cfgFile = "%s%s.json" % ( main.configPath + main.forJson,
main.cfgName )
@@ -98,9 +99,9 @@
if 'ports' in netcfg.keys():
for port in netcfg[ 'ports' ].keys():
- searchObj = re.search( "of:0*([1-9][0-9]*)/([0-9]+)", port )
+ searchObj = re.search( didRE, port )
if searchObj:
- new_port = 'device:bmv2:leaf' + searchObj.group( 1 ) + '/' + searchObj.group( 2 )
+ new_port = 'device:' + switchPrefix + ':leaf' + searchObj.group( 'swNum' ) + '/' + searchObj.group( 'portNum' )
netcfg[ 'ports' ][ new_port ] = netcfg[ 'ports' ].pop( port )
if 'hosts' in netcfg.keys():
@@ -108,36 +109,36 @@
if type( hostCfg[ 'basic' ][ 'locations' ] ) is list:
new_locations = []
for location in hostCfg[ 'basic' ][ 'locations' ]:
- searchObj = re.search( "of:0*([1-9][0-9]*)/([0-9]+)", location )
+ searchObj = re.search( didRE, location )
if searchObj:
- new_locations.append( 'device:bmv2:leaf' + searchObj.group( 1 ) + '/' + searchObj.group( 2 ) )
+ new_locations.append( 'device:' + switchPrefix + ':leaf' + searchObj.group( 'swNum' ) + '/' + searchObj.group( 'portNum' ) )
else:
new_locations.append( location )
netcfg[ 'hosts' ][ host ][ 'basic' ][ 'locations' ] = new_locations
else:
location = hostCfg[ 'basic' ][ 'locations' ]
- searchObj = re.search( "of:0*([1-9][0-9]*)/([0-9]+)", location )
+ searchObj = re.search( didRE, location )
if searchObj:
- new_location = 'device:bmv2:leaf' + searchObj.group( 1 ) + '/' + searchObj.group( 2 )
+ new_location = 'device:' + switchPrefix + ':leaf' + searchObj.group( 'swNum' ) + '/' + searchObj.group( 'portNum' )
netcfg[ 'hosts' ][ host ][ 'basic' ][ 'locations' ] = new_location
if 'devices' in netcfg.keys():
for device in netcfg[ 'devices' ].keys():
- searchObj = re.search( "of:0*([1-9][0-9]*)", device )
+ searchObj = re.search( didRE, device )
new_device = device
if searchObj:
isLeaf = netcfg[ 'devices' ][ device ][ SR_APP ][ 'isEdgeRouter' ]
if isLeaf is True:
- new_device = 'device:bmv2:leaf' + searchObj.group( 1 )
+ new_device = 'device:' + switchPrefix + ':leaf' + searchObj.group( 'swNum' )
else:
- new_device = 'device:bmv2:spine' + searchObj.group( 1 )
+ new_device = 'device:' + switchPrefix + ':spine' + searchObj.group( 'swNum' )
netcfg[ 'devices' ][ new_device ] = netcfg[ 'devices' ].pop( device )
if 'pairDeviceId' in netcfg[ 'devices' ][ new_device ][ SR_APP ].keys():
- searchObj = re.search( "of:0*([1-9][0-9]*)",
+ searchObj = re.search( didRE,
netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ])
if searchObj:
- netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ] = 'device:bmv2:leaf' + \
- searchObj.group( 1 )
+ netcfg[ 'devices' ][ new_device ][ SR_APP ][ 'pairDeviceId' ] = 'device:' + switchPrefix + ':leaf' + \
+ searchObj.group( 'swNum' )
if 'basic' in netcfg[ 'devices' ][ new_device ].keys():
if 'driver' in netcfg[ 'devices' ][ new_device ][ 'basic' ].keys():
del netcfg[ 'devices' ][ new_device ][ 'basic' ][ 'driver' ]
@@ -146,11 +147,11 @@
if DHCP_APP_ID in netcfg[ 'apps' ].keys():
for i, dhcpcfg in enumerate( netcfg[ 'apps' ][ DHCP_APP_ID ][ 'default' ] ):
if 'dhcpServerConnectPoint' in dhcpcfg.keys():
- searchObj = re.search( "of:0*([1-9][0-9]*)/([0-9]+)",
+ searchObj = re.search( didRE,
dhcpcfg[ 'dhcpServerConnectPoint' ] )
if searchObj:
netcfg[ 'apps' ][ DHCP_APP_ID ][ 'default' ][ i ][ 'dhcpServerConnectPoint' ] = \
- 'device:bmv2:leaf' + searchObj.group( 1 ) + '/' + searchObj.group( 2 )
+ 'device:' + switchPrefix + ':leaf' + searchObj.group( 'swNum' ) + '/' + searchObj.group( 'portNum' )
with open( cfgFile, 'w' ) as cfg:
- cfg.write( json.dumps( netcfg, indent=4, separators=( ',', ':' ) ) )
+ cfg.write( json.dumps( netcfg, indent=4, separators=( ',', ':' ), sort_keys=True ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/hagg_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/hagg_fabric.py
index 814b6fb..6e5626e 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/hagg_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/hagg_fabric.py
@@ -15,6 +15,7 @@
from trellislib import DhcpServer, TaggedRoutedHost, DualHomedRoutedHost, DualHomedTaggedRoutedHost, DhcpClient, Dhcp6Client, DhcpServer, Dhcp6Server, TrellisHost
from bmv2 import ONOSBmv2Switch
+from stratum import StratumBmv2Switch
# Parse command line options and dump results
def parseOptions():
@@ -31,7 +32,7 @@
parser.add_option( '--onos-ip', dest='onosIp', type='str', default='',
help='IP address list of ONOS instances, separated by comma(,). Overrides --onos option' )
parser.add_option( '--switch', dest='switch', type='str', default='ovs',
- help='Switch type: ovs, bmv2 (with fabric.p4)' )
+ help='Switch type: ovs, bmv2 (with fabric.p4), stratum' )
( options, args ) = parser.parse_args()
return options, args
@@ -42,7 +43,8 @@
SWITCH_TO_PARAMS_DICT = {
"ovs": dict(cls=OVSSwitch),
- "bmv2": dict(cls=ONOSBmv2Switch, pipeconf=FABRIC_PIPECONF)
+ "bmv2": dict(cls=ONOSBmv2Switch, pipeconf=FABRIC_PIPECONF),
+ "stratum": dict(cls=StratumBmv2Switch, pipeconf=FABRIC_PIPECONF, loglevel='debug')
}
if opts.switch not in SWITCH_TO_PARAMS_DICT:
raise Exception("Unknown switch type '%s'" % opts.switch)
@@ -261,7 +263,7 @@
dpid = "00000000000%s" % (ls + 1),
**SWITCH_PARAMS )
- # connecting leaf and spines, leafs 1-5 have double links
+ # connecting leafs 2-5 and spines 101 and 102 with double links
for s in range(2):
spine_switch = self.spines[s]
@@ -275,7 +277,7 @@
self.addLink(self.leafs[1], self.leafs[2], **linkopts)
self.addLink(self.leafs[3], self.leafs[4], **linkopts)
- # build second fabric with single links
+ # build second fabric with single links, spines 103 and 104 and leafs 1 and 6
for s in range(2, 4):
spine_switch = self.spines[s]
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
index 8668f83..7556d58 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
@@ -365,7 +365,7 @@
self.addLink(r1, rh1)
# External IPv6 Host behind r1
- rh1v6 = self.addHost('rh1v6', cls=TrellisHost, ips=['2000::9902/120'], gateway='2000::9901')
+ rh1v6 = self.addHost('rh1v6', cls=TrellisHost, ips=['2000::9902/120'], gateway='2000::9901', ipv6=True )
self.addLink(r1, rh1v6)
# DHCP server
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
index ebf6910..e02df4c 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellislib.py
@@ -9,6 +9,7 @@
sys.path.append('..')
from mininet.node import Host
from routinglib import RoutedHost, RoutedHost6, Router
+from stratum import NoOffloadHost
class TaggedRoutedHost(RoutedHost):
"""Host that can be configured with multiple IP addresses."""
@@ -24,6 +25,7 @@
intf = self.defaultIntf()
self.vlanIntf = "%s.%s" % (intf, self.vlan)
self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('ip link add link %s name %s type vlan id %s' % (intf, self.vlanIntf, self.vlan))
self.cmd('ip link set up %s' % self.vlanIntf)
@@ -38,7 +40,7 @@
self.cmd('ip link remove link %s' % self.vlanIntf)
super(TaggedRoutedHost, self).terminate()
-class DualHomedRoutedHost(Host):
+class DualHomedRoutedHost(NoOffloadHost):
def __init__(self, name, ips, gateway, *args, **kwargs):
super(DualHomedRoutedHost, self).__init__(name, **kwargs)
self.bond0 = None
@@ -72,6 +74,7 @@
self.cmd('ip link set %s master %s' % (intf2.name, self.bond0))
self.cmd('ip addr flush dev %s' % intf1.name)
self.cmd('ip addr flush dev %s' % intf2.name)
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('ip link set %s up' % self.bond0)
# NOTE: Issues with bonded intfs in mn data structures. Either only show bonded intf
# or create a custom class to handle bonded infs??
@@ -100,6 +103,7 @@
default_intf = self.defaultIntf()
self.vlanIntf = "%s.%s" % (default_intf, self.vlan)
self.cmd('ip -4 addr flush dev %s' % default_intf)
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('ip link add link %s name %s type vlan id %s' % (default_intf, self.vlanIntf, self.vlan))
self.cmd('ip link set up %s' % self.vlanIntf)
@@ -123,6 +127,7 @@
def config(self, **kwargs):
super(DhcpClient, self).config(**kwargs)
self.cmd('ip addr flush dev %s' % self.defaultIntf())
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('dhclient -q -4 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
def terminate(self, **kwargs):
@@ -139,6 +144,7 @@
def config(self, **kwargs):
super(Dhcp6Client, self).config(**kwargs)
self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('dhclient -q -6 -nw -pf %s -lf %s %s' % (self.pidFile, self.leaseFile, self.defaultIntf()))
def terminate(self, **kwargs):
@@ -214,6 +220,7 @@
super(TaggedDhcpClient, self).config(**kwargs)
self.vlanIntf = "%s.%s" % (self.defaultIntf(), self.vlan)
self.cmd('ip addr flush dev %s' % self.defaultIntf())
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('ip link add link %s name %s type vlan id %s' % (self.defaultIntf(), self.vlanIntf, self.vlan))
self.cmd('ip link set up %s' % self.vlanIntf)
self.cmd('dhclient -q -4 -nw -pf %s %s' % (self.pidFile, self.vlanIntf))
@@ -267,6 +274,7 @@
self.cmd('ip link set %s master %s' % (intf2.name, self.bond0))
self.cmd('ip addr flush dev %s' % intf1.name)
self.cmd('ip addr flush dev %s' % intf2.name)
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
self.cmd('ip link set %s up' % self.bond0)
# NOTE: Issues with bonded intfs in mn data structures. Either only show bonded intf
# or create a custom class to handle bonded infs??
@@ -284,7 +292,7 @@
self.cmd('rm -rf %s' % self.pidFile)
super(DualHomedDhcpClient, self).terminate()
-class TrellisHost(Host):
+class TrellisHost(NoOffloadHost):
def __init__(self, name, ips=[], gateway="", dualHomed=False, vlan=None, dhcpClient=False, dhcpServer=False, ipv6=False, *args, **kwargs):
super(TrellisHost, self).__init__(name, *args, **kwargs)
self.dualHomed = dualHomed
@@ -313,6 +321,10 @@
self.bondIntfs( self.intfs[0], self.intfs[1] )
self.cmd('ip %s addr flush dev %s' % ("-4" if self.ipv6 else "", self.defaultIntf()))
+ self.cmd('sysctl -w net.ipv4.ip_forward=0')
+
+ if not self.ipv6:
+ self.cmd('sysctl -w net.ipv6.conf.all.disable_ipv6=1')
if self.vlan:
# Setup vlan interface