Bug 1871 fix - Helm based KNF cannot be instantiated if values files contains a label... 90/11690/1 v10.1.0 v10.1.0-rc1 v10.1.0rc2 v10.1.0rc3
authorGuillermo Calvino <guillermo.calvino@canonical.com>
Wed, 26 Jan 2022 16:37:56 +0000 (17:37 +0100)
committerGuillermo Calvino <guillermo.calvino@canonical.com>
Fri, 18 Feb 2022 11:58:01 +0000 (12:58 +0100)
Change-Id: I1888e9402449ef67898b7ebe6a0d68f5cc282978
Signed-off-by: Guillermo Calvino <guillermo.calvino@canonical.com>
osm_nbi/instance_topics.py

index ece55b2..dbdc583 100644 (file)
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 # import logging
+import json
 from uuid import uuid4
 from http import HTTPStatus
 from time import time
@@ -239,14 +240,16 @@ class NsrTopic(BaseTopic):
                             where_, k
                         )
                     )
-                if "." in k or "$" in k:
+                if "$" in k:
                     raise EngineException(
-                        "Invalid param at {}:{}. Keys must not contain dots or $".format(
+                        "Invalid param at {}:{}. Keys must not contain $ symbol".format(
                             where_, k
                         )
                     )
                 if isinstance(v, (dict, tuple, list)):
                     additional_params[k] = "!!yaml " + safe_dump(v)
+            if kdu_name:
+                additional_params = json.dumps(additional_params)
 
         if descriptor:
             for df in descriptor.get("df", []):
@@ -1986,6 +1989,10 @@ class NsLcmOpTopic(BaseTopic):
                         HTTPStatus.CONFLICT,
                     )
             self._check_ns_operation(session, nsr, operation, indata)
+            if (indata.get("primitive_params")):
+                indata["primitive_params"] = json.dumps(indata["primitive_params"])
+            elif (indata.get("additionalParamsForVnf")):
+                indata["additionalParamsForVnf"] = json.dumps(indata["additionalParamsForVnf"])
 
             if operation == "instantiate":
                 self._update_vnfrs_from_nsd(nsr)