aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankaranarayanan Puzhavakath Narayanan <snarayanan@research.att.com>2019-11-19 15:04:35 +0000
committerGerrit Code Review <gerrit@onap.org>2019-11-19 15:04:35 +0000
commit34ba229b31758c38a299a163de0007848b5921be (patch)
tree98713f880c0273d337548b0c24161568d6afd9af
parent5293a382b6463069d4a2cc87806426d74833aa2e (diff)
parentd83fbd6ad8bbd2d0d3184f0df9f6cfa8cc4b96be (diff)
Merge "Unique field moved to vnf policy"
-rw-r--r--osdf/models/api/placementRequest.py1
-rw-r--r--osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml3
-rw-r--r--osdf/models/policy/placement/tosca_upload/onap.policies.optimization.VnfPolicy.yaml3
-rw-r--r--osdf/optimizers/placementopt/conductor/translation.py3
-rw-r--r--test/placement-tests/request_placement_vfmod.json2
-rw-r--r--test/placement-tests/request_vfmod.json1
-rw-r--r--test/policy-local-files/vnfPolicy_vPGN_TD.json1
7 files changed, 10 insertions, 4 deletions
diff --git a/osdf/models/api/placementRequest.py b/osdf/models/api/placementRequest.py
index 7d6bde4..a10ddc3 100644
--- a/osdf/models/api/placementRequest.py
+++ b/osdf/models/api/placementRequest.py
@@ -71,7 +71,6 @@ class PlacementDemand(OSDFModel):
resourceModuleName = StringType(required=True)
serviceResourceId = StringType(required=True)
tenantId = StringType()
- unique = BooleanType() # to be implemented on the policy level
resourceModelInfo = ModelType(ModelMetaData, required=True)
existingCandidates = ListType(ModelType(Candidates))
excludedCandidates = ListType(ModelType(Candidates))
diff --git a/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml b/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml
index 4ce3b9f..46d8c32 100644
--- a/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml
+++ b/osdf/models/policy/placement/tosca/vnfPolicy-v20181031.yml
@@ -66,3 +66,6 @@ data_types:
customerId:
type: string
required: true
+ unique:
+ type: string
+ required: false
diff --git a/osdf/models/policy/placement/tosca_upload/onap.policies.optimization.VnfPolicy.yaml b/osdf/models/policy/placement/tosca_upload/onap.policies.optimization.VnfPolicy.yaml
index 13d4f13..e1ec36d 100644
--- a/osdf/models/policy/placement/tosca_upload/onap.policies.optimization.VnfPolicy.yaml
+++ b/osdf/models/policy/placement/tosca_upload/onap.policies.optimization.VnfPolicy.yaml
@@ -70,4 +70,7 @@ data_types:
customerId:
type: string
required: true
+ unique:
+ type: string
+ required: false
diff --git a/osdf/optimizers/placementopt/conductor/translation.py b/osdf/optimizers/placementopt/conductor/translation.py
index d14f3e1..046e6e8 100644
--- a/osdf/optimizers/placementopt/conductor/translation.py
+++ b/osdf/optimizers/placementopt/conductor/translation.py
@@ -229,7 +229,8 @@ def get_demand_properties(demand, policies):
service_type=demand['serviceResourceId'],
service_resource_id=demand['serviceResourceId'])
- prop.update({'unique': demand['unique']} if demand.get('unique') else {})
+ prop.update({'unique': policy_property['unique']} if 'unique' in policy_property and
+ policy_property['unique'] else {})
prop['attributes'] = dict()
prop['attributes'].update({'global-customer-id': policy_property['customerId']}
if policy_property['customerId'] else {})
diff --git a/test/placement-tests/request_placement_vfmod.json b/test/placement-tests/request_placement_vfmod.json
index 7c3a2e1..e9f1966 100644
--- a/test/placement-tests/request_placement_vfmod.json
+++ b/test/placement-tests/request_placement_vfmod.json
@@ -74,7 +74,7 @@
},
"inventory_provider": "aai",
"service_resource_id": "vPGN-XX",
- "unique": "false",
+ "unique": "False",
"inventory_type": "vfmodule",
"service_type": "vPGN-XX"
}]
diff --git a/test/placement-tests/request_vfmod.json b/test/placement-tests/request_vfmod.json
index 1e95e22..1a8a462 100644
--- a/test/placement-tests/request_vfmod.json
+++ b/test/placement-tests/request_vfmod.json
@@ -39,7 +39,6 @@
{
"resourceModuleName": "vPGN",
"serviceResourceId": "vPGN-XX",
- "unique": "false",
"resourceModelInfo": {
"modelInvariantId": "762472ef-5284-4daa-ab32-3e7bee2ec355",
"modelVersionId": "e02a7e5c-9d27-4360-ab7c-73bb83b07e3b"
diff --git a/test/policy-local-files/vnfPolicy_vPGN_TD.json b/test/policy-local-files/vnfPolicy_vPGN_TD.json
index 7b374b4..3724f8a 100644
--- a/test/policy-local-files/vnfPolicy_vPGN_TD.json
+++ b/test/policy-local-files/vnfPolicy_vPGN_TD.json
@@ -26,6 +26,7 @@
"get_param": "chosen_customer_id"
},
"equipmentRole": "",
+ "unique": "False",
"attributes": {
"orchestrationStatus": ["active"],
"provStatus": "ACTIVE",