diff options
-rw-r--r-- | ci/testcases.yaml | 8 | ||||
-rw-r--r-- | docker/Dockerfile | 2 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Sfc/Sfc.py | 151 | ||||
-rwxr-xr-x | testcases/features/sfc/sfc.py | 10 | ||||
-rwxr-xr-x | utils/openstack_utils.py | 2 |
5 files changed, 61 insertions, 112 deletions
diff --git a/ci/testcases.yaml b/ci/testcases.yaml index 3b76e139d..409bc007d 100644 --- a/ci/testcases.yaml +++ b/ci/testcases.yaml @@ -130,8 +130,8 @@ tiers: description: >- Test suite from Doctor project. dependencies: - installer: '(apex)|(fuel)' - scenario: '' + installer: 'apex' + scenario: '^((?!fdio).)*$' - name: bgpvpn @@ -151,7 +151,7 @@ tiers: Simple security Scan dependencies: installer: 'apex' - scenario: '' + scenario: '^((?!fdio).)*$' - name: copper @@ -161,7 +161,7 @@ tiers: Test suite for policy management based on OpenStack Congress dependencies: installer: '(apex)|(joid)' - scenario: '^((?!lxd).)*$' + scenario: '^((?!fdio|lxd).)*$' - name: moon criteria: 'status == "PASS"' diff --git a/docker/Dockerfile b/docker/Dockerfile index 3d9940406..7120d3480 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,7 +33,7 @@ ARG TEMPEST_TAG=12.2.0 ARG RALLY_TAG=0.5.0 ARG ODL_TAG=release/beryllium-sr3 ARG OPENSTACK_TAG=stable/mitaka -ARG KINGBIRD_TAG=0.2.1 +ARG KINGBIRD_TAG=0.2.2 ARG VIMS_TAG=stable ENV HOME /home/opnfv ENV repos_dir /home/opnfv/repos diff --git a/testcases/Controllers/ONOS/Sfc/Sfc.py b/testcases/Controllers/ONOS/Sfc/Sfc.py index 28611982b..bea2828d2 100644 --- a/testcases/Controllers/ONOS/Sfc/Sfc.py +++ b/testcases/Controllers/ONOS/Sfc/Sfc.py @@ -36,110 +36,52 @@ CREATED = 201 ACCEPTED = 202 NO_CONTENT = 204 +start_time = time.time() + def PreConfig(): logger.info("Testcase 1 : Prerequisites configuration for SFC") logger.info("1.1 Creation of Auth-Token") - if (Sfc_obj.getToken() == OK): - logger.info("Creation of Token is successfull") - else: - logger.error(" : Creation of Token is NOT successfull") - fail() + check(Sfc_obj.getToken, OK, "Creation of Token") logger.info("1.2 Creation of Network") - if (Sfc_obj.createNetworks() == CREATED): - logger.info("Creation of network is successfull") - else: - logger.error(" : Creation of network is NOT successfull") - fail() + check(Sfc_obj.createNetworks, CREATED, "Creation of network") logger.info("1.3 Creation of Subnetwork") - - if (Sfc_obj.createSubnets() == CREATED): - logger.info("Creation of Subnetwork is successfull") - else: - logger.error(" : Creation of Subnetwork is NOT successfull") - fail() + check(Sfc_obj.createSubnets, CREATED, "Creation of Subnetwork") def CreateNodes(): logger.info("Testcase 2 : Creation of 3 VNF Nodes and Attaching Ports") logger.info("2.1 Creation of Ports") - if (Sfc_obj.createPorts() == CREATED): - logger.info("Creation of Port is successfull") - else: - logger.error(" : Creation of Port is NOT successfull") - fail() + check(Sfc_obj.createPorts, CREATED, "Creation of Port") logger.info("2.2 Creation of VM-Compute-Node") - if (Sfc_obj.createVm() == ACCEPTED): - logger.info("Creation of VM is successfull") - else: - logger.error(" : Creation of VM is NOT successfull") - fail() + check(Sfc_obj.createVm, ACCEPTED, "Creation of VM") logger.info("2.3 Check VM Status") - if (Sfc_obj.checkVmState() == OK): - logger.info("VM are in active state") - else: - logger.error(" : VM is NOT Active") - fail() + check(Sfc_obj.checkVmState, OK, "Vm statue check") logger.info("2.4 Router Creation") - if (Sfc_obj.createRouter() == CREATED): - logger.info("Creation of Router is Successful") - else: - logger.error(" : Router Creation is NOT Successful") - fail() + check(Sfc_obj.createRouter, CREATED, "Creation of Router") logger.info("2.5 Attachement of Interface to VM") - if (Sfc_obj.attachInterface() == OK): - logger.info("Interface attached to VM") - else: - logger.error(" : Interface NOT attached to VM") - fail() + check(Sfc_obj.attachInterface, OK, "Interface attached to VM") logger.info("2.6 Attachement of FLoating Ip to VM") - if (Sfc_obj.addFloatingIp() == ACCEPTED): - logger.info("Floating Ip attached to VM SUccessful") - else: - logger.error(" : Floating Ip NOT attached to VM ") - fail() + check(Sfc_obj.addFloatingIp, ACCEPTED, "Floating Ip attached to VM") def ConfigSfc(): logger.info( "Testcase 3 : Configure SFC [Portair,PortGroup,Flow classifer]") logger.info("3.1 Creation of Port Pair") - if (Sfc_obj.createPortPair() == CREATED): - logger.info("Creation of Port pair is successful") - else: - logger.error(" : Creation of Port pair is NOT successful") - fail() + check(Sfc_obj.createPortPair, CREATED, "Creation of Port Pair") logger.info("3.2 Getting the Port Pair ID") - if (Sfc_obj.getPortPair() == OK): - logger.info("Port Pair ID is successfully got") - else: - logger.error(" : UnSuccessfully got Port Pair ID") - fail() + check(Sfc_obj.getPortPair, OK, "Getting Port Pair ID") logger.info("3.3 Creation of Port Pair Group") - if (Sfc_obj.createPortGroup() == CREATED): - logger.info("Creation of Port Pair Group is successful") - else: - logger.error(" : Creation of Port Pair Group is NOT successful") - fail() + check(Sfc_obj.createPortGroup, CREATED, "Creation of Port Pair Group") logger.info("3.4 Getting Port Pair Group ID ") - if (Sfc_obj.getPortGroup() == OK): - logger.info("Port Pair Group ID is successfully received") - else: - logger.error(" : Port Pair Group ID is NOT successfully got") - fail() + check(Sfc_obj.getPortGroup, OK, "Getting Port Pair Group ID") logger.info("3.5 Creation of Flow Classifier") - if (Sfc_obj.createFlowClassifier() == CREATED): - logger.info("Creation of Flow Classifier is successful") - else: - logger.error(" : Creation of Flow Classifier is NOT successful") - fail() + check(Sfc_obj.createFlowClassifier, CREATED, "Creation of Flow Classifier") logger.info( "Testcase 4 : Configure Port Chain and verify flows are added") logger.info("4.1 Creation of Port Chain") - if (Sfc_obj.createPortChain() == CREATED): - logger.info("Creation of Port Chain is successful") - else: - logger.error("Creation of Port Chain is NOT successful") + check(Sfc_obj.createPortChain, CREATED, "Creation of Port Chain") def VerifySfcTraffic(): @@ -148,7 +90,7 @@ def VerifySfcTraffic(): if (Sfc_obj.loginToVM() == "1"): logger.info("SFC function Working") else: - logger.error(" : SFC function not working") + logger.error("SFC function not working") status = "FAIL" logger.info("Testcase 6 : Remove the Port Chain and Verify the traffic") @@ -156,7 +98,7 @@ def VerifySfcTraffic(): if (Sfc_obj.loginToVM() == "0"): logger.info("SFC function is removed Successfully") else: - logger.error(":SFC function not Removed. Have some problem") + logger.error("SFC function not Removed. Have some problem") status = "FAIL" if (Sfc_obj.deleteFlowClassifier() == NO_CONTENT): if (Sfc_obj.deletePortGroup() == NO_CONTENT): @@ -164,23 +106,19 @@ def VerifySfcTraffic(): logger.info( "SFC configuration is deleted successfully") else: - logger.error(" : Port pair configuration is NOT\ - deleted successfully") + logger.error("Port pair is deleted successfully") status = "FAIL" else: - logger.error(" : Port Group configuration is NOT \ - deleted successfully") + logger.error("Port Group is NOT deleted successfully") status = "FAIL" else: - logger.error(" : Flow classifier configuration is NOT \ - deleted successfully") - status = "FAIL" + logger.error("Flow classifier is NOT deleted successfully") + status = "FAIL" else: - logger.error(":PortChain configuration is NOT deleted \ - successfully") + logger.error("PortChain configuration is NOT deleted successfully") status = "FAIL" if (status == "FAIL"): - fail() + fail("Traffic for SFC is NOT verified successfully") def CleanUp(): @@ -188,23 +126,24 @@ def CleanUp(): if (Sfc_obj.cleanup() == NO_CONTENT): logger.info("CleanUp is successfull") else: - logger.error(" : CleanUp is NOT successfull") + logger.error("CleanUp is NOT successfull") + + +def check(method, criteria, msg): + if (method() == criteria): + logger.info(msg + 'is Successful') + else: + fail(msg + 'is not successful') -def fail(): +def fail(fail_info): + logger.error(fail_info) CleanUp() + PushDB("FAIL", fail_info) exit(-1) -def main(): - """Script to Test the SFC scenarios in ONOS.""" - start_time = time.time() - PreConfig() - CreateNodes() - ConfigSfc() - VerifySfcTraffic() - CleanUp() - status = "PASS" +def PushDB(status, info): logger.info("Summary :") try: logger.debug("Push ONOS SFC results into DB") @@ -218,11 +157,21 @@ def main(): start_time, stop_time, status, - details={'timestart': start_time, - 'duration': duration, - 'status': status}) + details={'duration': duration, + 'error': info}) except: logger.error("Error pushing results into Database") + +def main(): + """Script to Test the SFC scenarios in ONOS.""" + PreConfig() + CreateNodes() + ConfigSfc() + VerifySfcTraffic() + CleanUp() + PushDB("PASS", "") + + if __name__ == '__main__': main() diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py index 8aa7bb9a0..c73d8b230 100755 --- a/testcases/features/sfc/sfc.py +++ b/testcases/features/sfc/sfc.py @@ -263,6 +263,11 @@ def main(): logger.error('Failed to obtain IPs, cant continue, exiting') return + logger.info("Waiting 60 seconds for floating IP assignment") + for j in range(0, 6): + logger.debug("Test starting in {0} seconds".format(str((6 - j) * 10))) + time.sleep(10) + logger.debug("Floating IPs for SFs: %s..." % ips) # SSH TO START THE VXLAN_TOOL ON SF1 @@ -325,11 +330,6 @@ def main(): shell=True, stdout=subprocess.PIPE) - logger.info("Waiting for 60 seconds before TEST") - for j in range(0, 6): - logger.info("Test starting in {0} seconds".format(str((6 - j) * 10))) - time.sleep(10) - i = 0 # SSH TO EXECUTE cmd_client diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py index 5a4775d3a..d528549a1 100755 --- a/utils/openstack_utils.py +++ b/utils/openstack_utils.py @@ -239,7 +239,7 @@ def create_flavor(nova_client, flavor_name, ram, disk, vcpus): try: extra_specs = ft_utils.get_functest_config( 'general.flavor_extra_specs') - flavor.update(extra_specs) + flavor.set_keys(extra_specs) except ValueError: # flavor extra specs are not configured, therefore skip the update pass |