Update TCA config json send to Policy 85/20785/2
authorxg353y <xg353y@intl.att.com>
Tue, 24 Oct 2017 09:49:46 +0000 (11:49 +0200)
committerxg353y <xg353y@intl.att.com>
Thu, 26 Oct 2017 12:56:41 +0000 (14:56 +0200)
Update the format of the TCA configuration send to Policy

Issue-ID: CLAMP-62
Change-Id: I53cbfcb1f8f8772856b645e8aec0db2a8a94d15e
Signed-off-by: xg353y <xg353y@intl.att.com>
15 files changed:
pom.xml
src/main/java/org/onap/clamp/clds/client/PolicyClient.java
src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java
src/main/java/org/onap/clamp/clds/model/prop/TcaItem.java
src/main/java/org/onap/clamp/clds/model/prop/TcaThreshold.java
src/main/resources/META-INF/resources/designer/partials/portfolios/tca_properties.html
src/main/resources/clds/clds-policy-config.properties
src/main/resources/clds/clds-reference.properties
src/main/resources/clds/clds-users.json
src/main/resources/clds/globalClds.properties
src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
src/test/resources/clds/clds-reference.properties
src/test/resources/example/model-properties/tca/modelBpmnProperties.json
src/test/resources/example/tca-policy-req/blueprint-expected.yaml
src/test/resources/example/tca-policy-req/tca-policy-expected.json

diff --git a/pom.xml b/pom.xml
index 623efec..85d3223 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         </exclusion>
       </exclusions>
     </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>2.6.3</version>
-    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.dataformat</groupId>
       <artifactId>jackson-dataformat-yaml</artifactId>
index cb86acb..54b3fbb 100644 (file)
@@ -37,6 +37,7 @@ import java.util.UUID;
 
 import javax.ws.rs.BadRequestException;
 
+import org.onap.clamp.clds.client.req.TcaRequestFormatter;
 import org.onap.clamp.clds.exception.policy.PolicyClientException;
 import org.onap.clamp.clds.model.prop.ModelProperties;
 import org.onap.clamp.clds.model.refprop.RefProp;
