2 """Basic CNF 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.vf_module_ala_carte import YamlTemplateVfModuleAlaCarteInstantiateStep
11 from onaptests.utils.exceptions import OnapTestException
13 class BasicCnf(testcase.TestCase):
14 """Onboard then instantiate a simple CNF with ONAP."""
16 __logger = logging.getLogger(__name__)
18 def __init__(self, **kwargs):
20 if "case_name" not in kwargs:
21 kwargs["case_name"] = 'basic_cnf'
22 super(BasicCnf, self).__init__(**kwargs)
23 self.__logger.debug("BasicCnf init started")
24 self.test = YamlTemplateVfModuleAlaCarteInstantiateStep(
25 cleanup=settings.CLEANUP_FLAG)
26 self.start_time = None
31 """Run onap_tests with basic_cnf VM."""
32 self.start_time = time.time()
33 self.__logger.debug("start time")
36 self.__logger.info("basic_cnf successfully created")
37 # The cleanup is part of the test, not only a teardown action
38 if settings.CLEANUP_FLAG:
39 self.__logger.info("basic_cnf cleanup called")
40 time.sleep(settings.CLEANUP_ACTIVITY_TIMER)
44 self.__logger.info("No cleanup requested. Test completed.")
46 except OnapTestException as exc:
48 self.__logger.error(exc.error_message)
51 self.__logger.error("SDK exception")
53 self.stop_time = time.time()
56 """Clean Additional resources if needed."""
57 self.__logger.info("Generate Test report")
58 self.test.reports_collection.generate_report()