aboutsummaryrefslogtreecommitdiffstats
path: root/onap-client/onap_client/sdc/vnf.py
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-04-08 15:38:12 -0700
committerstark, steven <steven.stark@att.com>2020-04-08 16:12:37 -0700
commit71a1fd0d98c99692a25f9087ad5edfbd7cf00800 (patch)
treec1771dc78924344b90e79201b871017b0175a4e1 /onap-client/onap_client/sdc/vnf.py
parent298508191ae545ecf6eb2b7a56fd1d0828f20f0e (diff)
[VVP] check for existing policy in vnf.py
Issue-ID: VVP-401 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: Idd88dbe2031e182bb91c7f9b56f3525417cec676
Diffstat (limited to 'onap-client/onap_client/sdc/vnf.py')
-rw-r--r--onap-client/onap_client/sdc/vnf.py9
1 files changed, 7 insertions, 2 deletions
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