[ONOS-7369] Proof-of-concept testing for network driver to manage physical switches/hosts
Change-Id: If35298e29af22307d65f8f38546b0a21271ae333
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
index 09d8b19..0fbda47 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.params
@@ -1,4 +1,5 @@
<PARAMS>
+ # Sample testcase for physical network: 7
<testcases>5,6,7,8,15,16,17,18,25,26,27,28,35,36,37,38,45,46,47,48,55,56,57,58,65,66,67,68,75,76,77,78</testcases>
<GRAPH>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.physical b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.physical
new file mode 100644
index 0000000..4605185
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/SRBridging.topo.physical
@@ -0,0 +1,158 @@
+<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>
+
+ <MininetSwitchLeaf1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetSwitchDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <shortName>leaf1</shortName>
+ <port1>1</port1>
+ <link1>MininetSwitchSpine101</link1>
+ <port2>2</port2>
+ <link2>MininetSwitchSpine102</link2>
+ <port3>3</port3>
+ <link3>MininetHost1</link3>
+ <port4>4</port4>
+ <link4>MininetHost2</link4>
+ </COMPONENTS>
+ </MininetSwitchLeaf1>
+
+ <MininetSwitchLeaf2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetSwitchDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ <shortName>leaf2</shortName>
+ <port1>1</port1>
+ <link1>MininetSwitchSpine101</link1>
+ <port2>2</port2>
+ <link2>MininetSwitchSpine102</link2>
+ <port3>3</port3>
+ <link3>MininetHost3</link3>
+ <port4>4</port4>
+ <link4>MininetHost4</link4>
+ </COMPONENTS>
+ </MininetSwitchLeaf2>
+
+ <MininetSwitchSpine101>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetSwitchDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ <shortName>spine101</shortName>
+ <port1>1</port1>
+ <link1>MininetSwitchLeaf1</link1>
+ <port2>2</port2>
+ <link2>MininetSwitchLeaf2</link2>
+ </COMPONENTS>
+ </MininetSwitchSpine101>
+
+ <MininetSwitchSpine102>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetSwitchDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ <shortName>spine102</shortName>
+ <port1>1</port1>
+ <link1>MininetSwitchLeaf1</link1>
+ <port2>2</port2>
+ <link2>MininetSwitchLeaf2</link2>
+ </COMPONENTS>
+ </MininetSwitchSpine102>
+
+ <MininetHost1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ <ip>10.0.2.1</ip>
+ <shortName>h1</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitchLeaf1</link1>
+ </COMPONENTS>
+ </MininetHost1>
+
+ <MininetHost2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ <ip>10.0.2.2</ip>
+ <shortName>h2</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitchLeaf1</link1>
+ </COMPONENTS>
+ </MininetHost2>
+
+ <MininetHost3>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ <ip>10.0.3.1</ip>
+ <shortName>h3</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitchLeaf2</link1>
+ </COMPONENTS>
+ </MininetHost3>
+
+ <MininetHost4>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS>
+ <ip>10.0.3.2</ip>
+ <shortName>h4</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitchLeaf2</link1>
+ </COMPONENTS>
+ </MininetHost4>
+
+ <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 6b869c1..fa496dd 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRBridging/dependencies/SRBridgingTest.py
@@ -36,6 +36,8 @@
# TODO: Implement 2x3 topology
# topo[ '2x3' ] = ( 2, 3, True, '2x3 leaf-spine topology with dual ToR and single ToR', 28 )
topo[ '2x4' ] = ( 2, 4, True, '2x4 dual-homed leaf-spine topology', 53 )
+ switchNames = {}
+ switchNames[ '2x2' ] = [ "leaf1", "leaf2", "spine101", "spine102" ]
skipPackage = False
init = False
@@ -64,8 +66,7 @@
run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
else:
# Run the test with physical devices
- # TODO: connect TestON to the physical network
- pass
+ run.connectToPhysicalNetwork( main, switchNames[ topology ] )
run.checkFlows( main, minFlowCount=topo[ topology ][ 4 ] * topo[ topology ][ 1 ], sleep=5 )
leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( topo[ topology ][ 1 ] ) ]
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index c912ea2..8d929ad 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -158,6 +158,30 @@
main.cleanAndExit()
@staticmethod
+ def connectToPhysicalNetwork( main, switchNames ):
+ main.step( "Connecting to physical netowrk" )
+ topoResult = main.NetworkBench.connectToNet()
+ stepResult = topoResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully loaded topology",
+ onfail="Failed to load topology" )
+ # Exit if topology did not load properly
+ if not topoResult:
+ main.cleanAndExit()
+
+ main.step( "Assign switches to controllers." )
+ assignResult = main.TRUE
+ for name in switchNames:
+ assignResult = assignResult & main.NetworkBench.assignSwController( sw=name,
+ ip=main.Cluster.getIps(),
+ port='6653' )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully assign switches to controllers",
+ onfail="Failed to assign switches to controllers" )
+
+ @staticmethod
def config( main, cfgName ):
main.spines = []