aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-01-25 12:00:25 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2021-01-25 14:40:39 +0000
commit5021508f4b6f8bf2bb6ef890b4bb960dc144484b (patch)
tree2451b62511bb2de23d0515684bf6555717100321 /src/onaptests/steps/onboard
parent511400315961caba0aa7b96d1ecf6aa2c912b4c4 (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/onboard')
-rw-r--r--src/onaptests/steps/onboard/cds.py9
-rw-r--r--src/onaptests/steps/onboard/msb_k8s.py79
2 files changed, 86 insertions, 2 deletions
diff --git a/src/onaptests/steps/onboard/cds.py b/src/onaptests/steps/onboard/cds.py
index ed381ad..f7fc77a 100644
--- a/src/onaptests/steps/onboard/cds.py
+++ b/src/onaptests/steps/onboard/cds.py
@@ -52,6 +52,11 @@ class BootstrapBlueprintprocessor(CDSBaseStep):
"""Bootstrap blueprintsprocessor."""
def __init__(self, cleanup: bool = False) -> None:
+ """Initialize step.
+
+ Substeps:
+ - ExposeCDSBlueprintprocessorNodePortStep.
+ """
super().__init__(cleanup=cleanup)
self.add_step(ExposeCDSBlueprintprocessorNodePortStep(cleanup=cleanup))
@@ -62,7 +67,7 @@ class BootstrapBlueprintprocessor(CDSBaseStep):
@BaseStep.store_state
def execute(self) -> None:
- """Bootsrap CDS blueprintprocessor"""
+ """Bootsrap CDS blueprintprocessor."""
super().execute()
Blueprintprocessor.bootstrap()
@@ -126,4 +131,4 @@ class CbaEnrichStep(CDSBaseStep):
"""
super().cleanup()
- Path(settings.CDA_CBA_ENRICHED).unlink()
+ Path(settings.CDS_CBA_ENRICHED).unlink()
diff --git a/src/onaptests/steps/onboard/msb_k8s.py b/src/onaptests/steps/onboard/msb_k8s.py
new file mode 100644
index 0000000..cad471b
--- /dev/null
+++ b/src/onaptests/steps/onboard/msb_k8s.py
@@ -0,0 +1,79 @@
+"""MSB k8s plugin module."""
+from onapsdk.configuration import settings
+from onapsdk.msb.k8s import Definition, Profile
+
+from onaptests.steps.base import BaseStep
+from onaptests.steps.cloud.cloud_region_create import CloudRegionCreateStep
+from onaptests.steps.cloud.k8s_connectivity_info_create import K8SConnectivityInfoStep
+
+
+class CreateDefinitionStep(BaseStep):
+ """Create definition step initialization."""
+
+ def __init__(self, cleanup: bool = False) -> None:
+ """Initialize step.
+
+ Substeps:
+ - CloudRegionCreateStep,
+ - K8SConnectivityInfoStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(CloudRegionCreateStep(cleanup=cleanup))
+ self.add_step(K8SConnectivityInfoStep(cleanup=cleanup))
+ self.definition: Definition = None
+
+ @property
+ def description(self) -> str:
+ """Step description."""
+ return "Create K8S definition."
+
+ @property
+ def component(self) -> str:
+ """Component name."""
+ return "K8S plugin"
+
+ @BaseStep.store_state
+ def execute(self) -> None:
+ """Create definition."""
+ super().execute()
+ with open(settings.PNF_DEFINITION_ATRIFACT_FILE_PATH, "rb") as definition_file:
+ self.definition = Definition.create(rb_name=settings.PNF_RB_NAME,
+ rb_version=settings.PNF_RB_VERSION)
+ self.definition.upload_artifact(definition_file.read())
+
+
+class CreateProfileStep(BaseStep):
+ """Create profile step."""
+
+ def __init__(self, cleanup: bool = False) -> None:
+ """Initialize step.
+
+ Substeps:
+ - CreateDefinitionStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(CreateDefinitionStep(cleanup=cleanup))
+ self.profile: Profile = None
+
+ @property
+ def description(self) -> str:
+ """Step description."""
+ return "Create K8S profile."
+
+ @property
+ def component(self) -> str:
+ """Component name."""
+ return "K8S plugin"
+
+ @BaseStep.store_state
+ def execute(self) -> None:
+ """Create profile."""
+ super().execute()
+ definition: Definition = Definition.get_definition_by_name_version(\
+ rb_name=settings.PNF_RB_NAME,
+ rb_version=settings.PNF_RB_VERSION)
+ with open(settings.PNF_PROFILE_ARTIFACT_FILE_PATH, "rb") as profile_file:
+ self.profile = definition.create_profile(profile_name=settings.PNF_PROFILE_NAME,
+ namespace=settings.K8S_NAMESPACE,
+ kubernetes_version=settings.K8S_VERSION)
+ self.profile.upload_artifact(profile_file.read())