enabled NFV Affinity and Anti-affinity Rules 14/86014/2 1.4.0
authorsarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Tue, 23 Apr 2019 04:46:13 +0000 (10:16 +0530)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Wed, 1 May 2019 10:56:28 +0000 (10:56 +0000)
Fix the issue tosca.policies.nfv.AffinityRule and tosca.policies.nfv.AntiAffinityRule which was getting failed at first attempt with 404 error

Change-Id: I6630193343729051b41e4eb880832dee85b098ee
Issue-ID: SDC-2231
Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.json
catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.yml

index 5aedb4e..edd3b93 100644 (file)
@@ -97,9 +97,6 @@ public class PolicyTypeImportManager {
             if (result.isLeft()) {
                 for (String targetId : policyType.getTargets()) {
                         boolean isValid = toscaOperationFacade.getLatestByToscaResourceName(targetId).isLeft();
-                        if (!isValid) {
-                            isValid = groupOperation.isGroupExist(targetId, false);
-                        }
 
                         if (!isValid) { // check if it is a groupType
                             final Either<GroupTypeDefinition, StorageOperationStatus> groupTypeFound = groupTypeOperation
@@ -107,6 +104,10 @@ public class PolicyTypeImportManager {
                             isValid = groupTypeFound.isLeft() && !groupTypeFound.left().value().isEmpty();
                         }
 
+                        if (!isValid) {
+                            isValid = groupOperation.isGroupExist(targetId, false);
+                        }
+
                         if (!isValid) {
                             ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.TARGETS_NON_VALID, policyType.getType(), targetId);
                             result = Either.right(responseFormat);
index b86f00c..6885e50 100644 (file)
   "tosca.policies.nfv.SupportedVnfInterface": {
     "displayName": "NFV Supported VnfInterface",
     "icon": "policy-nfv-supported-vnfinterface"
+  },
+  "tosca.policies.nfv.AffinityRule": {
+  "displayName": "NFV AffinityRule",
+  "icon": "policy-nfv-affinityrule"
+  },
+  "tosca.policies.nfv.AntiAffinityRule": {
+    "displayName": "NFV AntiAffinityRule",
+    "icon": "policy-nfv-anti-affinityrule"
   }
-
 }
index 09020ac..4cc9031 100644 (file)
@@ -229,30 +229,6 @@ tosca.policies.nfv.VirtualLinkBitrateInitialDelta:
       required: true
   targets: [ tosca.nodes.nfv.VnfVirtualLink ]
 
-# tosca.policies.nfv.AffinityRule:
-#   derived_from: tosca.policies.Placement
-#   description: The AffinityRule describes the affinity rules applicable for the defined targets
-#   properties:
-#     scope:
-#       type: string
-#       description: scope of the rule is an NFVI_node, an NFVI_PoP, etc.
-#       required: true
-#       constraints:
-#         - valid_values: [ nfvi_node, zone, zone_group, nfvi_pop ]
-#   targets: [ tosca.nodes.nfv.Vdu.Compute, tosca.nodes.nfv.VnfVirtualLink, tosca.groups.nfv.PlacementGroup ]
-#
-# tosca.policies.nfv.AntiAffinityRule:
-#   derived_from: tosca.policies.Placement
-#   description: The AntiAffinityRule describes the anti-affinity rules applicable for the defined targets
-#   properties:
-#     scope:
-#       type: string
-#       description: scope of the rule is an NFVI_node, an NFVI_PoP, etc.
-#       required: true
-#       constraints:
-#         - valid_values: [ nfvi_node, zone, zone_group, nfvi_pop ]
-#   targets: [ tosca.nodes.nfv.Vdu.Compute, tosca.nodes.nfv.VnfVirtualLink, tosca.groups.nfv.PlacementGroup ]
-
 tosca.policies.nfv.SecurityGroupRule:
   derived_from: tosca.policies.Root
   description: The SecurityGroupRule type is a policy type specified the matching criteria for the ingress and/or egress traffic to/from visited connection points as defined in ETSI GS NFV-IFA 011 [1].
@@ -315,3 +291,27 @@ tosca.policies.nfv.SupportedVnfInterface:
       description: Provide additional data to access the interface endpoint
       required: false
   targets: [ tosca.nodes.nfv.VnfExtCp, tosca.nodes.nfv.VduCp ]
+
+tosca.policies.nfv.AffinityRule:
+  derived_from: tosca.policies.Placement
+  description: The AffinityRule describes the affinity rules applicable for the defined targets
+  properties:
+    scope:
+      type: string
+      description: scope of the rule is an NFVI_node, an NFVI_PoP, etc.
+      required: true
+      constraints:
+        - valid_values: [ nfvi_node, zone, zone_group, nfvi_pop ]
+  targets: [ tosca.nodes.nfv.Vdu.Compute, tosca.nodes.nfv.VnfVirtualLink, tosca.groups.nfv.PlacementGroup ]
+
+tosca.policies.nfv.AntiAffinityRule:
+  derived_from: tosca.policies.Placement
+  description: The AntiAffinityRule describes the anti-affinity rules applicable for the defined targets
+  properties:
+    scope:
+      type: string
+      description: scope of the rule is an NFVI_node, an NFVI_PoP, etc.
+      required: true
+      constraints:
+        - valid_values: [ nfvi_node, zone, zone_group, nfvi_pop ]
+  targets: [ tosca.nodes.nfv.Vdu.Compute, tosca.nodes.nfv.VnfVirtualLink, tosca.groups.nfv.PlacementGroup ]