Parameterizing the config file paths for PeeringRouterTest TestON and mininet scripts
diff --git a/TestON/tests/PeeringRouterTest/PeeringRouterTest.params b/TestON/tests/PeeringRouterTest/PeeringRouterTest.params
index 467141d..f12ada9 100755
--- a/TestON/tests/PeeringRouterTest/PeeringRouterTest.params
+++ b/TestON/tests/PeeringRouterTest/PeeringRouterTest.params
@@ -5,6 +5,7 @@
#Environment variables
<ENV>
<cellName>sdnip_single_instance</cellName>
+ <home>/home/tutorial1/ONLabTest/TestON/tests/PeeringRouterTest</home>
</ENV>
<CTRL>
diff --git a/TestON/tests/PeeringRouterTest/PeeringRouterTest.py b/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
index 5fd328c..6323a19 100755
--- a/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
+++ b/TestON/tests/PeeringRouterTest/PeeringRouterTest.py
@@ -49,9 +49,19 @@
main.case("The test case is to help to setup the TestON environment \
and test new drivers" )
- CURRENT_PATH = "/home/sdnip/TestON/tests/PeeringRouterTest/"
- SDNIPJSONFILEPATH = \
- "/home/sdnip/TestON/tests/PeeringRouterTest/sdnip.json"
+ TESTCASE_ROOT_PATH = main.params[ 'ENV' ][ 'home' ]
+ TESTCASE_MININET_ROOT_PATH = TESTCASE_ROOT_PATH + "/mininet"
+ SDNIPJSONFILEPATH = TESTCASE_ROOT_PATH + "/sdnip.json"
+ main.log.info("sdnip.json file path: "+ SDNIPJSONFILEPATH)
+ # Launch mininet topology for this case
+ MININET_TOPO_FILE = TESTCASE_MININET_ROOT_PATH + "/PeeringRouterMininet.py"
+ main.step( "Launch mininet" )
+ main.Mininet.handle.sendline("sudo python " + MININET_TOPO_FILE + " " + TESTCASE_MININET_ROOT_PATH)
+ main.step("waiting 20 secs for all switches and quagga instances to comeup")
+ time.sleep(20)
+ main.step("verifying mininet launch")
+ main.log.info( "Login Quagga CLI on host3" )
+ main.QuaggaCliHost3.loginQuagga( "1.168.30.2" )
# all expected routes for all BGP peers
allRoutesExpected = []
main.step( "Start to generate routes for all BGP peers" )
@@ -234,6 +244,10 @@
onpass="disconnect check PASS",
onfail="disconnect check FAIL")
+ main.ONOScli.disconnect()
+ main.ONOSbench.onosStop(ONOS1Ip);
+ main.Mininet.disconnect()
+
def CASE5( self, main ):
"""
Test the SDN-IP functionality
diff --git a/TestON/tests/PeeringRouterTest/PeeringRouterTest.topo b/TestON/tests/PeeringRouterTest/PeeringRouterTest.topo
index 4fe44bf..440789e 100755
--- a/TestON/tests/PeeringRouterTest/PeeringRouterTest.topo
+++ b/TestON/tests/PeeringRouterTest/PeeringRouterTest.topo
@@ -1,12 +1,21 @@
<TOPOLOGY>
<COMPONENT>
+ <Mininet>
+ <host>127.0.0.1</host>
+ <user>tutorial1</user>
+ <password>tutorial1</password>
+ <type>MininetCliDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet>
+
<ONOSbench>
<host>127.0.0.1</host>
<user>tutorial1</user>
<password>tutorial1</password>
<type>OnosDriver</type>
- <connect_order>1</connect_order>
+ <connect_order>2</connect_order>
<COMPONENTS>
<home>~/onos</home>
</COMPONENTS>
@@ -17,7 +26,7 @@
<user>tutorial1</user>
<password>tutorial1</password>
<type>OnosCliDriver</type>
- <connect_order>2</connect_order>
+ <connect_order>3</connect_order>
<COMPONENTS>
<home>~/onos</home>
</COMPONENTS>
@@ -28,7 +37,7 @@
<user>tutorial1</user>
<password>tutorial1</password>
<type>OnosDriver</type>
- <connect_order>3</connect_order>
+ <connect_order>4</connect_order>
<COMPONENTS>
<home>~/onos</home>
</COMPONENTS>
@@ -39,7 +48,7 @@
<user>tutorial1</user>
<password></password>
<type>QuaggaCliDriver</type>
- <connect_order>4</connect_order>
+ <connect_order>5</connect_order>
<COMPONENTS> </COMPONENTS>
</QuaggaCliHost3>
<QuaggaCliHost4>
@@ -47,7 +56,7 @@
<user>tutorial1</user>
<password></password>
<type>QuaggaCliDriver</type>
- <connect_order>5</connect_order>
+ <connect_order>6</connect_order>
<COMPONENTS> </COMPONENTS>
</QuaggaCliHost4>
<QuaggaCliHost5>
@@ -55,7 +64,7 @@
<user>tutorial1</user>
<password></password>
<type>QuaggaCliDriver</type>
- <connect_order>6</connect_order>
+ <connect_order>7</connect_order>
<COMPONENTS> </COMPONENTS>
</QuaggaCliHost5>
<QuaggaCliHost>
@@ -63,7 +72,7 @@
<user>tutorial1</user>
<password></password>
<type>QuaggaCliDriver</type>
- <connect_order>7</connect_order>
+ <connect_order>8</connect_order>
<COMPONENTS> </COMPONENTS>
</QuaggaCliHost>
diff --git a/TestON/tests/PeeringRouterTest/mininet/PeeringRouterMininet.py b/TestON/tests/PeeringRouterTest/mininet/PeeringRouterMininet.py
index 9ab4bf1..6991916 100755
--- a/TestON/tests/PeeringRouterTest/mininet/PeeringRouterMininet.py
+++ b/TestON/tests/PeeringRouterTest/mininet/PeeringRouterMininet.py
@@ -22,12 +22,14 @@
import os.path
import time
+import sys
from subprocess import Popen, STDOUT, PIPE
QUAGGA_DIR = '/usr/lib/quagga'
#QUAGGA_DIR = '/usr/local/sbin'
QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
+QUAGGA_CONFIG_FILE_DIR = '/home/tutorial1/ONLabTest/TestON/tests/PeeringRouterTest/mininet'
class SDNIpModifiedTopo( Topo ):
"SDN Ip Modified Topology"
@@ -126,7 +128,7 @@
def startquagga( host, num, config_file ):
info( '*** Starting Quagga on %s\n' % host )
- zebra_cmd = 'sudo %s/zebra -d -f zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' % (QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
+ zebra_cmd = 'sudo %s/zebra -d -f %s/zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' % (QUAGGA_DIR, QUAGGA_CONFIG_FILE_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
quagga_cmd = 'sudo %s/bgpd -d -f %s -z %s/zserv%s.api -i %s/bgpd%s.pid' % (QUAGGA_DIR, config_file, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
print zebra_cmd
@@ -137,7 +139,7 @@
def startquaggahost5( host, num ):
info( '*** Starting Quagga on %s\n' % host )
- zebra_cmd = 'sudo %s/zebra -d -f zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' % (QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
+ zebra_cmd = 'sudo %s/zebra -d -f %s/zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' % (QUAGGA_DIR, QUAGGA_CONFIG_FILE_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
quagga_cmd = 'sudo %s/bgpd -d -f ./as4quaggas/quagga%s.conf -z %s/zserv%s.api -i %s/bgpd%s.pid' % (QUAGGA_DIR, num, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num)
host.cmd( zebra_cmd )
@@ -285,14 +287,14 @@
# as6router.setIP('172.16.70.%d' % (baseip+2), 30, 'as6router-eth%d' % (i+1))
# Start Quagga on border routers
- startquagga(host3, 1, 'quagga1.conf')
- startquagga(host4, 2, 'quagga2.conf')
+ startquagga(host3, 1, QUAGGA_CONFIG_FILE_DIR + '/quagga1.conf')
+ startquagga(host4, 2, QUAGGA_CONFIG_FILE_DIR + '/quagga2.conf')
#for i in range(numHost101, numHost200 + 1):
#host100=net.get('host%d' % (i))
#startquaggahost5(host100, i)
#startquagga(as6rs, 4, 'quagga-as6-rs.conf')
- startquagga(host5, 5, 'quagga-as6.conf')
+ startquagga(host5, 5, QUAGGA_CONFIG_FILE_DIR + '/quagga-as6.conf')
#root1, root2, rootTestOn = net.get( 'root1', 'root2', 'rootTestOn' )
root1, rootTestOn = net.get( 'root1', 'rootTestOn' )
@@ -306,7 +308,7 @@
stopsshd()
- startquagga(host1, 100, 'quagga-sdn-modified.conf')
+ startquagga(host1, 100, QUAGGA_CONFIG_FILE_DIR + '/quagga-sdn-modified.conf')
hosts = [ host1, host3, host4, host5, as2host ];
#sshdHosts = sshdHosts + hosts
startsshds( hosts )
@@ -330,4 +332,6 @@
if __name__ == '__main__':
setLogLevel( 'debug' )
+ if len(sys.argv) > 1:
+ QUAGGA_CONFIG_FILE_DIR = sys.argv[1]
sdn1net()