[ONOS-7369] Proof-of-concept testing for network driver to manage physical switches/hosts
Change-Id: If35298e29af22307d65f8f38546b0a21271ae333
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
index 99a8e01..2be846e 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
@@ -4,13 +4,16 @@
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - install ONOS
# 3 - Start mininet and scapy and verify topology
+ # 11 - Connect to physical network and start scapy
# 4 - Testing Scapy
# 5 - Testing GROUP with type "ALL"
# 6 - Deleting the Group and Flow
# 7 - Testing GROUP with type "INDIRECT"
# 8 - Deleting the group and flow
- # 10 - Stop mininet and scapy
+ # 10 - Stop mininet and scapy
+ # 12 - Stop physical scapy hosts
# 100 - Check logs for Errors and Warnings
+ # Sample testcases for physical network: 1,2,11,5,6,7,6,12,100
<testcases>1,2,3,5,6,7,6,10,100</testcases>
<GRAPH>
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
index bbe759d..4a83581 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
@@ -84,15 +84,6 @@
bucket +
".py" )
- copyResult = main.ONOSbench.scp( main.Mininet1,
- main.dependencyPath + main.topology,
- main.Mininet1.home + '/custom/',
- direction="to" )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=copyResult,
- onpass="Successfully copy " + "test variables ",
- onfail="Failed to copy test variables" )
stepResult = main.testSetUp.envSetup()
except Exception as e:
@@ -134,6 +125,16 @@
main.caseExplanation = "Start mininet with custom topology and compare topology " +\
"elements between Mininet and ONOS"
+ main.step( "Copy Mininet topology file" )
+ copyResult = main.ONOSbench.scp( main.Mininet1,
+ main.dependencyPath + main.topology,
+ main.Mininet1.home + '/custom/',
+ direction="to" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=copyResult,
+ onpass="Successfully copy mininet topo file",
+ onfail="Failed to copy mininet topo file" )
+
main.step( "Setup Mininet Topology" )
topology = main.Mininet1.home + '/custom/' + main.topology
stepResult = main.Mininet1.startNet( topoFile=topology )
@@ -175,6 +176,52 @@
onpass="Successfully created Scapy Components",
onfail="Failed to discover Scapy Components" )
+ def CASE11( self, main ):
+ """
+ Connect to a physical network, assign controllers and start scapy
+ """
+ import time
+ main.case( "Connecting to physical network" )
+
+ main.step( "Connecting to physical network" )
+ 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 i in range( 1, 2 ):
+ assignResult = assignResult & main.NetworkBench.assignSwController( sw="s" + str( i ),
+ 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" )
+
+ main.step( "Start scapy" )
+ scapyResult = main.TRUE
+ for hostName in main.scapyHostNames:
+ main.scapyHosts.append( getattr( main, hostName ) )
+
+ for host in main.scapyHosts:
+ host.startScapy()
+ host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully created Scapy Components",
+ onfail="Failed to discover Scapy Components" )
+
def CASE4( self, main ):
"""
Testing scapy
@@ -557,6 +604,20 @@
if not ( mininetResult and scapyResult ):
main.cleanAndExit()
+ def CASE12( self, main ):
+ """
+ Stop Scapy on physical hosts
+ """
+ main.case( "Stop Scapy" )
+ main.step( "Stopping Scapy Hosts" )
+ scapyResult = main.TRUE
+ for host in main.scapyHosts:
+ host.stopScapy()
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully stopped scapy",
+ onfail="Failed to stop scapy" )
+
def CASE100( self, main ):
"""
Report errors/warnings/exceptions
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo.physical b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo.physical
new file mode 100644
index 0000000..956d1ef
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.topo.physical
@@ -0,0 +1,154 @@
+<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 for 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> 1 </nodes> # number of nodes in the cluster
+ </COMPONENTS>
+ </ONOScell>
+
+ <MininetSwitch1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetSwitchDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ <shortName>s1</shortName>
+ <port1>1</port1>
+ <link1>MininetHost1</link1>
+ <port2>2</port2>
+ <link2>MininetHost2</link2>
+ <port3>3</port3>
+ <link3>MininetHost3</link3>
+ <port4>4</port4>
+ <link4>MininetHost4</link4>
+ </COMPONENTS>
+ </MininetSwitch1>
+
+ <MininetHost1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ <ip>10.0.0.1</ip>
+ <shortName>h1</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitch1</link1>
+ </COMPONENTS>
+ </MininetHost1>
+
+ <MininetHost2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ <ip>10.0.0.2</ip>
+ <shortName>h2</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitch1</link1>
+ </COMPONENTS>
+ </MininetHost2>
+
+ <MininetHost3>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ <ip>10.0.0.3</ip>
+ <shortName>h3</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitch1</link1>
+ </COMPONENTS>
+ </MininetHost3>
+
+ <MininetHost4>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ <ip>10.0.0.4</ip>
+ <shortName>h4</shortName>
+ <port1>0</port1>
+ <link1>MininetSwitch1</link1>
+ </COMPONENTS>
+ </MininetHost4>
+
+ <NetworkBench>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>NetworkDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </NetworkBench>
+
+ <h1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostScapyCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS>
+ <ifaceName>h1-eth0</ifaceName>
+ </COMPONENTS>
+ </h1>
+
+ <h2>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostScapyCliDriver</type>
+ <connect_order>9</connect_order>
+ <COMPONENTS>
+ <ifaceName>h2-eth0</ifaceName>
+ </COMPONENTS>
+ </h2>
+
+ <h3>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostScapyCliDriver</type>
+ <connect_order>10</connect_order>
+ <COMPONENTS>
+ <ifaceName>h3-eth0</ifaceName>
+ </COMPONENTS>
+ </h3>
+
+ <h4>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetHostScapyCliDriver</type>
+ <connect_order>11</connect_order>
+ <COMPONENTS>
+ <ifaceName>h4-eth0</ifaceName>
+ </COMPONENTS>
+ </h4>
+
+ </COMPONENT>
+</TOPOLOGY>