diff options
author | 2021-01-25 12:00:25 +0000 | |
---|---|---|
committer | 2021-01-25 14:40:39 +0000 | |
commit | 5021508f4b6f8bf2bb6ef890b4bb960dc144484b (patch) | |
tree | 2451b62511bb2de23d0515684bf6555717100321 /src/onaptests/steps/instantiate | |
parent | 511400315961caba0aa7b96d1ecf6aa2c912b4c4 (diff) |
PNF simulator CNF instantiation and registation steps
Use CNF of PNF simulator in pnf_macro scenario
Issue-ID: INT-1822
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: Id7f70b45219a36b7fc70921a1438b0cbe57a1756
Diffstat (limited to 'src/onaptests/steps/instantiate')
-rw-r--r-- | src/onaptests/steps/instantiate/msb_k8s.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/onaptests/steps/instantiate/msb_k8s.py b/src/onaptests/steps/instantiate/msb_k8s.py new file mode 100644 index 0000000..eac8a75 --- /dev/null +++ b/src/onaptests/steps/instantiate/msb_k8s.py @@ -0,0 +1,45 @@ +"""MSB k8s instantiation module.""" +from onapsdk.configuration import settings +from onapsdk.msb.k8s import Instance + +from onaptests.steps.base import BaseStep +from onaptests.steps.onboard.msb_k8s import CreateProfileStep + + +class CreateInstanceStep(BaseStep): + """Create MSB k8s instance step.""" + + def __init__(self, cleanup: bool = False) -> None: + """Initialize step. + + Substeps: + - CreateProfileStep. + """ + super().__init__(cleanup=cleanup) + self.add_step(CreateProfileStep(cleanup=cleanup)) + self.instance: Instance = None + + @property + def description(self) -> str: + """Step description.""" + return "Create K8S instance." + + @property + def component(self) -> str: + """Component name.""" + return "K8S plugin" + + @BaseStep.store_state + def execute(self) -> None: + """Create instance using MSB K8S plugin.""" + super().execute() + self.instance = Instance.create(cloud_region_id=settings.CLOUD_REGION_ID, + profile_name=settings.PNF_PROFILE_NAME, + rb_name=settings.PNF_RB_NAME, + rb_version=settings.PNF_RB_VERSION) + + def cleanup(self) -> None: + """Delete instance.""" + if self.instance: + self.instance.delete() + return super().cleanup() |