Merge "ONOS-2000 Added Leader Candidate Functions"
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index a02871b..1b8bdbd 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -255,7 +255,7 @@
try :
for index, option in enumerate(args):
if index > 0 :
- if re.match("logdir|mail|example|testdir|testcases", option, flags = 0):
+ if re.match("logdir|mail|example|testdir|testcases|onoscell", option, flags = 0):
index = index+1
options[option] = args[index]
options = self.testcasesInRange(index,option,args,options)
@@ -275,6 +275,7 @@
options['example'] = None
options['testdir'] = None
options['testcases'] = None
+ options['onoscell'] = None
return options
def testcasesInRange(self,index,option,args,options):
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 7e99ffd..e4dbf9d 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -93,6 +93,7 @@
self.Thread = Thread
self.cleanupFlag = False
self.cleanupLock = threading.Lock()
+ self.initiated = False
self.configparser()
verifyOptions(options)
@@ -151,6 +152,7 @@
This method will initialize specified component
'''
global driver_options
+ self.initiated = False
self.log.info("Creating component Handle: "+component)
driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
@@ -165,21 +167,6 @@
driverClass = getattr(driverModule, driverName)
driverObject = driverClass()
- if "OC" in self.componentDictionary[component]['host']:
- try:
- self.componentDictionary[component]['host'] = os.environ[str( self.componentDictionary[component]['host'])]
- except KeyError:
- self.log.info("Missing OC environment variable! Using stored IPs")
- f = open("myIps","r")
- ips = f.readlines()
- for line in ips:
- if self.componentDictionary[component]['host'] in line:
- line = line.split("=")
- myIp = line[1]
- self.componentDictionary[component]['host'] = myIp
- except Exception as inst:
- self.log.error("Uncaught exception: " + str(inst))
-
connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
@@ -191,6 +178,7 @@
self.exit()
vars(self)[component] = driverObject
+ self.initiated = True
def run(self):
'''
@@ -368,7 +356,8 @@
try:
if self.cleanupFlag is False: # First thread to run this
self.cleanupFlag = True
- self.logger.testSummary(self)
+ if self.initiated:
+ self.logger.testSummary(self)
for component in self.componentDictionary.keys():
try :
tempObject = vars(self)[component]
@@ -628,6 +617,7 @@
verifyLogdir(options)
verifyMail(options)
verifyTestCases(options)
+ verifyOnosCell(options)
def verifyTest(options):
if options.testname:
@@ -692,6 +682,13 @@
print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
sys.exit()
+def verifyOnosCell(options):
+ # Verifying onoscell option. This could be extended to do even more from here.
+ if options.onoscell:
+ main.onoscell = options.onoscell
+ else :
+ main.onoscell = main.FALSE
+
def verifyTestScript(options):
'''
Verifyies test script.
diff --git a/TestON/dependencies/Jenkins_getresult_HA.py b/TestON/dependencies/Jenkins_getresult_HA.py
deleted file mode 100755
index 181e1a9..0000000
--- a/TestON/dependencies/Jenkins_getresult_HA.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import os
-import re
-import datetime
-import time
-import argparse
-import glob
-import shutil
-
-parser = argparse.ArgumentParser()
-parser.add_argument("-n", "--name", help="Comma Separated string of test names. Ex: --name='test1, test2, test3'")
-parser.add_argument("-w", "--workspace", help="The name of the Jenkin's job/workspace where csv files will be saved'")
-args = parser.parse_args()
-
-#Pass in test names as a comma separated string argument.
-#Example: ./Jenkins_getresult.py "Test1,Test2,Test3,Test4"
-name_list = args.name.split(",")
-result_list = map(lambda x: x.strip(), name_list)
-job = args.workspace
-if job is None:
- job = ""
-print job
-
-#NOTE: testnames list should be in order in which it is run
-testnames = result_list
-output = ''
-header = ''
-graphs = ''
-testdate = datetime.datetime.now()
-#workspace = "/var/lib/jenkins/workspace/ONOS-HA"
-workspace = "/var/lib/jenkins/workspace/"
-workspace = workspace + job
-
-header +="<p>**************************************</p>"
-header +=testdate.strftime('Jenkins test result for %H:%M on %b %d, %Y. %Z')
-
-
-#NOTE: CASE SPECIFIC THINGS
-
-#THIS LINE IS LOUSY FIXME
-if any("HA" in s for s in testnames):
- ##Graphs
- graphs += '<ac:structured-macro ac:name="html">\n'
- graphs += '<ac:plain-text-body><![CDATA[\n'
- graphs += '<iframe src="https://onos-jenkins.onlab.us/job/'+job+'/plot/Plot-HA/getPlot?index=2&width=500&height=300" noborder="0" width="500" height="300" scrolling="yes" seamless="seamless"></iframe>\n'
- graphs += '<iframe src="https://onos-jenkins.onlab.us/job/'+job+'/plot/Plot-HA/getPlot?index=1&width=500&height=300" noborder="0" width="500" height="300" scrolling="yes" seamless="seamless"></iframe>\n'
- graphs += '<iframe src="https://onos-jenkins.onlab.us/job/'+job+'/plot/Plot-HA/getPlot?index=0&width=500&height=300" noborder="0" width="500" height="300" scrolling="yes" seamless="seamless"></iframe>\n'
- graphs += '<iframe src="https://onos-jenkins.onlab.us/job/'+job+'/plot/Plot-HA/getPlot?index=3&width=500&height=300" noborder="0" width="500" height="300" scrolling="yes" seamless="seamless"></iframe>\n'
- graphs += ']]></ac:plain-text-body>\n'
- graphs += '</ac:structured-macro>\n'
- header +="<p> <a href='https://wiki.onosproject.org/display/OST/Test+Plan+-+HA'>Test Plan for HA Test Cases</a></p>"
-
-
-# ***
-
-
-#TestON reporting
-for test in testnames:
- passes = 0
- fails = 0
- name = os.popen("ls /home/admin/ONLabTest/TestON/logs/ -rt | grep %s_ | tail -1" % test).read().split()[0]
- path = "/home/admin/ONLabTest/TestON/logs/" + name + "/"
- try:
- #IF exists, move the csv file to the workspace
- for csvFile in glob.glob( path + '*.csv' ):
- shutil.copy( csvFile, workspace )
- except IOError:
- #File probably doesn't exist
- pass
-
- output +="<p></p>"
- #output +=" Date: %s, %s %s" % (name.split("_")[2], name.split("_")[1], name.split("_")[3]) + "<p>*******************<p>"
- #Open the latest log folder
- output += "<h2>Test "+str(test)+"</h2><p>************************************</p>"
-
- f = open(path + name + ".rpt")
-
- #Parse through each line of logs and look for specific strings to output to wiki.
- #NOTE: with current implementation, you must specify which output to output to wiki by using
- #main.log.report("") since it is looking for the [REPORT] tag in the logs
- for line in f:
- if re.search("Result summary for Testcase", line):
- output += "<h3>"+str(line)+"</h3>"
- #output += "<br>"
- if re.search("\[REPORT\]", line):
- line_split = line.split("] ")
- #line string is split by bracket, and first two items (log tags) in list are omitted from output
- #join is used to convert list to string
- line_str = ''.join(line_split[2:])
- output += "<p>"
- output += line_str
- output += "</p>"
- if re.search("Result:", line):
- output += "<p>"
- output += line
- output += "</p>"
- if re.search("Pass", line):
- passes = passes + 1
- elif re.search("Fail", line):
- fails = fails + 1
- f.close()
- #https://wiki.onosproject.org/display/OST/Test+Results+-+HA#Test+Results+-+HA
- #Example anchor on new wiki: #TestResults-HA-TestHATestSanity
- page_name = "Master-HA"
- if "ONOS-HA-1.1.X" in job:
- page_name = "Blackbird-HA"
- elif "ONOS-HA-Maint" in job:
- # NOTE if page name starts with number confluence prepends 'id-'
- # to anchor links
- page_name = "id-1.0-HA"
-
- header += "<li><a href=\'#" + str(page_name) + "-Test" + str(test) + "\'> " + str(test) + " - Results: " + str(passes) + " Passed, " + str(fails) + " Failed</a></li>"
-
- #*********************
- #include any other phrase specific to case you would like to include in wiki here
- if test == "IntentPerf":
- output += "URL to Historical Performance results data: <a href='http://10.128.5.54perf.html'>Perf Graph</a>"
- #*********************
-
-#header_file = open("/tmp/header_ha.txt",'w')
-#header_file.write(header)
-output = header + graphs + output
-print output
diff --git a/TestON/dependencies/Jenkins_getresult_andrew.py b/TestON/dependencies/Jenkins_getresult_andrew.py
deleted file mode 100755
index 0e7ef8d..0000000
--- a/TestON/dependencies/Jenkins_getresult_andrew.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import os
-import re
-import datetime
-import time
-import argparse
-
-parser = argparse.ArgumentParser()
-parser.add_argument("-n", "--name", help="Comma Separated string of test names. Ex: --name='test1, test2, test3'")
-args = parser.parse_args()
-
-#Pass in test names as a comma separated string argument.
-#Example: ./Jenkins_getresult.py "Test1,Test2,Test3,Test4"
-name_list = args.name.split(",")
-result_list = map(lambda x: x.strip(), name_list)
-
-#NOTE: testnames list should be in order in which it is run
-testnames = result_list
-output = ''
-testdate = datetime.datetime.now()
-
-output +="<p>**************************************</p>"
-output +=testdate.strftime('Jenkins test result for %H:%M on %b %d, %Y. %Z')
-
-#TestON reporting
-for test in testnames:
- name = os.popen("ls /home/admin/ONLabTest/TestON/logs/ -rt | grep %s | tail -1" % test).read().split()[0]
- path = "/home/admin/ONLabTest/TestON/logs/" + name + "/"
- output +="<p></p>"
- #output +=" Date: %s, %s %s" % (name.split("_")[2], name.split("_")[1], name.split("_")[3]) + "<br>*******************<br>"
- #Open the latest log folder
- output += "<h2>Test "+str(test)+"</h2><p>************************************</p>"
-
- f = open(path + name + ".rpt")
-
- #Parse through each line of logs and look for specific strings to output to wiki.
- #NOTE: with current implementation, you must specify which output to output to wiki by using
- #main.log.report("") since it is looking for the [REPORT] tag in the logs
- for line in f:
- if re.search("Result summary for Testcase", line):
- output += "<h3>"+str(line)+"</h3>"
- #output += "<br>"
- if re.search("\[REPORT\]", line):
- line_split = line.split("] ")
- #line string is split by bracket, and first two items (log tags) in list are omitted from output
- #join is used to convert list to string
- line_str = ''.join(line_split[2:])
- output += "<p>"
- output += line_str
- output += "</p>"
- if re.search("Result:", line):
- output += "<p>"
- output += line
- output += "</p>"
- f.close()
-
- #*********************
- #include any other phrase specific to case you would like to include in wiki here
- if test == "IntentPerf":
- output += "URL to Historical Performance results data: <a href='http://10.128.5.54/perf.html'>Perf Graph</a>"
- #*********************
-print output
diff --git a/TestON/dependencies/loadgen_NB.py b/TestON/dependencies/loadgen_NB.py
deleted file mode 100755
index 78d18b9..0000000
--- a/TestON/dependencies/loadgen_NB.py
+++ /dev/null
@@ -1,225 +0,0 @@
-#! /usr/bin/env python
-from time import time, sleep
-import time
-import json
-import requests
-import urllib2
-from urllib2 import URLError, HTTPError
-
-'''
- This script is for Intent Throughput testing. Use linear 7-switch topo. Intents are from S1P1 to/from S7/P1, with incrementing src/dst Mac addresses.
-'''
-
-def setIntentJSN(node_id, intPerGroup, group_id, intent_id):
- intents = [None for i in range(intPerGroup)]
- oper = {}
- index = 0
- for i in range(intPerGroup / 2):
- smac = str("%x" %(node_id * 0x100000000000 + 0x010000000000 + (group_id * 0x000001000000) +i + 1))
- dmac = str("%x" %(node_id * 0x100000000000 + 0x070000000000 + (group_id * 0x000001000000) +i + 1))
- srcMac = ':'.join(smac[i:i+2] for i in range(0, len(smac), 2))
- dstMac = ':'.join(dmac[i:i+2] for i in range(0, len(dmac), 2))
- srcSwitch = "00:00:00:00:00:00:00:01"
- dstSwitch = "00:00:00:00:00:00:00:07"
- srcPort = 1
- dstPort = 1
-
- oper['intentId'] = intent_id
- oper['intentType'] = 'SHORTEST_PATH' # XXX: Hardcode
- oper['staticPath'] = False # XXX: Hardcoded
- oper['srcSwitchDpid'] = srcSwitch
- oper['srcSwitchPort'] = srcPort
- oper['dstSwitchDpid'] = dstSwitch
- oper['dstSwitchPort'] = dstPort
- oper['matchSrcMac'] = srcMac
- oper['matchDstMac'] = dstMac
- intents[index] = oper
- #print ("perGroup Intents-0 are: " + json.dumps(intents) + "\n\n\n" )
- index += 1
- intent_id += 1
- oper = {}
- #print ("ID:" + str(id))
-
- oper['intentId'] = intent_id
- oper['intentType'] = 'SHORTEST_PATH' # XXX: Hardcoded
- oper['staticPath'] = False # XXX: Hardcoded
- oper['srcSwitchDpid'] = dstSwitch
- oper['srcSwitchPort'] = dstPort
- oper['dstSwitchDpid'] = srcSwitch
- oper['dstSwitchPort'] = srcPort
- oper['matchSrcMac'] = dstMac
- oper['matchDstMac'] = srcMac
- intents[index] = oper
- index += 1
- intent_id += 1
- oper = {}
- #print ("ID: " + str(id))
- #print ("perGroup Intents-1 are: " + json.dumps(intents) + "\n\n\n" )
- #print ("contructed intents are: " + json.dumps(intents) + "\n\n\n")
- return intents, intent_id
-
-def post_json(url, data):
- """Make a REST POST call and return the JSON result
- url: the URL to call
- data: the data to POST"""
- posturl = "http://%s/wm/onos/intent/high" %(url)
- #print ("\nPost url is : " + posturl + "\n")
- parsed_result = []
- data_json = json.dumps(data)
- try:
- request = urllib2.Request(posturl, data_json)
- request.add_header("Content-Type", "application/json")
- response = urllib2.urlopen(request)
- result = response.read()
- response.close()
- if len(result) != 0:
- parsed_result = json.loads(result)
- except HTTPError as exc:
- print "ERROR:"
- print " REST POST URL: %s" % posturl
- # NOTE: exc.fp contains the object with the response payload
- error_payload = json.loads(exc.fp.read())
- print " REST Error Code: %s" % (error_payload['code'])
- print " REST Error Summary: %s" % (error_payload['summary'])
- print " REST Error Description: %s" % (error_payload['formattedDescription'])
- print " HTTP Error Code: %s" % exc.code
- print " HTTP Error Reason: %s" % exc.reason
- except URLError as exc:
- print "ERROR:"
- print " REST POST URL: %s" % posturl
- print " URL Error Reason: %s" % exc.reason
- return parsed_result
-
-def delete_json(self, url, intPerGroup, startID):
- """Make a REST DELETE call and return the JSON result
- url: the URL to call"""
- #url = "localhost:8080"
- for i in range(intPerGroup):
- posturl = "http://%s/wm/onos/intent/high/%s" %(url, str(i + startID))
- parsed_result = []
- try:
- request = urllib2.Request(posturl)
- request.get_method = lambda: 'DELETE'
- response = urllib2.urlopen(request)
- result = response.read()
- response.close()
- #if len(result) != 0:
- # parsed_result = json.loads(result)
- except HTTPError as exc:
- print "ERROR:"
- print " REST DELETE URL: %s" % posturl
- # NOTE: exc.fp contains the object with the response payload
- error_payload = json.loads(exc.fp.read())
- print " REST Error Code: %s" % (error_payload['code'])
- print " REST Error Summary: %s" % (error_payload['summary'])
- print " REST Error Description: %s" % (error_payload['formattedDescription'])
- print " HTTP Error Code: %s" % exc.code
- print " HTTP Error Reason: %s" % exc.reason
- except URLError as exc:
- print "ERROR:"
- print " REST DELETE URL: %s" % posturl
- print " URL Error Reason: %s" % exc.reason
- return parsed_result
-
-def delete_all_json(url):
- """Make a REST DELETE call and return the JSON result
- url: the URL to call"""
- #url = "localhost:8080"
- posturl = "http://%s/wm/onos/intent/high" %(url)
- parsed_result = []
- try:
- request = urllib2.Request(posturl)
- request.get_method = lambda: 'DELETE'
- response = urllib2.urlopen(request)
- result = response.read()
- response.close()
- if len(result) != 0:
- parsed_result = json.loads(result)
- except HTTPError as exc:
- print "ERROR:"
- print " REST DELETE URL: %s" % posturl
- # NOTE: exc.fp contains the object with the response payload
- error_payload = json.loads(exc.fp.read())
- print " REST Error Code: %s" % (error_payload['code'])
- print " REST Error Summary: %s" % (error_payload['summary'])
- print " REST Error Description: %s" % (error_payload['formattedDescription'])
- print " HTTP Error Code: %s" % exc.code
- print " HTTP Error Reason: %s" % exc.reason
- except URLError as exc:
- print "ERROR:"
- print " REST DELETE URL: %s" % posturl
- print " URL Error Reason: %s" % exc.reason
- return parsed_result
-
-def loadIntents(node_id, urllist, intPerGroup, addrate, duration):
- urlindex = 0
- group = 0
- start_id = 0
- sleeptimer = (1.000/addrate)
- tstart = time.time()
- while ( (time.time() - tstart) <= duration ):
- if urlindex < len(urllist):
- realurlind = urlindex
- else:
- realurlind = 0
- urlindex = 0
-
- u = str(urllist[realurlind])
- gstart = time.time()
- intents,start_id = setIntentJSN(node_id, intPerGroup, group, start_id)
- #print (str(intents))
- #print ("Starting intent id: " + str(start_id))
- result = post_json(u, intents)
- #print json.dumps(intents[group])
- #print ("post result: " + str(result))
- gelapse = time.time() - gstart
- print ("Group: " + str(group) + " with " + str(intPerGroup) + " intents were added in " + str('%.3f' %gelapse) + " seconds.")
- sleep(sleeptimer)
- urlindex += 1
- group += 1
-
- telapse = time.time() - tstart
- #print ( "Number of groups: " + str(group) + "; Totoal " + str(args.groups * args.intPerGroup) + " intents were added in " + str(telapse) + " seconds.")
- return telapse, group
-
-def main():
- import argparse
-
- parser = argparse.ArgumentParser(description="less script")
- parser.add_argument("-n", "--node_id", dest="node_id", default = 1, type=int, help="id of the node generating the intents, this is used to distinguish intents when multiple nodes are use to generate intents")
- parser.add_argument("-u", "--urls", dest="urls", default="10.128.10.1", type=str, help="a string to show urls to post intents to separated by space, ex. '10.128.10.1:8080 10.128.10.2:80080' ")
- parser.add_argument("-i", "--intentsPerGroup", dest="intPerGroup", default=100, type=int, help="number of intents in one restcall group")
- parser.add_argument("-a", "--addrate", dest="addrate", default=10, type=float, help="rate to add intents groups, groups per second")
- parser.add_argument("-d", "--delrate", dest="delrate", default=100, type=float, help= "### Not Effective -for now intents are delete as bulk #### rate to delete intents, intents/second")
- parser.add_argument("-l", "--length", dest="duration", default=300, type=int, help="duration/length of time the intents are posted")
- parser.add_argument("-p", "--pause", dest="pause", default=0, type=int, help= "pausing time between add and delete of intents")
- args = parser.parse_args()
-
- node_id = args.node_id
- urllist = args.urls.split()
- intPerGroup = args.intPerGroup
- addrate = args.addrate
- delrate = args.delrate
- duration = args.duration
- pause = args.pause
-
- print ("Intent posting urls are: " + str(urllist))
- print ("Number of Intents per group: " + str(intPerGroup))
- print ("Intent group add rate: " + str(addrate) )
- print ("Intent delete rate:" + str(delrate) )
- print ("Duration: " + str(duration) )
- print ("Pause between add and delete: " + str(args.pause))
-
- telapse, group = loadIntents(node_id, urllist, intPerGroup, addrate, duration)
- print ("\n\n#####################")
- print ( str(group) + " groups " + " of " + str(intPerGroup) + " Intents per group - Total " + str(group * intPerGroup) + " intents were added in " + str('%.3f' %telapse) + " seconds.")
- print ( "Effective intents posting rate is: " + str( '%.1f' %( (group * intPerGroup)/telapse ) ) + " Intents/second." )
- print ("#####################\n\n")
- print ("Sleep for " + str(pause) + " seconds before deleting all intents...")
- time.sleep(pause)
- print ("Cleaning up intents in all nodes...")
- for url in urllist:
- delete_all_json(url)
-
-if __name__ == '__main__':
- main()
diff --git a/TestON/dependencies/loadgen_SB.py b/TestON/dependencies/loadgen_SB.py
deleted file mode 100755
index cfd2adf..0000000
--- a/TestON/dependencies/loadgen_SB.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/python
-
-"""
-This example shows how to create an empty Mininet object
-(without a topology object) and add nodes to it manually.
-"""
-import sys
-import subprocess
-import time
-from mininet.net import Mininet
-from mininet.node import Controller
-from mininet.cli import CLI
-from mininet.log import setLogLevel, info
-
-swlist = []
-hostlist= []
-count = 0
-
-def createSwPorts(numsw, numport):
-
- "Create an empty network and add nodes to it."
-
- net = Mininet()
- swlist = []
- hostlist= []
- print ("Starting Mininet Network....")
- for i in range(numsw):
- sw = net.addSwitch( 's' + str(i), dpid = ('00000000000000' + '%0d'%i))
- print str(sw),
- for p in range(numport):
- host = net.addHost("s"+str(i)+"h"+str(p))
- hostlist.append(host)
- print str(host),
- net.addLink(host,sw)
- swlist.append(sw)
-
-
- info( '*** Starting network\n')
- net.start()
-
- return swlist
-
-def loadsw(urllist, swlist, addrate, delrate, duration):
- global numport
- urlindex = 0
- count = 0
- addsleeptimer = 1.000 /addrate
- delsleeptimer = 1.000/delrate
- print (" Add sleeptimer: " + str('%.3f' %addsleeptimer) + "; Delete sleeptimer: " + str('%.3f' %delsleeptimer))
- print str(swlist)
-
- tstart = time.time()
- while ( (time.time() - tstart) <= duration ):
- #print (time.time() - tstart)
- astart = time.time()
- for sw in swlist:
- if urlindex < len(urllist):
- i = urlindex
- else:
- i = 0
- urlindex = 0
-
- ovscmd = "sudo ovs-vsctl set-controller " + str(sw) + " tcp:" + urllist[i]
- print ("a"),
- s = subprocess.Popen(ovscmd, shell=True )
- time.sleep(addsleeptimer)
- count += 1
- urlindex += 1
- aelapse = time.time() - astart
- print ("Number of switches connected: " + str(len(swlist)) + " in: " + str('%.3f' %aelapse) + "seconds.")
-
- dstart = time.time()
- for sw in swlist:
- ovscmd = "sudo ovs-vsctl set-controller " + str(sw) + " tcp:127.0.0.1:6633"
- print ("d"),
- s = subprocess.Popen(ovscmd, shell=True )
- time.sleep(delsleeptimer)
- count += 1
- delapse = time.time() - dstart
- print ("Number of switches disconnected: " + str(len(swlist)) + " in: " + str('%.3f' %delapse) + "seconds.")
- telapse = time.time() - tstart
-
- return telapse, count
-def cleanMN():
- print ("Cleaning MN switches...")
- s = subprocess.Popen("sudo mn -c > /dev/null 2>&1", shell=True)
- print ("Done.")
-
-def main():
- import argparse
- import threading
- from threading import Thread
-
- parser = argparse.ArgumentParser(description="less script")
- parser.add_argument("-u", "--urls", dest="urls", default="10.128.10.1", type=str, help="a string to show urls to post intents to separated by space, ex. '10.128.10.1:6633 10.128.10.2:6633' ")
- parser.add_argument("-s", "--switches", dest="numsw", default=100, type=int, help="number of switches use in the load generator; together with the ports per switch config, each switch generates (numport + 2) events")
- parser.add_argument("-p", "--ports", dest="numport", default=1, type=int, help="number of ports per switches")
- parser.add_argument("-a", "--addrate", dest="addrate", default=10, type=float, help="rate to add intents groups, groups per second")
- parser.add_argument("-d", "--delrate", dest="delrate", default=100, type=float, help= "rate to delete intents, intents/second")
- parser.add_argument("-l", "--testlength", dest="duration", default=0, type=int, help= "pausing time between add and delete of intents")
- args = parser.parse_args()
-
- urllist = args.urls.split()
- numsw = args.numsw
- numport = args.numport
- addrate = args.addrate
- delrate = args.delrate
- duration = args.duration
- setLogLevel( 'info' )
- swlist = createSwPorts(numsw,numport)
- telapse,count = loadsw(urllist, swlist, addrate, delrate, duration)
- print ("Total number of switches connected/disconnected: " + str(count) + "; Total events generated: " + str(count * (2 + numport)) + "; Elalpse time: " + str('%.1f' %telapse))
- print ("Effective aggregated loading is: " + str('%.1f' %((( count * (2+ numport))) / telapse ) ) + "Events/s.")
- cleanMN()
-
-if __name__ == '__main__':
- main()
diff --git a/TestON/dependencies/rotate.sh b/TestON/dependencies/rotate.sh
deleted file mode 100755
index 7136ac6..0000000
--- a/TestON/dependencies/rotate.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-
-# NOTE: Taken fnd modified from onos.sh
-# pack-rotate-log [packname] "[log-filenames]" [max rotations]
-# Note: [packname] and all the log-files specified by [log-filenames]
-# must reside in same dir
-# Example:
-# pack="/foo/bar/testlogs"
-# logfiles="/foo/bar/test1.log /foo/bar/test*.log"
-# pack-rotate-log $pack "$logfiles" 5
-# => testlogs.tar.bz2 (will contain test1.log test2.log ...)
-# testlogs.tar.bz2 -> testlogs.1.tar.bz2
-# testlogs.1.tar.bz2 -> testlogs.2.tar.bz2
-# ...
-function pack-rotate-log {
- local packname=$1
- local logfiles=$2
- local nr_max=${3:-10}
- local suffix=".tar.bz2"
-
- # rotate
- for i in `seq $(expr $nr_max - 1) -1 1`; do
- if [ -f ${packname}.${i}${suffix} ]; then
- mv -f -- ${packname}.${i}${suffix} ${packname}.`expr $i + 1`${suffix}
- fi
- done
- if [ -f ${packname}${suffix} ]; then
- mv -- ${packname}${suffix} ${packname}.1${suffix}
- fi
-
- # pack
- local existing_logfiles=$( ls -1 $logfiles 2>/dev/null | xargs -n1 basename 2>/dev/null)
- if [ ! -z "${existing_logfiles}" ]; then
- tar cjf ${packname}${suffix} -C `dirname ${packname}` -- ${existing_logfiles}
- for word in ${existing_logfiles}
- do
- rm -- `dirname ${packname}`/${word}
- done
- fi
-}
-
-
-
-#Begin script
-#NOTE: This seems to break the TestON summary since it mentions the testname
-#echo "Rotating logs for '${1}' test"
-base_name=$1
-root_dir="/home/admin/packet_captures"
-timestamp=`date +%Y_%B_%d_%H_%M_%S`
-#Maybe this should be an argument? pack-and-rotate supports that
-nr_max=10
-
-pack-rotate-log ${root_dir}'/'${base_name} "${root_dir}/${base_name}*.pcap ${root_dir}/${base_name}*.log*" ${nr_max}
diff --git a/TestON/dependencies/topo-100sw.py b/TestON/dependencies/topo-100sw.py
deleted file mode 100644
index 308a3f1..0000000
--- a/TestON/dependencies/topo-100sw.py
+++ /dev/null
@@ -1,31 +0,0 @@
-
-from mininet.topo import Topo
-
-class MyTopo( Topo ):
- "100 'floating' switch topology"
-
- def __init__( self ):
- # Initialize topology
- Topo.__init__( self )
-
- sw_list = []
-
- for i in range(1, 101):
- sw_list.append(
- self.addSwitch(
- 's'+str(i),
- dpid = str(i).zfill(16)))
-
-
- #Below connections are used for test cases
- #that need to test link and port events
- #Add link between switch 1 and switch 2
- self.addLink(sw_list[0],sw_list[1])
-
- #Create hosts and attach to sw 1 and sw 2
- h1 = self.addHost('h1')
- h2 = self.addHost('h2')
- self.addLink(sw_list[0],h1)
- self.addLink(sw_list[1],h2)
-
-topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependencies/topo-HA.py b/TestON/dependencies/topo-HA.py
deleted file mode 100644
index 65613d6..0000000
--- a/TestON/dependencies/topo-HA.py
+++ /dev/null
@@ -1,63 +0,0 @@
-from mininet.topo import Topo
-class MyTopo( Topo ):
- def __init__( self ):
- Topo.__init__( self )
- topSwitch = self.addSwitch('s1',dpid='1000'.zfill(16))
- leftTopSwitch = self.addSwitch('s2',dpid='2000'.zfill(16))
- rightTopSwitch = self.addSwitch('s5',dpid='5000'.zfill(16))
- leftBotSwitch = self.addSwitch('s3',dpid='3000'.zfill(16))
- rightBotSwitch = self.addSwitch('s6',dpid='6000'.zfill(16))
- midBotSwitch = self.addSwitch('s28',dpid='2800'.zfill(16))
-
- topHost = self.addHost( 'h1' )
- leftTopHost = self.addHost('h2')
- rightTopHost = self.addHost('h5')
- leftBotHost = self.addHost('h3')
- rightBotHost = self.addHost('h6')
- midBotHost = self.addHost('h28')
- self.addLink(topSwitch,topHost)
- self.addLink(leftTopSwitch,leftTopHost)
- self.addLink(rightTopSwitch,rightTopHost)
- self.addLink(leftBotSwitch,leftBotHost)
- self.addLink(rightBotSwitch,rightBotHost)
- self.addLink(midBotSwitch,midBotHost)
- self.addLink(leftTopSwitch,rightTopSwitch)
- self.addLink(topSwitch,leftTopSwitch)
- self.addLink(topSwitch,rightTopSwitch)
- self.addLink(leftTopSwitch,leftBotSwitch)
- self.addLink(rightTopSwitch,rightBotSwitch)
- self.addLink(leftBotSwitch,midBotSwitch)
- self.addLink(midBotSwitch,rightBotSwitch)
-
- agg1Switch = self.addSwitch('s4',dpid = '3004'.zfill(16))
- agg2Switch = self.addSwitch('s7',dpid = '6007'.zfill(16))
- agg1Host = self.addHost('h4')
- agg2Host = self.addHost('h7')
- self.addLink(agg1Switch,agg1Host)
- self.addLink(agg2Switch,agg2Host)
- self.addLink(agg1Switch, leftBotSwitch)
- self.addLink(agg2Switch, rightBotSwitch)
-
- for i in range(10):
- num = str(i+8)
- switch = self.addSwitch('s'+num,dpid = ('30'+num.zfill(2)).zfill(16))
- host = self.addHost('h'+num)
- self.addLink(switch, host)
- self.addLink(switch, agg1Switch)
-
- for i in range(10):
- num = str(i+18)
- switch = self.addSwitch('s'+num,dpid = ('60'+num.zfill(2)).zfill(16))
- host = self.addHost('h'+num)
- self.addLink(switch, host)
- self.addLink(switch, agg2Switch)
-
-topos = { 'mytopo': (lambda: MyTopo() ) }
-
-
-
-
-
-
-
-
diff --git a/TestON/dependencies/topo-intentFlower.py b/TestON/dependencies/topo-intentFlower.py
deleted file mode 100644
index 138c291..0000000
--- a/TestON/dependencies/topo-intentFlower.py
+++ /dev/null
@@ -1,80 +0,0 @@
-'''
-Topology with 3 core switches connected linearly.
-
-Each 'core' switch has a 'flower' of 10 switches
-for a total of 33 switches.
-
-Used in conjunction with 'IntentPerfNext' test
-'''
-
-from mininet.topo import Topo
-
-class MyTopo( Topo ):
-
- def __init__( self ):
- Topo.__init__( self )
-
- #Switches are listed out here for better view
- #of the topology from this code
- core_sw_list = ['s1','s2','s3']
-
- #Flower switches for core switch 1
- flower_sw_list_s1 =\
- ['s10', 's11', 's12', 's13', 's14',
- 's15', 's16', 's17', 's18', 's19']
- #Flower switches for core switch 2
- flower_sw_list_s2 =\
- ['s20', 's21', 's22', 's23', 's24',
- 's25', 's26', 's27', 's28', 's29']
- #Flower switches for core switch 3
- flower_sw_list_s3 =\
- ['s30', 's31', 's32', 's33', 's34',
- 's35', 's36', 's37', 's38', 's39']
-
- #Store switch objects in these variables
- core_switches = []
- flower_switches_1 = []
- flower_switches_2 = []
- flower_switches_3 = []
-
- #Add switches
- for sw in core_sw_list:
- core_switches.append(
- self.addSwitch(
- sw,
- dpid = sw.replace('s','').zfill(16)
- )
- )
- for sw in flower_sw_list_s1:
- flower_switches_1.append(
- self.addSwitch(
- sw,
- dpid = sw.replace('s','').zfill(16)
- )
- )
- for sw in flower_sw_list_s2:
- flower_switches_2.append(
- self.addSwitch(
- sw,
- dpid = sw.replace('s','').zfill(16)
- )
- )
- for sw in flower_sw_list_s3:
- flower_switches_3.append(
- self.addSwitch(
- sw,
- dpid = sw.replace('s','').zfill(16)
- )
- )
-
- self.addLink(core_switches[0], core_switches[1])
- self.addLink(core_switches[1], core_switches[2])
-
- for x in range(0, len(flower_sw_list_s1)):
- self.addLink(core_switches[0], flower_switches_1[x])
- for x in range(0, len(flower_sw_list_s2)):
- self.addLink(core_switches[1], flower_switches_2[x])
- for x in range(0, len(flower_sw_list_s3)):
- self.addLink(core_switches[2], flower_switches_3[x])
-
-topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependencies/topo-onos4node.py b/TestON/dependencies/topo-onos4node.py
deleted file mode 100644
index 4fc036c..0000000
--- a/TestON/dependencies/topo-onos4node.py
+++ /dev/null
@@ -1,63 +0,0 @@
-"""Custom topology example
-
-Two directly connected switches plus a host for each switch:
-
- host --- switch --- switch --- host
-
-Adding the 'topos' dict with a key/value pair to generate our newly defined
-topology enables one to pass in '--topo=mytopo' from the command line.
-"""
-
-from mininet.topo import Topo
-
-class MyTopo( Topo ):
- "Simple topology example."
-
- def __init__( self ):
- "Create custom topo."
- # Initialize topology
- Topo.__init__( self )
-
- # Make the middle triangle
- leftSwitch = self.addSwitch( 's1' , dpid = '1000'.zfill(16))
- rightSwitch = self.addSwitch( 's2' , dpid = '2000'.zfill(16))
- topSwitch = self.addSwitch( 's3' , dpid = '3000'.zfill(16))
- lefthost = self.addHost( 'h1' )
- righthost = self.addHost( 'h2' )
- tophost = self.addHost( 'h3' )
- self.addLink( leftSwitch, lefthost )
- self.addLink( rightSwitch, righthost )
- self.addLink( topSwitch, tophost )
-
- self.addLink( leftSwitch, rightSwitch )
- self.addLink( leftSwitch, topSwitch )
- self.addLink( topSwitch, rightSwitch )
-
- # Make aggregation switches
- agg1Switch = self.addSwitch( 's4', dpid = '1004'.zfill(16) )
- agg2Switch = self.addSwitch( 's5', dpid = '2005'.zfill(16) )
- agg1Host = self.addHost( 'h4' )
- agg2Host = self.addHost( 'h5' )
-
- self.addLink( agg1Switch, agg1Host, port1=1, port2=1 )
- self.addLink( agg2Switch, agg2Host, port1=1, port2=1 )
-
- self.addLink( agg2Switch, rightSwitch )
- self.addLink( agg1Switch, leftSwitch )
-
- # Make two aggregation fans
- for i in range(10):
- num=str(i+6)
- switch = self.addSwitch( 's' + num, dpid = ('10' + num.zfill(2) ).zfill(16))
- host = self.addHost( 'h' + num )
- self.addLink( switch, host, port1=1, port2=1 )
- self.addLink( switch, agg1Switch )
-
- for i in range(10):
- num=str(i+31)
- switch = self.addSwitch( 's' + num, dpid = ('20' + num.zfill(2)).zfill(16) )
- host = self.addHost( 'h' + num )
- self.addLink( switch, host, port1=1, port2=1 )
- self.addLink( switch, agg2Switch )
-
-topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependencies/topo-onos4node.py.old b/TestON/dependencies/topo-onos4node.py.old
deleted file mode 100644
index 3328a5d..0000000
--- a/TestON/dependencies/topo-onos4node.py.old
+++ /dev/null
@@ -1,61 +0,0 @@
-"""Custom topology example
-
-Two directly connected switches plus a host for each switch:
-
- host --- switch --- switch --- host
-
-Adding the 'topos' dict with a key/value pair to generate our newly defined
-topology enables one to pass in '--topo=mytopo' from the command line.
-"""
-
-from mininet.topo import Topo
-
-class MyTopo( Topo ):
- "Simple topology example."
-
- def __init__( self ):
- "Create custom topo."
- # Initialize topology
- Topo.__init__( self )
-
- # Make the middle triangle
- leftSwitch = self.addSwitch( 's1' )
- rightSwitch = self.addSwitch( 's2' )
- topSwitch = self.addSwitch( 's3' )
- lefthost = self.addHost( 'h1' )
- righthost = self.addHost( 'h2' )
- tophost = self.addHost( 'h3' )
- self.addLink( leftSwitch, lefthost )
- self.addLink( rightSwitch, righthost )
- self.addLink( topSwitch, tophost )
-
- self.addLink( leftSwitch, rightSwitch )
- self.addLink( leftSwitch, topSwitch )
- self.addLink( topSwitch, rightSwitch )
-
- # Make aggregation switches
- agg1Switch = self.addSwitch( 's4' )
- agg2Switch = self.addSwitch( 's5' )
- agg1Host = self.addHost( 'h4' )
- agg2Host = self.addHost( 'h5' )
-
- self.addLink( agg1Switch, agg1Host )
- self.addLink( agg2Switch, agg2Host )
-
- self.addLink( agg1Switch, rightSwitch )
- self.addLink( agg2Switch, leftSwitch )
-
- # Make two aggregation fans
- for i in range(10):
- switch = self.addSwitch( 's%d' % (i+6) )
- host = self.addHost( 'h%d' % (i+6) )
- self.addLink( switch, host )
- self.addLink( switch, agg1Switch )
-
- for i in range(10):
- switch = self.addSwitch( 's%d' % (i+31) )
- host = self.addHost( 'h%d' % (i+31) )
- self.addLink( switch, host )
- self.addLink( switch, agg2Switch )
-
-topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/dependencies/topo-onos4nodeNEW.py b/TestON/dependencies/topo-onos4nodeNEW.py
deleted file mode 100644
index 1824e3b..0000000
--- a/TestON/dependencies/topo-onos4nodeNEW.py
+++ /dev/null
@@ -1,63 +0,0 @@
-"""Custom topology example
-
-Two directly connected switches plus a host for each switch:
-
- host --- switch --- switch --- host
-
-Adding the 'topos' dict with a key/value pair to generate our newly defined
-topology enables one to pass in '--topo=mytopo' from the command line.
-"""
-
-from mininet.topo import Topo
-
-class MyTopo( Topo ):
- "Simple topology example."
-
- def __init__( self ):
- "Create custom topo."
- # Initialize topology
- Topo.__init__( self )
-
- # Make the middle triangle
- leftSwitch = self.addSwitch( 's1' , dpid = '1000'.zfill(16))
- rightSwitch = self.addSwitch( 's2' , dpid = '2000'.zfill(16))
- topSwitch = self.addSwitch( 's3' , dpid = '3000'.zfill(16))
- lefthost = self.addHost( 'h1' )
- righthost = self.addHost( 'h2' )
- tophost = self.addHost( 'h3' )
- self.addLink( leftSwitch, lefthost )
- self.addLink( rightSwitch, righthost )
- self.addLink( topSwitch, tophost )
-
- self.addLink( leftSwitch, rightSwitch )
- self.addLink( leftSwitch, topSwitch )
- self.addLink( topSwitch, rightSwitch )
-
- # Make aggregation switches
- agg1Switch = self.addSwitch( 's4', dpid = '1004'.zfill(16) )
- agg2Switch = self.addSwitch( 's5', dpid = '2005'.zfill(16) )
- agg1Host = self.addHost( 'h4' )
- agg2Host = self.addHost( 'h5' )
-
- self.addLink( agg1Switch, agg1Host )
- self.addLink( agg2Switch, agg2Host )
-
- self.addLink( agg2Switch, rightSwitch )
- self.addLink( agg1Switch, leftSwitch )
-
- # Make two aggregation fans
- for i in range(10):
- num=str(i+6)
- switch = self.addSwitch( 's' + num, dpid = ('10' + num.zfill(2) ).zfill(16))
- host = self.addHost( 'h' + num )
- self.addLink( switch, host )
- self.addLink( switch, agg1Switch )
-
- for i in range(10):
- num=str(i+31)
- switch = self.addSwitch( 's' + num, dpid = ('20' + num.zfill(2)).zfill(16) )
- host = self.addHost( 'h' + num )
- self.addLink( switch, host )
- self.addLink( switch, agg2Switch )
-
-topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index bdc9307..b877d93 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -35,6 +35,7 @@
import re
import sys
import types
+import os
sys.path.append( "../" )
from math import pow
from drivers.common.cli.emulatordriver import Emulator
@@ -61,6 +62,22 @@
vars( self )[ key ] = connectargs[ key ]
self.name = self.options[ 'name' ]
+
+ try:
+ if os.getenv( str( self.ip_address ) ) != None:
+ self.ip_address = os.getenv( str( self.ip_address ) )
+ else:
+ main.log.info( self.name +
+ ": Trying to connect to " +
+ self.ip_address )
+
+ except KeyError:
+ main.log.info( "Invalid host name," +
+ " connecting to local host instead" )
+ self.ip_address = 'localhost'
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
self.handle = super(
MininetCliDriver,
self ).connect(
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index c2c011a..cea3eab 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -24,6 +24,7 @@
import pexpect
import re
import sys
+import os
sys.path.append( "../" )
from drivers.common.cli.emulatordriver import Emulator
@@ -51,6 +52,22 @@
vars( self )[ key ] = connectargs[ key ]
self.name = self.options[ 'name' ]
+
+ try:
+ if os.getenv( str( self.ip_address ) ) != None:
+ self.ip_address = os.getenv( str( self.ip_address ) )
+ else:
+ main.log.info( self.name +
+ ": Trying to connect to " +
+ self.ip_address )
+
+ except KeyError:
+ main.log.info( "Invalid host name," +
+ " connecting to local host instead" )
+ self.ip_address = 'localhost'
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
self.handle = super(
RemoteMininetDriver,
self ).connect(
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 223ad4d..2f8bd47 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -22,6 +22,7 @@
import json
import types
import time
+import os
sys.path.append( "../" )
from drivers.common.clidriver import CLI
@@ -52,7 +53,28 @@
if self.home is None or self.home == "":
self.home = "~/onos"
+ for key in self.options:
+ if key == 'onosIp':
+ self.onosIp = self.options[ 'onosIp' ]
+ break
+
self.name = self.options[ 'name' ]
+
+ try:
+ if os.getenv( str( self.ip_address ) ) != None:
+ self.ip_address = os.getenv( str( self.ip_address ) )
+ else:
+ main.log.info( self.name +
+ ": Trying to connect to " +
+ self.ip_address )
+
+ except KeyError:
+ main.log.info( "Invalid host name," +
+ " connecting to local host instead" )
+ self.ip_address = 'localhost'
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
self.handle = super( OnosCliDriver, self ).connect(
user_name=self.user_name,
ip_address=self.ip_address,
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 4c786a3..37d55fe 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -19,6 +19,7 @@
import sys
import time
import pexpect
+import os
import os.path
from requests.models import Response
sys.path.append( "../" )
@@ -39,6 +40,10 @@
def connect( self, **connectargs ):
"""
Creates ssh handle for ONOS "bench".
+ NOTE:
+ The ip_address would come from the topo file using the host tag, the
+ value can be an environment variable as well as a "localhost" to get
+ the ip address needed to ssh to the "bench"
"""
try:
for key in connectargs:
@@ -52,6 +57,57 @@
self.home = "~/onos"
self.name = self.options[ 'name' ]
+
+ for key in self.options:
+ if key == "nodes":
+ # Maximum number of ONOS nodes to run
+ self.maxNodes = int( self.options[ 'nodes' ] )
+ break
+ self.maxNodes = None
+
+
+ # Grabs all OC environment variables
+ self.onosIps = {} # Dictionary of all possible ONOS ip
+
+ try:
+ if self.maxNodes:
+ main.log.info( self.name + ": Creating cluster data with " +
+ str( self.maxNodes ) + " maximum number" +
+ " of nodes" )
+
+ for i in range( self.maxNodes ):
+ envString = "OC" + str( i + 1 )
+ self.onosIps[ envString ] = os.getenv( envString )
+
+ if not self.onosIps:
+ main.log.info( "Could not read any environment variable"
+ + " please load a cell file with all" +
+ " onos IP" )
+ else:
+ main.log.info( self.name + ": Found " +
+ str( self.onosIps.values() ) +
+ " ONOS IPs" )
+
+ except KeyError:
+ main.log.info( "Invalid environment variable" )
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
+ try:
+ if os.getenv( str( self.ip_address ) ) != None:
+ self.ip_address = os.getenv( str( self.ip_address ) )
+ else:
+ main.log.info( self.name +
+ ": Trying to connect to " +
+ self.ip_address )
+
+ except KeyError:
+ main.log.info( "Invalid host name," +
+ " connecting to local host instead" )
+ self.ip_address = 'localhost'
+ except Exception as inst:
+ main.log.error( "Uncaught exception: " + str( inst ) )
+
self.handle = super( OnosDriver, self ).connect(
user_name=self.user_name,
ip_address=self.ip_address,
@@ -59,12 +115,12 @@
pwd=self.pwd,
home=self.home )
- self.handle.sendline( "cd " + self.home )
- self.handle.expect( "\$" )
if self.handle:
+ self.handle.sendline( "cd " + self.home )
+ self.handle.expect( "\$" )
return self.handle
else:
- main.log.info( "NO ONOS HANDLE" )
+ main.log.info( "Failed to create ONOS handle" )
return main.FALSE
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -587,7 +643,7 @@
main.exit()
def createCellFile( self, benchIp, fileName, mnIpAddrs,
- appString, *onosIpAddrs ):
+ appString, onosIpAddrs ):
"""
Creates a cell file based on arguments
Required:
@@ -623,7 +679,7 @@
tempCount = 1
# Create ONOSNIC ip address prefix
- tempOnosIp = onosIpAddrs[ 0 ]
+ tempOnosIp = str( onosIpAddrs[ 0 ] )
tempList = []
tempList = tempOnosIp.split( "." )
# Omit last element of list to format for NIC
@@ -674,6 +730,7 @@
"""
Calls 'cell <name>' to set the environment variables on ONOSbench
"""
+ import re
try:
if not cellname:
main.log.error( "Must define cellname" )
@@ -692,9 +749,13 @@
self.handle.expect("\$")
handleMore = self.handle.before
- main.log.info( "Cell call returned: " + handleBefore +
+ cell_result = handleBefore + handleAfter + handleMore
+ print cell_result
+ if( re.search( "No such cell", cell_result ) ):
+ main.log.error( "Cell call returned: " + handleBefore +
handleAfter + handleMore )
-
+ main.cleanup()
+ main.exit()
return main.TRUE
except pexpect.EOF:
@@ -1979,102 +2040,14 @@
main.cleanup()
main.exit()
- def getOnosIps(self):
+ def getOnosIps( self ):
+ """
+ Get all onos IPs stored in
+ """
- import os
-
- # reads env for OC variables, also saves file with OC variables. If file and env conflict
- # priority goes to env. If file has OCs that are not in the env, the file OCs are used.
- # In other words, if the env is set, the test will use those values.
+ return sorted( self.onosIps.values() )
- # returns a list of ip addresses for the onos nodes, will work with up to 7 nodes + OCN and OCI
- # returns in format [ OC1 ip, OC2 ...ect. , OCN, OCI ]
-
- envONOSIps = {}
-
- x = 1
- while True:
- try:
- temp = os.environ[ 'OC' + str(x) ]
- except KeyError:
- break
- envONOSIps[ ("OC" + str(x)) ] = temp
- x += 1
-
- try:
- temp = os.environ[ 'OCN' ]
- envONOSIps[ "OCN" ] = temp
- except KeyError:
- main.log.info("OCN not set in env")
-
- try:
- temp = os.environ[ 'OCI' ]
- envONOSIps[ "OCI" ] = temp
- except:
- main.log.error("OCI not set in env")
-
- print(str(envONOSIps))
-
- order = [ "OC1", "OC2", "OC3","OC4","OC5","OC6","OC7","OCN","OCI" ]
- ONOSIps = []
-
- try:
- if os.path.exists("myIps"):
- ipFile = open("myIps","r+")
- else:
- ipFile = open("myIps","w+")
-
- fileONOSIps = ipFile.readlines()
- ipFile.close()
-
- print str(fileONOSIps)
-
- if str(fileONOSIps) == "[]":
- ipFile = open("myIps","w+")
- for key in envONOSIps:
- ipFile.write(key+ "=" + envONOSIps[key] + "\n")
- ipFile.close()
- for i in order:
- if i in envONOSIps:
- ONOSIps.append(envONOSIps[i])
-
- return ONOSIps
-
- else:
- fileDict = {}
- for line in fileONOSIps:
- line = line.replace("\n","")
- line = line.split("=")
- key = line[0]
- value = line[1]
- fileDict[key] = value
-
- for x in envONOSIps:
- if x in fileDict:
- if envONOSIps[x] == fileDict[x]:
- continue
- else:
- fileDict[x] = envONOSIps[x]
- else:
- fileDict[x] = envONOSIps[x]
-
- ipFile = open("myIps","w+")
- for key in order:
- if key in fileDict:
- ipFile.write(key + "=" + fileDict[key] + "\n")
- ONOSIps.append(fileDict[key])
- ipFile.close()
-
- return ONOSIps
-
- except IOError as a:
- main.log.error(a)
-
- except Exception as a:
- main.log.error(a)
-
-
- def logReport(self, nodeIp, searchTerms, outputMode="s"):
+ def logReport( self, nodeIp, searchTerms, outputMode="s" ):
'''
- accepts either a list or a string for "searchTerms" these
terms will be searched for in the log and have their
@@ -2137,8 +2110,10 @@
def getOnosIPfromCell(self):
'''
Returns the ONOS node names and their IP addresses as defined in the cell and applied to shell environment
- Example output return: [['OC1', '10.128.40.41'], ['OC2', '10.128.40.42'], ['OC3', '10.128.40.43']]
- '''
+ Example output return: ['10.128.40.41','10.128.40.42','10.128.40.43']. This will work even if the Mininet is
+ not part of the cell definition and also if there are multiple mininets, just by using static hostname
+ in TOPO file.
+ '''
import re
try:
# Clean handle by sending empty and expecting $
@@ -2162,8 +2137,7 @@
continue
else:
onosIP = cellOutput[i].split("=")
- # below step could be changed to return only IP if node name is not needed.
- ipList.append(onosIP)
+ ipList.append(onosIP[1])
return ipList
except pexpect.ExceptionPexpect as e:
main.log.error( self.name + ": Pexpect exception found of type " +
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index f05be55..9199a4e 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -45,9 +45,8 @@
return getattr( self.wrapped, name )
except AttributeError as error:
# NOTE: The first time we load a driver module we get this error
- if "'module' object has no attribute '__path__'" in error\
- and self.count == 0:
- self.count += 1
+ if "'module' object has no attribute '__path__'" in error:
+ pass
else:
main.log.error( str(error.__class__) + " " + str(error) )
try:
diff --git a/TestON/tests/OnosCHO/Dependencies/topoAtt.py b/TestON/tests/OnosCHO/Dependencies/topoAtt.py
new file mode 100755
index 0000000..0247458
--- /dev/null
+++ b/TestON/tests/OnosCHO/Dependencies/topoAtt.py
@@ -0,0 +1,183 @@
+#!/usr/bin/python
+
+"""
+Custom topology for Mininet
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+
+class attTopo( Topo ):
+
+ def __init__( self, **opts ):
+ "Create a topology."
+
+ # Initialize Topology
+ Topo.__init__( self, **opts )
+
+ # add nodes, switches first...
+ NY54 = self.addSwitch( 's1' )
+ CMBR = self.addSwitch( 's2' )
+ CHCG = self.addSwitch( 's3' )
+ CLEV = self.addSwitch( 's4' )
+ RLGH = self.addSwitch( 's5' )
+ ATLN = self.addSwitch( 's6' )
+ PHLA = self.addSwitch( 's7' )
+ WASH = self.addSwitch( 's8' )
+ NSVL = self.addSwitch( 's9' )
+ STLS = self.addSwitch( 's10' )
+ NWOR = self.addSwitch( 's11' )
+ HSTN = self.addSwitch( 's12' )
+ SNAN = self.addSwitch( 's13' )
+ DLLS = self.addSwitch( 's14' )
+ ORLD = self.addSwitch( 's15' )
+ DNVR = self.addSwitch( 's16' )
+ KSCY = self.addSwitch( 's17' )
+ SNFN = self.addSwitch( 's18' )
+ SCRM = self.addSwitch( 's19' )
+ PTLD = self.addSwitch( 's20' )
+ STTL = self.addSwitch( 's21' )
+ SLKC = self.addSwitch( 's22' )
+ LA03 = self.addSwitch( 's23' )
+ SNDG = self.addSwitch( 's24' )
+ PHNX = self.addSwitch( 's25' )
+
+ # ... and now hosts
+ NY54_host = self.addHost( 'h1' )
+ CMBR_host = self.addHost( 'h2' )
+ CHCG_host = self.addHost( 'h3' )
+ CLEV_host = self.addHost( 'h4' )
+ RLGH_host = self.addHost( 'h5' )
+ ATLN_host = self.addHost( 'h6' )
+ PHLA_host = self.addHost( 'h7' )
+ WASH_host = self.addHost( 'h8' )
+ NSVL_host = self.addHost( 'h9' )
+ STLS_host = self.addHost( 'h10' )
+ NWOR_host = self.addHost( 'h11' )
+ HSTN_host = self.addHost( 'h12' )
+ SNAN_host = self.addHost( 'h13' )
+ DLLS_host = self.addHost( 'h14' )
+ ORLD_host = self.addHost( 'h15' )
+ DNVR_host = self.addHost( 'h16' )
+ KSCY_host = self.addHost( 'h17' )
+ SNFN_host = self.addHost( 'h18' )
+ SCRM_host = self.addHost( 'h19' )
+ PTLD_host = self.addHost( 'h20' )
+ STTL_host = self.addHost( 'h21' )
+ SLKC_host = self.addHost( 'h22' )
+ LA03_host = self.addHost( 'h23' )
+ SNDG_host = self.addHost( 'h24' )
+ PHNX_host = self.addHost( 'h25' )
+
+ # add edges between switch and corresponding host
+ self.addLink( NY54 , NY54_host )
+ self.addLink( CMBR , CMBR_host )
+ self.addLink( CHCG , CHCG_host )
+ self.addLink( CLEV , CLEV_host )
+ self.addLink( RLGH , RLGH_host )
+ self.addLink( ATLN , ATLN_host )
+ self.addLink( PHLA , PHLA_host )
+ self.addLink( WASH , WASH_host )
+ self.addLink( NSVL , NSVL_host )
+ self.addLink( STLS , STLS_host )
+ self.addLink( NWOR , NWOR_host )
+ self.addLink( HSTN , HSTN_host )
+ self.addLink( SNAN , SNAN_host )
+ self.addLink( DLLS , DLLS_host )
+ self.addLink( ORLD , ORLD_host )
+ self.addLink( DNVR , DNVR_host )
+ self.addLink( KSCY , KSCY_host )
+ self.addLink( SNFN , SNFN_host )
+ self.addLink( SCRM , SCRM_host )
+ self.addLink( PTLD , PTLD_host )
+ self.addLink( STTL , STTL_host )
+ self.addLink( SLKC , SLKC_host )
+ self.addLink( LA03 , LA03_host )
+ self.addLink( SNDG , SNDG_host )
+ self.addLink( PHNX , PHNX_host )
+
+ # add edges between switches
+ self.addLink( NY54 , CMBR, bw=10, delay='0.979030824185ms')
+ self.addLink( NY54 , CHCG, bw=10, delay='0.806374975652ms')
+ self.addLink( NY54 , PHLA, bw=10, delay='0.686192970166ms')
+ self.addLink( NY54 , WASH, bw=10, delay='0.605826192092ms')
+ self.addLink( CMBR , PHLA, bw=10, delay='1.4018238197ms')
+ self.addLink( CHCG , CLEV, bw=10, delay='0.232315346482ms')
+ self.addLink( CHCG , PHLA, bw=10, delay='1.07297714274ms')
+ self.addLink( CHCG , STLS, bw=10, delay='1.12827896944ms')
+ self.addLink( CHCG , DNVR, bw=10, delay='1.35964770335ms')
+ self.addLink( CHCG , KSCY, bw=10, delay='1.5199778541ms')
+ self.addLink( CHCG , SNFN, bw=10, delay='0.620743405435ms')
+ self.addLink( CHCG , STTL, bw=10, delay='0.93027212534ms')
+ self.addLink( CHCG , SLKC, bw=10, delay='0.735621751348ms')
+ self.addLink( CLEV , NSVL, bw=10, delay='0.523419372248ms')
+ self.addLink( CLEV , STLS, bw=10, delay='1.00360290845ms')
+ self.addLink( CLEV , PHLA, bw=10, delay='0.882912133249ms')
+ self.addLink( RLGH , ATLN, bw=10, delay='1.1644489729ms')
+ self.addLink( RLGH , WASH, bw=10, delay='1.48176810502ms')
+ self.addLink( ATLN , WASH, bw=10, delay='0.557636936322ms')
+ self.addLink( ATLN , NSVL, bw=10, delay='1.32869749865ms')
+ self.addLink( ATLN , STLS, bw=10, delay='0.767705554748ms')
+ self.addLink( ATLN , DLLS, bw=10, delay='0.544782086448ms')
+ self.addLink( ATLN , ORLD, bw=10, delay='1.46119152532ms')
+ self.addLink( PHLA , WASH, bw=10, delay='0.372209320106ms')
+ self.addLink( NSVL , STLS, bw=10, delay='1.43250491305ms')
+ self.addLink( NSVL , DLLS, bw=10, delay='1.67698215288ms')
+ self.addLink( STLS , DLLS, bw=10, delay='0.256389964194ms')
+ self.addLink( STLS , KSCY, bw=10, delay='0.395511571791ms')
+ self.addLink( STLS , LA03, bw=10, delay='0.257085227363ms')
+ self.addLink( NWOR , HSTN, bw=10, delay='0.0952906633914ms')
+ self.addLink( NWOR , DLLS, bw=10, delay='1.60231329739ms')
+ self.addLink( NWOR , ORLD, bw=10, delay='0.692731063896ms')
+ self.addLink( HSTN , SNAN, bw=10, delay='0.284150653798ms')
+ self.addLink( HSTN , DLLS, bw=10, delay='1.65690128332ms')
+ self.addLink( HSTN , ORLD, bw=10, delay='0.731886304782ms')
+ self.addLink( SNAN , PHNX, bw=10, delay='1.34258627257ms')
+ self.addLink( SNAN , DLLS, bw=10, delay='1.50063532341ms')
+ self.addLink( DLLS , DNVR, bw=10, delay='0.251471593235ms')
+ self.addLink( DLLS , KSCY, bw=10, delay='0.18026026737ms')
+ self.addLink( DLLS , SNFN, bw=10, delay='0.74304274592ms')
+ self.addLink( DLLS , LA03, bw=10, delay='0.506439293357ms')
+ self.addLink( DNVR , KSCY, bw=10, delay='0.223328790403ms')
+ self.addLink( DNVR , SNFN, bw=10, delay='0.889017541903ms')
+ self.addLink( DNVR , SLKC, bw=10, delay='0.631898982721ms')
+ self.addLink( KSCY , SNFN, bw=10, delay='0.922778522233ms')
+ self.addLink( SNFN , SCRM, bw=10, delay='0.630352278097ms')
+ self.addLink( SNFN , PTLD, bw=10, delay='0.828572513655ms')
+ self.addLink( SNFN , STTL, bw=10, delay='1.54076081649ms')
+ self.addLink( SNFN , SLKC, bw=10, delay='0.621507502625ms')
+ self.addLink( SNFN , LA03, bw=10, delay='0.602936230151ms')
+ self.addLink( SCRM , SLKC, bw=10, delay='0.461350343644ms')
+ self.addLink( PTLD , STTL, bw=10, delay='1.17591515181ms')
+ self.addLink( SLKC , LA03, bw=10, delay='0.243225267023ms')
+ self.addLink( LA03 , SNDG, bw=10, delay='0.681264950821ms')
+ self.addLink( LA03 , PHNX, bw=10, delay='0.343709457969ms')
+ self.addLink( LA03 , PHNX, bw=10, delay='0.343709457969ms')
+ self.addLink( SNDG , PHNX, bw=10, delay='0.345064487693ms')
+
+topos = { 'att': ( lambda: attTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = attTopo()
+ #if controller_ip == '':
+ #controller_ip = '10.0.2.2';
+ # controller_ip = '127.0.0.1';
+ network = Mininet(topo=topo, link=TCLink, autoSetMacs=True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
diff --git a/TestON/tests/OnosCHO/Dependencies/topoChordal.py b/TestON/tests/OnosCHO/Dependencies/topoChordal.py
new file mode 100755
index 0000000..38eb6a1
--- /dev/null
+++ b/TestON/tests/OnosCHO/Dependencies/topoChordal.py
@@ -0,0 +1,422 @@
+#!/usr/bin/python
+"""
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+
+class chordalTopo( Topo ):
+
+ def __init__( self, **opts ):
+ "Create a topology."
+
+ # Initialize Topology
+ Topo.__init__( self, **opts )
+
+ # add nodes, switches first...
+ s1 = self.addSwitch( 's1' )
+ s2 = self.addSwitch( 's2' )
+ s3 = self.addSwitch( 's3' )
+ s4 = self.addSwitch( 's4' )
+ s5 = self.addSwitch( 's5' )
+ s6 = self.addSwitch( 's6' )
+ s7 = self.addSwitch( 's7' )
+ s8 = self.addSwitch( 's8' )
+ s9 = self.addSwitch( 's9' )
+ s10 = self.addSwitch( 's10' )
+ s11 = self.addSwitch( 's11' )
+ s12 = self.addSwitch( 's12' )
+ s13 = self.addSwitch( 's13' )
+ s14 = self.addSwitch( 's14' )
+ s15 = self.addSwitch( 's15' )
+ s16 = self.addSwitch( 's16' )
+ s17 = self.addSwitch( 's17' )
+ s18 = self.addSwitch( 's18' )
+ s19 = self.addSwitch( 's19' )
+ s20 = self.addSwitch( 's20' )
+ s21 = self.addSwitch( 's21' )
+ s22 = self.addSwitch( 's22' )
+ s23 = self.addSwitch( 's23' )
+ s24 = self.addSwitch( 's24' )
+ s25 = self.addSwitch( 's25' )
+
+ # ... and now hosts
+ s1_host = self.addHost( 'h1' )
+ s2_host = self.addHost( 'h2' )
+ s3_host = self.addHost( 'h3' )
+ s4_host = self.addHost( 'h4' )
+ s5_host = self.addHost( 'h5' )
+ s6_host = self.addHost( 'h6' )
+ s7_host = self.addHost( 'h7' )
+ s8_host = self.addHost( 'h8' )
+ s9_host = self.addHost( 'h9' )
+ s10_host = self.addHost( 'h10' )
+ s11_host = self.addHost( 'h11' )
+ s12_host = self.addHost( 'h12' )
+ s13_host = self.addHost( 'h13' )
+ s14_host = self.addHost( 'h14' )
+ s15_host = self.addHost( 'h15' )
+ s16_host = self.addHost( 'h16' )
+ s17_host = self.addHost( 'h17' )
+ s18_host = self.addHost( 'h18' )
+ s19_host = self.addHost( 'h19' )
+ s20_host = self.addHost( 'h20' )
+ s21_host = self.addHost( 'h21' )
+ s22_host = self.addHost( 'h22' )
+ s23_host = self.addHost( 'h23' )
+ s24_host = self.addHost( 'h24' )
+ s25_host = self.addHost( 'h25' )
+
+ # add edges between switch and corresponding host
+ self.addLink( s1 , s1_host )
+ self.addLink( s2 , s2_host )
+ self.addLink( s3 , s3_host )
+ self.addLink( s4 , s4_host )
+ self.addLink( s5 , s5_host )
+ self.addLink( s6 , s6_host )
+ self.addLink( s7 , s7_host )
+ self.addLink( s8 , s8_host )
+ self.addLink( s9 , s9_host )
+ self.addLink( s10 , s10_host )
+ self.addLink( s11 , s11_host )
+ self.addLink( s12 , s12_host )
+ self.addLink( s13 , s13_host )
+ self.addLink( s14 , s14_host )
+ self.addLink( s15 , s15_host )
+ self.addLink( s16 , s16_host )
+ self.addLink( s17 , s17_host )
+ self.addLink( s18 , s18_host )
+ self.addLink( s19 , s19_host )
+ self.addLink( s20 , s20_host )
+ self.addLink( s21 , s21_host )
+ self.addLink( s22 , s22_host )
+ self.addLink( s23 , s23_host )
+ self.addLink( s24 , s24_host )
+ self.addLink( s25 , s25_host )
+ self.addLink(s1, s2)
+ self.addLink(s1, s3)
+ self.addLink(s1, s4)
+ self.addLink(s1, s5)
+ self.addLink(s1, s6)
+ self.addLink(s1, s7)
+ self.addLink(s1, s8)
+ self.addLink(s1, s9)
+ self.addLink(s1, s10)
+ self.addLink(s1, s11)
+ self.addLink(s1, s12)
+ self.addLink(s1, s13)
+ self.addLink(s1, s14)
+ self.addLink(s1, s15)
+ self.addLink(s1, s16)
+ self.addLink(s1, s17)
+ self.addLink(s1, s18)
+ self.addLink(s1, s19)
+ self.addLink(s1, s20)
+ self.addLink(s1, s21)
+ self.addLink(s1, s22)
+ self.addLink(s1, s23)
+ self.addLink(s1, s24)
+ self.addLink(s1, s25)
+ self.addLink(s2, s3)
+ self.addLink(s2, s4)
+ self.addLink(s2, s5)
+ self.addLink(s2, s6)
+ self.addLink(s2, s7)
+ self.addLink(s2, s8)
+ self.addLink(s2, s9)
+ self.addLink(s2, s10)
+ self.addLink(s2, s11)
+ self.addLink(s2, s12)
+ self.addLink(s2, s13)
+ self.addLink(s2, s14)
+ self.addLink(s2, s15)
+ self.addLink(s2, s16)
+ self.addLink(s2, s17)
+ self.addLink(s2, s18)
+ self.addLink(s2, s19)
+ self.addLink(s2, s20)
+ self.addLink(s2, s21)
+ self.addLink(s2, s22)
+ self.addLink(s2, s23)
+ self.addLink(s2, s24)
+ self.addLink(s2, s25)
+ self.addLink(s3, s4)
+ self.addLink(s3, s5)
+ self.addLink(s3, s6)
+ self.addLink(s3, s7)
+ self.addLink(s3, s8)
+ self.addLink(s3, s9)
+ self.addLink(s3, s10)
+ self.addLink(s3, s11)
+ self.addLink(s3, s12)
+ self.addLink(s3, s13)
+ self.addLink(s3, s14)
+ self.addLink(s3, s15)
+ self.addLink(s3, s16)
+ self.addLink(s3, s17)
+ self.addLink(s3, s18)
+ self.addLink(s3, s19)
+ self.addLink(s3, s20)
+ self.addLink(s3, s21)
+ self.addLink(s3, s22)
+ self.addLink(s3, s23)
+ self.addLink(s3, s24)
+ self.addLink(s3, s25)
+ self.addLink(s4, s5)
+ self.addLink(s4, s6)
+ self.addLink(s4, s7)
+ self.addLink(s4, s8)
+ self.addLink(s4, s9)
+ self.addLink(s4, s10)
+ self.addLink(s4, s11)
+ self.addLink(s4, s12)
+ self.addLink(s4, s13)
+ self.addLink(s4, s14)
+ self.addLink(s4, s15)
+ self.addLink(s4, s16)
+ self.addLink(s4, s17)
+ self.addLink(s4, s18)
+ self.addLink(s4, s19)
+ self.addLink(s4, s20)
+ self.addLink(s4, s21)
+ self.addLink(s4, s22)
+ self.addLink(s4, s23)
+ self.addLink(s4, s24)
+ self.addLink(s4, s25)
+ self.addLink(s5, s6)
+ self.addLink(s5, s7)
+ self.addLink(s5, s8)
+ self.addLink(s5, s9)
+ self.addLink(s5, s10)
+ self.addLink(s5, s11)
+ self.addLink(s5, s12)
+ self.addLink(s5, s13)
+ self.addLink(s5, s14)
+ self.addLink(s5, s15)
+ self.addLink(s5, s16)
+ self.addLink(s5, s17)
+ self.addLink(s5, s18)
+ self.addLink(s5, s19)
+ self.addLink(s5, s20)
+ self.addLink(s5, s21)
+ self.addLink(s5, s22)
+ self.addLink(s5, s23)
+ self.addLink(s5, s24)
+ self.addLink(s5, s25)
+ self.addLink(s6, s7)
+ self.addLink(s6, s8)
+ self.addLink(s6, s9)
+ self.addLink(s6, s10)
+ self.addLink(s6, s11)
+ self.addLink(s6, s12)
+ self.addLink(s6, s13)
+ self.addLink(s6, s14)
+ self.addLink(s6, s15)
+ self.addLink(s6, s16)
+ self.addLink(s6, s17)
+ self.addLink(s6, s18)
+ self.addLink(s6, s19)
+ self.addLink(s6, s20)
+ self.addLink(s6, s21)
+ self.addLink(s6, s22)
+ self.addLink(s6, s23)
+ self.addLink(s6, s24)
+ self.addLink(s6, s25)
+ self.addLink(s7, s8)
+ self.addLink(s7, s9)
+ self.addLink(s7, s10)
+ self.addLink(s7, s11)
+ self.addLink(s7, s12)
+ self.addLink(s7, s13)
+ self.addLink(s7, s14)
+ self.addLink(s7, s15)
+ self.addLink(s7, s16)
+ self.addLink(s7, s17)
+ self.addLink(s7, s18)
+ self.addLink(s7, s19)
+ self.addLink(s7, s20)
+ self.addLink(s7, s21)
+ self.addLink(s7, s22)
+ self.addLink(s7, s23)
+ self.addLink(s7, s24)
+ self.addLink(s7, s25)
+ self.addLink(s8, s9)
+ self.addLink(s8, s10)
+ self.addLink(s8, s11)
+ self.addLink(s8, s12)
+ self.addLink(s8, s13)
+ self.addLink(s8, s14)
+ self.addLink(s8, s15)
+ self.addLink(s8, s16)
+ self.addLink(s8, s17)
+ self.addLink(s8, s18)
+ self.addLink(s8, s19)
+ self.addLink(s8, s20)
+ self.addLink(s8, s21)
+ self.addLink(s8, s22)
+ self.addLink(s8, s23)
+ self.addLink(s8, s24)
+ self.addLink(s8, s25)
+ self.addLink(s9, s10)
+ self.addLink(s9, s11)
+ self.addLink(s9, s12)
+ self.addLink(s9, s13)
+ self.addLink(s9, s14)
+ self.addLink(s9, s15)
+ self.addLink(s9, s16)
+ self.addLink(s9, s17)
+ self.addLink(s9, s18)
+ self.addLink(s9, s19)
+ self.addLink(s9, s20)
+ self.addLink(s9, s21)
+ self.addLink(s9, s22)
+ self.addLink(s9, s23)
+ self.addLink(s9, s24)
+ self.addLink(s9, s25)
+ self.addLink(s10, s11)
+ self.addLink(s10, s12)
+ self.addLink(s10, s13)
+ self.addLink(s10, s14)
+ self.addLink(s10, s15)
+ self.addLink(s10, s16)
+ self.addLink(s10, s17)
+ self.addLink(s10, s18)
+ self.addLink(s10, s19)
+ self.addLink(s10, s20)
+ self.addLink(s10, s21)
+ self.addLink(s10, s22)
+ self.addLink(s10, s23)
+ self.addLink(s10, s24)
+ self.addLink(s10, s25)
+ self.addLink(s11, s12)
+ self.addLink(s11, s13)
+ self.addLink(s11, s14)
+ self.addLink(s11, s15)
+ self.addLink(s11, s16)
+ self.addLink(s11, s17)
+ self.addLink(s11, s18)
+ self.addLink(s11, s19)
+ self.addLink(s11, s20)
+ self.addLink(s11, s21)
+ self.addLink(s11, s22)
+ self.addLink(s11, s23)
+ self.addLink(s11, s24)
+ self.addLink(s11, s25)
+ self.addLink(s12, s13)
+ self.addLink(s12, s14)
+ self.addLink(s12, s15)
+ self.addLink(s12, s16)
+ self.addLink(s12, s17)
+ self.addLink(s12, s18)
+ self.addLink(s12, s19)
+ self.addLink(s12, s20)
+ self.addLink(s12, s21)
+ self.addLink(s12, s22)
+ self.addLink(s12, s23)
+ self.addLink(s12, s24)
+ self.addLink(s12, s25)
+ self.addLink(s13, s14)
+ self.addLink(s13, s15)
+ self.addLink(s13, s16)
+ self.addLink(s13, s17)
+ self.addLink(s13, s18)
+ self.addLink(s13, s19)
+ self.addLink(s13, s20)
+ self.addLink(s13, s21)
+ self.addLink(s13, s22)
+ self.addLink(s13, s23)
+ self.addLink(s13, s24)
+ self.addLink(s13, s25)
+ self.addLink(s14, s15)
+ self.addLink(s14, s16)
+ self.addLink(s14, s17)
+ self.addLink(s14, s18)
+ self.addLink(s14, s19)
+ self.addLink(s14, s20)
+ self.addLink(s14, s21)
+ self.addLink(s14, s22)
+ self.addLink(s14, s23)
+ self.addLink(s14, s24)
+ self.addLink(s14, s25)
+ self.addLink(s15, s16)
+ self.addLink(s15, s17)
+ self.addLink(s15, s18)
+ self.addLink(s15, s19)
+ self.addLink(s15, s20)
+ self.addLink(s15, s21)
+ self.addLink(s15, s22)
+ self.addLink(s15, s23)
+ self.addLink(s15, s24)
+ self.addLink(s15, s25)
+ self.addLink(s16, s17)
+ self.addLink(s16, s18)
+ self.addLink(s16, s19)
+ self.addLink(s16, s20)
+ self.addLink(s16, s21)
+ self.addLink(s16, s22)
+ self.addLink(s16, s23)
+ self.addLink(s16, s24)
+ self.addLink(s16, s25)
+ self.addLink(s17, s18)
+ self.addLink(s17, s19)
+ self.addLink(s17, s20)
+ self.addLink(s17, s21)
+ self.addLink(s17, s22)
+ self.addLink(s17, s23)
+ self.addLink(s17, s24)
+ self.addLink(s17, s25)
+ self.addLink(s18, s19)
+ self.addLink(s18, s20)
+ self.addLink(s18, s21)
+ self.addLink(s18, s22)
+ self.addLink(s18, s23)
+ self.addLink(s18, s24)
+ self.addLink(s18, s25)
+ self.addLink(s19, s20)
+ self.addLink(s19, s21)
+ self.addLink(s19, s22)
+ self.addLink(s19, s23)
+ self.addLink(s19, s24)
+ self.addLink(s19, s25)
+ self.addLink(s20, s21)
+ self.addLink(s20, s22)
+ self.addLink(s20, s23)
+ self.addLink(s20, s24)
+ self.addLink(s20, s25)
+ self.addLink(s21, s22)
+ self.addLink(s21, s23)
+ self.addLink(s21, s24)
+ self.addLink(s21, s25)
+ self.addLink(s22, s23)
+ self.addLink(s22, s24)
+ self.addLink(s22, s25)
+ self.addLink(s23, s24)
+ self.addLink(s23, s25)
+ self.addLink(s24, s25)
+
+topos = { 'chordal': ( lambda: chordalTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = chordalTopo()
+ #if controller_ip == '':
+ #controller_ip = '10.0.2.2';
+ # controller_ip = '127.0.0.1';
+ network = Mininet(topo=topo, switch=OVSSwitch,autoSetMacs=True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
diff --git a/TestON/tests/OnosCHO/Dependencies/topoSpine.py b/TestON/tests/OnosCHO/Dependencies/topoSpine.py
new file mode 100755
index 0000000..56fe745
--- /dev/null
+++ b/TestON/tests/OnosCHO/Dependencies/topoSpine.py
@@ -0,0 +1,436 @@
+#!/usr/bin/python
+
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController, OVSController
+from mininet.node import CPULimitedHost, Host, Node
+from mininet.cli import CLI
+from mininet.log import setLogLevel, info
+from mininet.link import TCLink, Intf
+from subprocess import call
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, OVSLegacyKernelSwitch, IVSSwitch )
+
+class spineTopo( Topo ):
+
+ def __init__( self, **opts ):
+ "Create a topology."
+
+ # Initialize Topology
+ Topo.__init__( self, **opts )
+
+ # add nodes, Leaf switches
+ s1 = self.addSwitch( 's1' )
+ s2 = self.addSwitch( 's2' )
+ s3 = self.addSwitch( 's3' )
+ s4 = self.addSwitch( 's4' )
+ s5 = self.addSwitch( 's5' )
+ s6 = self.addSwitch( 's6' )
+ s7 = self.addSwitch( 's7' )
+ s8 = self.addSwitch( 's8' )
+ s9 = self.addSwitch( 's9' )
+ s10 = self.addSwitch( 's10' )
+ s11 = self.addSwitch( 's11' )
+ s12 = self.addSwitch( 's12' )
+ s13 = self.addSwitch( 's13' )
+ s14 = self.addSwitch( 's14' )
+
+ # add nodes, Spine switches first...
+ s15 = self.addSwitch( 's15' )
+ s16 = self.addSwitch( 's16' )
+ s17 = self.addSwitch( 's17' )
+ s18 = self.addSwitch( 's18' )
+ s19 = self.addSwitch( 's19' )
+ s20 = self.addSwitch( 's20' )
+ s21 = self.addSwitch( 's21' )
+ s22 = self.addSwitch( 's22' )
+ s23 = self.addSwitch( 's23' )
+ s24 = self.addSwitch( 's24' )
+ s25 = self.addSwitch( 's25' )
+ s26 = self.addSwitch( 's26' )
+ s27 = self.addSwitch( 's27' )
+ s28 = self.addSwitch( 's28' )
+ s29 = self.addSwitch( 's29' )
+ s30 = self.addSwitch( 's30' )
+ s31 = self.addSwitch( 's31' )
+ s32 = self.addSwitch( 's32' )
+ s33 = self.addSwitch( 's33' )
+ s34 = self.addSwitch( 's34' )
+ s35 = self.addSwitch( 's35' )
+ s36 = self.addSwitch( 's36' )
+ s37 = self.addSwitch( 's37' )
+ s38 = self.addSwitch( 's38' )
+ s39 = self.addSwitch( 's39' )
+ s40 = self.addSwitch( 's40' )
+ s41 = self.addSwitch( 's41' )
+ s42 = self.addSwitch( 's42' )
+ s43 = self.addSwitch( 's43' )
+ s44 = self.addSwitch( 's44' )
+ s45 = self.addSwitch( 's45' )
+ s46 = self.addSwitch( 's46' )
+ s47 = self.addSwitch( 's47' )
+ s48 = self.addSwitch( 's48' )
+ s49 = self.addSwitch( 's49' )
+ s50 = self.addSwitch( 's50' )
+ s51 = self.addSwitch( 's51' )
+ s52 = self.addSwitch( 's52' )
+ s53 = self.addSwitch( 's53' )
+ s54 = self.addSwitch( 's54' )
+ s55 = self.addSwitch( 's55' )
+ s56 = self.addSwitch( 's56' )
+ s57 = self.addSwitch( 's57' )
+ s58 = self.addSwitch( 's58' )
+ s59 = self.addSwitch( 's59' )
+ s60 = self.addSwitch( 's60' )
+ s61 = self.addSwitch( 's61' )
+ s62 = self.addSwitch( 's62' )
+ s63 = self.addSwitch( 's63' )
+ s64 = self.addSwitch( 's64' )
+ s65 = self.addSwitch( 's65' )
+ s66 = self.addSwitch( 's66' )
+ s67 = self.addSwitch( 's67' )
+ s68 = self.addSwitch( 's68' )
+ s69 = self.addSwitch( 's69' )
+ s70 = self.addSwitch( 's70' )
+ s71 = self.addSwitch( 's71' )
+ s72 = self.addSwitch( 's72' )
+ s73 = self.addSwitch( 's73' )
+ s74 = self.addSwitch( 's74' )
+ s75 = self.addSwitch( 's75' )
+ s76 = self.addSwitch( 's76' )
+ s77 = self.addSwitch( 's77' )
+ s78 = self.addSwitch( 's78' )
+
+ # ... and now hosts
+ #s1_host = self.addHost( 'h1' )
+ #s2_host = self.addHost( 'h2' )
+ #s3_host = self.addHost( 'h3' )
+ #s4_host = self.addHost( 'h4' )
+ #s5_host = self.addHost( 'h5' )
+ #s6_host = self.addHost( 'h6' )
+ #s7_host = self.addHost( 'h7' )
+ #s8_host = self.addHost( 'h8' )
+ #s9_host = self.addHost( 'h9' )
+ #s10_host = self.addHost( 'h10' )
+ s11_host = self.addHost( 'h11' )
+ s12_host = self.addHost( 'h12' )
+ s13_host = self.addHost( 'h13' )
+ s14_host = self.addHost( 'h14' )
+ s15_host = self.addHost( 'h15' )
+ s16_host = self.addHost( 'h16' )
+ s17_host = self.addHost( 'h17' )
+ s18_host = self.addHost( 'h18' )
+ s19_host = self.addHost( 'h19' )
+ s20_host = self.addHost( 'h20' )
+ s21_host = self.addHost( 'h21' )
+ s22_host = self.addHost( 'h22' )
+ s23_host = self.addHost( 'h23' )
+ s24_host = self.addHost( 'h24' )
+ s25_host = self.addHost( 'h25' )
+ s26_host = self.addHost( 'h26' )
+ s27_host = self.addHost( 'h27' )
+ s28_host = self.addHost( 'h28' )
+ s29_host = self.addHost( 'h29' )
+ s30_host = self.addHost( 'h30' )
+ s31_host = self.addHost( 'h31' )
+ s32_host = self.addHost( 'h32' )
+ s33_host = self.addHost( 'h33' )
+ s34_host = self.addHost( 'h34' )
+ s35_host = self.addHost( 'h35' )
+ s36_host = self.addHost( 'h36' )
+ s37_host = self.addHost( 'h37' )
+ s38_host = self.addHost( 'h38' )
+ s39_host = self.addHost( 'h39' )
+ s40_host = self.addHost( 'h40' )
+ s41_host = self.addHost( 'h41' )
+ s42_host = self.addHost( 'h42' )
+ s43_host = self.addHost( 'h43' )
+ s44_host = self.addHost( 'h44' )
+ s45_host = self.addHost( 'h45' )
+ s46_host = self.addHost( 'h46' )
+ s47_host = self.addHost( 'h47' )
+ s48_host = self.addHost( 'h48' )
+ s49_host = self.addHost( 'h49' )
+ s50_host = self.addHost( 'h50' )
+ s51_host = self.addHost( 'h51' )
+ s52_host = self.addHost( 'h52' )
+ s53_host = self.addHost( 'h53' )
+ s54_host = self.addHost( 'h54' )
+ s55_host = self.addHost( 'h55' )
+ s56_host = self.addHost( 'h56' )
+ s57_host = self.addHost( 'h57' )
+ s58_host = self.addHost( 'h58' )
+ s59_host = self.addHost( 'h59' )
+ s60_host = self.addHost( 'h60' )
+ s61_host = self.addHost( 'h61' )
+ s62_host = self.addHost( 'h62' )
+ s63_host = self.addHost( 'h63' )
+ s64_host = self.addHost( 'h64' )
+ s65_host = self.addHost( 'h65' )
+ s66_host = self.addHost( 'h66' )
+ s67_host = self.addHost( 'h67' )
+ s68_host = self.addHost( 'h68' )
+ s69_host = self.addHost( 'h69' )
+ s70_host = self.addHost( 'h70' )
+ s71_host = self.addHost( 'h71' )
+ s72_host = self.addHost( 'h72' )
+ s73_host = self.addHost( 'h73' )
+ s74_host = self.addHost( 'h74' )
+ s75_host = self.addHost( 'h75' )
+ s76_host = self.addHost( 'h76' )
+ s77_host = self.addHost( 'h77' )
+ s78_host = self.addHost( 'h78' )
+
+ # add edges between switch and corresponding host
+ #self.addLink( s1 , s1_host )
+ #self.addLink( s2 , s2_host )
+ #self.addLink( s3 , s3_host )
+ #self.addLink( s4 , s4_host )
+ #self.addLink( s5 , s5_host )
+ #self.addLink( s6 , s6_host )
+ #self.addLink( s7 , s7_host )
+ #self.addLink( s8 , s8_host )
+ #self.addLink( s9 , s9_host )
+ #self.addLink( s10 , s10_host )
+ self.addLink( s11 , s11_host )
+ self.addLink( s12 , s12_host )
+ self.addLink( s13 , s13_host )
+ self.addLink( s14 , s14_host )
+ self.addLink( s15 , s15_host )
+ self.addLink( s16 , s16_host )
+ self.addLink( s17 , s17_host )
+ self.addLink( s18 , s18_host )
+ self.addLink( s19 , s19_host )
+ self.addLink( s20 , s20_host )
+ self.addLink( s21 , s21_host )
+ self.addLink( s22 , s22_host )
+ self.addLink( s23 , s23_host )
+ self.addLink( s24 , s24_host )
+ self.addLink( s25 , s25_host )
+ self.addLink( s26 , s26_host )
+ self.addLink( s27 , s27_host )
+ self.addLink( s28 , s28_host )
+ self.addLink( s29 , s29_host )
+ self.addLink( s30 , s30_host )
+ self.addLink( s31 , s31_host )
+ self.addLink( s32 , s32_host )
+ self.addLink( s33 , s33_host )
+ self.addLink( s34 , s34_host )
+ self.addLink( s35 , s35_host )
+ self.addLink( s36 , s36_host )
+ self.addLink( s37 , s37_host )
+ self.addLink( s38 , s38_host )
+ self.addLink( s39 , s39_host )
+ self.addLink( s40 , s40_host )
+ self.addLink( s41 , s41_host )
+ self.addLink( s42 , s42_host )
+ self.addLink( s43 , s43_host )
+ self.addLink( s44 , s44_host )
+ self.addLink( s45 , s45_host )
+ self.addLink( s46 , s46_host )
+ self.addLink( s47 , s47_host )
+ self.addLink( s48 , s48_host )
+ self.addLink( s49 , s49_host )
+ self.addLink( s50 , s50_host )
+ self.addLink( s51 , s51_host )
+ self.addLink( s52 , s52_host )
+ self.addLink( s53 , s53_host )
+ self.addLink( s54 , s54_host )
+ self.addLink( s55 , s55_host )
+ self.addLink( s56 , s56_host )
+ self.addLink( s57 , s57_host )
+ self.addLink( s58 , s58_host )
+ self.addLink( s59 , s59_host )
+ self.addLink( s60 , s60_host )
+ self.addLink( s61 , s61_host )
+ self.addLink( s62 , s62_host )
+ self.addLink( s63 , s63_host )
+ self.addLink( s64 , s64_host )
+ self.addLink( s65 , s65_host )
+ self.addLink( s66 , s66_host )
+ self.addLink( s67 , s67_host )
+ self.addLink( s68 , s68_host )
+ self.addLink( s69 , s69_host )
+ self.addLink( s70 , s70_host )
+ self.addLink( s71 , s71_host )
+ self.addLink( s72 , s72_host )
+ self.addLink( s73 , s73_host )
+ self.addLink( s74 , s74_host )
+ self.addLink( s75 , s75_host )
+ self.addLink( s76 , s76_host )
+ self.addLink( s77 , s77_host )
+ self.addLink( s78 , s78_host )
+
+ #info( '*** Add Leaf links\n')
+ self.addLink(s1, s9)
+ self.addLink(s2, s10)
+ self.addLink(s3, s9)
+ self.addLink(s4, s10)
+ self.addLink(s5, s9)
+ self.addLink(s6, s10)
+ self.addLink(s7, s9)
+ self.addLink(s8, s10)
+ self.addLink(s9, s11)
+ self.addLink(s9, s12)
+ self.addLink(s10, s13)
+ self.addLink(s10, s14)
+ self.addLink(s11, s12)
+ self.addLink(s13, s14)
+
+ #info( '*** Add Spine-1 links\n')
+ self.addLink(s15, s1)
+ self.addLink(s15, s2)
+ self.addLink(s16, s1)
+ self.addLink(s16, s2)
+ self.addLink(s17, s1)
+ self.addLink(s17, s2)
+ self.addLink(s18, s1)
+ self.addLink(s18, s2)
+ self.addLink(s19, s1)
+ self.addLink(s19, s2)
+ self.addLink(s20, s1)
+ self.addLink(s20, s2)
+ self.addLink(s21, s1)
+ self.addLink(s21, s2)
+ self.addLink(s22, s1)
+ self.addLink(s22, s2)
+ self.addLink(s23, s1)
+ self.addLink(s23, s2)
+ self.addLink(s24, s1)
+ self.addLink(s24, s2)
+ self.addLink(s25, s1)
+ self.addLink(s25, s2)
+ self.addLink(s26, s1)
+ self.addLink(s26, s2)
+ self.addLink(s27, s1)
+ self.addLink(s27, s2)
+ self.addLink(s28, s1)
+ self.addLink(s28, s2)
+ self.addLink(s29, s1)
+ self.addLink(s29, s2)
+ self.addLink(s30, s1)
+ self.addLink(s30, s2)
+
+ #info( '*** Add Spine-2 links\n')
+ self.addLink(s31, s3)
+ self.addLink(s31, s4)
+ self.addLink(s32, s3)
+ self.addLink(s32, s4)
+ self.addLink(s33, s3)
+ self.addLink(s33, s4)
+ self.addLink(s34, s3)
+ self.addLink(s34, s4)
+ self.addLink(s35, s3)
+ self.addLink(s35, s4)
+ self.addLink(s36, s3)
+ self.addLink(s36, s4)
+ self.addLink(s37, s3)
+ self.addLink(s37, s4)
+ self.addLink(s38, s3)
+ self.addLink(s38, s4)
+ self.addLink(s39, s3)
+ self.addLink(s39, s4)
+ self.addLink(s40, s3)
+ self.addLink(s40, s4)
+ self.addLink(s41, s3)
+ self.addLink(s41, s4)
+ self.addLink(s42, s3)
+ self.addLink(s42, s4)
+ self.addLink(s43, s3)
+ self.addLink(s43, s4)
+ self.addLink(s44, s3)
+ self.addLink(s44, s4)
+ self.addLink(s45, s3)
+ self.addLink(s45, s4)
+ self.addLink(s46, s3)
+ self.addLink(s46, s4)
+
+ #info( '*** Add Spine-3 links\n')
+ self.addLink(s47, s5)
+ self.addLink(s47, s6)
+ self.addLink(s48, s5)
+ self.addLink(s48, s6)
+ self.addLink(s49, s5)
+ self.addLink(s49, s6)
+ self.addLink(s50, s5)
+ self.addLink(s50, s6)
+ self.addLink(s51, s5)
+ self.addLink(s51, s6)
+ self.addLink(s52, s5)
+ self.addLink(s52, s6)
+ self.addLink(s53, s5)
+ self.addLink(s53, s6)
+ self.addLink(s54, s5)
+ self.addLink(s54, s6)
+ self.addLink(s55, s5)
+ self.addLink(s55, s6)
+ self.addLink(s56, s5)
+ self.addLink(s56, s6)
+ self.addLink(s57, s5)
+ self.addLink(s57, s6)
+ self.addLink(s58, s5)
+ self.addLink(s58, s6)
+ self.addLink(s59, s5)
+ self.addLink(s59, s6)
+ self.addLink(s60, s5)
+ self.addLink(s60, s6)
+ self.addLink(s61, s5)
+ self.addLink(s61, s6)
+ self.addLink(s62, s5)
+ self.addLink(s62, s6)
+
+ #info( '*** Add Spine-4 links\n')
+ self.addLink(s63, s7)
+ self.addLink(s63, s8)
+ self.addLink(s64, s7)
+ self.addLink(s64, s8)
+ self.addLink(s65, s7)
+ self.addLink(s65, s8)
+ self.addLink(s66, s7)
+ self.addLink(s66, s8)
+ self.addLink(s67, s7)
+ self.addLink(s67, s8)
+ self.addLink(s68, s7)
+ self.addLink(s68, s8)
+ self.addLink(s69, s7)
+ self.addLink(s69, s8)
+ self.addLink(s70, s7)
+ self.addLink(s70, s8)
+ self.addLink(s71, s7)
+ self.addLink(s71, s8)
+ self.addLink(s72, s7)
+ self.addLink(s72, s8)
+ self.addLink(s73, s7)
+ self.addLink(s73, s8)
+ self.addLink(s74, s7)
+ self.addLink(s74, s8)
+ self.addLink(s75, s7)
+ self.addLink(s75, s8)
+ self.addLink(s76, s7)
+ self.addLink(s76, s8)
+ self.addLink(s77, s7)
+ self.addLink(s77, s8)
+ self.addLink(s78, s7)
+ self.addLink(s78, s8)
+
+topos = { 'spine': ( lambda: spineTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = spineTopo()
+ #if controller_ip == '':
+ #controller_ip = '10.0.2.2';
+ # controller_ip = '127.0.0.1';
+ network = Mininet(topo=topo, switch=OVSSwitch, link=TCLink, autoSetMacs = True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
+
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
new file mode 100644
index 0000000..024bd11
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -0,0 +1,89 @@
+<PARAMS>
+ # 1,20,3,[40,5,60,70,80,10,90,71,81,10,93,10]*50,21,3,[41,5,61,72,82,10,91,73,83,10,94,10]*50,22,3,[42,5,62,10,92,10,95,10,98,10]*50
+ # 1. Starts ONOS cluster with 5 nodes
+ # 20. Starts Att Topology
+ # 21. Starts Chordal Topology
+ # 22. Starts Spine-Leaf Topology
+ # 3. Checks the consistency of ONOS and Mininet's topologies
+ # 4X. Reactive forwarding | host discovery
+ # 5. ONOS Topology verification
+ # 6X. host intents
+ # 7X. Bring random links down( Unique for each topology)
+ # 8X. Bring random links back up
+ # 9X Point,Multi-single,Single-Multi Intents
+
+ <testcases>1,20,3,40,5,60</testcases>
+ <ENV>
+ <cellName>choTest3</cellName>
+ </ENV>
+ <GIT>
+ #autoPull 'on' or 'off'
+ <autoPull>off</autoPull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <numCtrl>3</numCtrl>
+ <karafCliTimeout>3600000</karafCliTimeout>
+ </CTRL>
+
+ <TOPO1>
+ <topo>~/mininet/custom/topoAtt.py</topo>
+ <numSwitches>25</numSwitches>
+ <numHosts>25</numHosts>
+ <numLinks>114</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO1>
+
+ <TOPO2>
+ <topo>~/mininet/custom/topoChordal.py</topo>
+ <numSwitches>25</numSwitches>
+ <numHosts>25</numHosts>
+ <numLinks>600</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO2>
+
+ <TOPO3>
+ <topo>~/mininet/custom/topoSpine.py</topo>
+ <numSwitches>78</numSwitches>
+ <numHosts>68</numHosts>
+ <numLinks>284</numLinks>
+ <numPaths>1</numPaths>
+ </TOPO3>
+
+ <HOSTS>
+ <startMAC>00:00:00:00:00:01</startMAC>
+ <endMAC>00:00:00:00:00:19</endMAC>
+ </HOSTS>
+
+ <ATTCORELINKS>
+ <toggleLinks>1</toggleLinks>
+
+ <linkS3a>s3</linkS3a>
+ <linkS3b>s1,s4,s7,s10,s16,s17,s18,s21,s22</linkS3b>
+ #######s1,s4,s7,s10,s16,s17,s18,s21,s22########
+
+ <linkS14a>s14</linkS14a>
+ <linkS14b>s6,s9,s10,s11,s12,s13,s16,s17,s23</linkS14b>
+ ########s6,s9,s10,s11,s12,s13,s16,s17,s18,s23########
+
+ <linkS18a>s18</linkS18a>
+ <linkS18b>s14,s16,s17,s19,s20,s21,s22,s23</linkS18b>
+ #######s3,s14,s16,s17,s19,s20,s21,s22,s23########
+ </ATTCORELINKS>
+
+ <SPINECORELINKS>
+ <linkS9>s9</linkS9>
+ <linkS9top>s1,s3,s5,s7</linkS9top>
+ <linkS9bot>s11,s12</linkS9bot>
+ <linkS10>s10</linkS10>
+ <linkS10top>s2,s4,s6,s8</linkS10top>
+ <linkS10bot>s13,s14</linkS10bot>
+ </SPINECORELINKS>
+
+ <timers>
+ <LinkDiscovery>10</LinkDiscovery>
+ <SwitchDiscovery>10</SwitchDiscovery>
+ </timers>
+
+</PARAMS>
\ No newline at end of file
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
new file mode 100644
index 0000000..dfdfd39
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -0,0 +1,2375 @@
+import sys
+import os
+import re
+import time
+import json
+import itertools
+
+
+class OnosCHO:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ Startup sequence:
+ git pull
+ mvn clean install
+ onos-package
+ apply cell <name>
+ onos-verify-cell
+ onos-uninstall
+ onos-install
+ onos-start-cli
+ """
+ import time
+
+ global intentState
+ main.threadID = 0
+ main.pingTimeout = 300
+ main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+ cell_name = main.params[ 'ENV' ][ 'cellName' ]
+ git_pull = main.params[ 'GIT' ][ 'autoPull' ]
+ git_branch = main.params[ 'GIT' ][ 'branch' ]
+ karafTimeout = main.params['CTRL']['karafCliTimeout']
+ main.newTopo = ""
+ main.CLIs = []
+ main.onosIPs = []
+
+ for i in range( 1, int(main.numCtrls) + 1 ):
+ main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+ main.case( "Set up test environment" )
+ main.log.report( "Set up test environment" )
+ main.log.report( "_______________________" )
+
+ main.step( "Git checkout and pull " + git_branch )
+ if git_pull == 'on':
+ checkout_result = main.ONOSbench.gitCheckout( git_branch )
+ pull_result = main.ONOSbench.gitPull()
+ cp_result = ( checkout_result and pull_result )
+ else:
+ checkout_result = main.TRUE
+ pull_result = main.TRUE
+ main.log.info( "Skipped git checkout and pull" )
+ cp_result = ( checkout_result and pull_result )
+ utilities.assert_equals( expect=main.TRUE, actual=cp_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+
+ main.step( "mvn clean & install" )
+ if git_pull == 'on':
+ mvn_result = main.ONOSbench.cleanInstall()
+ utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ else:
+ mvn_result = main.TRUE
+ main.log.info("Skipped mvn clean install as git pull is disabled in params file")
+
+ main.ONOSbench.getVersion( report=True )
+
+ main.step( "Apply Cell environment for ONOS" )
+ cell_result = main.ONOSbench.setCell( cell_name )
+ onosNodes = main.ONOSbench.getOnosIPfromCell()
+ main.onosIPs = onosNodes
+ utilities.assert_equals( expect=main.TRUE, actual=cell_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+
+ main.step( "Create ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ utilities.assert_equals( expect=main.TRUE, actual=packageResult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+
+ main.step( "Uninstall ONOS package on all Nodes" )
+ uninstallResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
+ u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=u_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ uninstallResult = ( uninstallResult and u_result )
+
+ main.step( "Install ONOS package on all Nodes" )
+ installResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "Intsalling package on ONOS Node IP: " + main.onosIPs[i] )
+ i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=i_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ installResult = ( installResult and i_result )
+
+ main.step( "Verify ONOS nodes UP status" )
+ statusResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
+ onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=onos_status,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ statusResult = ( statusResult and onos_status )
+
+ main.step( "Start ONOS CLI on all nodes" )
+ cliResult = main.TRUE
+ main.log.step(" Start ONOS cli using thread ")
+ startCliResult = main.TRUE
+ pool = []
+ time1 = time.time()
+ for i in range( int( main.numCtrls) ):
+ t = main.Thread( target=main.CLIs[i].startOnosCli,
+ threadID=main.threadID,
+ name="startOnosCli",
+ args=[ main.onosIPs[i], karafTimeout ] )
+ pool.append(t)
+ t.start()
+ main.threadID = main.threadID + 1
+ for t in pool:
+ t.join()
+ startCliResult = startCliResult and t.result
+ time2 = time.time()
+
+ if not startCliResult:
+ main.log.info("ONOS CLI did not start up properly")
+ main.cleanup()
+ main.exit()
+ else:
+ main.log.info("Successful CLI startup")
+ startCliResult = main.TRUE
+ case1Result = installResult and uninstallResult and statusResult and startCliResult
+ time.sleep(30)
+ main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
+ utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+ onpass="Set up test environment PASS",
+ onfail="Set up test environment FAIL" )
+
+ def CASE20( self, main ):
+ """
+ This test script Loads a new Topology (Att) on CHO setup and balances all switches
+ """
+ import re
+ import time
+ import copy
+
+ main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
+ main.pingTimeout = 300
+ main.log.report(
+ "Load Att topology and Balance all Mininet switches across controllers" )
+ main.log.report(
+ "________________________________________________________________________" )
+ main.case(
+ "Assign and Balance all Mininet switches across controllers" )
+
+ main.step( "Stop any previous Mininet network topology" )
+ cliResult = main.TRUE
+ if main.newTopo == main.params['TOPO3']['topo']:
+ stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
+
+ main.step( "Start Mininet with Att topology" )
+ main.newTopo = main.params['TOPO1']['topo']
+ startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+
+ main.step( "Assign switches to controllers" )
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
+ sw="s" + str( i ),
+ ip=main.onosIPs )
+
+ switch_mastership = main.TRUE
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.onosIPs[0], response ):
+ switch_mastership = switch_mastership and main.TRUE
+ else:
+ switch_mastership = main.FALSE
+
+ if switch_mastership == main.TRUE:
+ main.log.report( "Controller assignment successfull" )
+ else:
+ main.log.report( "Controller assignment failed" )
+
+ time.sleep(30) # waiting here to make sure topology converges across all nodes
+
+ main.step( "Balance devices across controllers" )
+ balanceResult = main.ONOScli1.balanceMasters()
+ # giving some breathing time for ONOS to complete re-balance
+ time.sleep( 5 )
+
+ topology_output = main.ONOScli1.topology()
+ topology_result = main.ONOSbench.getTopology( topology_output )
+ case2Result = ( switch_mastership and startStatus )
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case2Result,
+ onpass="Starting new Att topology test PASS",
+ onfail="Starting new Att topology test FAIL" )
+
+ def CASE21( self, main ):
+ """
+ This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
+ """
+ import re
+ import time
+ import copy
+
+ main.newTopo = main.params['TOPO2']['topo']
+ main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
+ main.pingTimeout = 300
+ main.log.report(
+ "Load Chordal topology and Balance all Mininet switches across controllers" )
+ main.log.report(
+ "________________________________________________________________________" )
+ main.case(
+ "Assign and Balance all Mininet switches across controllers" )
+
+ main.step( "Stop any previous Mininet network topology" )
+ stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
+
+ main.step( "Start Mininet with Chordal topology" )
+ startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+
+ main.step( "Assign switches to controllers" )
+
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
+ sw="s" + str( i ),
+ ip=main.onosIPs )
+
+ switch_mastership = main.TRUE
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.onosIPs[0], response ):
+ switch_mastership = switch_mastership and main.TRUE
+ else:
+ switch_mastership = main.FALSE
+
+ if switch_mastership == main.TRUE:
+ main.log.report( "Controller assignment successfull" )
+ else:
+ main.log.report( "Controller assignment failed" )
+
+ main.step( "Balance devices across controllers" )
+ balanceResult = main.ONOScli1.balanceMasters()
+ # giving some breathing time for ONOS to complete re-balance
+ time.sleep( 5 )
+
+ case21Result = switch_mastership
+ time.sleep(30)
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case21Result,
+ onpass="Starting new Chordal topology test PASS",
+ onfail="Starting new Chordal topology test FAIL" )
+
+ def CASE22( self, main ):
+ """
+ This test script Loads a new Topology (Spine) on CHO setup and balances all switches
+ """
+ import re
+ import time
+ import copy
+
+ main.newTopo = main.params['TOPO3']['topo']
+ main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
+ main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
+ main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
+ main.pingTimeout = 600
+
+ main.log.report(
+ "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
+ main.log.report(
+ "________________________________________________________________________" )
+ main.case(
+ "Assign and Balance all Mininet switches across controllers" )
+ main.step( "Stop any previous Mininet network topology" )
+ stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
+ main.step( "Start Mininet with Spine topology" )
+ startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
+ time.sleep(60)
+ main.step( "Assign switches to controllers" )
+
+ for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
+ main.Mininet1.assignSwController(
+ sw="s" + str( i ),
+ ip=main.onosIPs )
+
+ switch_mastership = main.TRUE
+ for i in range( 1, ( main.numMNswitches + 1 ) ):
+ response = main.Mininet1.getSwController( "s" + str( i ) )
+ print( "Response is " + str( response ) )
+ if re.search( "tcp:" + main.onosIPs[0], response ):
+ switch_mastership = switch_mastership and main.TRUE
+ else:
+ switch_mastership = main.FALSE
+
+ if switch_mastership == main.TRUE:
+ main.log.report( "Controller assignment successfull" )
+ else:
+ main.log.report( "Controller assignment failed" )
+ time.sleep( 5 )
+
+ main.step( "Balance devices across controllers" )
+ for i in range( int( main.numCtrls ) ):
+ balanceResult = main.ONOScli1.balanceMasters()
+ # giving some breathing time for ONOS to complete re-balance
+ time.sleep( 3 )
+
+ case22Result = switch_mastership
+ time.sleep(60)
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case22Result,
+ onpass="Starting new Spine topology test PASS",
+ onfail="Starting new Spine topology test FAIL" )
+
+ def CASE3( self, main ):
+ """
+ This Test case will be extended to collect and store more data related
+ ONOS state.
+ """
+ import re
+ import copy
+ main.deviceDPIDs = []
+ main.hostMACs = []
+ main.deviceLinks = []
+ main.deviceActiveLinksCount = []
+ main.devicePortsEnabledCount = []
+
+ main.log.report(
+ "Collect and Store topology details from ONOS before running any Tests" )
+ main.log.report(
+ "____________________________________________________________________" )
+ main.case( "Collect and Store Topology Details from ONOS" )
+ main.step( "Collect and store current number of switches and links" )
+ topology_output = main.ONOScli1.topology()
+ topology_result = main.ONOSbench.getTopology( topology_output )
+ numOnosDevices = topology_result[ 'devices' ]
+ numOnosLinks = topology_result[ 'links' ]
+ topoResult = main.TRUE
+
+ if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
+ main.step( "Store Device DPIDs" )
+ for i in range( 1, (main.numMNswitches+1) ):
+ main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
+ print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
+
+ main.step( "Store Host MACs" )
+ for i in range( 1, ( main.numMNhosts + 1 ) ):
+ main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
+ print "Host MACs in Store: \n", str( main.hostMACs )
+ main.MACsDict = {}
+ print "Creating dictionary of DPID and HostMacs"
+ for i in range(len(main.hostMACs)):
+ main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
+ print main.MACsDict
+ main.step( "Collect and store all Devices Links" )
+ linksResult = main.ONOScli1.links( jsonFormat=False )
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ linksResult = ansi_escape.sub( '', linksResult )
+ linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
+ linksResult = linksResult.splitlines()
+ main.deviceLinks = copy.copy( linksResult )
+ print "Device Links Stored: \n", str( main.deviceLinks )
+ # this will be asserted to check with the params provided count of
+ # links
+ print "Length of Links Store", len( main.deviceLinks )
+
+ main.step( "Collect and store each Device ports enabled Count" )
+ time1 = time.time()
+ for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= main.numMNswitches + 1:
+ break
+ dpid = "of:00000000000000" + format( i,'02x' )
+ t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
+ t.start()
+ pool.append(t)
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ portResult = thread.result
+ main.devicePortsEnabledCount.append( portResult )
+ print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
+ time2 = time.time()
+ main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
+
+ main.step( "Collect and store each Device active links Count" )
+ time1 = time.time()
+
+ for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= main.numMNswitches + 1:
+ break
+ dpid = "of:00000000000000" + format( i,'02x' )
+ t = main.Thread( target = cli.getDeviceLinksActiveCount,
+ threadID = main.threadID,
+ name = "getDevicePortsEnabledCount",
+ args = [dpid])
+ t.start()
+ pool.append(t)
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ linkCountResult = thread.result
+ main.deviceActiveLinksCount.append( linkCountResult )
+ print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+ time2 = time.time()
+ main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
+
+ else:
+ main.log.info("Devices (expected): %s, Links (expected): %s" %
+ ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
+ main.log.info("Devices (actual): %s, Links (actual): %s" %
+ ( numOnosDevices , numOnosLinks ) )
+ main.log.info("Topology does not match, exiting CHO test...")
+ topoResult = main.FALSE
+ # It's better exit here from running the test
+ main.cleanup()
+ main.exit()
+
+ # just returning TRUE for now as this one just collects data
+ case3Result = topoResult
+ utilities.assert_equals( expect=main.TRUE, actual=case3Result,
+ onpass="Saving ONOS topology data test PASS",
+ onfail="Saving ONOS topology data test FAIL" )
+
+ def CASE40( self, main ):
+ """
+ Verify Reactive forwarding (Att Topology)
+ """
+ import re
+ import copy
+ import time
+ main.log.report( "Verify Reactive forwarding (Att Topology)" )
+ main.log.report( "______________________________________________" )
+ main.case( "Enable Reactive forwarding and Verify ping all" )
+ main.step( "Enable Reactive forwarding" )
+ installResult = main.TRUE
+ # Activate fwd app
+ appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
+ appCheck = main.TRUE
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ time.sleep( 10 )
+
+ main.step( "Verify Pingall" )
+ ping_result = main.FALSE
+ time1 = time.time()
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ if ping_result == main.TRUE:
+ main.log.report( "Pingall Test in Reactive mode successful" )
+ else:
+ main.log.report( "Pingall Test in Reactive mode failed" )
+
+ main.step( "Disable Reactive forwarding" )
+
+ main.log.info( "Uninstall reactive forwarding app" )
+ appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ # Waiting for reative flows to be cleared.
+ time.sleep( 30 )
+ case40Result = installResult and uninstallResult and ping_result
+ utilities.assert_equals( expect=main.TRUE, actual=case40Result,
+ onpass="Reactive Mode Pingall test PASS",
+ onfail="Reactive Mode Pingall test FAIL" )
+
+ def CASE41( self, main ):
+ """
+ Verify Reactive forwarding (Chordal Topology)
+ """
+ import re
+ import copy
+ import time
+ main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
+ main.log.report( "______________________________________________" )
+ main.case( "Enable Reactive forwarding and Verify ping all" )
+ main.step( "Enable Reactive forwarding" )
+ installResult = main.TRUE
+ # Activate fwd app
+ appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
+
+ appCheck = main.TRUE
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ time.sleep( 10 )
+
+ main.step( "Verify Pingall" )
+ ping_result = main.FALSE
+ time1 = time.time()
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ if ping_result == main.TRUE:
+ main.log.report( "Pingall Test in Reactive mode successful" )
+ else:
+ main.log.report( "Pingall Test in Reactive mode failed" )
+
+ main.step( "Disable Reactive forwarding" )
+
+ main.log.info( "Uninstall reactive forwarding app" )
+ appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ # Waiting for reative flows to be cleared.
+ time.sleep( 30 )
+ case41Result = installResult and uninstallResult and ping_result
+ utilities.assert_equals( expect=main.TRUE, actual=case41Result,
+ onpass="Reactive Mode Pingall test PASS",
+ onfail="Reactive Mode Pingall test FAIL" )
+
+ def CASE42( self, main ):
+ """
+ Verify Reactive forwarding (Spine Topology)
+ """
+ import re
+ import copy
+ import time
+ main.log.report( "Verify Reactive forwarding (Spine Topology)" )
+ main.log.report( "______________________________________________" )
+ main.case( "Enable Reactive forwarding and Verify ping all" )
+ main.step( "Enable Reactive forwarding" )
+ installResult = main.TRUE
+ # Activate fwd app
+ appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
+
+ appCheck = main.TRUE
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ time.sleep( 10 )
+
+ main.step( "Verify Pingall" )
+ ping_result = main.FALSE
+ time1 = time.time()
+ ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ if ping_result == main.TRUE:
+ main.log.report( "Pingall Test in Reactive mode successful" )
+ else:
+ main.log.report( "Pingall Test in Reactive mode failed" )
+
+ main.step( "Disable Reactive forwarding" )
+
+ main.log.info( "Uninstall reactive forwarding app" )
+ appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
+ pool = []
+ for cli in main.CLIs:
+ t = main.Thread( target=cli.appToIDCheck,
+ name="appToIDCheck-" + str( i ),
+ args=[] )
+ pool.append( t )
+ t.start()
+
+ for t in pool:
+ t.join()
+ appCheck = appCheck and t.result
+ utilities.assert_equals( expect=main.TRUE, actual=appCheck,
+ onpass="App Ids seem to be correct",
+ onfail="Something is wrong with app Ids" )
+ if appCheck != main.TRUE:
+ main.log.warn( main.CLIs[0].apps() )
+ main.log.warn( main.CLIs[0].appIDs() )
+
+ # Waiting for reative flows to be cleared.
+ time.sleep( 30 )
+ case42Result = installResult and uninstallResult and ping_result
+ utilities.assert_equals( expect=main.TRUE, actual=case42Result,
+ onpass="Reactive Mode Pingall test PASS",
+ onfail="Reactive Mode Pingall test FAIL" )
+
+ def CASE5( self, main ):
+ """
+ Compare current ONOS topology with reference data
+ """
+ import re
+
+ devicesDPIDTemp = []
+ hostMACsTemp = []
+ deviceLinksTemp = []
+ deviceActiveLinksCountTemp = []
+ devicePortsEnabledCountTemp = []
+
+ main.log.report(
+ "Compare ONOS topology with reference data in Stores" )
+ main.log.report( "__________________________________________________" )
+ main.case( "Compare ONOS topology with reference data" )
+
+ main.step( "Compare current Device ports enabled with reference" )
+ time1 = time.time()
+ for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= main.numMNswitches + 1:
+ break
+ dpid = "of:00000000000000" + format( i,'02x' )
+ t = main.Thread(target = cli.getDevicePortsEnabledCount,
+ threadID = main.threadID,
+ name = "getDevicePortsEnabledCount",
+ args = [dpid])
+ t.start()
+ pool.append(t)
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ portResult = thread.result
+ #portTemp = re.split( r'\t+', portResult )
+ #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ devicePortsEnabledCountTemp.append( portResult )
+
+ time2 = time.time()
+ main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
+ main.log.info (
+ "Device Enabled ports EXPECTED: %s" %
+ str( main.devicePortsEnabledCount ) )
+ main.log.info (
+ "Device Enabled ports ACTUAL: %s" %
+ str( devicePortsEnabledCountTemp ) )
+
+ if ( cmp( main.devicePortsEnabledCount,
+ devicePortsEnabledCountTemp ) == 0 ):
+ stepResult1 = main.TRUE
+ else:
+ stepResult1 = main.FALSE
+
+ main.step( "Compare Device active links with reference" )
+ time1 = time.time()
+ for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= main.numMNswitches + 1:
+ break
+ dpid = "of:00000000000000" + format( i,'02x' )
+ t = main.Thread(target = cli.getDeviceLinksActiveCount,
+ threadID = main.threadID,
+ name = "getDeviceLinksActiveCount",
+ args = [dpid])
+ t.start()
+ pool.append(t)
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ linkCountResult = thread.result
+ #linkCountTemp = re.split( r'\t+', linkCountResult )
+ #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+ deviceActiveLinksCountTemp.append( linkCountResult )
+
+ time2 = time.time()
+ main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
+ main.log.info (
+ "Device Active links EXPECTED: %s" %
+ str( main.deviceActiveLinksCount ) )
+ main.log.info (
+ "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
+ if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
+ stepResult2 = main.TRUE
+ else:
+ stepResult2 = main.FALSE
+
+ """
+ place holder for comparing devices, hosts, paths and intents if required.
+ Links and ports data would be incorrect with out devices anyways.
+ """
+ case5Result = ( stepResult1 and stepResult2 )
+ utilities.assert_equals( expect=main.TRUE, actual=case5Result,
+ onpass="Compare Topology test PASS",
+ onfail="Compare Topology test FAIL" )
+
+ def CASE60( self ):
+ """
+ Install 300 host intents and verify ping all (Att Topology)
+ """
+ main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+ import time
+ main.case( "Install 300 host intents" )
+ main.step( "Add host Intents" )
+ intentResult = main.TRUE
+ hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
+
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( hostCombos ):
+ break
+ t = main.Thread( target=cli.addHostIntent,
+ threadID=main.threadID,
+ name="addHostIntent",
+ args=[hostCombos[i][0],hostCombos[i][1]])
+ pool.append(t)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print "len of intent ID", str(len(intentIdList))
+ print "len of intent state results", str(len(getIntentStateResult))
+ print getIntentStateResult
+ # Takes awhile for all the onos to get the intents
+ time.sleep( 30 )
+ """intentState = main.TRUE
+ for i in getIntentStateResult:
+ if getIntentStateResult.get( 'state' ) != 'INSTALLED':
+ """
+
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case60Result = ( intentResult and pingResult )
+ waitForDebug = int (main.params[ 'ENV' ][ 'debugWait' ])
+ time.sleep(waitForDebug)
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case60Result,
+ onpass="Install 300 Host Intents and Ping All test PASS",
+ onfail="Install 300 Host Intents and Ping All test FAIL" )
+
+ def CASE61( self ):
+ """
+ Install 600 host intents and verify ping all for Chordal Topology
+ """
+ main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+
+ main.case( "Install 600 host intents" )
+ main.step( "Add host Intents" )
+ intentResult = main.TRUE
+ hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
+
+ intentIdList = []
+ time1 = time.time()
+
+ for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( hostCombos ):
+ break
+ t = main.Thread( target=cli.addHostIntent,
+ threadID=main.threadID,
+ name="addHostIntent",
+ args=[hostCombos[i][0],hostCombos[i][1]])
+ pool.append(t)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print getIntentStateResult
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case14Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case14Result,
+ onpass="Install 300 Host Intents and Ping All test PASS",
+ onfail="Install 300 Host Intents and Ping All test FAIL" )
+
+ def CASE62( self ):
+ """
+ Install 2278 host intents and verify ping all for Spine Topology
+ """
+ main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+
+ main.case( "Install 2278 host intents" )
+ main.step( "Add host Intents" )
+ intentResult = main.TRUE
+ hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
+ main.pingTimeout = 300
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( hostCombos ):
+ break
+ t = main.Thread( target=cli.addHostIntent,
+ threadID=main.threadID,
+ name="addHostIntent",
+ args=[hostCombos[i][0],hostCombos[i][1]])
+ pool.append(t)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print getIntentStateResult
+
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case15Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case15Result,
+ onpass="Install 2278 Host Intents and Ping All test PASS",
+ onfail="Install 2278 Host Intents and Ping All test FAIL" )
+
+ def CASE70( self, main ):
+ """
+ Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
+ """
+ import random
+ main.randomLink1 = []
+ main.randomLink2 = []
+ main.randomLink3 = []
+ link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
+ link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
+ link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
+ link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
+ link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
+ link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
+ switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
+ 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 your 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" )
+ main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+ main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+ main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+ for i in range( int( switchLinksToToggle ) ):
+ main.Mininet1.link(
+ END1=link1End1,
+ END2=main.randomLink1[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link2End1,
+ END2=main.randomLink2[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link3End1,
+ END2=main.randomLink3[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - 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(timeout=main.pingTimeout )
+ 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" )
+
+ caseResult70 = linkDown and pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
+ onpass="Random Link cut Test PASS",
+ onfail="Random Link cut Test FAIL" )
+
+ def CASE80( self, main ):
+ """
+ Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
+ """
+ import random
+ link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
+ link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
+ link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+ switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
+
+ main.log.report(
+ "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
+ 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=main.randomLink1[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link2End1,
+ END2=main.randomLink2[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link3End1,
+ END2=main.randomLink3[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.checkStatus(
+ topology_output,
+ main.numMNswitches,
+ str( main.numMNlinks ) )
+ 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( timeout=main.pingTimeout )
+ 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" )
+
+ caseResult80 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
+ 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-Att Topo)
+ """
+ import random
+ main.randomLink1 = []
+ main.randomLink2 = []
+ main.randomLink3 = []
+ link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
+ link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
+ link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
+ link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
+ link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
+ link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
+ switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
+ 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 your 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" )
+ main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+ main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+ main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+ for i in range( int( switchLinksToToggle ) ):
+ main.Mininet1.link(
+ END1=link1End1,
+ END2=main.randomLink1[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link2End1,
+ END2=main.randomLink2[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link3End1,
+ END2=main.randomLink3[ i ],
+ OPTION="down" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - 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(timeout=main.pingTimeout)
+ 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" )
+
+ caseResult71 = linkDown and pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+ 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-Att Topo )
+ """
+ import random
+ link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
+ link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
+ link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+ switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
+
+ main.log.report(
+ "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
+ 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=main.randomLink1[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link2End1,
+ END2=main.randomLink2[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+ main.Mininet1.link(
+ END1=link3End1,
+ END2=main.randomLink3[ i ],
+ OPTION="up" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.checkStatus(
+ topology_output,
+ main.numMNswitches,
+ str( main.numMNlinks ) )
+ 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(timeout = main.pingTimeout )
+ 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" )
+
+ caseResult81 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
+ onpass="Link Up Test PASS",
+ onfail="Link Up Test FAIL" )
+
+ def CASE72( self, main ):
+ """
+ Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
+ """
+ import random
+ import itertools
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
+ main.log.report( "___________________________________________________________________________" )
+ main.case( "Host intents - Randomly bring some core links down and verify ping all" )
+ switches = []
+ switchesComb = []
+ for i in range( main.numMNswitches ):
+ switches.append('s%d'%(i+1))
+ switchesLinksComb = list(itertools.combinations(switches,2))
+ main.randomLinks = random.sample(switchesLinksComb, 5 )
+ print main.randomLinks
+ main.step( "Cut links on random devices" )
+
+ for switch in main.randomLinks:
+ main.Mininet1.link(
+ END1=switch[0],
+ END2=switch[1],
+ OPTION="down")
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - 5 * 2 ) )
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult71 = pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+ onpass="Random Link cut Test PASS",
+ onfail="Random Link cut Test FAIL" )
+
+ def CASE82( self, main ):
+ """
+ Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
+ """
+ import random
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report(
+ "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
+ 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 devices up" )
+
+ for switch in main.randomLinks:
+ main.Mininet1.link(
+ END1=switch[0],
+ END2=switch[1],
+ OPTION="up")
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.checkStatus(
+ topology_output,
+ main.numMNswitches,
+ str( main.numMNlinks ) )
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult82 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
+ onpass="Link Up Test PASS",
+ onfail="Link Up Test FAIL" )
+
+ def CASE73( self, main ):
+ """
+ Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
+ """
+ import random
+ import itertools
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
+ main.log.report( "___________________________________________________________________________" )
+ main.case( "Point intents - Randomly bring some core links down and verify ping all" )
+ switches = []
+ switchesComb = []
+ for i in range( main.numMNswitches ):
+ switches.append('s%d'%(i+1))
+ switchesLinksComb = list(itertools.combinations(switches,2))
+ main.randomLinks = random.sample(switchesLinksComb, 5 )
+ print main.randomLinks
+ main.step( "Cut links on random devices" )
+
+ for switch in main.randomLinks:
+ main.Mininet1.link(
+ END1=switch[0],
+ END2=switch[1],
+ OPTION="down")
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - 5 * 2 ) )
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult73 = pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
+ onpass="Random Link cut Test PASS",
+ onfail="Random Link cut Test FAIL" )
+
+ def CASE83( self, main ):
+ """
+ Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
+ """
+ import random
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+ main.log.report(
+ "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
+ 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 devices up" )
+
+ for switch in main.randomLinks:
+ main.Mininet1.link(
+ END1=switch[0],
+ END2=switch[1],
+ OPTION="up")
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.checkStatus(
+ topology_output,
+ main.numMNswitches,
+ str( main.numMNlinks ) )
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult83 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
+ onpass="Link Up Test PASS",
+ onfail="Link Up Test FAIL" )
+
+ def CASE74( self, main ):
+ """
+ Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
+ """
+ import random
+ main.randomLink1 = []
+ main.randomLink2 = []
+ main.randomLink3 = []
+ main.randomLink4 = []
+ link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
+ link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
+ link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
+ link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
+ link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
+ link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+ main.pingTimeout = 400
+
+ main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
+ main.log.report( "___________________________________________________________________________" )
+
+ linkIndex = range(4)
+ linkIndexS9 = random.sample(linkIndex,1)[0]
+ linkIndex.remove(linkIndexS9)
+ linkIndexS10 = random.sample(linkIndex,1)[0]
+ main.randomLink1 = link1End2top[linkIndexS9]
+ main.randomLink2 = link2End2top[linkIndexS10]
+ main.randomLink3 = random.sample(link1End2bot,1)[0]
+ main.randomLink4 = random.sample(link2End2bot,1)[0]
+ # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
+ # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
+ main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
+ time.sleep( link_sleep )
+ main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkDown = main.ONOSbench.checkStatus(
+ topology_output, main.numMNswitches, str(
+ int( main.numMNlinks ) - 8 ))
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult74 = linkDown and pingResultLinkDown
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
+ onpass="Random Link cut Test PASS",
+ onfail="Random Link cut Test FAIL" )
+
+ def CASE84( self, main ):
+ """
+ Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
+ """
+ import random
+ link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
+ link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
+ link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+ main.log.report(
+ "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
+ main.log.report(
+ "__________________________________________________________________" )
+ main.case(
+ "Host intents - Bring the core links up that are down and verify ping all" )
+
+ #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
+ #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
+ main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
+ time.sleep( link_sleep )
+ main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
+ time.sleep( link_sleep )
+
+ topology_output = main.ONOScli2.topology()
+ linkUp = main.ONOSbench.checkStatus(
+ topology_output,
+ main.numMNswitches,
+ str( main.numMNlinks ) )
+ 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(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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" )
+
+ caseResult84 = linkUp and pingResultLinkUp
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
+ onpass="Link Up Test PASS",
+ onfail="Link Up Test FAIL" )
+
+ def CASE90( self ):
+ """
+ Install 600 point intents and verify ping all (Att Topology)
+ """
+ main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+ import time
+ main.case( "Install 600 point intents" )
+ main.step( "Add point Intents" )
+ intentResult = main.TRUE
+ deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
+
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( deviceCombos ):
+ break
+ t = main.Thread( target=cli.addPointIntent,
+ threadID=main.threadID,
+ name="addPointIntent",
+ args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4",main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print getIntentStateResult
+ # Takes awhile for all the onos to get the intents
+ time.sleep(60)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING tALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case90Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case90Result,
+ onpass="Install 600 point Intents and Ping All test PASS",
+ onfail="Install 600 point Intents and Ping All test FAIL" )
+
+ def CASE91( self ):
+ """
+ Install 600 point intents and verify ping all (Chordal Topology)
+ """
+ main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+ import time
+ main.case( "Install 600 point intents" )
+ main.step( "Add point Intents" )
+ intentResult = main.TRUE
+ deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
+
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( deviceCombos ):
+ break
+ t = main.Thread( target=cli.addPointIntent,
+ threadID=main.threadID,
+ name="addPointIntent",
+ args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ print getIntentStateResult
+ # Takes awhile for all the onos to get the intents
+ time.sleep(30)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case91Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case91Result,
+ onpass="Install 600 point Intents and Ping All test PASS",
+ onfail="Install 600 point Intents and Ping All test FAIL" )
+
+ def CASE92( self ):
+ """
+ Install 4556 point intents and verify ping all (Spine Topology)
+ """
+ main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
+ main.log.report( "_______________________________________" )
+ import itertools
+ import time
+ main.case( "Install 4556 point intents" )
+ main.step( "Add point Intents" )
+ intentResult = main.TRUE
+ main.pingTimeout = 600
+ for i in range(len(main.hostMACs)):
+ main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
+ print main.MACsDict
+ deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
+ intentIdList = []
+ time1 = time.time()
+ for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( deviceCombos ):
+ break
+ t = main.Thread( target=cli.addPointIntent,
+ threadID=main.threadID,
+ name="addPointIntent",
+ args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ intentResult = main.TRUE
+ intentsJson = main.ONOScli2.intents()
+ getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
+ intentsJson = intentsJson)
+ #print getIntentStateResult
+ # Takes awhile for all the onos to get the intents
+ time.sleep(60)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ 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=pingResult,
+ onpass="PING ALL PASS",
+ onfail="PING ALL FAIL" )
+
+ case92Result = ( intentResult and pingResult )
+
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case92Result,
+ onpass="Install 4556 point Intents and Ping All test PASS",
+ onfail="Install 4556 point Intents and Ping All test FAIL" )
+
+ def CASE93( self ):
+ """
+ Install multi-single point intents and verify Ping all works
+ for att topology
+ """
+ import copy
+ import time
+ main.log.report( "Install multi-single point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install multi-single point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
+ portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ print "MACsDict", main.MACsDict
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ egressDevice = deviceDPIDsCopy[i]
+ ingressDeviceList = copy.copy(deviceDPIDsCopy)
+ ingressDeviceList.remove(egressDevice)
+ if i >= len( deviceDPIDsCopy ):
+ break
+ t = main.Thread( target=cli.addMultipointToSinglepointIntent,
+ threadID=main.threadID,
+ name="addMultipointToSinglepointIntent",
+ args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ time.sleep(30)
+ print "getting all intents ID"
+ intentIdTemp = main.ONOScli1.getAllIntentsId()
+ print intentIdTemp
+ print len(intentIdList)
+ print intentIdList
+ checkIntentStateResult = main.TRUE
+ print "Checking intents state"
+ checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+ checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
+
+ if checkIntentStateResult:
+ main.log.info( "All intents are installed correctly " )
+
+ print "Checking flows state "
+ checkFlowsState = main.ONOScli1.checkFlowsState()
+ time.sleep(50)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+ checkFlowsState = main.ONOScli1.checkFlowsState()
+ case93Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case93Result,
+ onpass="Install 25 multi to single point Intents and Ping All test PASS",
+ onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
+
+ def CASE94( self ):
+ """
+ Install multi-single point intents and verify Ping all works
+ for Chordal topology
+ """
+ import copy
+ import time
+ main.log.report( "Install multi-single point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install multi-single point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
+ portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ print "MACsDict", main.MACsDict
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ egressDevice = deviceDPIDsCopy[i]
+ ingressDeviceList = copy.copy(deviceDPIDsCopy)
+ ingressDeviceList.remove(egressDevice)
+ if i >= len( deviceDPIDsCopy ):
+ break
+ t = main.Thread( target=cli.addMultipointToSinglepointIntent,
+ threadID=main.threadID,
+ name="addMultipointToSinglepointIntent",
+ args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ time.sleep(5)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ case94Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case94Result,
+ onpass="Install 25 multi to single point Intents and Ping All test PASS",
+ onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
+
+ #def CASE95 multi-single point intent for Spine
+
+ def CASE96( self ):
+ """
+ Install single-multi point intents and verify Ping all works
+ for att topology
+ """
+ import copy
+ main.log.report( "Install single-multi point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install single-multi point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
+ portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ print "MACsDict", main.MACsDict
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ ingressDevice = deviceDPIDsCopy[i]
+ egressDeviceList = copy.copy(deviceDPIDsCopy)
+ egressDeviceList.remove(ingressDevice)
+ if i >= len( deviceDPIDsCopy ):
+ break
+ t = main.Thread( target=cli.addSinglepointToMultipointIntent,
+ threadID=main.threadID,
+ name="addSinglepointToMultipointIntent",
+ args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice)])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ time.sleep(5)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ case96Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case96Result,
+ onpass="Install 25 single to multi point Intents and Ping All test PASS",
+ onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+
+ def CASE97( self ):
+ """
+ Install single-multi point intents and verify Ping all works
+ for Chordal topology
+ """
+ import copy
+ main.log.report( "Install single-multi point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install single-multi point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
+ portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ print "MACsDict", main.MACsDict
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ ingressDevice = deviceDPIDsCopy[i]
+ egressDeviceList = copy.copy(deviceDPIDsCopy)
+ egressDeviceList.remove(ingressDevice)
+ if i >= len( deviceDPIDsCopy ):
+ break
+ t = main.Thread( target=cli.addSinglepointToMultipointIntent,
+ threadID=main.threadID,
+ name="addSinglepointToMultipointIntent",
+ args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice),''])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ time.sleep(5)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ case97Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case97Result,
+ onpass="Install 25 single to multi point Intents and Ping All test PASS",
+ onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+
+ def CASE98( self ):
+ """
+ Install single-multi point intents and verify Ping all works
+ for Spine topology
+ """
+ import copy
+ main.log.report( "Install single-multi point intents and verify Ping all" )
+ main.log.report( "___________________________________________" )
+ main.case( "Install single-multi point intents and Ping all" )
+ deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
+ deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
+ portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
+ intentIdList = []
+ MACsDictCopy = {}
+ for i in range( len( deviceDPIDsCopy ) ):
+ MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
+
+ print "deviceDPIDsCopy", deviceDPIDsCopy
+ print ""
+ print "MACsDictCopy", MACsDictCopy
+ time1 = time.time()
+ for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( deviceDPIDsCopy ):
+ break
+ ingressDevice = deviceDPIDsCopy[i]
+ egressDeviceList = copy.copy(deviceDPIDsCopy)
+ egressDeviceList.remove(ingressDevice)
+ t = main.Thread( target=cli.addSinglepointToMultipointIntent,
+ threadID=main.threadID,
+ name="addSinglepointToMultipointIntent",
+ args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',MACsDictCopy.get(ingressDevice),''])
+ pool.append(t)
+ #time.sleep(1)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ time2 = time.time()
+ main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
+ time.sleep(5)
+ main.step( "Verify Ping across all hosts" )
+ pingResult = main.FALSE
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ case98Result = pingResult
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case98Result,
+ onpass="Install 25 single to multi point Intents and Ping All test PASS",
+ onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
+
+ def CASE10( self ):
+ import time
+ """
+ Remove all Intents
+ """
+ main.log.report( "Remove all intents that were installed previously" )
+ main.log.report( "______________________________________________" )
+ main.log.info( "Remove all intents" )
+ main.case( "Removing intents" )
+ main.step( "Obtain the intent id's first" )
+ intentsList = main.ONOScli1.getAllIntentIds()
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList = ansi_escape.sub( '', intentsList )
+ intentsList = intentsList.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ "id=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList = intentsList.splitlines()
+ #intentsList = intentsList[ 1: ]
+ intentIdList = []
+ step1Result = main.TRUE
+ moreIntents = main.TRUE
+ removeIntentCount = 0
+ intentsCount = len(intentsList)
+ main.log.info ( "Current number of intents: " + str(intentsCount) )
+ if ( len( intentsList ) > 1 ):
+ results = main.TRUE
+ main.log.info("Removing intent...")
+ while moreIntents:
+ #This is a work around for a major issue. We cycle through intents removal for up to 5 times.
+ if removeIntentCount == 5:
+ break
+ removeIntentCount = removeIntentCount + 1
+ intentsList1 = main.ONOScli1.getAllIntentIds()
+ if len( intentsList1 ) == 0:
+ break
+ ansi_escape = re.compile( r'\x1b[^m]*m' )
+ intentsList1 = ansi_escape.sub( '', intentsList1 )
+ intentsList1 = intentsList1.replace(
+ " onos:intents | grep id=",
+ "" ).replace(
+ " state=",
+ "" ).replace(
+ "\r\r",
+ "" )
+ intentsList1 = intentsList1.splitlines()
+ #intentsList1 = intentsList1[ 1: ]
+ main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
+ print intentsList1
+ intentIdList1 = []
+ if ( len( intentsList1 ) > 0 ):
+ moreIntents = main.TRUE
+ for i in range( len( intentsList1 ) ):
+ intentsTemp1 = intentsList1[ i ].split( ',' )
+ intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
+ main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
+ main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
+ time1 = time.time()
+ for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
+ pool = []
+ for cli in main.CLIs:
+ if i >= len( intentIdList1 ):
+ break
+ t = main.Thread( target=cli.removeIntent,
+ threadID=main.threadID,
+ name="removeIntent",
+ args=[intentIdList1[i],'org.onosproject.cli',False,False])
+ pool.append(t)
+ t.start()
+ i = i + 1
+ main.threadID = main.threadID + 1
+ for thread in pool:
+ thread.join()
+ intentIdList.append(thread.result)
+ #time.sleep(2)
+ time2 = time.time()
+ main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
+ time.sleep(10)
+ main.log.info("Purging WITHDRAWN Intents")
+ purgeResult = main.ONOScli2.purgeWithdrawnIntents()
+ else:
+ time.sleep(10)
+ if len( main.ONOScli1.intents()):
+ continue
+ break
+ time.sleep(10)
+ else:
+ print "Removed %d intents" %(intentsCount)
+ step1Result = main.TRUE
+ else:
+ print "No Intent IDs found in Intents list: ", intentsList
+ step1Result = main.FALSE
+
+ print main.ONOScli1.intents()
+ caseResult10 = step1Result
+ utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
+ onpass="Intent removal test successful",
+ onfail="Intent removal test failed" )
+
+ def CASE12( self, main ):
+ """
+ Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
+ """
+ import re
+ import copy
+ import time
+
+ Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
+ threadID = 0
+
+ main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
+ main.log.report( "_____________________________________________________" )
+ main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
+ main.step( "Enable intent based Reactive forwarding" )
+ installResult = main.FALSE
+ feature = "onos-app-ifwd"
+
+ pool = []
+ time1 = time.time()
+ for cli,feature in main.CLIs:
+ t = main.Thread(target=cli,threadID=threadID,
+ name="featureInstall",args=[feature])
+ pool.append(t)
+ t.start()
+ threadID = threadID + 1
+
+ results = []
+ for thread in pool:
+ thread.join()
+ results.append(thread.result)
+ time2 = time.time()
+
+ if( all(result == main.TRUE for result in results) == False):
+ main.log.info("Did not install onos-app-ifwd feature properly")
+ #main.cleanup()
+ #main.exit()
+ else:
+ main.log.info("Successful feature:install onos-app-ifwd")
+ installResult = main.TRUE
+ main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
+
+ main.step( "Verify Pingall" )
+ ping_result = main.FALSE
+ time1 = time.time()
+ ping_result = main.Mininet1.pingall(timeout=600)
+ time2 = time.time()
+ timeDiff = round( ( time2 - time1 ), 2 )
+ main.log.report(
+ "Time taken for Ping All: " +
+ str( timeDiff ) +
+ " seconds" )
+
+ if ping_result == main.TRUE:
+ main.log.report( "Pingall Test in Reactive mode successful" )
+ else:
+ main.log.report( "Pingall Test in Reactive mode failed" )
+
+ main.step( "Disable Intent based Reactive forwarding" )
+ uninstallResult = main.FALSE
+
+ pool = []
+ time1 = time.time()
+ for cli,feature in main.CLIs:
+ t = main.Thread(target=cli,threadID=threadID,
+ name="featureUninstall",args=[feature])
+ pool.append(t)
+ t.start()
+ threadID = threadID + 1
+
+ results = []
+ for thread in pool:
+ thread.join()
+ results.append(thread.result)
+ time2 = time.time()
+
+ if( all(result == main.TRUE for result in results) == False):
+ main.log.info("Did not uninstall onos-app-ifwd feature properly")
+ uninstallResult = main.FALSE
+ #main.cleanup()
+ #main.exit()
+ else:
+ main.log.info("Successful feature:uninstall onos-app-ifwd")
+ uninstallResult = main.TRUE
+ main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
+
+ # Waiting for reative flows to be cleared.
+ time.sleep( 10 )
+
+ case11Result = installResult and ping_result and uninstallResult
+ utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+ onpass="Intent based Reactive forwarding Pingall test PASS",
+ onfail="Intent based Reactive forwarding Pingall test FAIL" )
+
+ def CASE99(self):
+ import time
+ # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
+ main.step( "Stop ONOS on all Nodes" )
+ stopResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStop( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ stopResult = ( stopResult and sresult )
+
+ main.step( "Start ONOS on all Nodes" )
+ startResult = main.TRUE
+ for i in range( 1, int( main.numCtrls ) + 1 ):
+ ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+ main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
+ sresult = main.ONOSbench.onosStart( ONOS_ip )
+ utilities.assert_equals( expect=main.TRUE, actual=sresult,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ startResult = ( startResult and sresult )
+
+ main.step( "Start ONOS CLI on all nodes" )
+ cliResult = main.TRUE
+ time.sleep( 30 )
+ main.log.step(" Start ONOS cli using thread ")
+ pool = []
+ time1 = time.time()
+ for i in range( int( main.numCtrls ) ):
+ t = main.Thread(target=main.CLIs[i].startOnosCli,
+ threadID=main.threadID,
+ name="startOnosCli",
+ args=main.onosIPs[i])
+ pool.append(t)
+ t.start()
+ main.threadID = main.threadID + 1
+ for t in pool:
+ t.join()
+ cliResult = cliResult and t.result
+ time2 = time.time()
+
+ if not cliResult:
+ main.log.info("ONOS CLI did not start up properly")
+ #main.cleanup()
+ #main.exit()
+ else:
+ main.log.info("Successful CLI startup")
+ main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
+
+ case99Result = ( startResult and cliResult )
+ time.sleep(30)
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=case99Result,
+ onpass="Starting new Chordal topology test PASS",
+ onfail="Starting new Chordal topology test FAIL" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
new file mode 100644
index 0000000..76205b0
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -0,0 +1,52 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <home>~/ONOS</home>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>localhost</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>localhost</host>
+ <user>admin</user>
+ <password></password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli3>
+
+ <Mininet1>
+ <host>chONOS-MN</host>
+ <user>admin</user>
+ <password></password>
+ <type>MininetCliDriver</type>
+ <connect_order>12</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/OnosCHO/README b/TestON/tests/OnosCHO/README
new file mode 100644
index 0000000..4b92d14
--- /dev/null
+++ b/TestON/tests/OnosCHO/README
@@ -0,0 +1 @@
+#This README file be updated soon
diff --git a/TestON/tests/OnosCHO/__init__.py b/TestON/tests/OnosCHO/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/OnosCHO/__init__.py
diff --git a/TestON/tests/SAMPstartTemplate/Dependency/newFuncTopo.py b/TestON/tests/SAMPstartTemplate/Dependency/newFuncTopo.py
new file mode 100755
index 0000000..57ad42f
--- /dev/null
+++ b/TestON/tests/SAMPstartTemplate/Dependency/newFuncTopo.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+
+"""
+Custom topology for Mininet
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import Host, RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
+class VLANHost( Host ):
+ def config( self, vlan=100, **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
+ self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+ newName = '%s.%d' % ( intf, vlan )
+ intf.name = newName
+ self.nameToIntf[ newName ] = intf
+ return r
+
+class IPv6Host( Host ):
+ def config( self, v6Addr='1000:1/64', **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
+ return r
+
+class dualStackHost( Host ):
+ def config( self, v6Addr='2000:1/64', **params ):
+ r = super( Host, self ).config( **params )
+ intf = self.defaultIntf()
+ self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
+ return r
+
+class MyTopo( Topo ):
+
+ def __init__( self ):
+ # Initialize topology
+ Topo.__init__( self )
+
+ # Switch S5 Hosts
+ host1=self.addHost( 'h1', ip='10.1.0.2/24' )
+ host2=self.addHost( 'h2', cls=IPv6Host, v6Addr='1000::2/64' )
+ host3=self.addHost( 'h3', ip='10.1.0.3/24', cls=dualStackHost, v6Addr='2000::2/64' )
+ #VLAN hosts
+ host4=self.addHost( 'h4', ip='100.1.0.2/24', cls=VLANHost, vlan=100 )
+ host5=self.addHost( 'h5', ip='200.1.0.2/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host6=self.addHost( 'h6', ip='11.1.0.2/24' )
+ host7=self.addHost( 'h7', ip='12.1.0.2/24' )
+ #Multicast Sender
+ host8=self.addHost( 'h8', ip='10.1.0.4/24' )
+
+ # Switch S6 Hosts
+ host9=self.addHost( 'h9', ip='10.1.0.5/24' )
+ host10=self.addHost( 'h10', cls=IPv6Host, v6Addr='1000::3/64' )
+ host11=self.addHost( 'h11', ip='10.1.0.6/24', cls=dualStackHost, v6Addr='2000::3/64' )
+ #VLAN hosts
+ host12=self.addHost( 'h12', ip='100.1.0.3/24', cls=VLANHost, vlan=100 )
+ host13=self.addHost( 'h13', ip='200.1.0.3/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host14=self.addHost( 'h14', ip='11.1.0.3/24' )
+ host15=self.addHost( 'h15', ip='12.1.0.3/24' )
+ #Multicast Receiver
+ host16=self.addHost( 'h16', ip='10.1.0.7/24' )
+
+ # Switch S7 Hosts
+ host17=self.addHost( 'h17', ip='10.1.0.8/24' )
+ host18=self.addHost( 'h18', cls=IPv6Host, v6Addr='1000::4/64' )
+ host19=self.addHost( 'h19', ip='10.1.0.9/24', cls=dualStackHost, v6Addr='2000::4/64' )
+ #VLAN hosts
+ host20=self.addHost( 'h20', ip='100.1.0.4/24', cls=VLANHost, vlan=100 )
+ host21=self.addHost( 'h21', ip='200.1.0.4/24', cls=VLANHost, vlan=200 )
+ #VPN-1 and VPN-2 Hosts
+ host22=self.addHost( 'h22', ip='11.1.0.4/24' )
+ host23=self.addHost( 'h23', ip='12.1.0.4/24' )
+ #Multicast Receiver
+ host24=self.addHost( 'h24', ip='10.1.0.10/24' )
+
+ s1 = self.addSwitch( 's1' )
+ s2 = self.addSwitch( 's2' )
+ s3 = self.addSwitch( 's3' )
+ s4 = self.addSwitch( 's4' )
+ s5 = self.addSwitch( 's5' )
+ s6 = self.addSwitch( 's6' )
+ s7 = self.addSwitch( 's7' )
+
+ self.addLink(s5,host1)
+ self.addLink(s5,host2)
+ self.addLink(s5,host3)
+ self.addLink(s5,host4)
+ self.addLink(s5,host5)
+ self.addLink(s5,host6)
+ self.addLink(s5,host7)
+ self.addLink(s5,host8)
+
+ self.addLink(s6,host9)
+ self.addLink(s6,host10)
+ self.addLink(s6,host11)
+ self.addLink(s6,host12)
+ self.addLink(s6,host13)
+ self.addLink(s6,host14)
+ self.addLink(s6,host15)
+ self.addLink(s6,host16)
+
+ self.addLink(s7,host17)
+ self.addLink(s7,host18)
+ self.addLink(s7,host19)
+ self.addLink(s7,host20)
+ self.addLink(s7,host21)
+ self.addLink(s7,host22)
+ self.addLink(s7,host23)
+ self.addLink(s7,host24)
+
+ self.addLink(s1,s2)
+ self.addLink(s1,s3)
+ self.addLink(s1,s4)
+ self.addLink(s1,s5)
+
+ self.addLink(s2,s3)
+ self.addLink(s2,s5)
+ self.addLink(s2,s6)
+
+ self.addLink(s3,s4)
+ self.addLink(s3,s6)
+
+ self.addLink(s4,s7)
+ topos = { 'mytopo': ( lambda: MyTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = MyTopo()
+ network = Mininet(topo=topo, autoSetMacs=True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
diff --git a/TestON/tests/SAMPstartTemplate/Dependency/startUp.py b/TestON/tests/SAMPstartTemplate/Dependency/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/SAMPstartTemplate/Dependency/startUp.py
@@ -0,0 +1,38 @@
+"""
+ This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+ """
+ This includes pulling ONOS and building it using maven install
+ """
+
+ buildResult = main.FALSE
+
+ # Git checkout a branch of ONOS
+ checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+ # Does the git pull on the branch that was checked out
+ if not checkOutResult:
+ main.log.warn( "Failed to checked out " + gitBranch +
+ " branch")
+ else:
+ main.log.info( "Successfully checked out " + gitBranch +
+ " branch")
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ else:
+ main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+ # Maven clean install
+ buildResult = main.ONOSbench.cleanInstall()
+
+ return buildResult
+
+
+
+
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.params b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.params
index 04f6110..1fa6036 100755
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.params
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.params
@@ -1,33 +1,34 @@
<PARAMS>
- <testcases>10,9,10,9</testcases>
- <SCALE>1,3</SCALE>
- <availableNodes>3</availableNodes>
+ <testcases>1,2,2,2</testcases>
+
+ <SCALE>
+ <size>1,2,3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <path>/tests/SAMPstartTemplate/Dependency/</path>
+ <wrapper1>startUp</wrapper1>
+ <topology>newFuncTopo.py</topology>
+ </DEPENDENCY>
+
<ENV>
- <cellName>functionality</cellName>
+ <cellName>productionCell</cellName>
<cellApps>drivers,openflow,proxyarp,mobility</cellApps>
</ENV>
+
<GIT>
<pull>False</pull>
<branch>master</branch>
</GIT>
+
<CTRL>
- <num>3</num>
- <ip1>OC1</ip1>
- <port1>6633</port1>
- <ip2>OC2</ip2>
- <port2>6633</port2>
- <ip3>OC3</ip3>
- <port3>6633</port3>
+ <port>6633</port>
</CTRL>
- <BENCH>
- <user>admin</user>
- <ip1>OCN</ip1>
- </BENCH>
- <MININET>
- <switch>7</switch>
- <links>20</links>
- <topo>~/mininet/custom/newFuncTopo.py</topo>
- </MININET>
+
+ <SLEEP>
+ <startup>15</startup>
+ </SLEEP>
</PARAMS>
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
index 9df58af..acd899d 100644
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
@@ -7,104 +7,122 @@
def __init__( self ):
self.default = ''
- def CASE10( self, main ):
+ def CASE1( self, main ):
import time
import os
import imp
- """
- Startup sequence:
- git pull
- cell <name>
- onos-verify-cell
- onos-remove-raft-log
- mvn clean install
- onos-package
- onos-install -f
- onos-wait-for-start
- """
- global init
- global globalONOSip
- try:
- if type(init) is not bool:
- init = False
- except NameError:
- init = False
- #Local variables
- cellName = main.params[ 'ENV' ][ 'cellName' ]
- apps = main.params[ 'ENV' ][ 'cellApps' ]
+ """
+ - Construct tests variables
+ - GIT ( optional )
+ - Checkout ONOS master branch
+ - Pull latest ONOS code
+ - Building ONOS ( optional )
+ - Install ONOS package
+ - Build ONOS package
+ """
+
+ main.case( "Constructing test variables and building ONOS package" )
+ main.step( "Constructing test variables" )
+ stepResult = main.FALSE
+
+ # Test variables
+ main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+ main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.apps = main.params[ 'ENV' ][ 'cellApps' ]
gitBranch = main.params[ 'GIT' ][ 'branch' ]
- benchIp = os.environ[ 'OCN' ]
- benchUser = main.params[ 'BENCH' ][ 'user' ]
- topology = main.params[ 'MININET' ][ 'topo' ]
- main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
- main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
- main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
- main.ONOSport = []
- main.hostsData = {}
- PULLCODE = False
- if main.params[ 'GIT' ][ 'pull' ] == 'True':
- PULLCODE = True
- main.case( "Setting up test environment" )
+ main.dependencyPath = main.testOnDirectory + \
+ main.params[ 'DEPENDENCY' ][ 'path' ]
+ main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+ main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
+ main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
+ main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+ wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
+ main.cellData = {} # for creating cell file
main.CLIs = []
- for i in range( 1, int( main.numCtrls ) + 1 ):
+ main.ONOSip = []
+
+ main.ONOSip = main.ONOSbench.getOnosIps()
+ print main.ONOSip
+
+ # Assigning ONOS cli handles to a list
+ for i in range( 1, main.maxNodes + 1 ):
main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
- main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
# -- INIT SECTION, ONLY RUNS ONCE -- #
- if init == False:
- init = True
+ main.startUp = imp.load_source( wrapperFile1,
+ main.dependencyPath +
+ wrapperFile1 +
+ ".py" )
- main.scale = ( main.params[ 'SCALE' ] ).split( "," )
- main.numCtrls = int( main.scale[ 0 ] )
+ copyResult = main.ONOSbench.copyMininetFile( main.topology,
+ main.dependencyPath,
+ main.Mininet1.user_name,
+ main.Mininet1.ip_address )
+ if main.CLIs:
+ stepResult = main.TRUE
+ else:
+ main.log.error( "Did not properly created list of ONOS CLI handle" )
+ stepResult = main.FALSE
- if PULLCODE:
- main.step( "Git checkout and pull " + gitBranch )
- main.ONOSbench.gitCheckout( gitBranch )
- gitPullResult = main.ONOSbench.gitPull()
- if gitPullResult == main.ERROR:
- main.log.error( "Error pulling git branch" )
- main.step( "Using mvn clean & install" )
- cleanInstallResult = main.ONOSbench.cleanInstall()
- stepResult = cleanInstallResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully compiled " +
- "latest ONOS",
- onfail="Failed to compile " +
- "latest ONOS" )
- else:
- main.log.warn( "Did not pull new code so skipping mvn " +
- "clean install" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully construct " +
+ "test variables ",
+ onfail="Failed to construct test variables" )
- globalONOSip = main.ONOSbench.getOnosIps()
+ if gitPull == 'True':
+ main.step( "Building ONOS in " + gitBranch + " branch" )
+ onosBuildResult = main.startUp.onosBuild( main, gitBranch )
+ stepResult = onosBuildResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully compiled " +
+ "latest ONOS",
+ onfail="Failed to compile " +
+ "latest ONOS" )
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
- maxNodes = ( len( globalONOSip ) - 2 )
+ def CASE2( self, main ):
+ """
+ - Set up cell
+ - Create cell file
+ - Set cell file
+ - Verify cell file
+ - Kill ONOS process
+ - Uninstall ONOS cluster
+ - Verify ONOS start up
+ - Install ONOS cluster
+ - Connect to cli
+ """
+ # main.scale[ 0 ] determines the current number of ONOS controller
main.numCtrls = int( main.scale[ 0 ] )
- main.scale.remove( main.scale[ 0 ] )
- main.ONOSip = []
- for i in range( maxNodes ):
- main.ONOSip.append( globalONOSip[ i ] )
+ main.case( "Starting up " + str( main.numCtrls ) +
+ " node(s) ONOS cluster" )
#kill off all onos processes
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating enviornment setup" )
- for i in range( maxNodes ):
- main.ONOSbench.onosDie( globalONOSip[ i ] )
+
+ for i in range( main.maxNodes ):
+ main.ONOSbench.onosDie( main.ONOSip[ i ] )
print "NODE COUNT = ", main.numCtrls
- main.log.info( "Creating cell file" )
- cellIp = []
+
+ tempOnosIp = []
for i in range( main.numCtrls ):
- cellIp.append( str( main.ONOSip[ i ] ) )
- print cellIp
- main.ONOSbench.createCellFile( benchIp, cellName, "",
- str( apps ), *cellIp )
+ tempOnosIp.append( main.ONOSip[i] )
+
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
main.step( "Apply cell to environment" )
- cellResult = main.ONOSbench.setCell( cellName )
+ cellResult = main.ONOSbench.setCell( "temp" )
verifyResult = main.ONOSbench.verifyCell()
stepResult = cellResult and verifyResult
utilities.assert_equals( expect=main.TRUE,
@@ -121,6 +139,7 @@
onpass="Successfully created ONOS package",
onfail="Failed to create ONOS package" )
+ time.sleep( main.startUpSleep )
main.step( "Uninstalling ONOS package" )
onosUninstallResult = main.TRUE
for i in range( main.numCtrls ):
@@ -131,7 +150,8 @@
actual=stepResult,
onpass="Successfully uninstalled ONOS package",
onfail="Failed to uninstall ONOS package" )
- time.sleep( 5 )
+
+ time.sleep( main.startUpSleep )
main.step( "Installing ONOS package" )
onosInstallResult = main.TRUE
for i in range( main.numCtrls ):
@@ -143,11 +163,12 @@
onpass="Successfully installed ONOS package",
onfail="Failed to install ONOS package" )
- time.sleep( 20 )
+ time.sleep( main.startUpSleep )
main.step( "Starting ONOS service" )
stopResult = main.TRUE
startResult = main.TRUE
onosIsUp = main.TRUE
+
for i in range( main.numCtrls ):
onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
if onosIsUp == main.TRUE:
@@ -178,12 +199,15 @@
onpass="Successfully start ONOS cli",
onfail="Failed to start ONOS cli" )
+ # Remove the first element in main.scale list
+ main.scale.remove( main.scale[ 0 ] )
+
def CASE9( self, main ):
'''
Report errors/warnings/exceptions
'''
main.log.info("Error report: \n" )
- main.ONOSbench.logReport( globalONOSip[ 0 ],
+ main.ONOSbench.logReport( main.ONOSip[ 0 ],
[ "INFO",
"FOLLOWER",
"WARN",
@@ -191,7 +215,6 @@
"ERROR",
"Except" ],
"s" )
- #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
def CASE11( self, main ):
"""
@@ -212,3 +235,11 @@
main.cleanup()
main.exit()
+ def CASE12( self, main ):
+ """
+ Test random ONOS command
+ """
+
+ main.CLIs[ 0 ].startOnosCli( main.ONOSip[ 0 ] )
+ print main.CLIs[ 0 ].leaders()
+
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
index e6613de..4a116c3 100755
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.topo
@@ -2,45 +2,48 @@
<COMPONENT>
<ONOSbench>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
<COMPONENTS>
- <home>~/ONOS</home>
+ <nodes>3</nodes>
</COMPONENTS>
</ONOSbench>
<ONOScli1>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
+ <COMPONENTS>
+ </COMPONENTS>
</ONOScli1>
<ONOScli2>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>3</connect_order>
- <COMPONENTS> </COMPONENTS>
+ <COMPONENTS>
+ </COMPONENTS>
</ONOScli2>
<ONOScli3>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>OnosCliDriver</type>
<connect_order>4</connect_order>
- <COMPONENTS> </COMPONENTS>
+ <COMPONENTS>
+ </COMPONENTS>
</ONOScli3>
<Mininet1>
- <host>OCN</host>
+ <host>localhost</host>
<user>admin</user>
<password>onos_test</password>
<type>MininetCliDriver</type>
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.params b/TestON/tests/SCPFcbench/SCPFcbench.params
index 8a11b56..3e92294 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.params
+++ b/TestON/tests/SCPFcbench/SCPFcbench.params
@@ -33,6 +33,10 @@
<user>admin</user>
<ip1>localhost</ip1>
</BENCH>
+
+ <CBENCH>
+ <user>sdn</user>
+ </CBENCH>
<JSON>
</JSON>
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPFcbench/SCPFcbench.py
index 79cdce2..42ebf5e 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPFcbench/SCPFcbench.py
@@ -30,7 +30,8 @@
gitPull = main.params[ 'GIT' ][ 'autopull' ]
BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+ CBENCHuser = main.params[ 'CBENCH'][ 'user' ]
+ MN1Ip = os.environ[ main.params[ 'MN' ][ 'ip1' ] ]
maxNodes = int(main.params[ 'availableNodes' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -91,7 +92,7 @@
print "Cellname is: "+ cellName + "ONOS IP is: " + str(ONOSIp)
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",ONOSIp[1])
+ main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",[ONOSIp[1]])
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
@@ -145,7 +146,7 @@
if mode != "t":
mode = " "
- runCbench = ( "ssh admin@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
+ runCbench = ( "ssh " + CBENCHuser + "@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
main.ONOSbench.handle.sendline(runCbench)
time.sleep(30)
main.ONOSbench.handle.expect(":~")
@@ -158,37 +159,39 @@
print line
break
- resultLine = line.split(" ")
- for word in resultLine:
- if word == "min/max/avg/stdev":
- resultsIndex = resultLine.index(word)
- print resultsIndex
- break
+ try:
+ resultLine = line.split(" ")
+ for word in resultLine:
+ if word == "min/max/avg/stdev":
+ resultsIndex = resultLine.index(word)
+ print resultsIndex
+ break
- finalDataString = resultLine[resultsIndex + 2]
- print finalDataString
- finalDataList = finalDataString.split("/")
- avg = finalDataList[2]
- stdev = finalDataList[3]
+ finalDataString = resultLine[resultsIndex + 2]
+ print finalDataString
+ finalDataList = finalDataString.split("/")
+ avg = finalDataList[2]
+ stdev = finalDataList[3]
- main.log.info("Average: \t\t\t" + avg)
- main.log.info("Standard Deviation: \t" + stdev)
+ main.log.info("Average: \t\t\t" + avg)
+ main.log.info("Standard Deviation: \t" + stdev)
- if mode == " ":
- mode = "l"
+ if mode == " ":
+ mode = "l"
- commit = main.ONOSbench.getVersion()
- commit = (commit.split(" "))[1]
+ commit = main.ONOSbench.getVersion()
+ commit = (commit.split(" "))[1]
- dbfile = open("CbenchDB", "w+")
- temp = "'" + commit + "',"
- temp += "'" + mode + "',"
- temp += "'" + avg + "',"
- temp += "'" + stdev + "'\n"
- dbfile.write(temp)
- dbfile.close()
- main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
-
+ dbfile = open("CbenchDB", "w+")
+ temp = "'" + commit + "',"
+ temp += "'" + mode + "',"
+ temp += "'" + avg + "',"
+ temp += "'" + stdev + "'\n"
+ dbfile.write(temp)
+ dbfile.close()
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
+ except:
+ main.log.warn("Cbench test produced no valid results!!!")
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.topo b/TestON/tests/SCPFcbench/SCPFcbench.topo
index cae9c93..d4df2ed 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.topo
+++ b/TestON/tests/SCPFcbench/SCPFcbench.topo
@@ -8,18 +8,12 @@
<password>onos_test</password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>1</nodes>
+ </COMPONENTS>
</ONOSbench>
- <ONOS1cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
<ONOS1>
<host>OC1</host>
<user>sdn</user>