Initial base for routing tests.
Change-Id: I4279c50053900aa53bf7192334863ab830d4bc06
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md b/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md
new file mode 100644
index 0000000..6d461c4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/README.md
@@ -0,0 +1,15 @@
+This test verifies basic L23 connectivity using SegmentRouting via pingall
+
+It consists of
+
+1) Configure and install ONOS cluster
+2) Start Mininet and check flow state
+3) Pingall
+
+<h3>Requirements</h3>
+ - Trellis leaf-spine fabric: please visit following URL to set up Trellis leaf-spine fabric
+ https://github.com/opennetworkinglab/routing/tree/master/trellis
+ - ONOS_APPS=drivers,openflow,segmentrouting,fpm,netcfghostprovider
+
+<h3>Topologies</h3>
+- 2x5 Comcast Topology.
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
new file mode 100644
index 0000000..ad8377e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.params
@@ -0,0 +1,41 @@
+<PARAMS>
+ <testcases>1</testcases>
+
+ <GRAPH>
+ <nodeCluster>VM</nodeCluster>
+ <builds>20</builds>
+ </GRAPH>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <topology>comcast_fabric.py</topology>
+ <lib>routinglib.py,trellislib.py,trellis_fabric.py</lib>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting,openflow,fpmi</cellApps>
+ </ENV>
+
+ <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>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
new file mode 100644
index 0000000..34845f2
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.py
@@ -0,0 +1,26 @@
+
+class SRRouting:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Tests routing between single-homed untagged host and single-homed
+ untagged host residing on the same leaf.
+ """
+
+ from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import SRRoutingTest
+
+ SRRoutingTest.runTest( main,
+ test_idx = 1,
+ onosNodes = 3,
+ dhcp=0,
+ routers=0,
+ ipv4=1,
+ ipv6=0,
+ h1="h1v4",
+ h2="h2v4",
+ description = "Routing test for untagged to\
+ untagged single homed hosts residing on the same\
+ leaf")
+
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo
new file mode 100644
index 0000000..01316b6
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/SRRouting.topo
@@ -0,0 +1,36 @@
+<TOPOLOGY>
+ <COMPONENT>
+ <ONOScell>
+ <host>localhost</host> # ONOS "bench" machine
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosClusterDriver</type>
+ <connect_order>1</connect_order>
+ <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
+ <nodes>3</nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <home>~/mininet/custom/</home>
+ <prompt></prompt>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
new file mode 100644
index 0000000..33c7be0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -0,0 +1,72 @@
+"""
+Copyright 2017 Open Networking Foundation ( ONF )
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+
+ TestON is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ ( at your option ) any later version.
+
+ TestON is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
+
+class SRRoutingTest ():
+
+ topo = {}
+
+ def __init__( self ):
+ self.default = ''
+
+ @staticmethod
+ def runTest( main, test_idx, onosNodes, dhcp, routers, ipv4, ipv6, h1, h2, description):
+
+ skipPackage = False
+ init = False
+ if not hasattr( main, 'apps' ):
+ init = True
+ run.initTest( main )
+
+ # Skip onos packaging if the cluster size stays the same
+ if not init and onosNodes == main.Cluster.numCtrls:
+ skipPackage = True
+
+ main.case('%s, ONOS instance%s' %
+ (description, onosNodes))
+
+ main.cfgName = 'COMCAST_CONFIG_ipv4=%d_ipv6=%d_dhcp=%d_routers=%d' % \
+ (ipv4, ipv6, dhcp, routers)
+ main.configPath = main.path + "/dependencies/"
+ main.resultFileName = 'CASE%02d' % test_idx
+ main.Cluster.setRunningNode(onosNodes)
+
+ run.installOnos(main, skipPackage=skipPackage, cliSleep=5,
+ parallel=False)
+
+ if hasattr(main, 'Mininet1'):
+ # Run the test with Mininet
+ mininet_args = ' --dhcp=%s --routers=%s --ipv6=%s --ipv4=%s' % (dhcp, routers, ipv6, ipv4)
+ run.startMininet(main, 'comcast_fabric.py', args=mininet_args)
+ else:
+ # Run the test with physical devices
+ # TODO: connect TestON to the physical network
+ pass
+
+ # ping hosts
+ main.Network.pingHost(src=h1, target=h2)
+
+ if hasattr(main, 'Mininet1'):
+ run.cleanup(main)
+ else:
+ # TODO: disconnect TestON from the physical network
+ pass
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart
new file mode 100644
index 0000000..4438f56
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG.chart
@@ -0,0 +1,4 @@
+{
+ "leaf1": {"expect": "True",
+ "hosts":["h1", "h2"]}
+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
new file mode 100644
index 0000000..b4cf1dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.chart
@@ -0,0 +1,307 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.10.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000002/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.10.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/9" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.40.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.0.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.20.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"],
+ "ips": ["10.1.0.1"]
+ }
+ },
+ "00:aa:00:00:01:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"],
+ "ips": ["10.1.10.1"]
+ }
+ },
+ "00:aa:00:00:00:02/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/6"],
+ "ips": ["10.2.0.1"]
+ }
+ },
+ "00:aa:00:00:00:03/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+ "ips": ["10.2.30.1"]
+ }
+ },
+ "00:aa:00:00:00:04/30" : {
+ "basic": {
+ "locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+ "ips": ["10.2.20.1"]
+ }
+ },
+ "00:aa:00:00:00:05/20" : {
+ "basic": {
+ "locations": ["of:0000000000000003/8"],
+ "ips": ["10.2.10.1"]
+ }
+ },
+ "00:aa:00:00:01:05/40" : {
+ "basic": {
+ "locations": ["of:0000000000000003/9"],
+ "ips": ["10.2.40.1"]
+ }
+ },
+ "00:aa:00:00:00:06/30" : {
+ "basic": {
+ "locations": ["of:0000000000000004/6"],
+ "ips": ["10.3.0.1"]
+ }
+ },
+ "00:aa:00:00:00:07/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+ "ips": ["10.3.10.1"]
+ }
+ },
+ "00:aa:00:00:00:08/40" : {
+ "basic": {
+ "locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+ "ips": ["10.3.30.1"]
+ }
+ },
+ "00:aa:00:00:00:0A/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/8"],
+ "ips": ["10.3.20.1"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "name" : "s001",
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-105
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "name" : "s002",
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000003",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-95
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "name" : "s003",
+ "ipv4NodeSid" : 3,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000002",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-90
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "name" : "s004",
+ "ipv4NodeSid" : 4,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000005",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-85
+ }
+ },
+ "of:0000000000000005" : {
+ "segmentrouting" : {
+ "name" : "s005",
+ "ipv4NodeSid" : 5,
+ "ipv4Loopback" : "192.168.0.5",
+ "routerMac" : "00:00:00:00:00:05",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000004",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-80
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "name" : "s101",
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-100
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "name" : "s102",
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-95
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
new file mode 100644
index 0000000..b4cf1dd
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/json/COMCAST_CONFIG_ipv4=1_ipv6=0_dhcp=0_routers=0.json
@@ -0,0 +1,307 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000001/4" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.10.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000002/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.10.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/9" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.40.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.0.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.20.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"],
+ "ips": ["10.1.0.1"]
+ }
+ },
+ "00:aa:00:00:01:01/None" : {
+ "basic": {
+ "locations": ["of:0000000000000001/4"],
+ "ips": ["10.1.10.1"]
+ }
+ },
+ "00:aa:00:00:00:02/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/6"],
+ "ips": ["10.2.0.1"]
+ }
+ },
+ "00:aa:00:00:00:03/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+ "ips": ["10.2.30.1"]
+ }
+ },
+ "00:aa:00:00:00:04/30" : {
+ "basic": {
+ "locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+ "ips": ["10.2.20.1"]
+ }
+ },
+ "00:aa:00:00:00:05/20" : {
+ "basic": {
+ "locations": ["of:0000000000000003/8"],
+ "ips": ["10.2.10.1"]
+ }
+ },
+ "00:aa:00:00:01:05/40" : {
+ "basic": {
+ "locations": ["of:0000000000000003/9"],
+ "ips": ["10.2.40.1"]
+ }
+ },
+ "00:aa:00:00:00:06/30" : {
+ "basic": {
+ "locations": ["of:0000000000000004/6"],
+ "ips": ["10.3.0.1"]
+ }
+ },
+ "00:aa:00:00:00:07/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+ "ips": ["10.3.10.1"]
+ }
+ },
+ "00:aa:00:00:00:08/40" : {
+ "basic": {
+ "locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+ "ips": ["10.3.30.1"]
+ }
+ },
+ "00:aa:00:00:00:0A/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/8"],
+ "ips": ["10.3.20.1"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "name" : "s001",
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-105
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "name" : "s002",
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000003",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-95
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "name" : "s003",
+ "ipv4NodeSid" : 3,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000002",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-90
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "name" : "s004",
+ "ipv4NodeSid" : 4,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000005",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-85
+ }
+ },
+ "of:0000000000000005" : {
+ "segmentrouting" : {
+ "name" : "s005",
+ "ipv4NodeSid" : 5,
+ "ipv4Loopback" : "192.168.0.5",
+ "routerMac" : "00:00:00:00:00:05",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000004",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-80
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "name" : "s101",
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-100
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "name" : "s102",
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-95
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json b/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json
new file mode 100644
index 0000000..8a7eff8
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/COMCAST_CONFIG.json
@@ -0,0 +1,279 @@
+{
+ "ports" : {
+ "of:0000000000000001/3" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.1.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.0.254/24" ],
+ "vlan-untagged": 10
+ }
+ ]
+ },
+ "of:0000000000000002/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000002/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000003/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.10.254/24" ],
+ "vlan-tagged": [20]
+ }
+ ]
+ },
+ "of:0000000000000003/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.30.254/24" ],
+ "vlan-untagged": 15
+ }
+ ]
+ },
+ "of:0000000000000003/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.2.20.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.0.254/24" ],
+ "vlan-tagged": [30]
+ }
+ ]
+ },
+ "of:0000000000000004/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000004/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/8" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.20.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/6" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.10.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ },
+ "of:0000000000000005/7" : {
+ "interfaces" : [
+ {
+ "ips" : [ "10.3.30.254/24" ],
+ "vlan-tagged": [40]
+ }
+ ]
+ }
+ },
+ "hosts" : {
+ "00:aa:00:00:00:01/10" : {
+ "basic": {
+ "locations": ["of:0000000000000001/3"],
+ "ips": ["10.1.0.1"]
+ }
+ },
+ "00:aa:00:00:00:02/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/6"],
+ "ips": ["10.2.0.1"]
+ }
+ },
+ "00:aa:00:00:00:03/None" : {
+ "basic": {
+ "locations": ["of:0000000000000002/7", "of:0000000000000003/6"],
+ "ips": ["10.2.30.1"]
+ }
+ },
+ "00:aa:00:00:00:04/30" : {
+ "basic": {
+ "locations": ["of:0000000000000003/7","of:0000000000000002/8"],
+ "ips": ["10.2.20.1"]
+ }
+ },
+ "00:aa:00:00:00:05/20" : {
+ "basic": {
+ "locations": ["of:0000000000000003/8"],
+ "ips": ["10.2.10.1"]
+ }
+ },
+ "00:aa:00:00:00:06/30" : {
+ "basic": {
+ "locations": ["of:0000000000000004/6"],
+ "ips": ["10.3.0.1"]
+ }
+ },
+ "00:aa:00:00:00:07/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/6", "of:0000000000000004/7"],
+ "ips": ["10.3.10.1"]
+ }
+ },
+ "00:aa:00:00:00:08/40" : {
+ "basic": {
+ "locations": ["of:0000000000000004/8","of:0000000000000005/7"],
+ "ips": ["10.3.30.1"]
+ }
+ },
+ "00:aa:00:00:00:0A/40" : {
+ "basic": {
+ "locations": ["of:0000000000000005/8"],
+ "ips": ["10.3.20.1"]
+ }
+ }
+ },
+ "devices" : {
+ "of:0000000000000001" : {
+ "segmentrouting" : {
+ "name" : "s001",
+ "ipv4NodeSid" : 1,
+ "ipv4Loopback" : "192.168.0.1",
+ "routerMac" : "00:00:00:00:00:01",
+ "isEdgeRouter" : true,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-105
+ }
+ },
+ "of:0000000000000002" : {
+ "segmentrouting" : {
+ "name" : "s002",
+ "ipv4NodeSid" : 2,
+ "ipv4Loopback" : "192.168.0.2",
+ "routerMac" : "00:00:00:00:00:02",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000003",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-95
+ }
+ },
+ "of:0000000000000003" : {
+ "segmentrouting" : {
+ "name" : "s003",
+ "ipv4NodeSid" : 3,
+ "ipv4Loopback" : "192.168.0.3",
+ "routerMac" : "00:00:00:00:00:03",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000002",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-90
+ }
+ },
+ "of:0000000000000004" : {
+ "segmentrouting" : {
+ "name" : "s004",
+ "ipv4NodeSid" : 4,
+ "ipv4Loopback" : "192.168.0.4",
+ "routerMac" : "00:00:00:00:00:04",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000005",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-85
+ }
+ },
+ "of:0000000000000005" : {
+ "segmentrouting" : {
+ "name" : "s005",
+ "ipv4NodeSid" : 5,
+ "ipv4Loopback" : "192.168.0.5",
+ "routerMac" : "00:00:00:00:00:05",
+ "isEdgeRouter" : true,
+ "pairLocalPort" : 5,
+ "pairDeviceId": "of:0000000000000004",
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":34,
+ "longitude":-80
+ }
+ },
+ "of:0000000000000101" : {
+ "segmentrouting" : {
+ "name" : "s101",
+ "ipv4NodeSid" : 101,
+ "ipv4Loopback" : "192.168.0.101",
+ "routerMac" : "00:00:00:00:01:01",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-100
+ }
+ },
+ "of:0000000000000102" : {
+ "segmentrouting" : {
+ "name" : "s102",
+ "ipv4NodeSid" : 102,
+ "ipv4Loopback" : "192.168.0.102",
+ "routerMac" : "00:00:00:00:01:02",
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
+ },
+ "basic" : {
+ "driver" : "ofdpa-ovs",
+ "latitude":42,
+ "longitude":-95
+ }
+ }
+ }
+}
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 78c96cc..6329782 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -73,7 +73,8 @@
main.testSetUp.evnSetupConclusion( stepResult )
@staticmethod
- def installOnos( main, vlanCfg=True, skipPackage=False, cliSleep=10 ):
+ def installOnos( main, vlanCfg=True, skipPackage=False, cliSleep=10,
+ parallel=True ):
"""
- Set up cell
- Create cell file
@@ -92,7 +93,9 @@
main.log.info( ''.join( main.Cluster.getIps() ) )
main.dynamicHosts = [ 'in1', 'out1' ]
main.testSetUp.ONOSSetUp( main.Cluster, newCell=True, cellName=main.cellName,
- skipPack=skipPackage, useSSH=Testcaselib.useSSH )
+ skipPack=skipPackage,
+ useSSH=Testcaselib.useSSH,
+ installParallel=parallel)
ready = utilities.retry( main.Cluster.active( 0 ).CLI.summary,
main.FALSE,
sleep=cliSleep,
@@ -103,12 +106,10 @@
onpass="ONOS summary command succeded",
onfail="ONOS summary command failed" )
- with open( "%s/json/%s.json" % (
- main.configPath, main.cfgName ) ) as cfg:
- main.Cluster.active( 0 ).REST.setNetCfg( json.load( cfg ) )
- with open( "%s/json/%s.chart" % (
- main.configPath, main.cfgName ) ) as chart:
- main.pingChart = json.load( chart )
+ with open( "%s/json/%s.json" % (main.configPath, main.cfgName)) as cfg:
+ main.Cluster.active( 0 ).REST.setNetCfg(json.load(cfg))
+ with open("%s/json/%s.chart" % (main.configPath, main.cfgName)) as chart:
+ main.pingChart = json.load(chart)
if not ready:
main.log.error( "ONOS startup failed!" )
main.cleanAndExit()
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py
new file mode 100644
index 0000000..6691e11
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/comcast_fabric.py
@@ -0,0 +1,338 @@
+#!/usr/bin/python
+import os
+import re
+from optparse import OptionParser
+from ipaddress import ip_network
+from mininet.node import RemoteController, OVSBridge, Host
+from mininet.link import TCLink
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.nodelib import NAT
+from mininet.cli import CLI
+
+from routinglib import BgpRouter, RoutedHost
+from trellislib import DhcpServer, TaggedRoutedHost, DualHomedRoutedHost, DualHomedTaggedRoutedHost, DhcpClient, Dhcp6Client, DhcpServer, Dhcp6Server
+
+# Parse command line options and dump results
+def parseOptions():
+ "Parse command line options"
+ parser = OptionParser()
+ parser.add_option( '--dhcp', dest='dhcp', type='int', default=0,
+ help='Configure hosts with dhcp or not' )
+ parser.add_option( '--routers', dest='routers', type='int', default=0,
+ help='Configure external routers or not in the topology' )
+ parser.add_option( '--ipv6', dest='ipv6', type='int', default=0,
+ help='Configure hosts with ipv6 or not' )
+ parser.add_option( '--ipv4', dest='ipv4', type='int', default=1,
+ help='Configure hosts with ipv4 or not' )
+ parser.add_option( '--onos-ip', dest='onosIp', type='str', default='',
+ help='IP address list of ONOS instances, separated by comma(,). Overrides --onos option' )
+
+ ( options, args ) = parser.parse_args()
+ return options, args
+
+opts, args = parseOptions()
+
+class DualHomedTaggedHostWithIpv4(Host):
+
+ def __init__(self, name, ip, gateway, dhcp, vlan, *args, **kwargs):
+ super(DualHomedTaggedHostWithIpv4, self).__init__(name, **kwargs)
+ self.bond0 = None
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+ self.vlan = vlan
+
+ def config(self, **kwargs):
+ super(DualHomedTaggedHostWithIpv4, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+
+ self.bond0 = "%s-bond0" % self.name
+ self.vlanBondIntf = "%s.%s" % (self.bond0, self.vlan)
+
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+
+ self.cmd('ip link add link %s name %s type vlan id %s' % (self.bond0,
+ self.vlanBondIntf, self.vlan))
+
+ self.cmd('ip link set up %s' % self.vlanBondIntf)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.vlanBondIntf))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ default_intf = self.defaultIntf()
+ default_intf.name = self.bond0
+ self.nameToIntf[self.bond0] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ super(DualHomedTaggedHostWithIpv4, self).terminate()
+
+class DualHomedUntaggedHostWithIpv4(Host):
+
+ def __init__(self, name, ip, gateway, dhcp, *args, **kwargs):
+ super(DualHomedUntaggedHostWithIpv4, self).__init__(name, **kwargs)
+ self.bond0 = None
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ super(DualHomedUntaggedHostWithIpv4, self).config(**kwargs)
+ intf0 = self.intfs[0].name
+ intf1 = self.intfs[1].name
+
+ self.bond0 = "%s-bond0" % self.name
+ self.cmd('modprobe bonding')
+ self.cmd('ip link add %s type bond' % self.bond0)
+ self.cmd('ip link set %s down' % intf0)
+ self.cmd('ip link set %s down' % intf1)
+ self.cmd('ip link set %s master %s' % (intf0, self.bond0))
+ self.cmd('ip link set %s master %s' % (intf1, self.bond0))
+ self.cmd('ip addr flush dev %s' % intf0)
+ self.cmd('ip addr flush dev %s' % intf1)
+ self.cmd('ip link set %s up' % self.bond0)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.bond0))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ default_intf = self.defaultIntf()
+ default_intf.name = self.bond0
+ self.nameToIntf[self.bond0] = default_intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link set %s down' % self.bond0)
+ self.cmd('ip link delete %s' % self.bond0)
+ super(DualHomedUntaggedHostWithIpv4, self).terminate()
+
+class TaggedHostWithIpv4(Host):
+ '''
+ Tagged host configured with a static ip address.
+ '''
+ def __init__(self, name, ip, gateway, dhcp, vlan, *args, **kwargs):
+ super(TaggedHostWithIpv4, self).__init__(name, *args, **kwargs)
+ self.ip = ip
+ self.gateway = gateway
+ self.vlan = vlan
+ self.vlanIntf = None
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ intf = self.defaultIntf()
+ self.vlanIntf = "%s.%s" % (intf, self.vlan)
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ 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)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, self.vlanIntf))
+ self.cmd('ip route add default via %s' % self.gateway)
+ intf.name = self.vlanIntf
+ self.nameToIntf[self.vlanIntf] = intf
+
+ def terminate(self, **kwargs):
+ self.cmd('ip link remove link %s' % self.vlanIntf)
+ super(TaggedHostWithIpv4, self).terminate()
+
+
+class UnTaggedHostWithIpv4(Host):
+ '''
+ Untagged host configured with a static ip address.
+ '''
+ def __init__(self, name, ip, gateway, dhcp, *args, **kwargs):
+ super(UnTaggedHostWithIpv4, self).__init__(name, *args, **kwargs)
+ self.ip = ip
+ self.gateway = gateway
+ self.dhcp = dhcp
+
+ def config(self, **kwargs):
+ Host.config(self, **kwargs)
+
+ intf = self.defaultIntf()
+ self.cmd('ip -4 addr flush dev %s' % intf)
+ self.cmd('ip addr add %s/24 dev %s' % (self.ip, intf))
+ self.cmd('ip route add default via %s' % self.gateway)
+
+ def terminate(self, **kwargs):
+ super(UnTaggedHostWithIpv4, self).terminate()
+
+class ComcastLeafSpineFabric(Topo):
+
+ spines = dict()
+ leafs = dict()
+ hosts_dict = dict()
+
+ def createIpv4Hosts(self, dhcp):
+
+ h1 = self.addHost('h1v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:01', ip='10.1.0.1',
+ gateway='10.1.0.254', dhcp=dhcp)
+ self.addLink(h1, self.leafs[0])
+ self.hosts_dict['h1v4'] = h1
+
+ h2 = self.addHost('h2v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:01:01', ip='10.1.10.1',
+ gateway='10.1.10.254', dhcp=dhcp)
+ self.addLink(h2, self.leafs[0])
+ self.hosts_dict['h2v4'] = h2
+
+ h3 = self.addHost('h3v4', cls=UnTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:02', ip='10.2.0.1',
+ gateway='10.2.0.254', dhcp=dhcp)
+ self.addLink(h3, self.leafs[1])
+ self.hosts_dict['h3v4'] = h3
+
+ h4 = self.addHost('h4v4', cls=DualHomedUntaggedHostWithIpv4,
+ mac='00:aa:00:00:00:03', ip='10.2.30.1',
+ gateway='10.2.30.254', dhcp=dhcp)
+ self.addLink(h4, self.leafs[1])
+ self.addLink(h4, self.leafs[2])
+ self.hosts_dict['h4v4'] = h4
+
+ h5 = self.addHost('h5v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:04', ip='10.2.20.1',
+ gateway='10.2.20.254', dhcp=dhcp, vlan=30)
+ self.addLink(h5, self.leafs[1])
+ self.addLink(h5, self.leafs[2])
+ self.hosts_dict['h5v4'] = h5
+
+ h6 = self.addHost('h6v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:05', ip='10.2.10.1',
+ gateway='10.2.10.254', dhcp=dhcp, vlan=20)
+ self.addLink(h6, self.leafs[2])
+ self.hosts_dict['h6v4'] = h6
+
+ h7 = self.addHost('h7v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:01:05', ip='10.2.40.1',
+ gateway='10.2.40.254', dhcp=dhcp, vlan=40)
+ self.addLink(h7, self.leafs[2])
+ self.hosts_dict['h7v4'] = h7
+
+ h8 = self.addHost('h8v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:06', ip='10.3.0.1',
+ gateway='10.3.0.254', dhcp=dhcp, vlan=30)
+ self.addLink(h8, self.leafs[3])
+ self.hosts_dict['h8v4'] = h8
+
+ h9 = self.addHost('h9v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:07', ip='10.3.10.1',
+ gateway='10.3.10.254', dhcp=dhcp, vlan=40)
+ self.addLink(h9, self.leafs[3])
+ self.addLink(h9, self.leafs[4])
+ self.hosts_dict['h9v4'] = h9
+
+ h10 = self.addHost('h10v4', cls=DualHomedTaggedHostWithIpv4,
+ mac='00:aa:00:00:00:08', ip='10.3.30.1',
+ gateway='10.3.30.254', dhcp=dhcp, vlan=40)
+ self.addLink(h10, self.leafs[3])
+ self.addLink(h10, self.leafs[4])
+ self.hosts_dict['h10v4'] = h10
+
+ h11 = self.addHost('h11v4', cls=TaggedHostWithIpv4,
+ mac='00:aa:00:00:00:0a', ip='10.3.20.1',
+ gateway='10.3.20.254', dhcp=dhcp, vlan=40)
+ self.addLink(h11, self.leafs[4])
+ self.hosts_dict['h11v4'] = h11
+
+ return
+
+ def createIpv6Hosts(self, dhcp):
+ print("NYI")
+ return
+
+ '''
+ Creates the topology employed by Comcast which is a 2x5
+ leaf spine traffic.
+
+ S1 S2
+
+ L1 L2 L3 L4 L5
+
+ Where L2/L3 and L4/L5 are paired switches.
+ Parameters for this topology :
+ dhcp = True/False : set up dhcp servers
+ routers = True/False : set up external routers
+ '''
+ def __init__(self, dhcp=False, routers=False, ipv4=False, ipv6=False, **opts):
+ Topo.__init__(self, **opts)
+
+ # TODO: support IPv6 hosts
+ linkopts = dict( bw=10 )
+
+ spine = 2
+ leaf = 5
+
+ # Create spine switches
+ for s in range(spine):
+ self.spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid = "00000000010%s" % (s + 1) )
+
+ # Create leaf switches
+ for ls in range(leaf):
+ self.leafs[ls] = self.addSwitch('leaf%s' % (ls + 1), dpid = "00000000000%s" % ( ls + 1) )
+
+ # connecting leaf and spines, leafs 1-5 have double links
+ for s in range( spine ):
+ spine_switch = self.spines[s]
+
+ for ls in range( leaf ):
+ leaf_switch = self.leafs[ls]
+
+ self.addLink( spine_switch, leaf_switch, **linkopts )
+ if ls > 0:
+ self.addLink( spine_switch, leaf_switch, **linkopts )
+
+ # connect paired leafs
+ self.addLink(self.leafs[1], self.leafs[2], **linkopts)
+ self.addLink(self.leafs[3], self.leafs[4], **linkopts)
+
+ # create hosts
+ if ipv6:
+ self.createIpv6Hosts(dhcp)
+
+ if ipv4:
+ self.createIpv4Hosts(dhcp)
+
+ if not ipv4 and not ipv6:
+ print("No hosts were created!")
+
+def config( opts ):
+
+ dhcp = bool(opts.dhcp)
+ routers = bool(opts.routers)
+ ipv6 = bool(opts.ipv6)
+ ipv4 = bool(opts.ipv4)
+
+ if opts.onosIp != '':
+ controllers = opts.onosIp.split( ',' )
+ else:
+ controllers = ['127.0.0.1']
+ topo = ComcastLeafSpineFabric(dhcp=dhcp, routers=routers, ipv6=ipv6,
+ ipv4=ipv4)
+
+ net = Mininet( topo=topo, link=TCLink, build=False,
+ controller=None, autoSetMacs=True )
+ i = 0
+ for ip in controllers:
+ net.addController( "c%s" % ( i ), controller=RemoteController, ip=ip )
+ i += 1
+
+ net.build()
+ net.start()
+ CLI( net )
+ net.stop()
+
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ config(opts)
+ os.system('sudo mn -c')
+
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
index 98b5316..a39ed13 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/trellis_fabric.py
@@ -300,7 +300,6 @@
rh1 = self.addHost('rh1', cls=RoutedHost, ips=['10.0.99.2/24'], gateway='10.0.99.1')
self.addLink(r1, rh1)
-
def config( opts ):
spine = opts.spine
leaf = opts.leaf