2 """Basic CNF test case."""
6 from xtesting.core import testcase
7 from onapsdk.configuration import settings
9 import onaptests.utils.exceptions as onap_test_exceptions
10 from onaptests.steps.instantiate.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
12 class BasicCnf(testcase.TestCase):
13 """Onboard then instantiate a simple CNF with ONAP."""
15 __logger = logging.getLogger(__name__)
17 def __init__(self, **kwargs):
19 if "case_name" not in kwargs:
20 kwargs["case_name"] = 'basic_cnf'
21 super(BasicCnf, self).__init__(**kwargs)
22 self.__logger.debug("BasicCnf init started")
23 self.test = YamlTemplateVfModuleAlaCarteInstantiateStep(
24 cleanup=settings.CLEANUP_FLAG)
25 self.start_time = None
30 """Run onap_tests with basic_cnf VM."""
31 self.start_time = time.time()
32 self.__logger.debug("start time")
35 self.__logger.info("basic_cnf successfully created")
36 # The cleanup is part of the test, not only a teardown action
37 if settings.CLEANUP_FLAG:
38 self.__logger.info("basic_cnf cleanup called")
39 time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
43 self.__logger.info("No cleanup requested. Test completed.")
45 except onap_test_exceptions.OnapTestException as exc:
47 self.__logger.error(exc.error_message)
49 self.stop_time = time.time()
52 """Clean Additional resources if needed."""
53 self.__logger.info("Generate Test report")
54 self.test.reports_collection.generate_report()