enable login multiple Quaggas && add new test Case1
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 19717fb..0f84bc0 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -39,7 +39,6 @@
return main.FALSE
def loginQuagga(self, ip_address):
-
self.name = self.options['name']
self.handle = super(QuaggaCliDriver, self).connect(
user_name=self.user_name, ip_address=ip_address,
@@ -56,7 +55,7 @@
self.handle.expect("bgpd", timeout=5)
self.handle.sendline("enable")
self.handle.expect("bgpd#", timeout=5)
- main.log.info("I am inside BGP peer Quagga!")
+ main.log.info("I in quagga on host " + str(ip_address))
return self.handle
else:
@@ -120,7 +119,7 @@
else:
ingress.append("of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort']) )
- selector = "[IPV4_DST{ip=" + prefix + "}, ETH_TYPE{ethType=800}]"
+ selector = "[ETH_TYPE{ethType=800}, IPV4_DST{ip=" + prefix + "}]"
treatment = "[ETH_DST{mac=" + str(nextHopMac) + "}]"
intent = egress + "/" + str(sorted(ingress)) + "/" + selector + "/" + treatment
@@ -158,7 +157,7 @@
def extract_actual_routeIntents(self, get_intents_result):
intents = []
# TODO: delete the line below when change to Mininet demo script
- get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+ # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
intents_json_obj = json.loads(get_intents_result)
for intent in intents_json_obj:
@@ -177,7 +176,7 @@
def extract_actual_bgpIntents(self, get_intents_result):
intents = []
# TODO: delete the line below when change to Mininet demo script
- get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+ # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
intents_json_obj = json.loads(get_intents_result)
for intent in intents_json_obj:
@@ -274,7 +273,7 @@
except:
main.log.warn("Probably not in config-router mode!")
self.disconnect()
- main.log.report("Adding Routes")
+ main.log.info("Adding Routes")
j=0
k=0
while numRoutes > 255:
@@ -321,7 +320,7 @@
except:
main.log.warn("Probably not in config-router mode!")
self.disconnect()
- main.log.report("Deleting Routes")
+ main.log.info("Deleting Routes")
j=0
k=0
while numRoutes > 255:
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
index dd73766..543bea2 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -1,3 +1,4 @@
+from cupshelpers.config import prefix
#Testing the basic functionality of SDN-IP
@@ -24,38 +25,51 @@
SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
# all expected routes for all BGP peers
allRoutes_expected = []
- main.step("Start to generate routes for BGP peer on host1")
- prefixes = main.Quaggacli.generate_prefixes(1, 3)
- main.log.info(prefixes)
+ main.step("Start to generate routes for all BGP peers")
+ #bgpPeerHosts = []
+ #for i in range(3, 5):
+ # bgpPeerHosts.append("host" + str(i))
+ #main.log.info("BGP Peer Hosts are:" + bgpPeerHosts)
- # TODO: delete the static prefix below after integration with Demo Mininet script
- prefixes = []
- prefixes.append("172.16.30.0/24")
- prefixes.append("1.0.0.0/24")
- prefixes.append("2.0.0.0/24")
- prefixes.append("3.0.0.0/24")
+ #for i in range(3, 5):
+ # QuaggaCliHost = "QuaggaCliHost" + str(i)
+ # prefixes = main.QuaggaCliHost.generate_prefixes(3, 10)
+ # main.log.info(prefixes)
+ #allRoutes_expected.append(prefixes)
+ main.log.info("Generate prefixes for host3")
+ prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
+ main.log.info(prefixes_host3)
+ # generate route with next hop
+ for prefix in prefixes_host3:
+ allRoutes_expected.append(prefix + "/" + "192.168.20.1")
+ routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
- for prefix in prefixes:
- # generate route with next hop
- allRoutes_expected.append(prefix + "/" + "1.1.1.1")
+ main.log.info("Generate prefixes for host4")
+ prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
+ main.log.info(prefixes_host4)
+ # generate route with next hop
+ for prefix in prefixes_host4:
+ allRoutes_expected.append(prefix + "/" + "192.168.30.1")
+ routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
- routeIntents_expected = main.Quaggacli.generate_expected_onePeerRouteIntents(prefixes, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+ routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
- # start to insert routes into the bgp peer
- main.step("Start Quagga-cli on host1")
- main.Quaggacli.loginQuagga("1.1.1.1")
+ main.step("Login all BGP peers and add routes into peers")
+ main.log.info("Login Quagga CLI on host3")
+ main.QuaggaCliHost3.loginQuagga("1.168.30.2")
+ main.log.info("Enter configuration model of Quagga CLI on host3")
+ main.QuaggaCliHost3.enter_config(64514)
+ main.log.info("Add routes to Quagga on host3")
+ main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
- main.step("Start to configure Quagga on host1")
- main.Quaggacli.enter_config(64513)
-
- main.step("Start to generate and add routes for BGP peer on host1")
- routes = main.Quaggacli.generate_prefixes(8, 3)
- main.Quaggacli.add_routes(routes, 1)
-
- # add generates routes to allRoutes
- for route in routes:
- allRoutes_expected.append(route + "/" + "1.1.1.1")
+ main.log.info("Login Quagga CLI on host4")
+ main.QuaggaCliHost4.loginQuagga("1.168.30.3")
+ main.log.info("Enter configuration model of Quagga CLI on host4")
+ main.QuaggaCliHost4.enter_config(64516)
+ main.log.info("Add routes to Quagga on host4")
+ main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
+
cell_name = main.params['ENV']['cellName']
ONOS1_ip = main.params['CTRL']['ip1']
@@ -77,42 +91,46 @@
main.log.info(list_result)
#get all routes inside SDN-IP
- get_routes_result = main.ONOScli.routes(json_format=True)
+ get_routes_result = main.ONOScli.routes(json_format=True)
# parse routes from ONOS CLI
- allRoutes_actual = main.Quaggacli.extract_actual_routes(get_routes_result)
+ allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+ allRoutes_str_expected = str(sorted(allRoutes_expected))
+ allRoutes_str_actual = str(allRoutes_actual).replace('u',"")
main.step("Check routes installed")
main.log.info("Routes expected:")
- main.log.info(sorted(allRoutes_expected))
+ main.log.info(allRoutes_str_expected)
main.log.info("Routes get from ONOS CLI:")
- main.log.info(allRoutes_actual)
- utilities.assert_equals(expect=sorted(allRoutes_expected), actual=allRoutes_actual,
+ main.log.info(allRoutes_str_actual)
+ utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
onpass="***Routes in SDN-IP are correct!***",
onfail="***Routes in SDN-IP are wrong!***")
- time.sleep(2)
+ time.sleep(20)
get_intents_result = main.ONOScli.intents(json_format=True)
main.step("Check MultiPointToSinglePointIntent intents installed")
# route_intents_expected are generated when generating routes
# get rpoute intents from ONOS CLI
- routeIntents_actual = main.Quaggacli.extract_actual_routeIntents(get_intents_result)
+ routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+ routeIntents_str_expected = str(sorted(routeIntents_expected))
+ routeIntents_str_actual = str(routeIntents_actual).replace('u',"")
main.log.info("MultiPointToSinglePoint intents expected:")
- main.log.info(routeIntents_expected)
+ main.log.info(routeIntents_str_expected)
main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
- main.log.info(routeIntents_actual)
- utilities.assert_equals(expect=True, actual=eq(routeIntents_expected, routeIntents_actual),
+ main.log.info(routeIntents_str_actual)
+ utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
main.step("Check BGP PointToPointIntent intents installed")
# bgp intents expected
- bgpIntents_expected = main.Quaggacli.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+ bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
# get BGP intents from ONOS CLI
- bgpIntents_actual = main.Quaggacli.extract_actual_bgpIntents(get_intents_result)
+ bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
bgpIntents_str_expected = str(bgpIntents_expected).replace('u',"")
bgpIntents_str_actual = str(bgpIntents_actual)
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.topo b/TestON/tests/SdnIpTest/SdnIpTest.topo
index 1d23878..a2d9616 100755
--- a/TestON/tests/SdnIpTest/SdnIpTest.topo
+++ b/TestON/tests/SdnIpTest/SdnIpTest.topo
@@ -28,14 +28,30 @@
<COMPONENTS> </COMPONENTS>
</ONOS1>
- <Quaggacli>
+ <QuaggaCliHost3>
<host>127.0.0.1</host>
<user>username</user>
<password>password</password>
<type>QuaggaCliDriver</type>
<connect_order>5</connect_order>
<COMPONENTS> </COMPONENTS>
- </Quaggacli>
+ </QuaggaCliHost3>
+ <QuaggaCliHost4>
+ <host>127.0.0.1</host>
+ <user>username</user>
+ <password>password</password>
+ <type>QuaggaCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </QuaggaCliHost4>
+ <QuaggaCliHost5>
+ <host>127.0.0.1</host>
+ <user>username</user>
+ <password>password</password>
+ <type>QuaggaCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </QuaggaCliHost5>
</COMPONENT>
</TOPOLOGY>