aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/cloud/k8s_connectivity_info_create.py
diff options
context:
space:
mode:
authorThierry Hardy <thierry.hardy@orange.com>2020-10-14 08:51:57 +0000
committerThierry Hardy <thierry.hardy@orange.com>2020-10-16 17:11:00 +0200
commite050624faa3a4b792a7325241457eed68785bd19 (patch)
treee52e7991ed4eacfbb841f8ff9191fe229c685be3 /src/onaptests/steps/cloud/k8s_connectivity_info_create.py
parent8642324e0b95b9efef53a7d62b419d72aed617b6 (diff)
Revert "Revert "Create basic_cnf test leveraging onapsdk""
This reverts commit ded9ae3b507b9687a68cc00dfc75e13130be13ff. Reason for revert: ONAP SDK 7.1 version is released Correction hardcode value (k8s) and onapsdk version to 7.1.0 Issue-ID: TEST-243 Change-Id: I535af4298f79a34476074612079dc479d2fc0b61 Signed-off-by: Thierry Hardy <thierry.hardy@orange.com>
Diffstat (limited to 'src/onaptests/steps/cloud/k8s_connectivity_info_create.py')
-rw-r--r--src/onaptests/steps/cloud/k8s_connectivity_info_create.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/onaptests/steps/cloud/k8s_connectivity_info_create.py b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py
new file mode 100644
index 0000000..6106d7e
--- /dev/null
+++ b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py
@@ -0,0 +1,35 @@
+from onapsdk.configuration import settings
+from onapsdk.msb.k8s import ConnectivityInfo
+
+from ..base import BaseStep
+
+class K8SConnectivityInfoStep(BaseStep):
+ """CreateConnnectivityInfoStep."""
+
+ @BaseStep.store_state
+ def execute(self):
+ """Creation k8s connectivity information
+
+ Use settings values:
+ - CLOUD_REGION_ID,
+ - CLOUD_REGION_CLOUD_OWNER,
+ - K8S_KUBECONFIG_FILE.
+ """
+ super().execute()
+ ######## Create Connectivity Info #########################################
+ try:
+ self._logger.info("Check if k8s connectivity information exists")
+ ConnectivityInfo.get_connectivity_info_by_region_id(settings.CLOUD_REGION_ID)
+ except ValueError:
+ self._logger.info("Create the k8s connectivity information")
+ ConnectivityInfo.create(settings.CLOUD_REGION_ID,
+ settings.CLOUD_REGION_CLOUD_OWNER,
+ open(settings.K8S_KUBECONFIG_FILE, 'rb').read())
+
+ def cleanup(self) -> None:
+ """Cleanup K8S Connectivity information.
+ """
+ self._logger.info("Clean the k8s connectivity information")
+ super().cleanup()
+ connectinfo = ConnectivityInfo.get_connectivity_info_by_region_id(settings.CLOUD_REGION_ID)
+ connectinfo.delete()