diff options
author | 2020-10-02 16:18:17 +0200 | |
---|---|---|
committer | 2020-10-08 15:47:00 +0200 | |
commit | 0123c525b0182a5d6f9cd1bee3830eb1956239c7 (patch) | |
tree | 2ba5a5b7ae88e53aa634cabd113338b42d49c8d0 /src/onaptests/steps/cloud/k8s_connectivity_info_create.py | |
parent | d1d44781c7d03c8794dd626184f77d9836264212 (diff) |
Create basic_cnf test leveraging onapsdk
Add the scenario basic_cnf that uses multicloud-k8s plugin to instantiate cnf on k8s
Add the removal of profile in cleanup part
Add store_state
Issue-ID: TEST-243
Signed-off-by: Thierry Hardy <thierry.hardy@orange.com>
Change-Id: Ib743c259decf95cdc69975e1ef7d4ba7aadccfae
Diffstat (limited to 'src/onaptests/steps/cloud/k8s_connectivity_info_create.py')
-rw-r--r-- | src/onaptests/steps/cloud/k8s_connectivity_info_create.py | 33 |
1 files changed, 33 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..ef95876 --- /dev/null +++ b/src/onaptests/steps/cloud/k8s_connectivity_info_create.py @@ -0,0 +1,33 @@ +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: + ConnectivityInfo.get_connectivity_info_by_region_id(settings.CLOUD_REGION_ID) + except ValueError: + 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() |