# See the License for the specific language governing permissions and\r
# limitations under the License.\r
\r
+import json\r
from sqlalchemy import select\r
import uuid\r
from o2common.service import unit_of_work\r
id = str(uuid.uuid4())\r
entity = NfDeploymentDesc(\r
id, input['name'], deploymentManagerId, input['description'],\r
- input['inputParams'], input['outputParams'], input['artifactUrl'])\r
+ input['inputParams'], input['outputParams'],\r
+ input['artifactRepoUrl'], input['artifactName'])\r
+ _nfdeploymentdesc_validate(entity)\r
uow.nfdeployment_descs.add(entity)\r
uow.commit()\r
return id\r
\r
\r
+def _nfdeploymentdesc_validate(desc: NfDeploymentDesc):\r
+ try:\r
+ if desc.inputParams:\r
+ json.loads(desc.inputParams)\r
+ if desc.outputParams:\r
+ json.loads(desc.outputParams)\r
+ if not desc.deploymentManagerId:\r
+ raise Exception("Invalid deploymentManager Id")\r
+ if not desc.artifactRepoUrl:\r
+ raise Exception("Invalid artifactRepoUrl")\r
+ if not desc.artifactName:\r
+ raise Exception("Invalid artifactName")\r
+ return\r
+ except json.decoder.JSONDecodeError as e:\r
+ logger.debug("NfDeploymentDesc json error with: %s" % (str(e)))\r
+ raise e\r
+ except Exception as e:\r
+ logger.debug("NfDeploymentDesc validate error with: %s" % (str(e)))\r
+ raise e\r
+\r
+\r
def lcm_nfdeploymentdesc_update(\r
nfdeploymentdescriptorid: str,\r
input: DmsLcmNfDeploymentDescriptorDTO.NfDeploymentDescriptor_update,\r
entity.description = input['description']\r
entity.inputParams = input['inputParams']\r
entity.outputParams = input['outputParams']\r
- entity.artifactUrl = input['artifactUrl']\r
+ entity.artifactRepoUrl = input['artifactRepoUrl']\r
+ entity.artifactName = input['artifactName']\r
uow.commit()\r
return True\r
\r