initial commit for code clean up
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
index 7856a28..c0325a9 100644
--- a/TestON/tests/OnosCHO/OnosCHO.params
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -12,7 +12,7 @@
# 10. Remove all intents on ONOS
# 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
- <testcases>1,2,3,9</testcases>
+ <testcases>1,2,3,[4,5,6,5,70,80,5,10,5,9,5,71,81,5,10,5]*100</testcases>
<ENV>
<cellName>choTest5</cellName>
</ENV>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 3a838fa..228843e 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -6,7 +6,9 @@
import json
import itertools
+
class OnosCHO:
+
def __init__(self):
self.default = ''
global deviceDPIDs
@@ -16,6 +18,7 @@
global devicePortsEnabledCount
global installedIntents
global randomLink1, randomLink2, randomLink3, numSwitches, numLinks
+
def CASE1(self, main):
'''
Startup sequence:
@@ -109,12 +112,13 @@
main.step("Start ONOS CLI on all nodes")
cliResult = main.TRUE
+ karafTimeout = "3600000"
time.sleep(15) # need to wait here for sometime. This will be removed once ONOS is stable enough
for i in range(1,int(numCtrls)+1):
ONOS_ip = main.params['CTRL']['ip'+str(i)]
ONOScli = 'ONOScli'+str(i)
main.log.info("ONOS Node "+ONOS_ip+" cli start:")
- exec "startcli=main."+ONOScli+".start_onos_cli(ONOS_ip)"
+ exec "startcli=main."+ONOScli+".start_onos_cli(ONOS_ip, karafTimeout=karafTimeout)"
utilities.assert_equals(expect=main.TRUE, actual=startcli,
onpass="Test step PASS",
onfail="Test step FAIL")
@@ -267,6 +271,7 @@
ONOScli = 'ONOScli'+str(i)
main.log.info("Enabling Reactive mode on ONOS Node "+ONOS_ip)
exec "inResult=main."+ONOScli+".feature_install(onosFeature)"
+ time.sleep(3)
installResult = inResult and installResult
time.sleep(5)
@@ -388,9 +393,9 @@
onpass="Install 300 Host Intents and Ping All test PASS",
onfail="Install 300 Host Intents and Ping All test FAIL")
- def CASE7(self,main):
+ def CASE70(self,main):
'''
- Randomly bring some core links down and verify ping all
+ Randomly bring some core links down and verify ping all (Host Intents Scenario)
'''
import random
ONOS1_ip = main.params['CTRL']['ip1']
@@ -403,9 +408,9 @@
switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
link_sleep = int(main.params['timers']['LinkDiscovery'])
- main.log.report("Randomly bring some core links down and verify ping all")
- main.log.report("____________________________________________________")
- main.case("Randomly bring some core links down and verify ping all")
+ main.log.report("Host intents - Randomly bring some core links down and verify ping all")
+ main.log.report("_________________________________________________________________")
+ main.case("Host intents - Randomly bring some core links down and verify ping all")
main.step("Verify number of Switch links to toggle on each Core Switch are between 1 - 5")
if (int(switchLinksToToggle) == 0 or int(switchLinksToToggle) > 5):
main.log.info("Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5")
@@ -446,9 +451,9 @@
onpass="Random Link cut Test PASS",
onfail="Random Link cut Test FAIL")
- def CASE8(self,main):
+ def CASE80(self,main):
'''
- Bring the core links up that are down and verify ping all
+ Bring the core links up that are down and verify ping all (Host Intents Scenario)
'''
import random
ONOS1_ip = main.params['CTRL']['ip1']
@@ -458,9 +463,9 @@
link_sleep = int(main.params['timers']['LinkDiscovery'])
switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
- main.log.report("Bring the core links up that are down and verify ping all")
- main.log.report("_____________________________________________________")
- main.case("Bring the core links up that are down and verify ping all")
+ main.log.report("Host intents - Bring the core links up that are down and verify ping all")
+ main.log.report("__________________________________________________________________")
+ main.case("Host intents - Bring the core links up that are down and verify ping all")
main.step("Bring randomly cut links on Core devices up")
for i in range(int(switchLinksToToggle)):
main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="up")
@@ -490,6 +495,108 @@
onpass="Link Up Test PASS",
onfail="Link Up Test FAIL")
+ def CASE71(self,main):
+ '''
+ Randomly bring some core links down and verify ping all (Point Intents Scenario)
+ '''
+ import random
+ ONOS1_ip = main.params['CTRL']['ip1']
+ link1End1 = main.params['CORELINKS']['linkS3a']
+ link1End2 = main.params['CORELINKS']['linkS3b'].split(',')
+ link2End1 = main.params['CORELINKS']['linkS14a']
+ link2End2 = main.params['CORELINKS']['linkS14b'].split(',')
+ link3End1 = main.params['CORELINKS']['linkS18a']
+ link3End2 = main.params['CORELINKS']['linkS18b'].split(',')
+ switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+ link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+ main.log.report("Point Intents - Randomly bring some core links down and verify ping all")
+ main.log.report("__________________________________________________________________")
+ main.case("Point Intents - Randomly bring some core links down and verify ping all")
+ main.step("Verify number of Switch links to toggle on each Core Switch are between 1 - 5")
+ if (int(switchLinksToToggle) == 0 or int(switchLinksToToggle) > 5):
+ main.log.info("Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5")
+ main.cleanup()
+ main.exit()
+ else:
+ main.log.info("User provided Core switch links range to toggle is correct, proceeding to run the test")
+
+ main.step("Cut links on Core devices using user provided range")
+ randomLink1 = random.sample(link1End2,int(switchLinksToToggle))
+ randomLink2 = random.sample(link2End2,int(switchLinksToToggle))
+ randomLink3 = random.sample(link3End2,int(switchLinksToToggle))
+ for i in range(int(switchLinksToToggle)):
+ main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="down")
+ main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="down")
+ main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="down")
+ time.sleep(link_sleep)
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.check_status(topology_output,numSwitches,str(int(numLinks)-int(switchLinksToToggle)*6))
+ utilities.assert_equals(expect=main.TRUE,actual=linkDown,
+ onpass="Link Down discovered properly",
+ onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+
+ main.step("Verify Ping across all hosts")
+ pingResultLinkDown = main.FALSE
+ time1 = time.time()
+ pingResultLinkDown = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round((time2-time1),2)
+ main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+ utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkDown,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL")
+
+ caseResult7 = linkDown and pingResultLinkDown
+ utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
+ onpass="Random Link cut Test PASS",
+ onfail="Random Link cut Test FAIL")
+
+ def CASE81(self,main):
+ '''
+ Bring the core links up that are down and verify ping all (Point Intents Scenario)
+ '''
+ import random
+ ONOS1_ip = main.params['CTRL']['ip1']
+ link1End1 = main.params['CORELINKS']['linkS3a']
+ link2End1 = main.params['CORELINKS']['linkS14a']
+ link3End1 = main.params['CORELINKS']['linkS18a']
+ link_sleep = int(main.params['timers']['LinkDiscovery'])
+ switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+
+ main.log.report("Point intents - Bring the core links up that are down and verify ping all")
+ main.log.report("___________________________________________________________________")
+ main.case("Point intents - Bring the core links up that are down and verify ping all")
+ main.step("Bring randomly cut links on Core devices up")
+ for i in range(int(switchLinksToToggle)):
+ main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="up")
+ main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="up")
+ main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="up")
+ time.sleep(link_sleep)
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.check_status(topology_output,numSwitches,str(numLinks))
+ utilities.assert_equals(expect=main.TRUE,actual=linkUp,
+ onpass="Link up discovered properly",
+ onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+
+ main.step("Verify Ping across all hosts")
+ pingResultLinkUp = main.FALSE
+ time1 = time.time()
+ pingResultLinkUp = main.Mininet1.pingall()
+ time2 = time.time()
+ timeDiff = round((time2-time1),2)
+ main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+ utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkUp,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL")
+
+ caseResult8 = linkUp and pingResultLinkUp
+ utilities.assert_equals(expect=main.TRUE, actual=caseResult8,
+ onpass="Link Up Test PASS",
+ onfail="Link Up Test FAIL")
+
def CASE9(self):
'''
Install 114 point intents and verify Ping all works