aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-08-04 08:35:09 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2021-12-14 13:55:52 +0000
commit54803e59a08d09bbb34cb686740f41b1e7bc3684 (patch)
tree182279aa12e07db86e5c210cbcee7f5500b8206a /src/onaptests/steps
parent337aa506b763cd3c3799a9e874f5c4fccad73fa1 (diff)
[TEST] Do not create simulators in "onap" namespace
As described in ticket - that resource shouldn't be created in onap namespace because if it's not properly deleted it has impact on the security tests results. Note: That change doesn't require any additional work in lab preparation - the namespace is going to be created by MSB K8S plugin. Issue-ID: TEST-356 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I0acf6262e3c8c9fbe9113d96e62960ce36ece04c
Diffstat (limited to 'src/onaptests/steps')
-rw-r--r--src/onaptests/steps/instantiate/msb_k8s.py6
-rw-r--r--src/onaptests/steps/instantiate/vl_ala_carte.py2
-rw-r--r--src/onaptests/steps/onboard/cds.py8
-rw-r--r--src/onaptests/steps/onboard/msb_k8s.py16
-rw-r--r--src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py4
5 files changed, 18 insertions, 18 deletions
diff --git a/src/onaptests/steps/instantiate/msb_k8s.py b/src/onaptests/steps/instantiate/msb_k8s.py
index e6186f5..8f9ff2f 100644
--- a/src/onaptests/steps/instantiate/msb_k8s.py
+++ b/src/onaptests/steps/instantiate/msb_k8s.py
@@ -34,9 +34,9 @@ class CreateInstanceStep(BaseStep):
"""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)
+ profile_name=settings.MSB_K8S_PROFILE_NAME,
+ rb_name=settings.MSB_K8S_RB_NAME,
+ rb_version=settings.MSB_K8S_RB_VERSION)
@BaseStep.store_state(cleanup=True)
def cleanup(self) -> None:
diff --git a/src/onaptests/steps/instantiate/vl_ala_carte.py b/src/onaptests/steps/instantiate/vl_ala_carte.py
index 158e437..3f81228 100644
--- a/src/onaptests/steps/instantiate/vl_ala_carte.py
+++ b/src/onaptests/steps/instantiate/vl_ala_carte.py
@@ -157,7 +157,7 @@ class YamlTemplateVlAlaCarteInstantiateStep(YamlTemplateBaseStep):
Raises:
Exception: VL cleaning failed
"""
- if settings.CLEANUP_FLAG:
+ if self._cleanup:
for net_instance in self._service_instance.network_instances:
self._logger.info("Start network deletion %s",net_instance.name)
net_deletion = net_instance.delete(a_la_carte=True)
diff --git a/src/onaptests/steps/onboard/cds.py b/src/onaptests/steps/onboard/cds.py
index 9239c43..7f91d56 100644
--- a/src/onaptests/steps/onboard/cds.py
+++ b/src/onaptests/steps/onboard/cds.py
@@ -54,7 +54,7 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
try:
service_data: Dict[str, Any] = self.k8s_client.read_namespaced_service(
self.service_name,
- settings.K8S_NAMESPACE
+ settings.K8S_ONAP_NAMESPACE
)
return service_data.spec.type == "NodePort"
except ApiException:
@@ -67,7 +67,7 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
Use settings values:
- K8S_CONFIG,
- - K8S_NAMESPACE.
+ - K8S_ONAP_NAMESPACE.
"""
super().execute()
@@ -75,7 +75,7 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
try:
self.k8s_client.patch_namespaced_service(
self.service_name,
- settings.K8S_NAMESPACE,
+ settings.K8S_ONAP_NAMESPACE,
{"spec": {"ports": [{"port": 8080, "nodePort": 30449}], "type": "NodePort"}}
)
except ApiException:
@@ -97,7 +97,7 @@ class ExposeCDSBlueprintprocessorNodePortStep(CDSBaseStep):
try:
self.k8s_client.patch_namespaced_service(
self.service_name,
- settings.K8S_NAMESPACE,
+ settings.K8S_ONAP_NAMESPACE,
[
{
"op": "remove",
diff --git a/src/onaptests/steps/onboard/msb_k8s.py b/src/onaptests/steps/onboard/msb_k8s.py
index cad471b..503a886 100644
--- a/src/onaptests/steps/onboard/msb_k8s.py
+++ b/src/onaptests/steps/onboard/msb_k8s.py
@@ -36,9 +36,9 @@ class CreateDefinitionStep(BaseStep):
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)
+ with open(settings.MSB_K8S_DEFINITION_ATRIFACT_FILE_PATH, "rb") as definition_file:
+ self.definition = Definition.create(rb_name=settings.MSB_K8S_RB_NAME,
+ rb_version=settings.MSB_K8S_RB_VERSION)
self.definition.upload_artifact(definition_file.read())
@@ -70,10 +70,10 @@ class CreateProfileStep(BaseStep):
"""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,
+ rb_name=settings.MSB_K8S_RB_NAME,
+ rb_version=settings.MSB_K8S_RB_VERSION)
+ with open(settings.MSB_K8S_PROFILE_ARTIFACT_FILE_PATH, "rb") as profile_file:
+ self.profile = definition.create_profile(profile_name=settings.MSB_K8S_PROFILE_NAME,
+ namespace=settings.K8S_ADDITIONAL_RESOURCES_NAMESPACE,
kubernetes_version=settings.K8S_VERSION)
self.profile.upload_artifact(profile_file.read())
diff --git a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py
index caeb20b..1960659 100644
--- a/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py
+++ b/src/onaptests/steps/simulator/pnf_simulator_cnf/pnf_register.py
@@ -51,7 +51,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
k8s_watch: "Watch" = watch.Watch()
try:
for event in k8s_watch.stream(k8s_client.list_namespaced_pod,
- namespace=settings.K8S_NAMESPACE,
+ namespace=settings.K8S_ADDITIONAL_RESOURCES_NAMESPACE,
timeout_seconds=timeout_seconds):
if event["object"].metadata.name == "pnf-macro-test-simulator":
if not event["object"].status.phase in ["Pending", "Running"]:
@@ -76,7 +76,7 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
config.load_kube_config(settings.K8S_CONFIG)
k8s_client: "CoreV1API" = client.CoreV1Api()
try:
- for service in k8s_client.list_namespaced_service(namespace=settings.K8S_NAMESPACE).items:
+ for service in k8s_client.list_namespaced_service(namespace=settings.K8S_ONAP_NAMESPACE).items:
if service.metadata.name == settings.DCAE_VES_COLLECTOR_POD_NAME:
return service.spec.cluster_ip, service.spec.ports[0].port
raise EnvironmentPreparationException("Couldn't get VES ip and port")