Prepare basic_clamp use case 27/116227/2
authormrichomme <morgan.richomme@orange.com>
Tue, 8 Dec 2020 17:11:58 +0000 (18:11 +0100)
committermrichomme <morgan.richomme@orange.com>
Tue, 8 Dec 2020 17:20:21 +0000 (18:20 +0100)
Update of basic_clamp use case
Please note there is a dependency with the onapsdk [1]
due to teh fact that policy_tca (frankfurt) has to be changed
to policy.tca in guilin.

In this version, we still use the clamp authentication
done by certificates.
The last version of clamp supports basic/auth but onapsdk has to be
updated to offer this option, which will better.
Until it is updated, the use case can work using the old cert
authentificaiton method.

This use case has been succesfully tested on
- daily guilin => dcae k8s plugin 3.4.2
- daily master => use the version 3.4.3

[1]: https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/merge_requests/216

Issue-ID: TEST-277

Signed-off-by: mrichomme <morgan.richomme@orange.com>
Change-Id: I4c5da94dd5669f328d124f7a85886d248a9c5a61

run_basic_clamp.py
src/onaptests/configuration/settings.py
src/onaptests/steps/loop/clamp.py
src/onaptests/templates/vnf-services/ubuntu18agent-service.yaml

index 06c3dda..514b91f 100644 (file)
@@ -14,3 +14,4 @@ if __name__ == "__main__":
     basic_clamp = ClampStep(
         cleanup=settings.CLEANUP_FLAG)
     basic_clamp.execute()
+    basic_clamp.reports_collection.generate_report()
index 7a9d7c9..a2a4b4a 100644 (file)
@@ -43,4 +43,4 @@ REPORTING_FILE_PATH = "/tmp/reporting.html"
 K8S_REGION_TYPE = "k8s"
 K8S_CONFIG = None  # None means it will use default config (~/.kube/config)
 K8S_NAMESPACE = "onap"  # Kubernetes namespace
-# SOCK_HTTP = "socks5h://127.0.0.1:8080"
+# SOCK_HTTP = "socks5h://127.0.0.1:8083"
index 3a5c1ad..b46e723 100644 (file)
@@ -12,6 +12,7 @@ import time
 from onapsdk.clamp.clamp_element import Clamp
 from onapsdk.sdc.service import Service
 
+import onaptests.utils.exceptions as onap_test_exceptions
 from onapsdk.configuration import settings
 from onaptests.steps.onboard.clamp import OnboardClampStep
 from onaptests.steps.loop.instantiate_loop import InstantiateLoop
@@ -108,6 +109,31 @@ class ClampStep(YamlTemplateBaseStep):
     @YamlTemplateBaseStep.store_state
     def execute(self):
         super().execute() # TODO work only the 1st time, not if already onboarded
+
+        # Before instantiating, be sure that the service has been distributed
+        service = Service(self.service_name)
+        self._logger.info("******** Check Service Distribution *******")
+        distribution_completed = False
+        nb_try = 0
+        nb_try_max = 10
+        while distribution_completed is False and nb_try < nb_try_max:
+            distribution_completed = service.distributed
+            if distribution_completed is True:
+                self._logger.info(
+                "Service Distribution for %s is sucessfully finished",
+                service.name)
+                break
+            self._logger.info(
+                "Service Distribution for %s ongoing, Wait for 60 s",
+                service.name)
+            time.sleep(60)
+            nb_try += 1
+
+        if distribution_completed is False:
+            self._logger.error(
+                "Service Distribution for %s failed !!",service.name)
+            raise onap_test_exceptions.ServiceDistributionException
+
         # time to wait for template load in CLAMP
         self._logger.info("Wait a little bit to give a chance to the distribution")
         time.sleep(settings.CLAMP_DISTRIBUTION_TIMER)
index baf804e..94f45fe 100644 (file)
@@ -1,7 +1,7 @@
 ---
-basicclamp-1:
+basicclamp:
     vnfs:
-        - vnf_name: basicclamp-1
+        - vnf_name: basicclamp
           heat_files_to_upload: onaptests/templates/heat-files/ubuntu18/ubuntu18agent.zip
           vnf_parameters: [
               {"name": "ubuntu18_image_name",