diff options
Diffstat (limited to 'framework/scripts/function_test/Teston')
23 files changed, 0 insertions, 2280 deletions
diff --git a/framework/scripts/function_test/Teston/Readme.txt b/framework/scripts/function_test/Teston/Readme.txt deleted file mode 100644 index 7393f59a..00000000 --- a/framework/scripts/function_test/Teston/Readme.txt +++ /dev/null @@ -1,5 +0,0 @@ -1.This is a basic test run about onos,we will make them better and better -2.This test include two suites: -(1)Test northbound(network/subnet/ports create/update/delete) -(2)Ovsdb test,default configuration,openflow connection,vm go onlines. -3.Later we will make a framework to do this test
\ No newline at end of file diff --git a/framework/scripts/function_test/Teston/__init__.py b/framework/scripts/function_test/Teston/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/__init__.py +++ /dev/null diff --git a/framework/scripts/function_test/Teston/adapters/__init__.py b/framework/scripts/function_test/Teston/adapters/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/adapters/__init__.py +++ /dev/null diff --git a/framework/scripts/function_test/Teston/adapters/client.py b/framework/scripts/function_test/Teston/adapters/client.py deleted file mode 100644 index 32e3749f..00000000 --- a/framework/scripts/function_test/Teston/adapters/client.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Description: - This file is used to run testcase - lanqinglong@huawei.com -""" -from environment import environment -import os -import time -import pexpect -import re - -class client( environment ): - - def __init__( self ): - environment.__init__( self ) - self.loginfo = environment() - self.testcase = '' - - def RunScript( self, handle, testname, timeout=300 ): - """ - Run ONOS Test Script - Parameters: - testname: ONOS Testcase Name - masterusername: The server username of running ONOS - masterpassword: The server password of running ONOS - """ - self.testcase = testname - self.ChangeTestCasePara( testname, self.masterusername, self.masterpassword ) - runhandle = handle - runtest = self.home + "/OnosSystemTest/TestON/bin/cli.py run " + testname - runhandle.sendline(runtest) - circletime = 0 - lastshowscreeninfo = '' - while True: - Result = runhandle.expect(["PEXPECT]#", pexpect.EOF, pexpect.TIMEOUT]) - curshowscreeninfo = runhandle.before - if (len(lastshowscreeninfo) != len(curshowscreeninfo)): - print str(curshowscreeninfo)[len(lastshowscreeninfo)::] - lastshowscreeninfo = curshowscreeninfo - if Result == 0: - print "Done!" - return - time.sleep(1) - circletime += 1 - if circletime > timeout: - break - self.loginfo.log( "Timeout when running the test, please check!" ) - - def onosstart( self ): - #This is the compass run machine user&pass,you need to modify - - print "Test Begin....." - self.OnosConnectionSet() - masterhandle = self.SSHlogin(self.localhost, self.masterusername, - self.masterpassword) - self.OnosEnvSetup( masterhandle ) - return masterhandle - - def onosclean( self, handle ): - self.SSHRelease( handle ) - self.loginfo.log('Release onos handle Successful') - - def push_results_to_db( self, payload, pushornot = 1): - url = self.Result_DB + "/results" - params = {"project_name": "functest", "case_name": "ONOS-" + self.testcase, - "pod_name": 'huawei-build-2', "details": payload} - headers = {'Content-Type': 'application/json'} - r = requests.post(url, data=json.dumps(params), headers=headers) - self.loginfo.log('Pushing result via Northbound, info:' + r ) diff --git a/framework/scripts/function_test/Teston/adapters/connection.py b/framework/scripts/function_test/Teston/adapters/connection.py deleted file mode 100644 index f7f283ed..00000000 --- a/framework/scripts/function_test/Teston/adapters/connection.py +++ /dev/null @@ -1,191 +0,0 @@ -""" -Description: - This file is used to make connections - Include ssh & exchange public-key to each other so that - it can run without password - - lanqinglong@huawei.com -""" -import os -import time -import pexpect -import re -import sys -from foundation import foundation - -class connection( foundation ): - - def __init__( self ): - foundation.__init__( self ) - self.loginfo = foundation() - - def AddKnownHost( self, handle, ipaddr, username, password ): - """ - Add an user to known host,so that onos can login in with onos $ipaddr. - parameters: - ipaddr: ip address - username: login user name - password: login password - """ - print( "Now Adding an user to known hosts " + ipaddr ) - login = handle - login.sendline( "ssh -l %s -p 8101 %s"%( username, ipaddr ) ) - index = 0 - while index != 2: - index = login.expect( ['assword:', 'yes/no', pexpect.EOF, \ - pexpect.TIMEOUT] ) - if index == 0: - login.sendline( password ) - login.sendline( "logout" ) - index = login.expect( ["closed", pexpect.EOF] ) - if index == 0: - self.loginfo.log( "Add SSH Known Host Success!" ) - break - else: - self.loginfo.log( "Add SSH Known Host Failed! Please Check!" ) - break - login.prompt( ) - - if index == 1: - login.sendline('yes') - - def GetEnvValue( self, handle, envname): - """ - os.getenv only returns current user value - GetEnvValue returns a environment value of - current handle - eg: GetEnvValue(handle,'HOME') - """ - envhandle = handle - envhandle.sendline( 'echo $' + envname ) - envhandle.prompt( ) - reg = envname + '\r\n(.*)\r' - envaluereg = re.compile( reg ) - envalue = envaluereg.search( envhandle.before ) - if envalue: - return envalue.groups()[0] - else: - return None - - def Gensshkey( self, handle ): - """ - Generate ssh keys, used for some server have no sshkey. - """ - print "Now Generating SSH keys..." - #Here file name may be id_rsa or id_ecdsa or others - #So here will have a judgement - keysub = handle - filepath = self.GetEnvValue( keysub, 'HOME' ) + '/.ssh' - filelist = os.listdir( filepath ) - for item in filelist: - if 'id' in item: - self.loginfo.log("SSH keys are exsit in ssh directory.") - return True - keysub.sendline("ssh-keygen -t rsa") - Result = 0 - while Result != 2: - Result = keysub.expect( ["Overwrite", "Enter", pexpect.EOF, \ - 'PEXPECT]#', pexpect.TIMEOUT]) - if Result == 0: - keysub.sendline("y") - if Result == 1 or Result == 2: - keysub.sendline("\n") - if Result == 3: - self.loginfo.log( "Generate SSH key success." ) - keysub.prompt() - break - if Result == 4: - self.loginfo.log("Generate SSH key failed.") - keysub.prompt() - break - - def GetRootAuth( self, password ): - """ - Get root user - parameters: - password: root login password - """ - print( "Now changing to user root" ) - login = pexpect.spawn( "su - root" ) - index = 0 - while index != 2: - index = login.expect( ['assword:', "failure", \ - pexpect.EOF, pexpect.TIMEOUT] ) - if index == 0: - login.sendline( password ) - if index == 1: - self.loginfo.log("Change user to root failed.") - - login.interact() - - def ReleaseRootAuth( self ): - """ - Exit root user. - """ - print( "Now Release user root" ) - login = pexpect.spawn( "exit" ) - index = login.expect( ['logout', \ - pexpect.EOF, pexpect.TIMEOUT] ) - if index == 0: - self.loginfo.log("Release root user success.") - if index == 1: - self.loginfo.log("Release root user failed.") - - login.interact() - - def AddEnvIntoBashrc( self, envalue ): - """ - Add Env var into /etc/profile. - parameters: - envalue: environment value to add - """ - print "Now Adding bash environment" - fileopen = open( "/etc/profile", 'r' ) - findContext = 1 - while findContext: - findContext = fileopen.readline( ) - result = findContext.find( envalue ) - if result != -1: - break - fileopen.close - if result == -1: - envAdd = open( "/etc/profile", 'a+' ) - envAdd.writelines( "\n" + envalue ) - envAdd.close( ) - self.loginfo.log( "Add env to bashrc success!" ) - - def OnosRootPathChange( self, onospath ): - """ - Change ONOS root path in file:bash_profile - onospath: path of onos root - """ - print "Now Changing ONOS Root Path" - filepath = onospath + '/onos/tools/dev/bash_profile' - line = open(filepath, 'r').readlines() - lenall = len(line) - 1 - for i in range(lenall): - if "export ONOS_ROOT" in line[i]: - line[i] = 'export ONOS_ROOT=' + onospath + 'onos\n' - NewFile = open(filepath, 'w') - NewFile.writelines(line) - NewFile.close - print "Done!" - - def OnosConnectionSet (self): - """ - Intergrate for ONOS connection setup - """ - if self.masterusername == 'root': - filepath = '/root/' - else : - filepath = '/home/' + self.masterusername + '/' - self.OnosRootPathChange( filepath ) - filepath = os.path.join( filepath, "onos/tools/dev/bash_profile" ) - self.AddEnvIntoBashrc("source " + filepath + "\n") - self.AddEnvIntoBashrc("export OCT=" + self.OCT) - self.AddEnvIntoBashrc("export OC1=" + self.OC1) - self.AddEnvIntoBashrc("export OC2=" + self.OC2) - self.AddEnvIntoBashrc("export OC3=" + self.OC3) - self.AddEnvIntoBashrc("export OCN=" + self.OCN) - self.AddEnvIntoBashrc("export OCN2=" + self.OCN2) - self.AddEnvIntoBashrc("export localhost=" + self.localhost) diff --git a/framework/scripts/function_test/Teston/adapters/environment.py b/framework/scripts/function_test/Teston/adapters/environment.py deleted file mode 100644 index bdd0e122..00000000 --- a/framework/scripts/function_test/Teston/adapters/environment.py +++ /dev/null @@ -1,226 +0,0 @@ -""" -Description: - This file is used to setup the running environment - Include Download code,setup environment variable - Set onos running config - Set user name/password - Onos-push-keys and so on - lanqinglong@huawei.com -""" - -import os -import time -import pexpect -import re -import sys -import pxssh -from connection import connection - -class environment( connection ): - - def __init__( self ): - connection.__init__( self ) - self.loginfo = connection( ) - self.masterhandle = '' - self.home = '' - - def DownLoadCode( self, handle, codeurl ): - """ - Download Code use 'git clone' - parameters: - handle: current working handle - codeurl: clone code url - """ - print "Now loading test codes! Please wait in patient..." - originalfolder = self.home - gitclone = handle - gitclone.sendline( "git clone " + codeurl ) - index = 0 - while index != 1 or index != 4: - index = gitclone.expect ( ['already exists', 'resolving deltas: 100%', \ - 'Receiving objects', 'Already up-to-date', \ - pexpect.EOF] ) - - filefolder = originalfolder + '/' + codeurl.split('/')[-1].split('.')[0] - if index == 0 : - os.chdir( filefolder ) - os.system( 'git pull' ) - os.chdir( originalfolder ) - self.loginfo.log( 'Download code success!' ) - break - elif index == 1 : - self.loginfo.log( 'Download code success!' ) - break - elif index == 2 : - increment += 1 - if increment == 20: - print '\n' - print '.' - else : - self.loginfo.log( 'Download code failed!' ) - self.loginfo.log( 'Information before' + gitclone.before ) - break - time.sleep(5) - gitclone.prompt( ) - - def InstallDefaultSoftware( self, handle ): - """ - Install default software - parameters: - handle(input): current working handle - """ - print "Now Cleaning test environment" - handle.sendline("sudo apt-get install -y mininet") - handle.prompt( ) - handle.sendline("sudo pip install configobj") - handle.prompt( ) - handle.sendline("sudo apt-get install -y sshpass") - handle.prompt( ) - handle.sendline("OnosSystemTest/TestON/bin/cleanup.sh") - handle.prompt( ) - time.sleep(5) - self.loginfo.log( 'Clean environment success!' ) - - def OnosPushKeys(self, handle, cmd, password): - """ - Using onos-push-keys to make ssh device without password - parameters: - handle(input): working handle - cmd(input): onos-push-keys xxx(xxx is device) - password(input): login in password - """ - print "Now Pushing Onos Keys:"+cmd - Pushkeys = handle - Pushkeys.sendline( cmd ) - Result = 0 - while Result != 2: - Result = Pushkeys.expect( ["(yes/no)", "assword:", "PEXPECT]#", \ - pexpect.EOF, pexpect.TIMEOUT]) - if ( Result == 0 ): - Pushkeys.sendline( "yes" ) - if ( Result == 1 ): - Pushkeys.sendline( password ) - if ( Result == 2 ): - self.loginfo.log( "ONOS Push keys Success!" ) - break - if ( Result == 3 ): - self.loginfo.log( "ONOS Push keys Error!" ) - break - time.sleep(2) - Pushkeys.prompt( ) - print "Done!" - - def SetOnosEnvVar( self, handle, masterpass, agentpass): - """ - Setup onos pushkeys to all devices(3+2) - parameters: - handle(input): current working handle - masterpass: scripts running server's password - agentpass: onos cluster&compute node password - """ - print "Now Setting test environment" - self.OnosPushKeys( handle, "onos-push-keys " + self.OCT, masterpass) - self.OnosPushKeys( handle, "onos-push-keys " + self.OC1, agentpass) - self.OnosPushKeys( handle, "onos-push-keys " + self.OC2, agentpass) - self.OnosPushKeys( handle, "onos-push-keys " + self.OC3, agentpass) - self.OnosPushKeys( handle, "onos-push-keys " + self.OCN, agentpass) - self.OnosPushKeys( handle, "onos-push-keys " + self.OCN2, agentpass) - - def ChangeOnosName( self, user, password): - """ - Change onos name in envDefault file - Because some command depend on this - parameters: - user: onos&compute node user - password: onos&compute node password - """ - print "Now Changing ONOS name&password" - filepath = self.home + '/onos/tools/build/envDefaults' - line = open(filepath, 'r').readlines() - lenall = len(line) - 1 - for i in range(lenall): - if "ONOS_USER=" in line[i]: - line[i]=line[i].replace("sdn",user) - if "ONOS_GROUP" in line[i]: - line[i]=line[i].replace("sdn",user) - if "ONOS_PWD" in line[i]: - line[i]=line[i].replace("rocks",password) - NewFile = open(filepath, 'w') - NewFile.writelines(line) - NewFile.close - print "Done!" - - def ChangeTestCasePara(self, testcase, user, password): - """ - When running test script, there's something need \ - to change in every test folder's *.param & *.topo files - user: onos&compute node user - password: onos&compute node password - """ - print "Now Changing " + testcase + " name&password" - if self.masterusername == 'root': - filepath = '/root/' - else : - filepath = '/home/' + self.masterusername + '/' - filepath = filepath +"OnosSystemTest/TestON/tests/" + testcase + "/" + \ - testcase + ".topo" - line = open(filepath,'r').readlines() - lenall = len(line)-1 - for i in range(lenall-2): - if ("localhost" in line[i]) or ("OCT" in line[i]): - line[i+1]=re.sub(">\w+",">"+user,line[i+1]) - line[i+2]=re.sub(">\w+",">"+password,line[i+2]) - if "OC1" in line [i] \ - or "OC2" in line [i] \ - or "OC3" in line [i] \ - or "OCN" in line [i] \ - or "OCN2" in line[i]: - line[i+1]=re.sub(">\w+",">root",line[i+1]) - line[i+2]=re.sub(">\w+",">root",line[i+2]) - NewFile = open(filepath,'w') - NewFile.writelines(line) - NewFile.close - - def SSHlogin ( self, ipaddr, username, password ) : - """ - SSH login provide a connection to destination. - parameters: - ipaddr: ip address - username: login user name - password: login password - return: handle - """ - login = pxssh.pxssh( ) - login.login ( ipaddr, username, password, original_prompt='[$#>]') - #send command ls -l - login.sendline ('ls -l') - #match prompt - login.prompt() - print ("SSH login " + ipaddr + " success!") - return login - - def SSHRelease( self, handle ): - #Release ssh - handle.logout() - - def CopyOnostoTestbin( self ): - sourcefile = os.curdir + '/dependencies/onos' - destifile = self.home + '/onos/tools/test/bin/' - runcommand = 'cp ' + sourcefile + ' ' + destifile - os.system( runcommand ) - - def OnosEnvSetup( self, handle ): - """ - Onos Environment Setup function - """ - self.Gensshkey( handle ) - self.home = self.GetEnvValue( handle, 'HOME' ) - self.AddKnownHost( handle, self.OC1, "karaf", "karaf" ) - self.AddKnownHost( handle, self.OC2, "karaf", "karaf" ) - self.AddKnownHost( handle, self.OC3, "karaf", "karaf" ) - self.DownLoadCode( handle, 'https://github.com/sunyulin/OnosSystemTest.git' ) - self.DownLoadCode( handle, 'https://gerrit.onosproject.org/onos' ) - self.CopyOnostoTestbin() - self.ChangeOnosName(self.agentusername,self.agentpassword) - self.InstallDefaultSoftware( handle ) - self.SetOnosEnvVar(handle, self.masterpassword,self.agentpassword) diff --git a/framework/scripts/function_test/Teston/adapters/foundation.py b/framework/scripts/function_test/Teston/adapters/foundation.py deleted file mode 100644 index c909d36b..00000000 --- a/framework/scripts/function_test/Teston/adapters/foundation.py +++ /dev/null @@ -1,64 +0,0 @@ -""" -Description: - This file include basis functions - lanqinglong@huawei.com -""" - -import logging -import os -import time -import yaml - -class foundation: - - def __init__(self): - - currentpath = os.getcwd() - self.logdir = os.path.join( currentpath, 'log' ) - self.workhome = currentpath[0:currentpath.rfind('testcases')-1] - self.Result_DB = '' - - def log (self, loginfo): - """ - Record log in log directory for deploying test environment - parameters: - loginfo(input): record info - """ - filename = time.strftime( '%Y-%m-%d-%H-%M-%S' ) + '.log' - filepath = os.path.join( self.logdir, filename ) - logging.basicConfig( level=logging.INFO, - format = '%(asctime)s %(filename)s:%(message)s', - datefmt = '%d %b %Y %H:%M:%S', - filename = filepath, - filemode = 'w') - filelog = logging.FileHandler( filepath ) - logging.getLogger( 'Functest' ).addHandler( filelog ) - print loginfo - logging.info(loginfo) - - def getdefaultpara( self ): - """ - Get Default Parameters value - """ - with open(self.workhome + "testcases/config_functest.yaml") as f: - functest_yaml = yaml.safe_load(f) - f.close() - - self.Result_DB = str(functest_yaml.get("results").get("test_db_url")) - self.masterusername = str(functest_yaml.get("ONOS").get("general").\ - get('onosbench_username')) - self.masterpassword = str(functest_yaml.get("ONOS").get("general").\ - get("onosbench_password")) - self.agentusername = str(functest_yaml.get("ONOS").get("general").\ - get("onoscli_username")) - self.agentpassword = str(functest_yaml.get("ONOS").get("general").\ - get("onoscli_password")) - self.runtimeout = functest_yaml.get("ONOS").get("general").get("runtimeout") - self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT")) - self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1")) - self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2")) - self.OC3 = str(functest_yaml.get("ONOS").get("environment").get("OC3")) - self.OCN = str(functest_yaml.get("ONOS").get("environment").get("OCN")) - self.OCN2 = str(functest_yaml.get("ONOS").get("environment").get("OCN2")) - self.localhost = self.OCT - return True
\ No newline at end of file diff --git a/framework/scripts/function_test/Teston/config.yaml b/framework/scripts/function_test/Teston/config.yaml deleted file mode 100644 index 78afb01b..00000000 --- a/framework/scripts/function_test/Teston/config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -ONOS: - general: - onosbench_username: 'root' - onosbench_password: 'root' - onoscli_username: 'root' - onoscli_password: 'root' - runtimeout: 300 - environment: - OCT: '189.42.8.99' - OC1: '189.42.8.101' - OC2: '189.42.8.102' - OC3: '189.42.8.103' - OCN: '189.42.8.104' - OCN2: '189.42.8.105' -results: - test_db_url: http://213.77.62.197
\ No newline at end of file diff --git a/framework/scripts/function_test/Teston/dependencies/onos b/framework/scripts/function_test/Teston/dependencies/onos deleted file mode 100644 index d4d59e0f..00000000 --- a/framework/scripts/function_test/Teston/dependencies/onos +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# ONOS remote command-line client. -# ----------------------------------------------------------------------------- - -[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 -. /root/.bashrc -. $ONOS_ROOT/tools/build/envDefaults -. $ONOS_ROOT/tools/test/bin/find-node.sh - -[ "$1" = "-w" ] && shift && onos-wait-for-start $1 - -[ -n "$1" ] && OCI=$(find_node $1) && shift - -if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then - # Use Karaf client only if we can and are allowed to - unset KARAF_HOME - client -h $OCI -u karaf "$@" 2>/dev/null -else - # Otherwise use raw ssh; strict checking is off for dev environments only - #ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@" - sshpass -p karaf ssh -l karaf -p 8101 $OCI "$@" -fi diff --git a/framework/scripts/function_test/Teston/log/temp.log b/framework/scripts/function_test/Teston/log/temp.log deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/log/temp.log +++ /dev/null diff --git a/framework/scripts/function_test/Teston/onosfunctest.py b/framework/scripts/function_test/Teston/onosfunctest.py deleted file mode 100644 index e8524430..00000000 --- a/framework/scripts/function_test/Teston/onosfunctest.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Description: This test is to run onos Teston VTN scripts - -List of test cases: -CASE1 - Northbound NBI test network/subnet/ports -CASE2 - Ovsdb test&Default configuration&Vm go online - -lanqinglong@huawei.com -""" -from adapters.client import client - -if __name__=="__main__": - - main = client() - main.getdefaultpara() - - #scripts to run - runhandle = main.onosstart() - main.RunScript(runhandle, "FUNCvirNetNB") - main.RunScript(runhandle, "FUNCovsdbtest") - main.onosclean( runhandle ) diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.params b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.params deleted file mode 100644 index e1128284..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.params +++ /dev/null @@ -1,48 +0,0 @@ -<PARAMS> - # CASE - Description - # 1 - Compile ONOS and push it to the test machines - # 2 - Test ovsdb connection and tearDown - # 3 - Test default br-int configuration and vxlan port - # 4 - Test default openflow configuration - # 5 - Test default flows - # 6 - Configure Network Subnet Port - # 7 - Test host go online and ping each other - # 8 - Clear ovs configuration and host configuration - - <testcases>1,3,4,2,5,6,7,8</testcases> - - <DEPENDENCY> - <path>/tests/FUNCovsdbtest/Dependency/</path> - </DEPENDENCY> - - <ENV> - <cellName>singlenode</cellName> - <cellApps>drivers,openflow,proxyarp,mobility</cellApps> - </ENV> - - <CTRL> - <ip1>OC1</ip1> - <port1>6653</port1> - <ovsdbport>6640</ovsdbport> - </CTRL> - - <TIMER> - <delaytime>5</delaytime> #delaytime for ovsdb connection create and delete - </TIMER> - - <HTTP> - <port>8181</port> - <path>/onos/vtn/</path> - </HTTP> - - <GIT> - <pull>False</pull> - <branch>master</branch> - </GIT> - - <OVSDB> - <ip1>OCN</ip1> - <ip2>OC1</ip2> - </OVSDB> - -</PARAMS> diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.py b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.py deleted file mode 100644 index 1cb0ab20..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.py +++ /dev/null @@ -1,240 +0,0 @@ -""" -Description: This test is to check onos set configuration and flows with ovsdb connection. - -List of test cases: -CASE1: Compile ONOS and push it to the test machines -CASE2: Test ovsdb connection and tearDown -CASE3: Test default br-int configuration and vxlan port -CASE4: Test default openflow configuration -CASE5: Test default flows -CASE6: Configure Network Subnet Port -CASE7: Test host go online and ping each other -CASE8: Clear ovs configuration and host configuration -zhanghaoyu7@huawei.com -""" -import os - -class FUNCovsdbtest: - - def __init__( self ): - self.default = '' - - def CASE1( self, main ): - """ - CASE1 is to compile ONOS and push it to the test machines - - Startup sequence: - cell <name> - onos-verify-cell - NOTE: temporary - onos-remove-raft-logs - onos-uninstall - start mininet - git pull - mvn clean install - onos-package - onos-install -f - onos-wait-for-start - start cli sessions - start ovsdb - start vtn apps - """ - import os - main.log.info( "ONOS Single node start " + - "ovsdb test - initialization" ) - main.case( "Setting up test environment" ) - main.caseExplanation = "Setup the test environment including " +\ - "installing ONOS, start ONOS." - - # load some variables from the params file - PULLCODE = False - if main.params[ 'GIT' ][ 'pull' ] == 'True': - PULLCODE = True - gitBranch = main.params[ 'GIT' ][ 'branch' ] - cellName = main.params[ 'ENV' ][ 'cellName' ] - ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) - OVSDB1Ip = os.getenv( main.params[ 'OVSDB' ][ 'ip1' ] ) - OVSDB2Ip = os.getenv( main.params[ 'OVSDB' ][ 'ip2' ] ) - - main.step( "Create cell file" ) - cellAppString = main.params[ 'ENV' ][ 'cellApps' ] - main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName, - main.OVSDB1.ip_address, - cellAppString, ipList ) - - main.step( "Applying cell variable to environment" ) - cellResult = main.ONOSbench.setCell( cellName ) - verifyResult = main.ONOSbench.verifyCell() - - main.log.info( "Removing raft logs" ) - main.ONOSbench.onosRemoveRaftLogs() - - main.CLIs = [] - main.nodes = [] - main.numCtrls= 1 - - for i in range( 1, main.numCtrls + 1 ): - try: - main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) - main.nodes.append( getattr( main, 'ONOS' + str( i ) ) ) - ipList.append( main.nodes[ -1 ].ip_address ) - except AttributeError: - break - - main.log.info( "Uninstalling ONOS" ) - for node in main.nodes: - main.ONOSbench.onosUninstall( node.ip_address ) - - # Make sure ONOS process is not running - main.log.info( "Killing any ONOS processes" ) - killResults = main.TRUE - for node in main.nodes: - killed = main.ONOSbench.onosKill( node.ip_address ) - killResults = killResults and killed - - cleanInstallResult = main.TRUE - gitPullResult = main.TRUE - main.step( "Git checkout and pull" + gitBranch ) - if PULLCODE: - main.ONOSbench.gitCheckout( gitBranch ) - gitPullResult = main.ONOSbench.gitPull() - # values of 1 or 3 are good - utilities.assert_lesser( expect=0, actual=gitPullResult, - onpass="Git pull successful", - onfail="Git pull failed" ) - - main.ONOSbench.getVersion( report=True ) - - main.step( "Using mvn clean install" ) - cleanInstallResult = main.TRUE - if PULLCODE and gitPullResult == main.TRUE: - cleanInstallResult = main.ONOSbench.cleanInstall() - else: - main.log.warn( "Did not pull new code so skipping mvn" + - "clean install" ) - utilities.assert_equals( expect=main.TRUE, - actual=cleanInstallResult, - onpass="MCI successful", - onfail="MCI failed" ) - - main.step( "Creating ONOS package" ) - packageResult = main.ONOSbench.onosPackage() - utilities.assert_equals( expect=main.TRUE, - actual=packageResult, - onpass="Successfully created ONOS package", - onfail="Failed to create ONOS package" ) - - main.step( "Installing ONOS package" ) - onosInstallResult = main.ONOSbench.onosInstall( - options="-f", node=main.nodes[0].ip_address ) - utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult, - onpass="ONOS install successful", - onfail="ONOS install failed" ) - - main.step( "Checking if ONOS is up yet" ) - print main.nodes[0].ip_address - for i in range( 2 ): - onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address ) - if onos1Isup: - break - utilities.assert_equals( expect=main.TRUE, actual=onos1Isup, - onpass="ONOS startup successful", - onfail="ONOS startup failed" ) - main.log.step( "Starting ONOS CLI sessions" ) - print main.nodes[0].ip_address - cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address ) - utilities.assert_equals( expect=main.TRUE, actual=cliResults, - onpass="ONOS cli startup successful", - onfail="ONOS cli startup failed" ) - - main.step( "App Ids check" ) - appCheck = main.ONOScli1.appToIDCheck() - - if appCheck !=main.TRUE: - main.log.warn( main.CLIs[0].apps() ) - main.log.warn( main.CLIs[0].appIDs() ) - utilities.assert_equals( expect=main.TRUE, actual=appCheck, - onpass="App Ids seem to be correct", - onfail="Something is wrong with app Ids" ) - if cliResults == main.FALSE: - main.log.error( "Failed to start ONOS,stopping test" ) - main.cleanup() - main.exit() - - main.step( "Install onos-ovsdatabase" ) - installResults = main.ONOScli1.activateApp( "org.onosproject.ovsdb" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-ovsdatabase successful", - onfail="Install onos-ovsdatabase failed" ) - - main.step( "Install onos-app-vtnrsc" ) - installResults = main.ONOScli1.activateApp( "org.onosproject.vtnrsc" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-app-vtnrsc successful", - onfail="Install onos-app-vtnrsc failed" ) - - main.step( "Install onos-app-vtn" ) - installResults = main.ONOScli1.activateApp( "org.onosproject.vtn" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-app-vtn successful", - onfail="Install onos-app-vtn failed" ) - - main.step( "Install onos-app-vtnweb" ) - installResults = main.ONOScli1.activateApp( "org.onosproject.vtnweb" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-app-vtnweb successful", - onfail="Install onos-app-vtnweb failed" ) - - def CASE2( self, main ): - - """ - Test ovsdb connection and teardown - """ - import os,sys - import re - import time - - main.case( "Test ovsdb connection and teardown" ) - main.caseExplanation = "Test ovsdb connection create and delete" +\ - " over ovsdb node and onos node " - - ctrlip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) - ovsdbport = main.params[ 'CTRL' ][ 'ovsdbport' ] - delaytime = main.params[ 'TIMER' ][ 'delaytime' ] - - main.step( "Set ovsdb node manager" ) - assignResult = main.OVSDB1.setManager( ip=ctrlip, port=ovsdbport, delaytime=delaytime ) - stepResult = assignResult - utilities.assert_equals( expect=main.TRUE, - actual=stepResult, - onpass="Set ovsdb node manager sucess", - onfail="Set ovsdb node manager failed" ) - - main.step( "Check ovsdb node manager is " + str( ctrlip ) ) - response = main.OVSDB1.getManager() - if re.search( ctrlip, response ): - stepResult = main.TRUE - else: - stepResult = main.FALSE - utilities.assert_equals( expect=main.TRUE, - actual=stepResult, - onpass="Check ovsdb node manager is " + str( response ) , - onfail="Check ovsdb node manager failed" ) - - main.step( "Delete ovsdb node manager" ) - deleteResult = main.OVSDB1.delManager( delaytime=delaytime ) - stepResult = deleteResult - utilities.assert_equals( expect=main.TRUE, - actual=stepResult, - onpass="ovsdb node delete manager sucess", - onfail="ovsdb node delete manager failed" ) - - main.step( "Check ovsdb node delete manager " + str( ctrlip ) ) - response = main.OVSDB1.getManager() - if not re.search( ctrlip, response ): - stepResult = main.TRUE - else: - stepResult = main.FALSE - utilities.assert_equals( expect=main.TRUE, - actual=stepResult, - onpass="Check ovsdb node delete manager sucess", - onfail="Check ovsdb node delete manager failed" ) diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.topo b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.topo deleted file mode 100644 index ae748d2e..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/FUNCovsdbtest.topo +++ /dev/null @@ -1,60 +0,0 @@ -<TOPOLOGY> - <COMPONENT> - - <ONOSbench> - <host>OCN</host> - <user>admin</user> - <password></password> - <type>OnosDriver</type> - <connect_order>1</connect_order> - <COMPONENTS> - </COMPONENTS> - </ONOSbench> - - <ONOScli1> - <host>OCN</host> - <user>admin</user> - <password></password> - <type>OnosCliDriver</type> - <connect_order>2</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOScli1> - - <ONOS1> - <host>OC1</host> - <user>sdn</user> - <password></password> - <type>OnosDriver</type> - <connect_order>3</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOS1> - - <ONOSrest> - <host>OC1</host> - <user>sdn</user> - <password></password> - <type>OnosRestDriver</type> - <connect_order>4</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOSrest> - - <OVSDB1> - <host>OCN</host> - <user>admin</user> - <password></password> - <type>OvsdbDriver</type> - <connect_order>5</connect_order> - <COMPONENTS> </COMPONENTS> - </OVSDB1> - - <OVSDB2> - <host>OC1</host> - <user>sdn</user> - <password></password> - <type>OvsdbDriver</type> - <connect_order>6</connect_order> - <COMPONENTS> </COMPONENTS> - </OVSDB2> - - </COMPONENT> -</TOPOLOGY> diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/__init__.py b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/__init__.py +++ /dev/null diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/Nbdata.py b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/Nbdata.py deleted file mode 100644 index 3fde20db..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/Nbdata.py +++ /dev/null @@ -1,212 +0,0 @@ -""" -This file provide the data -lanqinglong@huawei.com -""" -import json - -class NetworkData: - - def __init__(self): - self.id = '' - self.state = 'ACTIVE' - self.name = 'onosfw-1' - self.physicalNetwork = 'none' - self.admin_state_up = True - self.tenant_id = '' - self.routerExternal = False - self.type ='LOCAL' - self.segmentationID = '6' - self.shared = False - - def DictoJson(self): - - if self.id =='' or self.tenant_id == '': - print 'Id and tenant id is necessary!' - - Dicdata = {} - if self.id !='': - Dicdata['id'] = self.id - if self.state != '': - Dicdata['status'] = self.state - if self.name !='': - Dicdata['name'] = self.name - if self.physicalNetwork !='': - Dicdata['provider:physical_network'] = self.physicalNetwork - if self.admin_state_up !='': - Dicdata['admin_state_up'] = self.admin_state_up - if self.tenant_id !='': - Dicdata['tenant_id'] = self.tenant_id - if self.routerExternal !='': - Dicdata['router:external'] = self.routerExternal - if self.type !='': - Dicdata['provider:network_type'] = self.type - if self.segmentationID !='': - Dicdata['provider:segmentation_id'] = self.segmentationID - if self.shared !='': - Dicdata['shared'] = self.shared - - Dicdata = {'network': Dicdata} - - return json.dumps(Dicdata,indent=4) - - def Ordered(self,obj): - - if isinstance(obj, dict): - return sorted((k,self.Ordered(v)) for k, v in obj.items()) - if isinstance(obj, list): - return sorted(self.Ordered(x) for x in obj ) - else: - return obj - - def JsonCompare(self,SourceData,DestiData,FirstPara,SecondPara): - - try: - SourceCompareDataDic = json.loads(SourceData) - DestiCompareDataDic = json.loads(DestiData) - except ValueError: - print "SourceData or DestData is not JSON Type!" - return False - - try: - Socom = SourceCompareDataDic[FirstPara][SecondPara] - Decom = DestiCompareDataDic[FirstPara][SecondPara] - except KeyError,error: - print "Key error ,This key is not found:%s"%error - return False - - if str(Socom).lower()== str(Decom).lower(): - return True - else: - print "Source Compare data:"+FirstPara+"."+SecondPara+"="+str(Socom) - print "Dest Compare data: "+FirstPara+"."+SecondPara+"="+str(Decom) - return False - -class SubnetData(NetworkData): - - def __init__(self): - self.id = '' - self.tenant_id = '' - self.network_id = '' - self.nexthop = '192.168.1.1' - self.destination = '192.168.1.1/24' - self.start = '192.168.2.2' - self.end = '192.168.2.254' - self.ipv6_address_mode = 'DHCPV6_STATELESS' - self.ipv6_ra_mode = 'DHCPV6_STATELESS' - self.cidr = '192.168.1.1/24' - self.enable_dhcp = True - self.dns_nameservers = 'aaa' - self.gateway_ip = '192.168.2.1' - self.ip_version = '4' - self.shared = False - self.name = 'demo-subnet' - - def DictoJson(self): - if self.id =='' or self.tenant_id == '': - print 'Id and tenant id is necessary!' - - Dicdata = {} - host_routesdata = [] - host_routesdata.append({'nexthop': self.nexthop,'destination': self.destination}) - allocation_pools = [] - allocation_pools.append({'start': self.start,'end':self.end}) - - if self.id != '': - Dicdata['id'] = self.id - if self.network_id != '': - Dicdata['network_id'] = self.network_id - if self.name != '': - Dicdata['name'] = self.name - if self.nexthop != '': - Dicdata['host_routes'] = host_routesdata - if self.tenant_id != '': - Dicdata['tenant_id'] = self.tenant_id - if self.start != '': - Dicdata['allocation_pools'] = allocation_pools - if self.shared != '': - Dicdata['shared'] = self.shared - if self.ipv6_address_mode != '': - Dicdata['ipv6_address_mode'] = self.ipv6_address_mode - if self.ipv6_ra_mode != '': - Dicdata['ipv6_ra_mode'] = self.ipv6_ra_mode - if self.cidr != '': - Dicdata['cidr'] = self.cidr - if self.enable_dhcp != '': - Dicdata['enable_dhcp'] = self.enable_dhcp - if self.dns_nameservers != '': - Dicdata['dns_nameservers'] = self.dns_nameservers - if self.gateway_ip != '': - Dicdata['gateway_ip'] = self.gateway_ip - if self.ip_version != '': - Dicdata['ip_version'] = self.ip_version - - Dicdata = {'subnet': Dicdata} - - return json.dumps(Dicdata,indent=4) - -class VirtualPortData(NetworkData): - - def __init__(self): - self.id = '' - self.state = 'ACTIVE' - self.bindingHostId = 'fa:16:3e:76:8e:88' - self.allowedAddressPairs = [{'mac_address':'fa:16:3e:76:8e:88','ip_address':'192.168.1.1'}] - self.deviceOwner = 'none' - self.fixedIp = [] - self.securityGroups = [{'securityGroup':'asd'}] - self.adminStateUp = True - self.network_id = '' - self.tenant_id = '' - self.subnet_id = '' - self.bindingvifDetails = 'port_filter' - self.bindingvnicType = 'normal' - self.bindingvifType = 'ovs' - self.macAddress = 'fa:16:3e:76:8e:88' - self.deviceId = 'a08aa' - self.name = 'u' - - def DictoJson(self): - if self.id == '' or self.tenant_id == ' ' or \ - self.network_id == '' or self.subnet_id == '': - print 'Id/tenant id/networkid/subnetId is necessary!' - - Dicdata = {} - fixedIp =[] - fixedIp.append({'subnet_id':self.subnet_id,'ip_address':'192.168.1.4'}) - allocation_pools = [] - - if self.id != '': - Dicdata['id'] = self.id - if self.state != '': - Dicdata['status'] = self.state - if self.bindingHostId != '': - Dicdata['binding:host_id'] = self.bindingHostId - if self.allowedAddressPairs != '': - Dicdata['allowed_address_pairs'] = self.allowedAddressPairs - if self.deviceOwner != '': - Dicdata['device_owner'] = self.deviceOwner - if self.securityGroups != '': - Dicdata['security_groups'] = self.securityGroups - if self.adminStateUp != '': - Dicdata['admin_state_up'] = self.adminStateUp - if self.network_id != '': - Dicdata['network_id'] = self.network_id - if self.tenant_id != '': - Dicdata['tenant_id'] = self.tenant_id - if self.bindingvifDetails != '': - Dicdata['binding:vif_details'] = self.bindingvifDetails - if self.bindingvnicType != '': - Dicdata['binding:vnic_type'] = self.bindingvnicType - if self.bindingvifType != '': - Dicdata['binding:vif_type'] = self.bindingvifType - if self.macAddress != '': - Dicdata['mac_address'] = self.macAddress - if self.deviceId != '': - Dicdata['device_id'] = self.deviceId - if self.name != '': - Dicdata['name'] = self.name - - Dicdata['fixed_ips'] = fixedIp - Dicdata = {'port': Dicdata} - - return json.dumps(Dicdata,indent=4) diff --git a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/__init__.py b/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCovsdbtest/dependencies/__init__.py +++ /dev/null diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.params b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.params deleted file mode 100644 index a922e751..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.params +++ /dev/null @@ -1,45 +0,0 @@ -<PARAMS> - # CASE - Description - # 1 - Variable initialization and optional pull and build ONOS package - # 2 - Create Network northbound test - # 3 - Update Network northbound test - # 4 - Delete Network northbound test - # 5 - Create Subnet northbound test - # 6 - Update Subnet northbound test - # 7 - Delete Subnet northbound test - # 8 - Create Virtualport northbound test - # 9 - Update Virtualport northbound test - #10 - Delete Virtualport northbound test - - <testcases>1,2,3,4,5,6,7,8,9,10</testcases> - - <SLEEP> - <startup>15</startup> - </SLEEP> - - <ENV> - <cellName>singlenode</cellName> - <cellApps>drivers,openflow,proxyarp,mobility</cellApps> - </ENV> - - <CTRL> - <ip1>OC1</ip1> - <port1>6653</port1> - </CTRL> - - <HTTP> - <port>8181</port> - <path>/onos/vtn/</path> - </HTTP> - - <GIT> - <pull>False</pull> - <branch>master</branch> - </GIT> - - <MININET> - <switch>7</switch> - <links>20</links> - </MININET> - -</PARAMS> diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.py b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.py deleted file mode 100644 index 4ea8a359..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.py +++ /dev/null @@ -1,795 +0,0 @@ -""" -Description: This test is to determine if North bound - can handle the request - -List of test cases: -CASE1 - Variable initialization and optional pull and build ONOS package -CASE2 - Create Network northbound test -CASE3 - Update Network northbound test -CASE4 - Delete Network northbound test -CASE5 - Create Subnet northbound test -CASE6 - Update Subnet northbound test -CASE7 - Delete Subnet northbound test -CASE8 - Create Virtualport northbound test -CASE9 - Update Virtualport northbound test -CASE10 - Delete Virtualport northbound test -CASE11 - Post Error Json Create Network test -CASE12 - Post Error Json Create Subnet test -CASE13 - Post Error Json Create Virtualport test - -lanqinglong@huawei.com -""" -import os - -class FUNCvirNetNB: - - def __init__( self ): - self.default = '' - - def CASE1( self, main ): - """ - CASE1 is to compile ONOS and push it to the test machines - - Startup sequence: - cell<name> - onos-verify-cell - NOTE:temporary - onos-remove-raft-logs - onos-uninstall - git pull - mvn clean install - onos-package - onos-install -f - onos-wait-for-start - start cli sessions - start vtnrsc - """ - - import time - import os - main.log.info( "ONOS Single node Start "+ - "VirtualNet Northbound test - initialization" ) - main.case( "Setting up test environment" ) - main.caseExplanation = "Setup the test environment including "+\ - "installing ONOS,start ONOS." - - # load some variables from the params file - PULLCODE = False - if main.params['GIT']['pull'] =='True': - PULLCODE = True - gitBranch = main.params['GIT']['branch'] - cellName = main.params['ENV']['cellName'] - ipList = os.getenv( main.params['CTRL']['ip1'] ) - - main.step("Create cell file and apply to environment") - cellAppString = main.params['ENV']['cellApps'] - main.ONOSbench.createCellFile(main.ONOSbench.ip_address,cellName, - main.Mininet1.ip_address, - cellAppString,ipList ) - - cellResult = main.ONOSbench.setCell(cellName) - verifyResult = main.ONOSbench.verifyCell() - - stepResult = cellResult and verifyResult - utilities.assert_equals( expect=main.TRUE, - actual=stepResult, - onpass="Successfully applied cell to " + \ - "environment", - onfail="Failed to apply cell to environment " ) - - #FIXME:this is short term fix - main.log.info( "Removing raft logs" ) - main.ONOSbench.onosRemoveRaftLogs() - - main.CLIs = [] - main.nodes = [] - main.numCtrls=1 - main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) - - for i in range ( 1, main.numCtrls +1): - try: - main.CLIs.append( getattr( main, 'ONOScli' + str(i) ) ) - main.nodes.append( getattr( main, 'ONOS' + str(i) ) ) - ipList.append( main.nodes[ -1 ].ip_address ) - except AttributeError: - break - - main.log.info( "Uninstalling ONOS" ) - for node in main.nodes: - main.ONOSbench.onosUninstall( node.ip_address ) - - #Make sure ONOS is DEAD - main.log.info( "Killing any ONOS processes" ) - killResults = main.TRUE - for node in main.nodes: - killed = main.ONOSbench.onosKill( node.ip_address ) - killResults = killResults and killed - - cleanInstallResult = main.TRUE - gitPullResult = main.TRUE - main.log.info( "Git checkout and pull " + gitBranch ) - if PULLCODE: - main.ONOSbench.gitCheckout ( gitBranch ) - gitPullResult = main.ONOSbench.gitPull() - # values of 1 or 3 are good - utilities.assert_lesser ( expect=0, actual=gitPullResult, - onpass="Git pull successful", - onfail ="Git pull failed" ) - main.ONOSbench.getVersion( report =True ) - main.step( "Using mvn clean install" ) - cleanInstallResult= main.TRUE - if PULLCODE and gitPullResult == main.TRUE: - cleanInstallResult = main.ONOSbench.cleanInstall() - else: - main.log.warn("Did not pull new code so skipping mvn "+ - "clean install") - - utilities.assert_equals( expect=main.TRUE, - actual=cleanInstallResult, - onpass="MCI successful", - onfail="MCI failed" ) - - main.step( "Creating ONOS package" ) - packageResult = main.ONOSbench.onosPackage() - utilities.assert_equals( expect=main.TRUE, - actual=packageResult, - onpass="Successfully created ONOS package", - onfail="Failed to create ONOS package " ) - time.sleep( main.startUpSleep ) - - main.step( "Installing ONOS package" ) - onosInstallResult = main.ONOSbench.onosInstall( - options="-f",node=main.nodes[0].ip_address ) - utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult, - onpass="ONOS install successful", - onfail="ONOS install failed" ) - time.sleep( main.startUpSleep ) - - main.step( "Checking if ONOS is up yet" ) - - for i in range( 2 ): - onos1Isup = main.ONOSbench.isup( main.nodes[0].ip_address ) - if onos1Isup: - break - utilities.assert_equals( expect=main.TRUE, actual=onos1Isup, - onpass="ONOS startup successful", - onfail="ONOS startup failed" ) - time.sleep( main.startUpSleep ) - - main.log.step( "Starting ONOS CLI sessions" ) - - print main.nodes[0].ip_address - cliResults = main.ONOScli1.startOnosCli(main.nodes[0].ip_address) - utilities.assert_equals( expect=main.TRUE, actual=cliResults, - onpass="ONOS cli startup successful", - onfail="ONOS cli startup failed" ) - time.sleep( main.startUpSleep ) - - main.step( "App Ids check" ) - appCheck = main.ONOScli1.appToIDCheck() - if appCheck != main.TRUE: - main.log.warn( main.CLIs[0].apps() ) - main.log.warn( main.CLIs[0].appIDs() ) - utilities.assert_equals( expect=main.TRUE, actual=appCheck, - onpass="App Ids seem to be correct", - onfail="Something is wrong with app Ids" ) - - if cliResults == main.FALSE: - main.log.error( "Failed to start ONOS, stopping test" ) - main.cleanup() - main.exit() - - main.step( "Install onos-app-vtnrsc app" ) - installResults = main.ONOScli1.featureInstall( "onos-app-vtnrsc" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-app-vtnrsc successful", - onfail="Install onos-app-vtnrsc app failed" ) - - time.sleep( main.startUpSleep ) - - main.step( "Install onos-app-vtnweb app" ) - installResults = main.ONOScli1.featureInstall( "onos-app-vtnweb" ) - utilities.assert_equals( expect=main.TRUE, actual=installResults, - onpass="Install onos-app-vtnweb successful", - onfail="Install onos-app-vtnweb app failed" ) - - time.sleep( main.startUpSleep ) - - def CASE2 ( self,main ): - - """ - Test Post Network - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Network Post test Start" ) - main.case( "Virtual Network NBI Test - Network" ) - main.caseExplanation = "Test Network Post NBI " +\ - "Verify Post Data same with Stored Data" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - postdata = network.DictoJson() - - main.step( "Post Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path+'networks/', - 'POST', None, postdata) - - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Success", - onfail="Post Failed " + str( Poststatus ) + str( result ) ) - - main.step( "Get Data via HTTP" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'GET', None, None) - utilities.assert_equals( - expect='200', - actual=Getstatus, - onpass="Get Success", - onfail="Get Failed " + str( Getstatus ) + str( result ) ) - - main.log.info("Post Network Data is :%s\nGet Network Data is:%s"%(postdata,result)) - - main.step( "Compare Send Id and Get Id" ) - IDcmpresult = network.JsonCompare( postdata, result, 'network', 'id' ) - TanantIDcmpresult = network.JsonCompare( postdata, result, 'network', 'tenant_id' ) - Cmpresult = IDcmpresult and TanantIDcmpresult - - utilities.assert_equals( - expect=True, - actual=Cmpresult, - onpass="Compare Success", - onfail="Compare Failed:ID compare: " + str( IDcmpresult ) + \ - ",Tenant id compare :" + str( TanantIDcmpresult ) ) - - deletestatus,result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='200', - actual=deletestatus, - onpass="Delete Network Success", - onfail="Delete Network Failed") - - if Cmpresult != True: - main.log.error( "Post Network compare failed" ) - - def CASE3( self,main ): - - """ - Test Update Network - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Network Update test Start" ) - main.case( "Virtual Network NBI Test - Network" ) - main.caseExplanation = "Test Network Update NBI " +\ - "Verify Update Data same with Stored Data" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - network.shared = False - postdata = network.DictoJson() - - network.shared = True - postdatanew = network.DictoJson() - - main.step( "Post Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path+'networks', - 'POST', None, postdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Success", - onfail="Post Failed " + str( Poststatus ) + str( result ) ) - - main.step( "Update Data via HTTP" ) - Updatestatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'PUT', None, postdatanew) - utilities.assert_equals( - expect='200', - actual=Updatestatus, - onpass="Update Success", - onfail="Update Failed " + str( Updatestatus ) + str( result ) ) - - main.step( "Get Data via HTTP" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'GET', None, None ) - utilities.assert_equals( - expect='200', - actual=Getstatus, - onpass="Get Success", - onfail="Get Failed " + str( Getstatus ) + str( result ) ) - - main.step( "Compare Update data." ) - IDcmpresult = network.JsonCompare( postdatanew, result, 'network', 'id' ) - TanantIDcmpresult = network.JsonCompare( postdatanew, result, 'network', 'tenant_id' ) - Shareresult = network.JsonCompare( postdatanew, result, 'network', 'shared' ) - - Cmpresult = IDcmpresult and TanantIDcmpresult and Shareresult - utilities.assert_equals( - expect=True, - actual=Cmpresult, - onpass="Compare Success", - onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \ - ",Tenant id compare:"+ str( TanantIDcmpresult ) + \ - ",Name compare:" + str( Shareresult ) ) - - deletestatus,result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'DELETE', None, None ) - - utilities.assert_equals( - expect='200', - actual=deletestatus, - onpass="Delete Network Success", - onfail="Delete Network Failed" ) - - if Cmpresult != True: - main.log.error( "Update Network compare failed" ) - - def CASE4( self,main ): - - """ - Test Delete Network - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Network Delete test Start" ) - main.case( "Virtual Network NBI Test - Network" ) - main.caseExplanation = "Test Network Delete NBI " +\ - "Verify Stored Data is NULL after Delete" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - postdata = network.DictoJson() - - main.step( "Post Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'networks/', - 'POST', None, postdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Success", - onfail="Post Failed " + str( Poststatus ) + str( result ) ) - - main.step( "Delete Data via HTTP" ) - Deletestatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='200', - actual=Deletestatus, - onpass="Delete Success", - onfail="Delete Failed " + str( Deletestatus ) + str( result ) ) - - main.step( "Get Data is NULL" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'GET', None, None ) - utilities.assert_equals( - expect='Network is not found', - actual=result, - onpass="Get Success", - onfail="Get Failed " + str( Getstatus ) + str( result ) ) - - if result != 'Network is not found': - main.log.error( "Delete Network failed" ) - - def CASE5( self, main ): - - """ - Test Post Subnet - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Subnet Post test Start" ) - main.case( "Virtual Network NBI Test - Subnet" ) - main.caseExplanation = "Test Subnet Post NBI " +\ - "Verify Stored Data is same with Post Data" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - subnet = SubnetData() - subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178" - subnet.tenant_id = network.tenant_id - subnet.network_id = network.id - - networkpostdata = network.DictoJson() - subnetpostdata = subnet.DictoJson() - - main.step( "Post Network Data via HTTP(Post Subnet need post network)" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'networks/', - 'POST', None, networkpostdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Network Success", - onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Post Subnet Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'subnets/', - 'POST', None, subnetpostdata ) - utilities.assert_equals( - expect='202', - actual=Poststatus, - onpass="Post Subnet Success", - onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Get Subnet Data via HTTP" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/', - 'GET', None, None ) - utilities.assert_equals( - expect='200', - actual=Getstatus, - onpass="Get Subnet Success", - onfail="Get Subnet Failed " + str( Getstatus ) + "," + str( result ) ) - - IDcmpresult = subnet.JsonCompare( subnetpostdata, result, 'subnet', 'id' ) - TanantIDcmpresult = subnet.JsonCompare( subnetpostdata, result, 'subnet', 'tenant_id' ) - NetoworkIDcmpresult = subnet.JsonCompare( subnetpostdata, result, 'subnet', 'network_id' ) - - main.step( "Compare Post Subnet Data via HTTP" ) - Cmpresult = IDcmpresult and TanantIDcmpresult and NetoworkIDcmpresult - utilities.assert_equals( - expect=True, - actual=Cmpresult, - onpass="Compare Success", - onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \ - ",Tenant id compare:"+ str( TanantIDcmpresult ) + \ - ",Network id compare:" + str( NetoworkIDcmpresult ) ) - - deletestatus,result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='200', - actual=deletestatus, - onpass="Delete Network Success", - onfail="Delete Network Failed" ) - - if Cmpresult != True: - main.log.error( "Post Subnet compare failed" ) - - def CASE6( self, main ): - - """ - Test Post Subnet - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Subnet Update test Start" ) - main.case( "Virtual Network NBI Test - Subnet" ) - main.caseExplanation = "Test Subnet Update NBI " +\ - "Verify Stored Data is same with Update Data" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - subnet = SubnetData() - subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178" - subnet.tenant_id = network.tenant_id - subnet.network_id = network.id - subnet.start = "192.168.2.1" - subnet.end = "192.168.2.255" - networkpostdata = network.DictoJson() - subnetpostdata = subnet.DictoJson() - - #Change allocation_poolsdata scope - subnet.start = "192.168.102.1" - subnet.end = "192.168.102.255" - #end change - newsubnetpostdata = subnet.DictoJson() - - main.step( "Post Network Data via HTTP(Post Subnet need post network)" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'networks/', - 'POST', None, networkpostdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Network Success", - onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Post Subnet Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'subnets/', - 'POST', None, subnetpostdata ) - utilities.assert_equals( - expect='202', - actual=Poststatus, - onpass="Post Subnet Success", - onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Update Subnet Data via HTTP" ) - Putstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/', - 'PUT', None, newsubnetpostdata ) - utilities.assert_equals( - expect='203', - actual=Putstatus, - onpass="Update Subnet Success", - onfail="Update Subnet Failed " + str( Putstatus ) + "," + str( result ) ) - - main.step( "Get Subnet Data via HTTP" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/', - 'GET', None, None ) - utilities.assert_equals( - expect='200', - actual=Getstatus, - onpass="Get Subnet Success", - onfail="Get Subnet Failed " + str( Getstatus ) + "," + str( result ) ) - - IDcmpresult = subnet.JsonCompare( newsubnetpostdata, result, 'subnet', 'id' ) - TanantIDcmpresult = subnet.JsonCompare( newsubnetpostdata, result, 'subnet', 'tenant_id' ) - Poolcmpresult = subnet.JsonCompare( newsubnetpostdata, result, 'subnet', 'allocation_pools' ) - - main.step( "Compare Subnet Data" ) - Cmpresult = IDcmpresult and TanantIDcmpresult and Poolcmpresult - utilities.assert_equals( - expect=True, - actual=Cmpresult, - onpass="Compare Success", - onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \ - ",Tenant id compare:"+ str( TanantIDcmpresult ) + \ - ",Pool compare:" + str( Poolcmpresult ) ) - - main.step( "Delete Subnet via HTTP" ) - deletestatus,result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='200', - actual=deletestatus, - onpass="Delete Network Success", - onfail="Delete Network Failed" ) - - if Cmpresult != True: - main.log.error( "Update Subnet compare failed" ) - - def CASE7( self, main ): - - """ - Test Delete Subnet - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Subnet Delete test Start" ) - main.case( "Virtual Network NBI Test - Subnet" ) - main.caseExplanation = "Test Subnet Delete NBI " +\ - "Verify Stored Data is Null after Delete" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - port = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - subnet = SubnetData() - subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178" - subnet.tenant_id = network.tenant_id - subnet.network_id = network.id - - networkpostdata = network.DictoJson() - subnetpostdata = subnet.DictoJson() - - main.step( "Post Network Data via HTTP(Post Subnet need post network)" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'networks/', - 'POST', None, networkpostdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Network Success", - onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Post Subnet Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, port, '', path + 'subnets/', - 'POST', None, subnetpostdata ) - utilities.assert_equals( - expect='202', - actual=Poststatus, - onpass="Post Subnet Success", - onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Delete Subnet Data via HTTP" ) - Deletestatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='201', - actual=Deletestatus, - onpass="Delete Subnet Success", - onfail="Delete Subnet Failed " + str( Deletestatus ) + "," + str( result ) ) - - main.step( "Get Subnet Data is NULL" ) - Getstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/', - 'GET', None, None ) - utilities.assert_equals( - expect='Subnet is not found', - actual=result, - onpass="Get Subnet Success", - onfail="Get Subnet Failed " + str( Getstatus ) + str( result ) ) - - if result != 'Subnet is not found': - main.log.error( "Delete Subnet failed" ) - - def CASE8( self, main ): - - """ - Test Post Port - """ - import os - - try: - from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData - from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData - from tests.FUNCvirNetNB.dependencies.Nbdata import VirtualPortData - except ImportError: - main.log.exception( "Something wrong with import file or code error." ) - main.log.info( "Import Error, please check!" ) - main.cleanup() - main.exit() - - main.log.info( "ONOS Port Post test Start" ) - main.case( "Virtual Network NBI Test - Port" ) - main.caseExplanation = "Test Port Post NBI " +\ - "Verify Stored Data is same with Post Data" - - ctrlip = os.getenv( main.params['CTRL']['ip1'] ) - httpport = main.params['HTTP']['port'] - path = main.params['HTTP']['path'] - - main.log.info( "Generate Post Data" ) - network = NetworkData() - network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc' - network.tenant_id = '26cd996094344a0598b0a1af1d525cdc' - subnet = SubnetData() - subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178" - subnet.tenant_id = network.tenant_id - subnet.network_id = network.id - port = VirtualPortData() - port.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466" - port.subnet_id = subnet.id - port.tenant_id = network.tenant_id - port.network_id = network.id - - networkpostdata = network.DictoJson() - subnetpostdata = subnet.DictoJson() - portpostdata = port.DictoJson() - - main.step( "Post Network Data via HTTP(Post port need post network)" ) - Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/', - 'POST', None, networkpostdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Network Success", - onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Post Subnet Data via HTTP(Post port need post subnet)" ) - Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/', - 'POST', None, subnetpostdata ) - utilities.assert_equals( - expect='202', - actual=Poststatus, - onpass="Post Subnet Success", - onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Post Port Data via HTTP" ) - Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/', - 'POST', None, portpostdata ) - utilities.assert_equals( - expect='200', - actual=Poststatus, - onpass="Post Port Success", - onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) ) - - main.step( "Get Port Data via HTTP" ) - Getstatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/', - 'GET', None, None ) - utilities.assert_equals( - expect='200', - actual=Getstatus, - onpass="Get Port Success", - onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) ) - - main.step( "Compare Post Port Data" ) - IDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'id' ) - TanantIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'tenant_id' ) - NetoworkIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'network_id' ) - fixedIpresult = subnet.JsonCompare( portpostdata, result, 'port', 'fixed_ips' ) - - Cmpresult = IDcmpresult and TanantIDcmpresult and NetoworkIDcmpresult and fixedIpresult - utilities.assert_equals( - expect=True, - actual=Cmpresult, - onpass="Compare Success", - onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \ - ",Tenant id compare:"+ str( TanantIDcmpresult ) + \ - ",Network id compare:" + str( NetoworkIDcmpresult ) +\ - ",FixIp compare:" + str( fixedIpresult ) ) - - main.step( "Clean Data via HTTP" ) - deletestatus,result = main.ONOSrest.send( ctrlip, httpport, network.id, path + 'networks/', - 'DELETE', None, None ) - utilities.assert_equals( - expect='200', - actual=deletestatus, - onpass="Delete Network Success", - onfail="Delete Network Failed" ) - - if Cmpresult != True: - main.log.error( "Post port compare failed" )
\ No newline at end of file diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.topo b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.topo deleted file mode 100644 index fbe743b8..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/FUNCvirNetNB.topo +++ /dev/null @@ -1,53 +0,0 @@ -<TOPOLOGY> - <COMPONENT> - - <ONOSbench> - <host>localhost</host> - <user>admin</user> - <password>onos_test</password> - <type>OnosDriver</type> - <connect_order>1</connect_order> - <COMPONENTS> - </COMPONENTS> - </ONOSbench> - - <ONOScli1> - <host>localhost</host> - <user>admin</user> - <password>onos_test</password> - <type>OnosCliDriver</type> - <connect_order>2</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOScli1> - - <ONOS1> - <host>OC1</host> - <user>sdn</user> - <password>rocks</password> - <type>OnosDriver</type> - <connect_order>3</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOS1> - - <ONOSrest> - <host>OC1</host> - <user>sdn</user> - <password>rocks</password> - <type>OnosRestDriver</type> - <connect_order>4</connect_order> - <COMPONENTS> </COMPONENTS> - </ONOSrest> - - <Mininet1> - <host>OCN</host> - <user>admin</user> - <password>onos_test</password> - <type>MininetCliDriver</type> - <connect_order>5</connect_order> - <COMPONENTS> - <controller> none </controller> - </COMPONENTS> - </Mininet1> - - </COMPONENT> -</TOPOLOGY> diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/__init__.py b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/__init__.py +++ /dev/null diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/Nbdata.py b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/Nbdata.py deleted file mode 100644 index 9b3b9782..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/Nbdata.py +++ /dev/null @@ -1,212 +0,0 @@ -""" -This file provide the data -lanqinglong@huawei.com -""" -import json - -class NetworkData: - - def __init__(self): - self.id = '' - self.state = 'ACTIVE' - self.name = 'onosfw-1' - self.physicalNetwork = 'none' - self.admin_state_up = True - self.tenant_id = '' - self.routerExternal = False - self.type ='LOCAL' - self.segmentationID = '6' - self.shared = False - - def DictoJson(self): - - if self.id =='' or self.tenant_id == '': - print 'Id and tenant id is necessary!' - - Dicdata = {} - if self.id !='': - Dicdata['id'] = self.id - if self.state != '': - Dicdata['status'] = self.state - if self.name !='': - Dicdata['name'] = self.name - if self.physicalNetwork !='': - Dicdata['provider:physical_network'] = self.physicalNetwork - if self.admin_state_up !='': - Dicdata['admin_state_up'] = self.admin_state_up - if self.tenant_id !='': - Dicdata['tenant_id'] = self.tenant_id - if self.routerExternal !='': - Dicdata['router:external'] = self.routerExternal - if self.type !='': - Dicdata['provider:network_type'] = self.type - if self.segmentationID !='': - Dicdata['provider:segmentation_id'] = self.segmentationID - if self.shared !='': - Dicdata['shared'] = self.shared - - Dicdata = {'network': Dicdata} - - return json.dumps(Dicdata,indent=4) - - def Ordered(self,obj): - - if isinstance(obj, dict): - return sorted((k,self.Ordered(v)) for k, v in obj.items()) - if isinstance(obj, list): - return sorted(self.Ordered(x) for x in obj ) - else: - return obj - - def JsonCompare(self,SourceData,DestiData,FirstPara,SecondPara): - - try: - SourceCompareDataDic = json.loads(SourceData) - DestiCompareDataDic = json.loads(DestiData) - except ValueError: - print "SourceData or DestData is not JSON Type!" - return False - - try: - Socom = SourceCompareDataDic[FirstPara][SecondPara] - Decom = DestiCompareDataDic[FirstPara][SecondPara] - except KeyError,error: - print "Key error ,This key is not found:%s"%error - return False - - if str(Socom).lower()== str(Decom).lower(): - return True - else: - print "Source Compare data:"+FirstPara+"."+SecondPara+"="+str(Socom) - print "Dest Compare data: "+FirstPara+"."+SecondPara+"="+str(Decom) - return False - -class SubnetData(NetworkData): - - def __init__(self): - self.id = '' - self.tenant_id = '' - self.network_id = '' - self.nexthop = '192.168.1.1' - self.destination = '192.168.1.1/24' - self.start = '192.168.2.2' - self.end = '192.168.2.254' - self.ipv6_address_mode = 'DHCPV6_STATELESS' - self.ipv6_ra_mode = 'DHCPV6_STATELESS' - self.cidr = '192.168.1.1/24' - self.enable_dhcp = True - self.dns_nameservers = 'aaa' - self.gateway_ip = '192.168.2.1' - self.ip_version = '4' - self.shared = False - self.name = 'demo-subnet' - - def DictoJson(self): - if self.id =='' or self.tenant_id == '': - print 'Id and tenant id is necessary!' - - Dicdata = {} - host_routesdata = [] - host_routesdata.append({'nexthop': self.nexthop,'destination': self.destination}) - allocation_pools = [] - allocation_pools.append({'start': self.start,'end':self.end}) - - if self.id != '': - Dicdata['id'] = self.id - if self.network_id != '': - Dicdata['network_id'] = self.network_id - if self.name != '': - Dicdata['name'] = self.name - if self.nexthop != '': - Dicdata['host_routes'] = host_routesdata - if self.tenant_id != '': - Dicdata['tenant_id'] = self.tenant_id - if self.start != '': - Dicdata['allocation_pools'] = allocation_pools - if self.shared != '': - Dicdata['shared'] = self.shared - if self.ipv6_address_mode != '': - Dicdata['ipv6_address_mode'] = self.ipv6_address_mode - if self.ipv6_ra_mode != '': - Dicdata['ipv6_ra_mode'] = self.ipv6_ra_mode - if self.cidr != '': - Dicdata['cidr'] = self.cidr - if self.enable_dhcp != '': - Dicdata['enable_dhcp'] = self.enable_dhcp - if self.dns_nameservers != '': - Dicdata['dns_nameservers'] = self.dns_nameservers - if self.gateway_ip != '': - Dicdata['gateway_ip'] = self.gateway_ip - if self.ip_version != '': - Dicdata['ip_version'] = self.ip_version - - Dicdata = {'subnet': Dicdata} - - return json.dumps(Dicdata,indent=4) - -class VirtualPortData(NetworkData): - - def __init__(self): - self.id = '' - self.state = 'ACTIVE' - self.bindingHostId = 'fa:16:3e:76:8e:88' - self.allowedAddressPairs = [{'mac_address':'fa:16:3e:76:8e:88','ip_address':'192.168.1.1'}] - self.deviceOwner = 'none' - self.fixedIp = [] - self.securityGroups = [{'securityGroup':'asd'}] - self.adminStateUp = True - self.network_id = '' - self.tenant_id = '' - self.subnet_id = '' - self.bindingvifDetails = 'port_filter' - self.bindingvnicType = 'normal' - self.bindingvifType = 'ovs' - self.macAddress = 'fa:16:3e:76:8e:88' - self.deviceId = 'a08aa' - self.name = 'u' - - def DictoJson(self): - if self.id == '' or self.tenant_id == ' ' or \ - self.network_id == '' or self.subnet_id == '': - print 'Id/tenant id/networkid/subnetId is necessary!' - - Dicdata = {} - fixedIp =[] - fixedIp.append({'subnet_id':self.subnet_id,'ip_address':'192.168.1.4'}) - allocation_pools = [] - - if self.id != '': - Dicdata['id'] = self.id - if self.state != '': - Dicdata['status'] = self.state - if self.bindingHostId != '': - Dicdata['binding:host_id'] = self.bindingHostId - if self.allowedAddressPairs != '': - Dicdata['allowed_address_pairs'] = self.allowedAddressPairs - if self.deviceOwner != '': - Dicdata['device_owner'] = self.deviceOwner - if self.securityGroups != '': - Dicdata['security_groups'] = self.securityGroups - if self.adminStateUp != '': - Dicdata['admin_state_up'] = self.adminStateUp - if self.network_id != '': - Dicdata['network_id'] = self.network_id - if self.tenant_id != '': - Dicdata['tenant_id'] = self.tenant_id - if self.bindingvifDetails != '': - Dicdata['binding:vif_details'] = self.bindingvifDetails - if self.bindingvnicType != '': - Dicdata['binding:vnic_type'] = self.bindingvnicType - if self.bindingvifType != '': - Dicdata['binding:vif_type'] = self.bindingvifType - if self.macAddress != '': - Dicdata['mac_address'] = self.macAddress - if self.deviceId != '': - Dicdata['device_id'] = self.deviceId - if self.name != '': - Dicdata['name'] = self.name - - Dicdata['fixed_ips'] = fixedIp - Dicdata = {'port': Dicdata} - - return json.dumps(Dicdata,indent=4)
\ No newline at end of file diff --git a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/__init__.py b/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/framework/scripts/function_test/Teston/testcases/FUNCvirNetNB/dependencies/__init__.py +++ /dev/null |