@@ -62,7 +63,6 @@ import org.springframework.context.ApplicationContext;
  * Policy utility methods - specifically, send the policy.
  */
 public class PolicyClient {
-
     protected static final String     POLICY_PREFIX_BASE         = "Config_";
     protected static final String     POLICY_PREFIX_BRMS_PARAM   = "Config_BRMS_Param_";
     protected static final String     POLICY_PREFIX_MICROSERVICE = "Config_MS_";
@@ -110,8 +110,6 @@ public class PolicyClient {
         // Data Issue: No policyDescription given.
         policyParameters.setPolicyDescription(refProp.getStringValue("op.policyDescription"));
 
-        policyParameters.setAttributes(attributes);
-
         // Set a random UUID(Mandatory)
         policyParameters.setRequestID(UUID.fromString(policyRequestUuid));
         String policyNamePrefix = refProp.getStringValue("policy.op.policyNamePrefix");
@@ -213,16 +211,12 @@ public class PolicyClient {
     public String sendMicroServiceInOther(String configBody, ModelProperties prop, String policyRequestUuid) {
 
         PolicyParameters policyParameters = new PolicyParameters();
-
-        // Set Policy Type
+        // Set Policy Type 
         policyParameters.setPolicyConfigType(PolicyConfigType.MicroService);
+        policyParameters.setOnapName("DCAE");
         policyParameters.setEcompName(refProp.getStringValue("policy.onap.name"));
         policyParameters.setPolicyName(prop.getCurrentPolicyScopeAndPolicyName());
-
         policyParameters.setConfigBody(configBody);
-        policyParameters.setConfigBodyType(PolicyType.OTHER);
-
-        policyParameters.setRequestID(UUID.fromString(policyRequestUuid));
         String policyNamePrefix = refProp.getStringValue("policy.ms.policyNamePrefix");
 
         // Adding this line to clear the policy id from policy name while
index c2590d7..a71a5f3 100644 (file)
@@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml;
 
 import java.util.HashMap;
@@ -70,16 +71,11 @@ public class TcaRequestFormatter {
 
             Tca tca = modelProperties.getType(Tca.class);
             modelProperties.setCurrentModelElementId(tca.getId());
-            ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("tca.template", service);
-            ((ObjectNode) rootNode.get("cdap-tca-hi-lo_policy").get("metricsPerEventName").get(0)).put("policyName",
-                    modelProperties.getCurrentPolicyScopeAndPolicyName());
-            ((ObjectNode) rootNode.get("cdap-tca-hi-lo_policy").get("metricsPerEventName").get(0)).put("eventName",
-                    tca.getTcaItem().getEventName());
-
-            ObjectNode thresholdsParent = ((ObjectNode) rootNode.get("cdap-tca-hi-lo_policy").get("metricsPerEventName")
-                    .get(0));
-
-            addThresholds(refProp, service, thresholdsParent, tca.getTcaItem(), modelProperties);
+            ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("tca.policy.template", service);
+            String policyName = refProp.getStringValue("tca.policyid.prefix") + modelProperties.getCurrentPolicyScopeAndPolicyName();
+            ((ObjectNode) rootNode).put("policyName", policyName);
+            ((ObjectNode) rootNode).put("description", "MicroService vCPE Policy");
+            ((ObjectNode) rootNode).replace("content", createPolicyContent(refProp, modelProperties, service, policyName, tca));
 
             String tcaPolicyReq = rootNode.toString();
             logger.info("tcaPolicyReq=" + tcaPolicyReq);
@@ -89,6 +85,43 @@ public class TcaRequestFormatter {
         }
     }
 
+    /**
+     * Format Tca Policy Content JSON
+     *
+     * @param refProp
+     *            The refProp generally created by Spring, it's an access on the
+     *            clds-references.properties file
+     * @param modelProperties
+     *            The Model Prop created from BPMN JSON and BPMN properties JSON
+     * @return The Json string containing that should be sent to policy
+     */
+    public static JsonNode createPolicyContent(RefProp refProp, ModelProperties modelProperties, String service, String policyName, Tca tca) {
+        try {
+            if (null == service) {
+                service = modelProperties.getGlobal().getService();
+            }
+            if (null == tca){
+                tca = modelProperties.getType(Tca.class);
+                modelProperties.setCurrentModelElementId(tca.getId());
+            }
+            if (null == policyName) {
+                policyName = refProp.getStringValue("tca.policyid.prefix") + modelProperties.getCurrentPolicyScopeAndPolicyName();
+            }
+            ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("tca.template", service);
+            ((ObjectNode) rootNode.get("metricsPerEventName").get(0)).put("eventName", tca.getTcaItem().getEventName());
+            ((ObjectNode) rootNode.get("metricsPerEventName").get(0)).put("policyName", policyName);
+            ((ObjectNode) rootNode.get("metricsPerEventName").get(0)).put("controlLoopSchemaType", tca.getTcaItem().getControlLoopSchemaType());
+            ObjectNode thresholdsParent = ((ObjectNode) rootNode.get("metricsPerEventName").get(0));
+
+            addThresholds(refProp, service, thresholdsParent, tca.getTcaItem(), modelProperties);
+
+            logger.info("tcaPolicyContent=" + rootNode.toString());
+            return (JsonNode) rootNode;
+        } catch (Exception e) {
+            throw new TcaRequestFormatterException("Exception caught when attempting to create the policy content JSON", e);
+        }
+    }
+
     /**
      * Add threshold values to the existing policy JSON.
      *
@@ -114,7 +147,6 @@ public class TcaRequestFormatter {
             ObjectNode tcaNode = (ObjectNode) refProp.getJsonTemplate("tca.thresholds.template", service);
 
             for (TcaThreshold tcaThreshold : tcaItem.getTcaThresholds()) {
-                tcaNode.put("controlLoopSchema", tcaThreshold.getControlLoopSchema());
                 tcaNode.put("closedLoopControlName", modelProperties.getControlNameAndPolicyUniqueId());
                 tcaNode.put("fieldPath", tcaThreshold.getFieldPath());
                 tcaNode.put("thresholdValue", tcaThreshold.getThreshold());
@@ -143,7 +175,7 @@ public class TcaRequestFormatter {
     public static String updatedBlueprintWithConfiguration(RefProp refProp, ModelProperties modelProperties,
             String yamlValue) {
         try {
-            String jsonPolicy = createPolicyJson(refProp, modelProperties);
+            String jsonPolicy = ((ObjectNode) createPolicyContent(refProp, modelProperties, null, null, null)).toString();
 
             logger.info("Yaml that will be updated:" + yamlValue);
             Yaml yaml = new Yaml();
index 79da2db..13bff00 100644 (file)
@@ -44,6 +44,7 @@ public class TcaItem {
     private String                    tcaUuId;
     private String                    policyId;
     private String                    eventName;
+    private String                    controlLoopSchemaType;
     private List<TcaThreshold>        tcaThresholds;
 
     /**
@@ -57,6 +58,7 @@ public class TcaItem {
         tcaUuId = AbstractModelElement.getValueByName(node, "tuuid");
         policyId = AbstractModelElement.getValueByName(node, "tcaPolId");
         eventName = AbstractModelElement.getValueByName(node, "eventName");
+        controlLoopSchemaType = AbstractModelElement.getValueByName(node, "controlLoopSchemaType");
         // process service Configurations
         JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations");
         Iterator<JsonNode> itr = serviceConfigurationsNode.elements();
@@ -66,6 +68,14 @@ public class TcaItem {
         }
     }
 
+    public String getControlLoopSchemaType() {
+        return controlLoopSchemaType;
+    }
+
+    public void setControlLoopSchemaType(String controlLoopSchemaType) {
+        this.controlLoopSchemaType = controlLoopSchemaType;
+    }
+
     public String getTcaName() {
         return tcaName;
     }
index 43bdb5c..d278c25 100644 (file)
@@ -40,7 +40,6 @@ public class TcaThreshold {
     private String                    operator;
     private Integer                   threshold;
     private String                    closedLoopEventStatus;
-    private String                    controlLoopSchema;
 
     /**
      * Parse Tca Threshhold given json node
@@ -59,10 +58,7 @@ public class TcaThreshold {
             threshold = Integer.valueOf(node.get(2).asText());
         }
         if (node.get(3) != null) {
-            controlLoopSchema = node.get(3).asText();
-        }
-        if (node.get(4) != null) {
-            closedLoopEventStatus = node.get(4).asText();
+            closedLoopEventStatus = node.get(3).asText();
         }
     }
 
@@ -97,12 +93,4 @@ public class TcaThreshold {
     public void setClosedLoopEventStatus(String closedLoopEventStatus) {
         this.closedLoopEventStatus = closedLoopEventStatus;
     }
-
-    public String getControlLoopSchema() {
-        return controlLoopSchema;
-    }
-
-    public void setControlLoopSchema(String controlLoopSchema) {
-        this.controlLoopSchema = controlLoopSchema;
-    }
 }
index 546909a..323891e 100644 (file)
                                                        <div class="col-sm-9" style="padding:0px;">
                                                                <select name="eventName" id="eventName" enableFilter="true"></select>
                                                        </div>
-                                               </div>            
-                                               
+                                               </div>
+                                               <div class="col-sm-8 form-group">
+                                                       <label class="col-sm-3">Control Loop Schema Type</label>
+                                                       <div class="col-sm-9" style="padding:0px;">
+                                                               <select name="controlLoopSchemaType" id="controlLoopSchemaType" enableFilter="true"></select>
+                                                       </div>
+                                               </div>
                                                <div class="col-sm-8 form-group" style="display:none;">
                                                        <label class="col-sm-3"> Policy ID </label>
                                                        <div class="col-sm-9" style="padding:0px;">
 
                                        </div>
                                </form>
-                               
+
                                <div class="tcaBody row">
                                        <div class="col-sm-5" style="padding:0px 5px; margin: 15px;">
                                                <div class="panel panel-default" id="tcaTableHolder">
                                                                                onkeypress="return isNumberKey(event)" id="threshold"></input>
                                                                        </div>
                                                                </div>
-                                                               <div>
-                                                                       <label class="control-label">Control Loop Schema</label>
-                                                                       <div>
-                                                                               <select id="controlLoopSchema" name="controlLoopSchema"></select>
-                                                                       </div>
-                                                               </div>
                                                                <div>
                                                                        <label class="control-label">Closed Loop Event Status</label>
                                                                        <div>
                                                                                <select id="closedLoopEventStatus" name="closedLoopEventStatus"></select>
                                                                        </div>
-                                                               </div>                
+                                                               </div>
                                                        </div>
                                                </div>
                                        </div>
       return $('#formId'+formIdNum+' #fieldPathM').find(':selected').text() + ' ' +
                                $('#formId'+formIdNum+' #operator').val() + ' ' +
                                $('#formId'+formIdNum+' #threshold').val() + ' ' +
-        $('#formId'+formIdNum+' #controlLoopSchema').val() + ' ' +
         $('#formId'+formIdNum+' #closedLoopEventStatus').val();
     };
 
                loadPropertyWindow("tca");
-               
+
                //load dropdown with policy options
                if (typeof allPolicies !== "undefined"){
                $.each(Object.keys(allPolicies), function(val, text) {
                        $('#tcaPol').append($('<option></option>').val(text).html(text));
-               });  
+               });
                } else if (typeof elementMap !== "undefined"){
                        for (key in elementMap){
                                if (key.indexOf("Policy")>-1){
                                                $('#formId'+count+' #fieldPathM').val(fieldPathMLabel2Value(str[0])).multiselect('refresh');
                                                $('#formId'+count+' #operator').val(str[1]).multiselect('refresh');
                                                $('#formId'+count+' #threshold').val(str[2]);
-            $('#formId'+count+' #controlLoopSchema').val(str[3]).multiselect('refresh');
-            $('#formId'+count+' #closedLoopEventStatus').val(str[4]).multiselect('refresh');
+            $('#formId'+count+' #closedLoopEventStatus').val(str[3]).multiselect('refresh');
                                        }
-                                       
+
                                        if ((!(readOnly||readMOnly)) && ($('#formId'+count + ' #deleteThresh').prop('disabled'))) {
                                                $('#formId'+count + ' #deleteThresh').prop('disabled', false);
                                        }
                                }
                        });
-                       
+
                        $('#formId'+count+' #deleteThresh').on('click', function(){
                                $('#formId'+num+' .tcaErr').hide();
                                $('#formId'+count+ ' #properties_tab').invisible();
                                        $('#formId'+count+' #fieldPathM').prop("selectedIndex", 0).multiselect('refresh');
                                        $('#formId'+count+' #operator').prop("selectedIndex", 0).multiselect('refresh');
                                        $('#formId'+count+' #threshold').val("");
-                                       $('#formId'+count+' #controlLoopSchema').prop("selectedIndex", 0).multiselect('refresh');
                                        $('#formId'+count+' #closedLoopEventStatus').prop("selectedIndex", 0).multiselect('refresh');
 
                                        if ($('#formId'+count + ' #deleteThresh').prop('disabled')) {
                                        }
                                }
                        });
-                       
+
                        $('#formId'+count+' #tname').on('change',function(){
                                $('#go_properties_tab'+count).text($('#formId'+count+' #tname').val())
                        });
index fa2634b..a2bc1fa 100644 (file)
@@ -21,9 +21,8 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 ###
 # Configuration Settings for Policy Engine Components
-PDP_URL1=https://vm1.policy.simpledemo.openecomp.org:8081/pdp/ , testpdp, alpha123
-PDP_URL2=https://vm1.policy.simpledemo.openecomp.org:8081/pdp/ , testpdp, alpha456
-PAP_URL=https://vm1.policy.simpledemo.openecomp.org:8081/pap/ , testpap, alpha123
+PDP_URL1=https://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
+PDP_URL2=https://vm1.policy.simpledemo.onap.org:8081/pdp/ , testpdp, alpha123
 NOTIFICATION_TYPE=websocket
 NOTIFICATION_UEB_SERVERS=localhost
 NOTIFICATION_TOPIC=
index fd7af5e..94f6dd2 100644 (file)
@@ -48,8 +48,9 @@ policy.op.policyNamePrefix=Config_BRMS_Param_
 # TCA MicroService Policy request build properties\r
 #\r
 tca.policyid.prefix=DCAE.Config_\r
-tca.template={"cdap-tca-hi-lo_policy": {"domain": "measurementsForVfScaling","metricsPerEventName": [{"eventName": "???","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}}\r
-tca.thresholds.template={"closedLoopControlName": "???", "controlLoopSchema": "VM","version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}\r
+tca.policy.template={"service": "policy_tosca_tca", "version": "1.0.0", "location": "SampleServiceLocation", "configName": "SampleConfigName", "uuid": "test", "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", "templateVersion": "OpenSource.version.1", "policyName": "MicroServicevCPE", "description": "MicroService Policy", "priority": "1", "riskType": "SampleRiskType", "riskLevel": "1", "guard": "False","content":{}}\r
+tca.template= {"domain": "measurementsForVfScaling", "metricsPerEventName": [{"eventName": "???", "controlLoopSchemaType":"VNF","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}\r
+tca.thresholds.template={"closedLoopControlName": "???", "version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}\r
 \r
 #\r
 #\r
@@ -60,24 +61,24 @@ op.policyDescription=from clds
 op.templateName=ClosedLoopvUSP\r
 op.operationTopic=APPC-CL\r
 op.notificationTopic=POLICY-CL-MGT\r
-op.controller=1610-vUSP\r
+op.controller=amsterdam\r
 op.policy.appc=APPC\r
 # by service: vSCP\r
 op.templateName.vSCP=ClosedLoopTemplate\r
 op.controller.vSCP=1607-f5fw\r
-op.eNodeB.templateName=CLeNodeB\r
+op.eNodeB.templateName=ClosedLoopControlName\r
 op.eNodeB.operationTopic=com.onap.sdnr.RanCLRequest-v00\r
 op.eNodeB.notificationTopic=com.onap-policy.IST-ENODEB-CL\r
-op.eNodeB.controller=ClosedLoop-eNodeB\r
+op.eNodeB.controller=amsterdam\r
 op.eNodeB.recipe={"eNodeBRecipes":[{"Actor":"AOTS","Recipe":"checkENodeBTicketHours","ParentPolicy":"","PPConditions":"","Retry":"0","TimeLimit":"120"},{"Actor":"AOTS","Recipe":"checkEquipmentStatus","ParentPolicy":"checkENodeBTicketHours","PPConditions":"Success","Retry":"0","TimeLimit":"120"},{"Actor":"AOTS","Recipe":"checkEimStatus","ParentPolicy":"checkEquipmentStatus","PPConditions":"Success","Retry":"0","TimeLimit":"120"},{"Actor":"AOTS","Recipe":"checkMaintenanceWindow","ParentPolicy":"checkEimStatus","PPConditions":"Success","Retry":"0","TimeLimit":"120"},{"Actor":"SDNR","Recipe":"Reset","ParentPolicy":"checkMaintenanceWindow","PPConditions":"Success","Retry":"","TimeLimit":""}]}\r
 op.eNodeB.timeWindow=35\r
 op.eNodeB.limit=2\r
 op.eNodeB.period=10s\r
 #\r
 # Sdc service properties\r
-sdc.catalog.url=http://sdc.api.simpledemo.openecomp.org:8080/sdc/v1/catalog/
-sdc.hostUrl=http://sdc.api.simpledemo.openecomp.org:8080
-sdc.serviceUrl=http://sdc.api.simpledemo.openecomp.org:8080/sdc/v1/catalog/services
+sdc.catalog.url=http://sdc.api.simpledemo.onap.org:8080/sdc/v1/catalog/
+sdc.hostUrl=http://sdc.api.simpledemo.onap.org:8080
+sdc.serviceUrl=http://sdc.api.simpledemo.onap.org:8080/sdc/v1/catalog/services
 sdc.serviceUsername=test\r
 sdc.servicePassword=123456\r
 sdc.artifactLabel=blueprintclampcockpit\r
@@ -99,8 +100,8 @@ action.insert.test.event=false
 CLDS_SERVICE_CACHE_MAX_SECONDS=30\r
 \r
 #DCAE Inventory Url Properties\r
-DCAE_INVENTORY_URL = https://dcae.api.simpledemo.openecomp.org:8080
+DCAE_INVENTORY_URL = https://dcae.api.simpledemo.onap.org:8080
 \r
 #DCAE Dispatcher Url Properties\r
-DCAE_DISPATCHER_URL = https://dcae.api.simpledemo.openecomp.org:8443
+DCAE_DISPATCHER_URL = https://dcae.api.simpledemo.onap.org:8443
 \r
index b569f9d..5909e8e 100644 (file)
@@ -1,7 +1,20 @@
  [{
-    "user":"admin",
-    "password":"5f4dcc3b5aa765d61d8327deb882cf99",
-       "permissions": 
+       "user":"admin",
+       "password":"5f4dcc3b5aa765d61d8327deb882cf99",
+       "permissions":
+                   [
+                      "permission-type-cl|dev|read",
+                      "permission-type-cl|dev|update",
+                      "permission-type-cl-manage|dev|*",
+                      "permission-type-filter-vf|dev|*",
+                      "permission-type-template|dev|read",
+                      "permission-type-template|dev|update"
+                   ]
+       },
+       {
+       "user":"cs0008",
+       "password":"5f4dcc3b5aa765d61d8327deb882cf99",
+       "permissions":
                    [
                       "permission-type-cl|dev|read",
                       "permission-type-cl|dev|update",
@@ -11,5 +24,4 @@
                       "permission-type-template|dev|update"
                    ]
        }
-
 ]
\ No newline at end of file
index d21afbc..c3d2706 100644 (file)
 # 
 # http://www.apache.org/licenses/LICENSE-2.0
 # 
-# Unless required by applicable law or agreed to in writing, software 
-# distributed under the License is distributed on an "AS IS" BASIS, 
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-# See the License for the specific language governing permissions and 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
 # limitations under the License.
 # ============LICENSE_END============================================
 # ===================================================================
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 ###
 
-globalCldsProps ={"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","eventName":{"vCPEvGMUXPacketLoss":"vCPEvGMUXPacketLoss","vLoadBalancer":"vLoadBalancer","vFirewallBroadcastPackets":"vFirewallBroadcastPackets"},"fieldPathM":{"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated":"receivedBroadcastPacketsAccumulated","$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta":"receivedDiscardedPacketsDelta"},"operator":{">":"GREATER",">=":"GREATER_OR_EQUAL","=":"EQUAL","<=":"LESS_OR_EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"},"controlLoopSchema":{"":"","VM":"VM","VNF":"VNF"},"closedLoopEventStatus":{"":"","ONSET":"ONSET","ABATED":"ABATED"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"policy":{"pname":"0","timeout":345,"vnfRecipe":{"":"","restart":"Restart","rebuild":"Rebuild","migrate":"Migrate","healthCheck":"Health Check"},"enbRecipe":{"":"","reset":"Reset"},"maxRetries":"3","retryTimeLimit":180,"resource":{"vCTS":"vCTS","v3CDB":"v3CDB","vUDR":"vUDR","vCOM":"vCOM","vRAR":"vRAR","vLCS":"vLCS","vUDR-BE":"vUDR-BE","vDBE":"vDBE"},"parentPolicyConditions":{"Failure_Retries":"Failure: Max Retries Exceeded","Failure_Timeout":"Failure: Time Limit Exceeded","Failure_Guard":"Failure: Guard","Failure_Exception":"Failure: Exception","Failure":"Failure: Other","Success":"Success"}},"shared":{"byService":{"":{"vf":{"":""},"location":{"":""},"alarmCondition":{"":""}}},"byVf":{"":{"vfc":{"":""}}}}}
+globalCldsProps ={"tca":{"tname":"New_Set","tcaInt":"1","tcaVio":"1","eventName":{"vCPEvGMUXPacketLoss":"vCPEvGMUXPacketLoss","vLoadBalancer":"vLoadBalancer","vFirewallBroadcastPackets":"vFirewallBroadcastPackets"},"fieldPathM":{"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated":"receivedBroadcastPacketsAccumulated","$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta":"receivedDiscardedPacketsDelta"},"operator":{">":"GREATER",">=":"GREATER_OR_EQUAL","=":"EQUAL","<=":"LESS_OR_EQUAL","<":"LESS"},"opsPolicy":{"POLICY_test_X":"POLICY_test_X","POLICY_test_Y":"POLICY_test_Y"},"controlLoopSchemaType":{"":"","VM":"VM","VNF":"VNF"},"closedLoopEventStatus":{"":"","ONSET":"ONSET","ABATED":"ABATED"}},"global":{"actionSet":{"vnfRecipe":"VNF", "enbRecipe":"eNodeB"},"location":{"SNDGCA64":"San Diego SAN3","ALPRGAED":"Alpharetta PDK1","LSLEILAA":"Lisle DPA3","MDTWNJC1":"FTL_C_location1","MDTWNJC2":"FTL_C_location2","MDTWNJ21":"FTL_L_location1","MDTWNJ22":"FTL_L_location2","RDM2WAGPLCP":"ISTFTL_location","RDM3":"RDM3WAGPLCP"}},"policy":{"pname":"0","timeout":345,"vnfRecipe":{"":"","restart":"Restart","rebuild":"Rebuild","migrate":"Migrate","healthCheck":"Health Check"},"enbRecipe":{"":"","reset":"Reset"},"maxRetries":"3","retryTimeLimit":180,"resource":{"vCTS":"vCTS","v3CDB":"v3CDB","vUDR":"vUDR","vCOM":"vCOM","vRAR":"vRAR","vLCS":"vLCS","vUDR-BE":"vUDR-BE","vDBE":"vDBE"},"parentPolicyConditions":{"Failure_Retries":"Failure: Max Retries Exceeded","Failure_Timeout":"Failure: Time Limit Exceeded","Failure_Guard":"Failure: Guard","Failure_Exception":"Failure: Exception","Failure":"Failure: Other","Success":"Success"}},"shared":{"byService":{"":{"vf":{"":""},"location":{"":""},"alarmCondition":{"":""}}},"byVf":{"":{"vfc":{"":""}}}}}
index 9daa97c..eb02141 100644 (file)
@@ -69,12 +69,12 @@ public class ModelPropertiesTest {
         assertNotNull(tca);
         assertTrue(tca.isFound());
         assertEquals("vFirewallBroadcastPackets", tca.getTcaItem().getEventName());
+        assertEquals("VNF", tca.getTcaItem().getControlLoopSchemaType());
         assertEquals("policy1", tca.getTcaItem().getPolicyId());
         assertEquals("f734f031-10aa-t8fb-330f-04dde2886325", tca.getTcaItem().getTcaUuId());
         assertEquals(2, tca.getTcaItem().getTcaThresholds().size());
 
         assertEquals("ABATED", tca.getTcaItem().getTcaThresholds().get(0).getClosedLoopEventStatus());
-        assertEquals("VM", tca.getTcaItem().getTcaThresholds().get(0).getControlLoopSchema());
         assertEquals(
                 "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
                 tca.getTcaItem().getTcaThresholds().get(0).getFieldPath());
@@ -82,7 +82,6 @@ public class ModelPropertiesTest {
         assertEquals(Integer.valueOf(123), tca.getTcaItem().getTcaThresholds().get(0).getThreshold());
 
         assertEquals("ONSET", tca.getTcaItem().getTcaThresholds().get(1).getClosedLoopEventStatus());
-        assertEquals("VNF", tca.getTcaItem().getTcaThresholds().get(1).getControlLoopSchema());
         assertEquals("$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
                 tca.getTcaItem().getTcaThresholds().get(1).getFieldPath());
         assertEquals("GREATER_OR_EQUAL", tca.getTcaItem().getTcaThresholds().get(1).getOperator());
index 405b3ed..a9670e1 100644 (file)
 #\r
 # TCA MicroService Policy request build properties\r
 #\r
-tca.template={"cdap-tca-hi-lo_policy": {"domain": "measurementsForVfScaling","metricsPerEventName": [{"eventName": "???","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}}\r
-tca.thresholds.template={"closedLoopControlName": "???", "controlLoopSchema": "VM","version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}\r
+tca.policyid.prefix=DCAE.Config_\r
+tca.policy.template={"service": "policy_tosca_tca", "version": "1.0.0", "location": "SampleServiceLocation", "configName": "SampleConfigName", "uuid": "test", "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", "templateVersion": "OpenSource.version.1", "policyName": "MicroServicevCPE", "description": "MicroService Policy", "priority": "1", "riskType": "SampleRiskType", "riskLevel": "1", "guard": "False","content":{}}\r
+tca.template= {"domain": "measurementsForVfScaling", "metricsPerEventName": [{"eventName": "???", "controlLoopSchemaType":"VNF","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}\r
+tca.thresholds.template={"closedLoopControlName": "???", "version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}\r
 #\r
 #\r
 # DCAE request build properties\r
index 0bfa78c..7bb4fe0 100644 (file)
         "name": "eventName",
         "value": "vFirewallBroadcastPackets"
       },
+      {
+        "name": "controlLoopSchemaType",
+        "value": "VNF"
+      },
       {
         "serviceConfigurations": [
           [
             "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
             "LESS_OR_EQUAL",
             "123",
-            "VM",
             "ABATED"
           ],
           [
             "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
             "GREATER_OR_EQUAL",
             "123",
-            "VNF",
             "ONSET"
           ]
         ]
index 747d342..ffc5057 100644 (file)
@@ -30,7 +30,7 @@ node_templates:
         subscriberMessageLimit: '-1', subscriberPollingInterval: '20000', subscriberProtocol: https,
         subscriberTimeoutMS: '-1', subscriberTopicName: com.att.dcae.dmaap.mtnje2.DcaeTestVESSub,
         subscriberUserName: m00502@tca.af.dcae.att.com, subscriberUserPassword: Te5021abc,
-        tca_policy: '{"cdap-tca-hi-lo_policy":{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","policyScope":"DCAE","policyName":"example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","controlLoopSchema":"VNF","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","controlLoopSchema":"VNF","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}}'}
+        tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'}
       artifact_name: dcae-analytics-tca
       artifact_version: 1.0.0
       connections:
@@ -50,4 +50,4 @@ node_templates:
     - {target: cdap_host_host, type: dcae.relationships.component_contained_in}
   policy_0:
     type: dcae.nodes.policy
-    properties: {policy_id: nullexample_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4}
+    properties: {policy_id: DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4}
index ce23091..ad95c07 100644 (file)
@@ -1,16 +1,29 @@
 {
-  "cdap-tca-hi-lo_policy": {
+  "service": "policy_tosca_tca",
+  "version": "1.0.0",
+  "location": "SampleServiceLocation",
+  "configName": "SampleConfigName",
+  "uuid": "test",
+  "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+  "templateVersion": "OpenSource.version.1",
+  "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+  "description": "MicroService vCPE Policy",
+  "priority": "1",
+  "riskType": "SampleRiskType",
+  "riskLevel": "1",
+  "guard": "False",
+  "content": {
     "domain": "measurementsForVfScaling",
     "metricsPerEventName": [
       {
         "eventName": "vFirewallBroadcastPackets",
+        "controlLoopSchemaType": "VNF",
         "policyScope": "DCAE",
-        "policyName": "example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+        "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
         "policyVersion": "v0.0.1",
         "thresholds": [
           {
             "closedLoopControlName": "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null",
-            "controlLoopSchema": "VNF",
             "version": "1.0.2",
             "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
             "thresholdValue": 123,
@@ -20,7 +33,6 @@
           },
           {
             "closedLoopControlName": "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null",
-            "controlLoopSchema": "VNF",
             "version": "1.0.2",
             "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
             "thresholdValue": 123,