Add Stratum-bmv2 to Trellis SRBridging
TODO:
- Refactor so that we can use with other SR Tests
- Add creating docker image
Change-Id: Ib44418579e6f0eb4a862c36077459ed4dd389f8e
(cherry picked from commit 9bc3fb67167255b8962f4c1e4dc05d7fac10656b)
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile b/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile
new file mode 100644
index 0000000..1843055
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Dockerfile
@@ -0,0 +1,6 @@
+FROM opennetworking/mn-stratum
+
+RUN install_packages python-pip openvswitch-switch
+#RUN apt-get update && apt-get install -y python-pip
+RUN pip install ipaddress
+ENTRYPOINT bash
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 22988d8..efd8868 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -76,6 +76,7 @@
main.topologyLib = main.params[ 'DEPENDENCY' ][ 'lib' ] if 'lib' in main.params[ 'DEPENDENCY' ] else None
main.topologyConf = main.params[ 'DEPENDENCY' ][ 'conf' ] if 'conf' in main.params[ 'DEPENDENCY' ] else None
main.bmv2 = "bmv2.py"
+ main.stratumRoot = main.params[ 'DEPENDENCY'][ 'stratumRoot'] if 'stratumRoot' in main.params[ 'DEPENDENCY' ] else None
main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
main.trellisOar = main.params[ 'DEPENDENCY' ][ 'trellisOar' ]
@@ -141,9 +142,21 @@
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" )
+ 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" )
+
@staticmethod
def loadCount( main ):
with open("%s/count/%s.count" % (main.configPath, main.cfgName)) as count:
@@ -227,9 +240,14 @@
actual=stepResult,
onpass="Successfully copied topo files",
onfail="Failed to copy topo files" )
+ if main.stratumRoot:
+ main.Mininet1.handle.sendline( "export STRATUM_ROOT=" + str( main.stratumRoot ) )
+ main.Mininet1.handle.expect( main.Mininet1.prompt )
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
@@ -865,6 +883,8 @@
"""
from tests.dependencies.utils import Utils
main.utils = Utils()
+ for ctrl in main.Cluster.active():
+ ctrl.CLI.log( "\"Ending Test - Shutting down ONOS and Network\"", level="INFO" )
# Clean up scapy hosts
if hasattr( main, "scapyHosts" ):
scapyResult = main.TRUE
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
index e02a675..8668f83 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
@@ -17,6 +17,7 @@
from functools import partial
from bmv2 import ONOSBmv2Switch
+from stratum import StratumBmv2Switch
# Parse command line options and dump results
def parseOptions():
@@ -46,7 +47,7 @@
parser.add_option( '--remote-dhcp-server', action="store_true", dest='remoteServer', default=False,
help='Connect DHCP server indirectly (via gateway) if True' )
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
@@ -58,7 +59,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)