aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/scenario/basic_network.py
diff options
context:
space:
mode:
authorandreasgeissler <andreas-geissler@telekom.de>2020-10-12 18:05:46 +0200
committermrichomme <morgan.richomme@orange.com>2020-10-16 10:06:41 +0200
commit8642324e0b95b9efef53a7d62b419d72aed617b6 (patch)
tree40d76e3b8d312033aad592e8629cf538d36d2eb3 /src/onaptests/scenario/basic_network.py
parente39466fadd289f279509e460f6222d9c08f53c56 (diff)
Added basic_network testcase
Issue-ID: TEST-255 Signed-off-by: andreasgeissler <andreas-geissler@telekom.de> Change-Id: I86b34c0980cee7a5824231591a60d1f50dfe4f37 Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'src/onaptests/scenario/basic_network.py')
-rw-r--r--src/onaptests/scenario/basic_network.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/onaptests/scenario/basic_network.py b/src/onaptests/scenario/basic_network.py
new file mode 100644
index 0000000..de465d3
--- /dev/null
+++ b/src/onaptests/scenario/basic_network.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+"""Basic VM test case."""
+import logging
+import time
+
+from xtesting.core import testcase
+from onapsdk.configuration import settings
+
+import onaptests.utils.exceptions as onap_test_exceptions
+from onaptests.steps.instantiate.vl_ala_carte import YamlTemplateVlAlaCarteInstantiateStep
+
+class BasicNetwork(testcase.TestCase):
+ """Onboard then instantiate a simple Network with ONAP."""
+
+ __logger = logging.getLogger(__name__)
+
+ def __init__(self, **kwargs):
+ """Init Basic Network use case."""
+ # import basic_network_nomulticloud_settings needed
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'basic_network'
+ super(BasicNetwork, self).__init__(**kwargs)
+ self.__logger.debug("BasicNetwork init started")
+ self.test = YamlTemplateVlAlaCarteInstantiateStep(
+ cleanup=settings.CLEANUP_FLAG)
+ self.start_time = None
+ self.stop_time = None
+ self.result = 0
+
+ def run(self):
+ """Run onap_tests with basic network."""
+ self.start_time = time.time()
+ self.__logger.debug("start time")
+ try:
+ self.test.execute()
+ self.__logger.info("Service basic_network successfully created")
+ # The cleanup is part of the test, not only a teardown action
+ if settings.CLEANUP_FLAG:
+ self.__logger.info("Service basic_network cleanup called")
+ time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
+ try:
+ self.test.cleanup()
+ except ValueError as error:
+ self.__logger.info("service deleted as expected {0}".format(error))
+ self.result = 100
+ 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.")
+ self.result = 0
+ finally:
+ self.stop_time = time.time()
+
+ def clean(self):
+ """Clean Additional resources if needed."""
+ self.__logger.info("Generate Test report")
+ self.test.reports_collection.generate_report()