aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--setup.cfg1
-rw-r--r--src/onaptests/scenario/basic_cnf.py29
-rw-r--r--src/onaptests/scenario/basic_network.py13
-rw-r--r--src/onaptests/scenario/basic_vm.py23
-rw-r--r--src/onaptests/scenario/cds_blueprint_enrichment.py13
-rw-r--r--src/onaptests/scenario/clearwater_ims.py7
-rw-r--r--src/onaptests/utils/exceptions.py56
7 files changed, 59 insertions, 83 deletions
diff --git a/setup.cfg b/setup.cfg
index d5e2fc7..8ac68c4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -47,4 +47,5 @@ xtesting.testcase =
basic_vm = onaptests.scenario.basic_vm:BasicVm
basic_network = onaptests.scenario.basic_network:BasicNetwork
basic_cnf = onaptests.scenario.basic_cnf:BasicCnf
+ basic_cds = onaptests.scenario.cds_blueprint_enrichment:CDSBlueprintEnrichment
clearwater_ims = onaptests.scenario.clearwater_ims:ClearwaterIms
diff --git a/src/onaptests/scenario/basic_cnf.py b/src/onaptests/scenario/basic_cnf.py
index 30c3c3b..306205f 100644
--- a/src/onaptests/scenario/basic_cnf.py
+++ b/src/onaptests/scenario/basic_cnf.py
@@ -5,6 +5,7 @@ import time
from xtesting.core import testcase
from onapsdk.configuration import settings
+
import onaptests.utils.exceptions as onap_test_exceptions
from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
@@ -41,33 +42,9 @@ class BasicCnf(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except onap_test_exceptions.TestConfigurationException:
- self.result = 0
- self.__logger.error("Basic CNF configuration error")
- except onap_test_exceptions.ServiceInstantiateException:
- self.result = 0
- self.__logger.error("Basic CNF service instantiation error")
- except onap_test_exceptions.ServiceCleanupException:
- self.result = 0
- self.__logger.error("Basic CNF service instance cleanup error")
- except onap_test_exceptions.VnfInstantiateException:
- self.result = 0
- self.__logger.error("Basic CNF Vnf instantiation error")
- except onap_test_exceptions.VnfCleanupException:
- self.result = 0
- self.__logger.error("Basic CNF Vnf instance cleanup error")
- except onap_test_exceptions.ProfileInformationException:
- self.__logger.error("Missing k8s profile information")
- self.result = 0
- except onap_test_exceptions.ProfileCleanupException:
- self.__logger.error("K8s profile deletion failed")
- self.result = 0
- except onap_test_exceptions.VfModuleInstantiateException:
- self.result = 0
- self.__logger.error("Basic CNF Module instantiation error")
- except onap_test_exceptions.VfModuleCleanupException:
- self.__logger.error("Basic CNF Module cleanup failed.")
+ except onap_test_exceptions.OnapTestException as exc:
self.result = 0
+ self.__logger.error(exc.error_message)
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py
index de465d3..8aafd32 100644
--- a/src/onaptests/scenario/basic_network.py
+++ b/src/onaptests/scenario/basic_network.py
@@ -46,18 +46,9 @@ class BasicNetwork(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except onap_test_exceptions.ServiceInstantiateException:
- self.__logger.error("Basic network service instantiation failed.")
- self.result = 0
- except onap_test_exceptions.ServiceInstantiateException:
- self.__logger.error("Basic network service cleanup failed.")
- self.result = 0
- except onap_test_exceptions.NetworkInstantiateException:
- self.__logger.error("Basic network VL instantiation failed.")
- self.result = 0
- except onap_test_exceptions.NetworkCleanupException:
- self.__logger.error("Basic network VL cleanup failed.")
+ except onap_test_exceptions.OnapTestException as exc:
self.result = 0
+ self.__logger.error(exc.error_message)
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/basic_vm.py b/src/onaptests/scenario/basic_vm.py
index 35cedbc..cbf9b7c 100644
--- a/src/onaptests/scenario/basic_vm.py
+++ b/src/onaptests/scenario/basic_vm.py
@@ -5,6 +5,7 @@ import time
from xtesting.core import testcase
from onapsdk.configuration import settings
+
import onaptests.utils.exceptions as onap_test_exceptions
from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
@@ -42,27 +43,9 @@ class BasicVm(testcase.TestCase):
else:
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
- except onap_test_exceptions.TestConfigurationException:
- self.result = 0
- self.__logger.error("Basic VM configuration error")
- except onap_test_exceptions.ServiceInstantiateException:
- self.result = 0
- self.__logger.error("Basic VM instantiation error")
- except onap_test_exceptions.ServiceCleanupException:
- self.result = 0
- self.__logger.error("Basic VM instance cleanup error")
- except onap_test_exceptions.VnfInstantiateException:
- self.result = 0
- self.__logger.error("Basic VM Vnf instantiation error")
- except onap_test_exceptions.VnfCleanupException:
- self.result = 0
- self.__logger.error("Basic VM Vnf instance cleanup error")
- except onap_test_exceptions.VfModuleInstantiateException:
- self.result = 0
- self.__logger.error("Basic VM Module instantiation error")
- except onap_test_exceptions.VfModuleCleanupException:
- self.__logger.error("Basic VM Module cleanup failed.")
+ except onap_test_exceptions.OnapTestException as exc:
self.result = 0
+ self.__logger.error(exc.error_message)
finally:
self.stop_time = time.time()
diff --git a/src/onaptests/scenario/cds_blueprint_enrichment.py b/src/onaptests/scenario/cds_blueprint_enrichment.py
index b3442d1..502c92d 100644
--- a/src/onaptests/scenario/cds_blueprint_enrichment.py
+++ b/src/onaptests/scenario/cds_blueprint_enrichment.py
@@ -2,6 +2,7 @@
"""Simple CDS blueprint erichment test scenario."""
import logging
+import time
from onapsdk.configuration import settings
from xtesting.core import testcase
@@ -14,16 +15,24 @@ class CDSBlueprintEnrichment(testcase.TestCase):
__logger = logging.getLogger(__name__)
- def __init__(self):
+ def __init__(self, **kwargs):
"""Init CDS blueprint enrichment use case."""
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'basic_cds'
+ super(CDSBlueprintEnrichment, self).__init__(**kwargs)
self.__logger.debug("CDS blueprint enrichment initialization")
- super.__init__()
self.test = CbaEnrichStep(
cleanup=settings.CLEANUP_FLAG)
+ self.start_time = None
+ self.stop_time = None
+ self.result = 0
def run(self):
self.__logger.debug("CDS blueprint enrichment run")
+ self.start_time = time.time()
self.test.execute()
+ self.result = 100
+ self.stop_time = time.time()
def clean(self):
"""Clean Additional resources if needed."""
diff --git a/src/onaptests/scenario/clearwater_ims.py b/src/onaptests/scenario/clearwater_ims.py
index 0177e02..8a68fa9 100644
--- a/src/onaptests/scenario/clearwater_ims.py
+++ b/src/onaptests/scenario/clearwater_ims.py
@@ -5,6 +5,8 @@ import time
from xtesting.core import testcase
from onapsdk.configuration import settings
+
+import onaptests.utils.exceptions as onap_test_exceptions
from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
class ClearwaterIms(testcase.TestCase):
@@ -42,9 +44,10 @@ class ClearwaterIms(testcase.TestCase):
self.__logger.info("No cleanup requested. Test completed.")
self.result = 100
self.stop_time = time.time()
- except:
- self.__logger.error("Clearwater IMS test case failed.")
+ except onap_test_exceptions.OnapTestException as exc:
self.result = 0
+ self.__logger.error(exc.error_message)
+ finally:
self.stop_time = time.time()
def clean(self):
diff --git a/src/onaptests/utils/exceptions.py b/src/onaptests/utils/exceptions.py
index daadc32..0b21248 100644
--- a/src/onaptests/utils/exceptions.py
+++ b/src/onaptests/utils/exceptions.py
@@ -1,6 +1,4 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2018 Orange and others.
+# Copyright (c) 2018-2020 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,48 +8,62 @@
__author__ = ("Morgan Richomme <morgan.richomme@orange.com>")
+class OnapTestException(Exception):
+ """Parent Class for all Onap Test Exceptions."""
+ error_message='Generic OnapTest exception'
-class TestConfigurationException(Exception):
- """Raise when configutation of the use cases is not complete or buggy."""
-
+class TestConfigurationException(OnapTestException):
+ """Raise when configuration of the use case is incomplete or buggy."""
+ error_message='Configuration error'
-class ServiceDistributionException(Exception):
+class ServiceDistributionException(OnapTestException):
"""Service not properly distributed."""
+ error_message='Service not well distributed'
-class ServiceInstantiateException(Exception):
- """Service cannot be instantiate."""
+class ServiceInstantiateException(OnapTestException):
+ """Service cannot be instantiated."""
+ error_message='Service instantiation error'
-class ServiceCleanupException(Exception):
+class ServiceCleanupException(OnapTestException):
"""Service cannot be cleaned."""
+ error_message='Service not well cleaned up'
-class VnfInstantiateException(Exception):
- """VNF cannot be instantiate."""
+class VnfInstantiateException(OnapTestException):
+ """VNF cannot be instantiated."""
+ error_message='VNF instantiation error'
-class VnfCleanupException(Exception):
+class VnfCleanupException(OnapTestException):
"""VNF cannot be cleaned."""
+ error_message="VNF can't be cleaned"
-class VfModuleInstantiateException(Exception):
- """VF Module cannot be instantiate."""
+class VfModuleInstantiateException(OnapTestException):
+ """VF Module cannot be instantiated."""
+ error_message='VF Module instantiation error'
-class VfModuleCleanupException(Exception):
- """VF Module cannot be instantiate."""
+class VfModuleCleanupException(OnapTestException):
+ """VF Module cannot be cleaned."""
+ error_message="VF Module can't be cleaned"
-class NetworkInstantiateException(Exception):
- """Network cannot be instantiate."""
+class NetworkInstantiateException(OnapTestException):
+ """Network cannot be instantiated."""
+ error_message='Network instantiation error'
-class NetworkCleanupException(Exception):
+class NetworkCleanupException(OnapTestException):
"""Network cannot be cleaned."""
+ error_message="Network can't be cleaned"
-class ProfileInformationException(Exception):
+class ProfileInformationException(OnapTestException):
"""Missing k8s profile information."""
+ error_message='Missing k8s profile information'
-class ProfileCleanupException(Exception):
+class ProfileCleanupException(OnapTestException):
"""K8s profile cannot be cleaned."""
+ error_message="Profile can't be cleaned"