From 71a1fd0d98c99692a25f9087ad5edfbd7cf00800 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Wed, 8 Apr 2020 15:38:12 -0700 Subject: [VVP] check for existing policy in vnf.py Issue-ID: VVP-401 Signed-off-by: stark, steven Change-Id: Idd88dbe2031e182bb91c7f9b56f3525417cec676 --- onap-client/onap_client/sdc/vnf.py | 9 +++++++-- onap-client/setup.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'onap-client') diff --git a/onap-client/onap_client/sdc/vnf.py b/onap-client/onap_client/sdc/vnf.py index 5fa401c..d07882c 100644 --- a/onap-client/onap_client/sdc/vnf.py +++ b/onap-client/onap_client/sdc/vnf.py @@ -299,13 +299,18 @@ class VNF(Resource): def policy_exists(self, policy_name): """Checking the tosca model for a VF to see if a resource - has already been added""" + has already been added + + The policy name in the tosca model is all lowercase, + and if there are dashes in the VNF name they are + removed in the policy name. + """ policies = self.tosca.get("policies", {}) for p_name, policy in policies.items(): tosca_policy_name = policy.get("name").lower() - if tosca_policy_name.find("{}..{}".format(self.vnf_name.lower(), policy_name.lower())) != -1: + if tosca_policy_name.find("{}..{}".format(self.vnf_name.lower().replace("-", ""), policy_name.lower())) != -1: return True return False diff --git a/onap-client/setup.py b/onap-client/setup.py index 2624f9b..ea37a9e 100644 --- a/onap-client/setup.py +++ b/onap-client/setup.py @@ -47,7 +47,7 @@ for file in os.listdir("etc/payloads"): setuptools.setup( name="onap-client", - version="0.4.0", + version="0.4.1", author="Steven Stark", author_email="steven.stark@att.com", description="Python API wrapper for ONAP applications", -- cgit 1.2.3-korg