2 """Basic VM test case."""
6 from xtesting.core import testcase
7 from onapsdk.configuration import settings
8 from onapsdk.exceptions import SDKException
10 from onaptests.steps.instantiate.vl_ala_carte import YamlTemplateVlAlaCarteInstantiateStep
11 from onaptests.utils.exceptions import OnapTestException
13 class BasicNetwork(testcase.TestCase):
14 """Onboard then instantiate a simple Network with ONAP."""
16 __logger = logging.getLogger(__name__)
18 def __init__(self, **kwargs):
19 """Init Basic Network use case."""
20 # import basic_network_nomulticloud_settings needed
21 if "case_name" not in kwargs:
22 kwargs["case_name"] = 'basic_network'
23 super(BasicNetwork, self).__init__(**kwargs)
24 self.__logger.debug("BasicNetwork init started")
25 self.test = YamlTemplateVlAlaCarteInstantiateStep(
26 cleanup=settings.CLEANUP_FLAG)
27 self.start_time = None
32 """Run onap_tests with basic network."""
33 self.start_time = time.time()
34 self.__logger.debug("start time")
37 self.__logger.info("Service basic_network successfully created")
38 # The cleanup is part of the test, not only a teardown action
39 if settings.CLEANUP_FLAG:
40 self.__logger.info("Service basic_network cleanup called")
41 time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
44 except SDKException as error:
45 self.__logger.info("service deletion error {0}".format(error))
48 self.__logger.info("No cleanup requested. Test completed.")
50 except OnapTestException as exc:
52 self.__logger.error(exc.error_message)
55 self.__logger.error("SDK Exception")
57 self.stop_time = time.time()
60 """Clean Additional resources if needed."""
61 self.__logger.info("Generate Test report")
62 self.test.reports_collection.generate_report()