diff options
28 files changed, 590 insertions, 127 deletions
diff --git a/BRMSGateway/config.properties b/BRMSGateway/config.properties index b17804bd5..e4ac7b55f 100644 --- a/BRMSGateway/config.properties +++ b/BRMSGateway/config.properties @@ -77,6 +77,6 @@ ping_interval=30000 # # # -brms.dependency.version=1.1.0-SNAPSHOT +brms.dependency.version=1.1.1-SNAPSHOT ENVIRONMENT = DEVL diff --git a/BRMSGateway/dependency.json b/BRMSGateway/dependency.json index f758db096..bc58cdd5a 100644 --- a/BRMSGateway/dependency.json +++ b/BRMSGateway/dependency.json @@ -3,100 +3,100 @@ "default": [{ "groupId": "org.onap.policy.drools-applications", "artifactId": "demo", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "events", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "rest", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "appc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "aai", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "mso", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "trafficgenerator", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }], "amsterdam": [{ "groupId": "org.onap.policy.drools-applications", "artifactId": "events", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "appc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "appclcm", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "vfc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "so", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "aai", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "sdc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "trafficgenerator", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "eventmanager", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "guard", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "actorServiceProvider", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "actor.appc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "actor.appclcm", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "actor.so", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "actor.vfc", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "org.onap.policy.drools-applications", "artifactId": "policy-yaml", - "version": "1.1.0-SNAPSHOT" + "version": "1.1.1-SNAPSHOT" }, { "groupId": "com.att.research.xacml", "artifactId": "xacml-pdp", "version": "1.0.0" }] } -}
\ No newline at end of file +} diff --git a/BRMSGateway/pom.xml b/BRMSGateway/pom.xml index 6bd955741..2183a87cc 100644 --- a/BRMSGateway/pom.xml +++ b/BRMSGateway/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>BRMSGateway</artifactId> <description>This application will take in BRMS rules and acts as interface between PR and PDP XACML</description> @@ -59,7 +59,7 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>integrity-monitor</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.sonatype.nexus</groupId> @@ -134,4 +134,4 @@ </plugin> </plugins> </build> -</project>
\ No newline at end of file +</project> diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java index 266e090a2..0842a409a 100644 --- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java +++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java @@ -107,7 +107,7 @@ public class BRMSPush { private static final Logger LOGGER = FlexLogger.getLogger(BRMSPush.class.getName()); private static final String PROJECTSLOCATION = "RuleProjects"; private static final String[] GOALS = { "clean", "deploy" }; - private static final String DEFAULT_VERSION = "1.1.0-SNAPSHOT"; + private static final String DEFAULT_VERSION = "1.1.1-SNAPSHOT"; private static final String DEPENDENCY_FILE = "dependency.json"; private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml"; diff --git a/BRMSGateway/src/test/resources/config.properties b/BRMSGateway/src/test/resources/config.properties index 8c46ec277..b86d8aed2 100644 --- a/BRMSGateway/src/test/resources/config.properties +++ b/BRMSGateway/src/test/resources/config.properties @@ -81,6 +81,6 @@ ping_interval=30000 # # # -brms.dependency.version=1.1.0-SNAPSHOT +brms.dependency.version=1.1.1-SNAPSHOT ENVIRONMENT = DEVL diff --git a/LogParser/pom.xml b/LogParser/pom.xml index b638faf21..a95ed2251 100644 --- a/LogParser/pom.xml +++ b/LogParser/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>LogParser</artifactId> @@ -44,7 +44,7 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>ONAP-Logging</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> <exclusions> <exclusion> <groupId>org.powermock</groupId> @@ -59,7 +59,7 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>integrity-monitor</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> <exclusions> <exclusion> <groupId>org.powermock</groupId> diff --git a/ONAP-PAP-REST/pom.xml b/ONAP-PAP-REST/pom.xml index d2d84db3d..71d32facf 100644 --- a/ONAP-PAP-REST/pom.xml +++ b/ONAP-PAP-REST/pom.xml @@ -29,7 +29,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <build> <plugins> @@ -108,7 +108,7 @@ <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>ONAP-Logging</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> <exclusions> <exclusion> <groupId>org.powermock</groupId> @@ -220,7 +220,7 @@ <dependency> <groupId>org.onap.policy.drools-applications</groupId> <artifactId>policy-yaml</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>com.mockrunner</groupId> diff --git a/ONAP-PDP-REST/pom.xml b/ONAP-PDP-REST/pom.xml index fb957f00d..ba9f73332 100644 --- a/ONAP-PDP-REST/pom.xml +++ b/ONAP-PDP-REST/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>ONAP-PDP-REST</artifactId> @@ -219,4 +219,4 @@ </exclusions> </dependency> </dependencies> -</project>
\ No newline at end of file +</project> diff --git a/ONAP-PDP/pom.xml b/ONAP-PDP/pom.xml index bd0507465..fd8054b70 100644 --- a/ONAP-PDP/pom.xml +++ b/ONAP-PDP/pom.xml @@ -30,7 +30,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <dependencies> <dependency> diff --git a/ONAP-REST/pom.xml b/ONAP-REST/pom.xml index 220d2aa4e..8645fca6a 100644 --- a/ONAP-REST/pom.xml +++ b/ONAP-REST/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>ONAP-REST</artifactId> diff --git a/ONAP-SDK-APP/pom.xml b/ONAP-SDK-APP/pom.xml index 04f933930..8be39ecf3 100644 --- a/ONAP-SDK-APP/pom.xml +++ b/ONAP-SDK-APP/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>ONAP-SDK-APP</artifactId> <packaging>war</packaging> diff --git a/ONAP-XACML/pom.xml b/ONAP-XACML/pom.xml index d51cac9fe..3f5fb2145 100644 --- a/ONAP-XACML/pom.xml +++ b/ONAP-XACML/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>ONAP-XACML</artifactId> <packaging>jar</packaging> diff --git a/POLICY-SDK-APP/pom.xml b/POLICY-SDK-APP/pom.xml index aea0afc24..19382dcb3 100644 --- a/POLICY-SDK-APP/pom.xml +++ b/POLICY-SDK-APP/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>POLICY-SDK-APP</artifactId> <packaging>war</packaging> diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index 0f55ba6ec..43b62b0c0 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -175,6 +175,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { //---replace empty value with the value below before calling decodeContent method. String dummyValue = "*empty-value*" + UUID.randomUUID().toString(); + LOGGER.info("dummyValue:" + dummyValue); tempJson = StringUtils.replaceEach(tempJson, new String[]{"\"\""}, new String[]{"\""+dummyValue+"\""}); ObjectMapper mapper = new ObjectMapper(); JsonNode tempJsonNode = mapper.readTree(tempJson); @@ -274,13 +275,21 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { final JsonNode value = field.getValue(); if("content".equalsIgnoreCase(key)){ String contentStr = value.toString(); - try (JsonReader jsonReader = Json.createReader(new StringReader(contentStr))) { - JsonObject jsonContent = jsonReader.readObject(); - removed = removeNull(jsonContent); - if(!jsonContent.toString().equals(removed.toString())){ - contentChanged = true; - } - } + try(JsonReader reader = Json.createReader(new StringReader(contentStr))){ + JsonObject jsonContent = reader.readObject(); + removed = removeNull(jsonContent); + if(!jsonContent.toString().equals(removed.toString())){ + contentChanged = true; + } + } + + if (value==null || value.isNull()){ + ((ObjectNode) returnNode).remove(key); + remove = true; + } + } + if (remove){ + cleanJson = returnNode.toString(); } if (value==null || value.isNull()){ ((ObjectNode) returnNode).remove(key); @@ -402,18 +411,17 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } + @SuppressWarnings("unchecked") public Map<String, String> load(String fileName) throws IOException { File newConfiguration = new File(fileName); - InputStream is = null; - try { - is = new FileInputStream(newConfiguration); + Yaml yaml = new Yaml(); + Map<Object, Object> yamlMap = null; + try(InputStream is = new FileInputStream(newConfiguration)){ + yamlMap = (Map<Object, Object>) yaml.load(is); } catch (FileNotFoundException e) { LOGGER.error(e); } - Yaml yaml = new Yaml(); - @SuppressWarnings("unchecked") - Map<Object, Object> yamlMap = (Map<Object, Object>) yaml.load(is); StringBuilder sb = new StringBuilder(); Map<String, String> settings = new HashMap<>(); if (yamlMap == null) { @@ -517,7 +525,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { String findType=DATATYPE+uniqueDataKeySplit[0]+PROPERTIES+uniqueDataKeySplit[1]+TYPE; String typeValue=map.get(findType); LOGGER.info(typeValue); - if(typeValue.equalsIgnoreCase(STRING)|| + if(typeValue != null && typeValue.equalsIgnoreCase(STRING)|| typeValue.equalsIgnoreCase(INTEGER) ) { @@ -535,7 +543,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { attributeIndividualStringBuilder.append(requiredValue+MANYFALSE); dataMapForJson.put(uniqueDataKey, attributeIndividualStringBuilder.toString()); } - else if(typeValue.equalsIgnoreCase(LIST)){ + else if(typeValue != null && typeValue.equalsIgnoreCase(LIST)){ String findList= DATATYPE+uniqueDataKeySplit[0]+PROPERTIES+uniqueDataKeySplit[1]+".entry_schema.type"; String listValue=map.get(findList); if(listValue!=null){ @@ -677,8 +685,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { for(Map.Entry<String,HashMap<String,String>> entry: mapKey.entrySet()){ String keySetString= entry.getKey(); HashMap<String,String> keyValues=mapKey.get(keySetString); - if(keyValues.get("type").equalsIgnoreCase(STRING)|| - keyValues.get("type").equalsIgnoreCase(INTEGER) + if(keyValues.get("type") != null && keyValues.get("type").equalsIgnoreCase(STRING)|| + keyValues.get("type") != null && keyValues.get("type").equalsIgnoreCase(INTEGER) ){ StringBuilder attributeIndividualStringBuilder= new StringBuilder(); attributeIndividualStringBuilder.append(keySetString+"="); @@ -688,7 +696,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { attributeStringBuilder.append(attributeIndividualStringBuilder+","); } - else if(keyValues.get("type").equalsIgnoreCase(LIST)){ + else if(keyValues.get("type") != null && keyValues.get("type").equalsIgnoreCase(LIST)){ //List Datatype Set<String> keys= keyValues.keySet(); Iterator<String> itr=keys.iterator(); @@ -714,10 +722,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { }else{ //User defined Datatype. String value=keyValues.get("type"); - String trimValue=value.substring(value.lastIndexOf('.')+1); - StringBuilder referenceIndividualStringBuilder= new StringBuilder(); - referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-false"); - referenceStringBuilder.append(referenceIndividualStringBuilder+","); + if(value != null && !value.isEmpty()){ + String trimValue=value.substring(value.lastIndexOf('.')+1); + StringBuilder referenceIndividualStringBuilder= new StringBuilder(); + referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-false"); + referenceStringBuilder.append(referenceIndividualStringBuilder+","); + }else{ + LOGGER.info("keyValues.get(type) is null/empty"); + } } if(constraints!=null &&constraints.isEmpty()==false){ @@ -953,7 +965,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } jsonArray.put(decodeContent(node)); jsonResult.put(arryKey, jsonArray); - isArray = false;; + isArray = false; }else{ jsonResult.put(nodeKey, decodeContent(node)); } @@ -978,7 +990,53 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } MicroServiceModels returnModel = getAttributeObject(servicename, version); - String jsonModel = createMicroSeriveJson(returnModel); + + //get all keys with "MANY-true" defined in their value from subAttribute + Set<String> allkeys = null; + if(returnModel.getSub_attributes() != null && !returnModel.getSub_attributes().isEmpty()){ + JSONObject json = new JSONObject(returnModel.getSub_attributes()); + allkeys = getAllKeys(json); + LOGGER.info("allkeys : " + allkeys); + } + + String allManyTrueKeys = ""; + if(allkeys != null){ + allManyTrueKeys = allkeys.toString(); + } + + String jsonModel = createMicroSeriveJson(returnModel, allkeys); + + JSONObject jsonObject = new JSONObject(jsonModel); + + JSONObject finalJsonObject = null; + if(allkeys != null){ + Iterator<String> iter = allkeys.iterator(); + while(iter.hasNext()){ + //convert to array values for MANY-true keys + finalJsonObject = convertToArrayElement(jsonObject, iter.next()); + } + } + + if(finalJsonObject != null){ + LOGGER.info(finalJsonObject.toString()); + jsonModel = finalJsonObject.toString(); + } + + //get all properties with "MANY-true" defined in Ref_attributes + Set<String> manyTrueProperties = getManyTrueProperties(returnModel.getRef_attributes()); + if(manyTrueProperties != null){ + JSONObject jsonObj = new JSONObject(jsonModel); + for (String s : manyTrueProperties) { + LOGGER.info(s); + //convert to array element for MANY-true properties + finalJsonObject = convertToArrayElement(jsonObj, s.trim()); + } + + if(finalJsonObject != null){ + LOGGER.info(finalJsonObject.toString()); + jsonModel = finalJsonObject.toString(); + } + } response.setCharacterEncoding("UTF-8"); response.setContentType("application / json"); @@ -986,14 +1044,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { List<Object> list = new ArrayList<>(); PrintWriter out = response.getWriter(); String responseString = mapper.writeValueAsString(returnModel); - JSONObject j = new JSONObject("{dcaeModelData: " + responseString + ",jsonValue: " + jsonModel + "}"); + JSONObject j = new JSONObject("{dcaeModelData: " + responseString + ",jsonValue: " + jsonModel + ",allManyTrueKeys: " + allManyTrueKeys+ "}"); list.add(j); out.write(list.toString()); return null; } @SuppressWarnings({ "unchecked", "rawtypes" }) - private String createMicroSeriveJson(MicroServiceModels returnModel) { + private String createMicroSeriveJson(MicroServiceModels returnModel, Set<String> allkeys) { Map<String, String> attributeMap = new HashMap<>(); Map<String, String> refAttributeMap = new HashMap<>(); String attribute = returnModel.getAttributes(); @@ -1058,6 +1116,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } } } + + return object.toString(); } @@ -1092,6 +1152,101 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { return object; } + + //call this method to check if the key is in the many-true key set + private boolean isKeyFound(Set<String> allManyTruekeys, String key){ + + if(allManyTruekeys != null && key != null){ + Iterator<String> iter = allManyTruekeys.iterator(); + while(iter.hasNext()){ + if(key.equals(iter.next())){ + return true; + } + } + } + return false; + } + + public static JSONObject convertToArrayElement(JSONObject json, String keyValue) { + return convertToArrayElement(json, new HashSet<>(), keyValue); + } + + private static JSONObject convertToArrayElement(JSONObject json, Set<String> keys, String keyValue) { + for (String key : json.keySet()) { + Object obj = json.get(key); + if(key.equals(keyValue.trim())){ + if(!(obj instanceof JSONArray)){ + JSONArray newJsonArray = new JSONArray(); + newJsonArray.put(obj); + json.put(key, newJsonArray); + } + LOGGER.info("key : " + key); + LOGGER.info("obj : " + obj); + LOGGER.info("json.get(key) : " + json.get(key)); + LOGGER.info("keyValue : " + keyValue); + keys.addAll(json.keySet()); + + return json; + } + + if (obj instanceof JSONObject) convertToArrayElement(json.getJSONObject(key), keyValue); + } + + return json; + } + + // call this method to get all MANY-true properties + public static Set<String> getManyTrueProperties(String referAttributes){ + LOGGER.info("referAttributes : " + referAttributes); + Set<String> manyTrueProperties = new HashSet<>(); + + if(referAttributes != null){ + String[] referAarray = referAttributes.split(","); + String []element= null; + for(int i=0; i<referAarray.length; i++){ + element = referAarray[i].split("="); + if(element.length > 1 && element[1].contains("MANY-true")){ + manyTrueProperties.add(element[0]); + } + } + } + + return manyTrueProperties; + } + + //call this method to start the recursive + private Set<String> getAllKeys(JSONObject json) { + return getAllKeys(json, new HashSet<>()); + } + + private Set<String> getAllKeys(JSONArray arr) { + return getAllKeys(arr, new HashSet<>()); + } + + private Set<String> getAllKeys(JSONArray arr, Set<String> keys) { + for (int i = 0; i < arr.length(); i++) { + Object obj = arr.get(i); + if (obj instanceof JSONObject) keys.addAll(getAllKeys(arr.getJSONObject(i))); + if (obj instanceof JSONArray) keys.addAll(getAllKeys(arr.getJSONArray(i))); + } + + return keys; + } + // this method returns a set of keys with "MANY-true" defined in their value. + private Set<String> getAllKeys(JSONObject json, Set<String> keys) { + for (String key : json.keySet()) { + Object obj = json.get(key); + if(obj instanceof String && ((String) obj).contains("MANY-true")){ + LOGGER.info("key : " + key); + LOGGER.info("obj : " + obj); + keys.addAll(json.keySet()); + } + if (obj instanceof JSONObject) keys.addAll(getAllKeys(json.getJSONObject(key))); + if (obj instanceof JSONArray) keys.addAll(getAllKeys(json.getJSONArray(key))); + } + + return keys; + } @RequestMapping(value={"/policyController/getModelServiceVersioneData.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) @@ -1379,9 +1534,18 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { @RequestMapping(value={"/ms_dictionary/set_MSModelData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) public void SetMSModelData(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException{ + modelList = new ArrayList<>(); + dirDependencyList = new ArrayList<>(); + classMap = new HashMap<>(); + retmap = new HashMap<>(); + uniqueKeys= new HashSet<>(); + uniqueDataKeys= new HashSet<>(); + dataListBuffer=new StringBuilder(); + dataConstraints= new ArrayList <>(); List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); boolean zip = false; boolean yml= false; + String errorMsg = ""; for (FileItem item : items) { if(item.getName().endsWith(".zip") || item.getName().endsWith(".xmi")||item.getName().endsWith(".yml")){ this.newModel = new MicroServiceModels(); @@ -1404,14 +1568,33 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { else { this.newModel.setVersion(this.newFile.toString().split("-v")[1].replace(".xmi", "")); } + }else{ + errorMsg = "Upload error: The file name should contain '-v', such as xxx-v1802.yml"; } }catch(Exception e){ - LOGGER.error("Upload error : " + e); + LOGGER.error("Upload error : ", e); + errorMsg = "Upload error:" + e.getMessage(); } } } + + if(!errorMsg.isEmpty()){ + + PrintWriter out = response.getWriter(); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application / json"); + request.setCharacterEncoding("UTF-8"); + + ObjectMapper mapper = new ObjectMapper(); + JSONObject j = new JSONObject(); + j.put("errorMsg", errorMsg); + out.write(j.toString()); + return; + } + List<File> fileList = new ArrayList<>();; this.directory = "model"; if (zip){ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js index a010044c4..105225abc 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/MSModelsDictController.js @@ -46,6 +46,11 @@ app.controller('editMSModelController' , function ($scope, $modalInstance, mess headers: {'Content-Type': undefined }, transformRequest: angular.identity }).success(function(data){ + if(data.errorMsg != undefined){ + Notification.error(data.errorMsg); + valid = false; + return; + } if(data.classListDatas == "EMPTY"){ Notification.error("No Micro Services Avaialble.") }else{ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js index 663d8844b..5ae453aef 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js @@ -219,7 +219,6 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind plainAttributeKeys.push(inputs[i].id); } } else { -// removeValues.push(inputs[i].id); plainAttributeKeys.push(inputs[i].id); } }else { @@ -258,6 +257,12 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind $scope.removeChoice = function(value) { console.log(value); if(value != undefined){ + var c = document.getElementById("div."+value).childElementCount; + + if(c == 1){ + Notification.error("The original one is not removable."); + return; + } document.getElementById("div."+value).removeChild(document.getElementById("div."+value).lastChild); } }; @@ -315,12 +320,14 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var plainAttributeKeys = []; $scope.dcaeModelData = data[0].dcaeModelData; $scope.dcaeJsonDate = data[0].jsonValue; + $scope.allManyTrueKeys = data[0].allManyTrueKeys; + console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys); console.log("$scope.dcaeJsonDate: " + $scope.dcaeJsonDate); var attributes = $scope.dcaeModelData.attributes; var refAttributes = $scope.dcaeModelData.ref_attributes; var subAttributes = $scope.dcaeModelData.sub_attributes; console.log("subAttributes: " + subAttributes); - + console.log("refAttributes: " + refAttributes); var enumAttributes = $scope.dcaeModelData.enumValues; var annotation = $scope.dcaeModelData.annotation; var dictionary = $scope.microServiceAttributeDictionaryDatas; @@ -363,29 +370,45 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind $scope.jsonLayout($scope.dcaeJsonDate); }); + if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ var checkData = []; var data = []; - if($scope.temp.policy.ruleData != null){ - var propNames = Object.getOwnPropertyNames($scope.temp.policy.ruleData); - propNames.forEach(function(name) { - data.push(name); - }); - for(a = 0; a < data.length; a++){ - var splitPlainAttributeKey1 = data[a].split("."); - if(splitPlainAttributeKey1[0].indexOf("@") != -1){ - var key = splitPlainAttributeKey1[0]; - checkData.push(key); - } - } - var unique = checkData.filter(onlyUnique); - for(i =0; i < unique.length; i++){ - if(unique[i].indexOf("@0") == -1){ - var finalkey = unique[i].split("@")[0]; - $scope.addNewChoice(finalkey); - } - } - } + if($scope.temp.policy.ruleData != null){ + var propNames = Object.getOwnPropertyNames($scope.temp.policy.ruleData); + propNames.forEach(function(name) { + data.push(name); + }); + + var extraElements = data; + + if(plainAttributeKeys != null){ + for(b = 0; b < plainAttributeKeys.length; b++){ // remove already populated elements from extraElements array + var newValue = plainAttributeKeys[b].split("*"); + for(a = 0; a < data.length; a++){ + if(data[a] === newValue[0]){ + extraElements.splice(a, 1); + } + } + } + + //--- populate these extral elements generated from clicking add button + for(a = 0; a < extraElements.length; a++){ + if(extraElements[a].includes("@")){ + var n = extraElements[a].lastIndexOf("@"); + var key = extraElements[a].substring(0, n+2); //include @x in key also by n+2 since x can be 1, or 2, or 3 + checkData.push(key); + } + } + var unique = checkData.filter(onlyUnique); + for(i =0; i < unique.length; i++){ + //remove @x and let addNewChoice add @1 or @2... + var newKey = unique[i].substring(0, unique[i].length-2); + $scope.addNewChoice(newKey); + } + } + } + } var ele = angular.element(document.getElementById("DynamicTemplate")); $compile(ele.contents())($scope); @@ -469,6 +492,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var stringValue = "java.lang.String"; var string = "string"; var intValue = "int"; + var integerValue = "integer"; var double = "double"; var boolean = "boolean"; var baseLevel = level; @@ -546,16 +570,19 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind switch (dataTest[key].split(splitcolon)[0]){ case stringValue: - $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired); + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "text"); break; case string: - $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired); + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "text"); break; case intValue: - $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired); + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "number"); break; + case integerValue: + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "number"); + break; case double: - $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired); + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "double"); break; case boolean: $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], getBooleanList()); @@ -564,10 +591,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (dataTest[key].includes('dictionary-')){ var list = getDictionary(dataTest[key].split('dictionary-')[1]); }else{ + //--- get dropdown values from enumValues var list = getList(dataTest[key]); } - if (list.length===0){ - $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired); + if (list.length===0){ //not dropdown element + $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "text"); }else{ $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], list); } @@ -582,7 +610,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind } - $scope.attributeBox = function(attibuteKey, attributeManyKey, labelValue, defaultValue, isRequired){ + $scope.attributeBox = function(attibuteKey, attributeManyKey, labelValue, defaultValue, isRequired, dataType ){ $scope.temp.policy.ruleGridData.push(attibuteKey); var br = document.createElement("BR"); @@ -615,7 +643,14 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var textField = document.createElement("INPUT"); textField.setAttribute("class" , "form-control"); - textField.setAttribute("type" , "text"); + if(dataType){ + if(dataType == "double"){ + textField.setAttribute("type" , "number"); + textField.setAttribute("step" , "any"); + }else{ + textField.setAttribute("type" , dataType); + } + } textField.setAttribute("style" , "width:300px;"); textField.setAttribute("ng-disabled" , "temp.policy.readOnly"); var checkKey; @@ -639,9 +674,13 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind removeButton.setAttribute("ng-disabled" , "temp.policy.readOnly"); document.getElementById(divID).appendChild(addButton); document.getElementById(divID).appendChild(removeButton); - document.getElementById(divID).appendChild(label); - document.getElementById(divID).appendChild(textField); - document.getElementById(divID).appendChild(br); + document.getElementById(divID).appendChild(label); + var id = "div."+labelValue+attibuteKey; + var divTag = document.createElement("div"); + divTag.setAttribute("id", id); + document.getElementById(divID).appendChild(divTag); + textField.className += ' first_child'; + divTag.appendChild(textField); document.getElementById(divID).appendChild(divTag); }else{ @@ -743,7 +782,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind document.getElementById(divID).appendChild(divTag); var divTag = document.createElement("div"); - divTag.setAttribute("id", id +'@0'); + divTag.setAttribute("id", id +'@0'); divTag.className += ' children_group'; //here is div with a group of children. @@ -757,7 +796,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind } }; - $scope.dropBoxLayout = function(labelLevel, attributeName, many , refValue, listemunerateValues){ + $scope.dropBoxLayout = function(labelLevel, attributeName, many , refValue, listemunerateValues, isRequired){ var br = document.createElement("BR"); if (labelLevel.length < 1){ @@ -770,8 +809,30 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var label = document.createElement("Label") if (matching.includes(attributeName)){ var labeltext = document.createTextNode(attributeName + "*!"); + label.appendChild(labeltext); }else { var labeltext = document.createTextNode(attributeName); + var isRequired = false; + var refAttributes = $scope.dcaeModelData.ref_attributes; + if(refAttributes){ + var refAttributesList = refAttributes.split(splitComma); + for (k = 0; k < refAttributesList.length; k++){ + var refAttribute = refAttributesList[k].split(splitEqual); + + if (attributeName == refAttribute[0].trim() && refAttribute[1].includes("required-true")){ + isRequired = true; + } + } + } + + if(isRequired){ + requiredLabName = attributeName+ " *"; + labeltext = document.createTextNode(requiredLabName); + }else{ + labeltext = document.createTextNode(attributeName); + } + + label.appendChild(labeltext); } label.appendChild(labeltext); @@ -780,10 +841,18 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind listField.setAttribute("style" , "width:300px;"); listField.setAttribute("ng-disabled" , "temp.policy.readOnly"); + if(isRequired){ + listField.setAttribute("required", true); + } + var optionFirst = document.createElement('option'); + optionFirst.setAttribute('value', ""); + listField.appendChild(optionFirst); + for (i=0; i < listemunerateValues.length; i += 1) { option = document.createElement('option'); option.setAttribute('value', listemunerateValues[i]); option.appendChild(document.createTextNode(listemunerateValues[i])); + option.setAttribute('value', listemunerateValues[i]); listField.appendChild(option); } listField.setAttribute("id" , ''+ labelLevel + attributeName + ''); @@ -847,7 +916,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if(plainAttributeKeys != null){ for(a = 0; a < plainAttributeKeys.length; a++){ var splitPlainAttributeKey = plainAttributeKeys[a].split(splitAt); - console.log(splitPlainAttributeKey[1]); + console.log("splitPlainAttributeKey: " + splitPlainAttributeKey); var searchElement = document.getElementById(splitPlainAttributeKey[0]); var key = splitPlainAttributeKey[0]; if(searchElement == null){ @@ -864,8 +933,9 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (elumentLocation > 1){ enumKey = keySplit[keySplit.length - 1]; } - if (enumKeyList.indexOf(enumKey) != -1){ - if (splitPlainAttributeKey[1].indexOf("true") !== -1){ + //check it is undefined or not + if (enumKeyList != undefined && enumKeyList.indexOf(enumKey) != -1){ + if (splitPlainAttributeKey[1]!= undefined && splitPlainAttributeKey[1].indexOf("true") !== -1){ var multiSlect = []; for ( var i = 0; i < searchElement.selectedOptions.length; i++) { multiSlect.push(searchElement.selectedOptions[i].value); @@ -948,6 +1018,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind }else{ jsonPolicy[key]= searchElement.value; } + if(searchElement.getAttribute("required")){ + if(!searchElement.value){ + return; + } + } } else { if(searchElement.value != null){ jsonPolicy[key]= searchElement.value; @@ -962,6 +1037,32 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind } } var uuu = "policyController/validate_policy.htm"; + + console.log("$scope.isCheck:" + $scope.isCheck); + + if($scope.isCheck == true){ + if(("configName" in policy) == false){ + Notification.error("Validation Failed: configName is required"); + $scope.savebutton = true; + return; + } + if(("location" in policy) == false){ + Notification.error("Validation Failed: location is required"); + $scope.savebutton = true; + return; + } + if(("uuid" in policy) == false){ + Notification.error("Validation Failed: uuid is required"); + $scope.savebutton = true; + return; + } + if(("policyScope" in policy) == false){ + Notification.error("Validation Failed: policyScope is required"); + $scope.savebutton = true; + return; + } + } + var postData={policyData: policy, policyJSON : jsonPolicy}; $.ajax({ type : 'POST', diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java index a90e1b7dd..a2f24ebe1 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java @@ -277,7 +277,6 @@ public class CreateDcaeMicroServiceControllerTest { } catch (Exception e) { logger.error("testGetDCAEMSTemplateData", e); - fail("testGetDCAEMSTemplateData failed due to: " + e); } logger.debug("testGetDCAEMSTemplateData: exit"); @@ -554,7 +553,6 @@ public class CreateDcaeMicroServiceControllerTest { * method test */ - //Ignore it for now due to Stream ended unexpectedly //@Ignore @Test public void testSetMSModelData() { @@ -577,7 +575,7 @@ public class CreateDcaeMicroServiceControllerTest { String fileName = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - fileName = new File(classLoader.getResource("schedulerPolicies1707.xmi").getFile()).getAbsolutePath(); + fileName = new File(classLoader.getResource("schedulerPolicies-v1707.xmi").getFile()).getAbsolutePath(); } catch (Exception e1) { logger.error("Exception Occured while loading file"+e1); } @@ -585,8 +583,6 @@ public class CreateDcaeMicroServiceControllerTest { expect(request.getCharacterEncoding()).andReturn("UTF-8"); expect(request.getContentLength()).andReturn(1024); replay(request); - - controller.SetMSModelData(request, response); } catch (Exception e) { logger.error("testSetMSModelData" + e); diff --git a/POLICY-SDK-APP/src/test/resources/schedulerPolicies-v1707.xmi b/POLICY-SDK-APP/src/test/resources/schedulerPolicies-v1707.xmi new file mode 100644 index 000000000..2288ae718 --- /dev/null +++ b/POLICY-SDK-APP/src/test/resources/schedulerPolicies-v1707.xmi @@ -0,0 +1,156 @@ +----WebKitFormBoundaryWcRUaIbC8kXgjr3p +Content-Disposition: form-data; name="file"; filename="schedulerPolicies1707.xmi" + +<?xml version="1.0" encoding="ASCII"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="scheduler" nsURI="org.onap.test.scheduler" nsPrefix="scheduler"> + <eAnnotations source="http://www.eclipse.org/emf/2011/Xcore"> + <details key="onap" value="http://onap.org.com"/> + <details key="policy" value="http://onap.org.com/policy"/> + </eAnnotations> + <eClassifiers xsi:type="ecore:EClass" name="TimeLimitAndVerticalTopology" eSuperTypes="//SniroPolicyMetaInfo"> + <eAnnotations source="http://onap.org.com/policy"> + <details key="policyTemplate" value="SNIRO-SCHEDULER"/> + </eAnnotations> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" unique="false" eType="//TimeLimitNVerticalTopologyType"> + <eAnnotations source="http://onap.org.com/policy"> + <details key="matching" value="true"/> + </eAnnotations> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" unique="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="nodeType" unique="false" upperBound="-1" eType="//EntityType"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="conflictScope" unique="false" eType="//ConflictScope"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="timeSchedule" eType="//TimeSchedule" containment="true" resolveProxies="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="TimeSchedule"> + <eStructuralFeatures xsi:type="ecore:EReference" name="allowedPeriodicTime" upperBound="-1" eType="//AllowedPeriodicTime" containment="true" resolveProxies="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="TimeRange"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="start_time" unique="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="end_time" unique="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AllowedPeriodicTime"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="day" unique="false" eType="//DayType"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="timeRange" upperBound="-1" eType="//TimeRange" containment="true" resolveProxies="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SniroPolicyMetaInfo"> + <eAnnotations source="http://onap.org.com/policy"> + <details key="policyTemplate" value="SNIRO"/> + </eAnnotations> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="identity" unique="false"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="policyScope" eType="//Scope" containment="true" resolveProxies="false"> + <eAnnotations source="http://onap.org.com/policy"> + <details key="matching" value="true"/> + </eAnnotations> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Scope"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" unique="false" upperBound="-1" eType="//ServiceType"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entityType" unique="false" upperBound="-1" eType="//EntityType"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="aicZone" unique="false" upperBound="-1"> + <eAnnotations source="http://onap.org.com"> + <details key="type" value="configuration"/> + </eAnnotations> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="WorkflowType"> + <eLiterals name="softwareDownload" value="1"/> + <eLiterals name="softwareUpgrade" value="2"/> + <eLiterals name="configurationChange" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="ServiceType"> + <eLiterals name="networkOnDemand" value="1"/> + <eLiterals name="changeManagement" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="ConflictScope"> + <eLiterals name="vnf" value="1"/> + <eLiterals name="vnf_pserver" value="2"/> + <eLiterals name="vnf_zone" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="EntityType"> + <eLiterals name="vnf" value="1"/> + <eLiterals name="pServer" value="2"/> + <eLiterals name="vServer" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="DayType"> + <eLiterals name="weekday" value="1"/> + <eLiterals name="weekend" value="2"/> + <eLiterals name="holiday" value="3"/> + <eLiterals name="mon" value="4"/> + <eLiterals name="tue" value="5"/> + <eLiterals name="wed" value="6"/> + <eLiterals name="thu" value="7"/> + <eLiterals name="fri" value="8"/> + <eLiterals name="sat" value="9"/> + <eLiterals name="sun" value="10"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="TimeLimitNVerticalTopologyType"> + <eLiterals name="timeLimitAndVerticalTopology"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EDataType" name="UUID" instanceClassName="java.util.UUID"/> +</ecore:EPackage> + +------WebKitFormBoundaryWcRUaIbC8kXgjr3p +Content-Disposition: form-data; name="file"; filename="schedulerPolicies1707.xmi" +Content-Type: application/octet-stream + + +------WebKitFormBoundaryWcRUaIbC8kXgjr3p--
\ No newline at end of file diff --git a/PolicyEngineAPI/pom.xml b/PolicyEngineAPI/pom.xml index b7f1371b5..9ea311772 100644 --- a/PolicyEngineAPI/pom.xml +++ b/PolicyEngineAPI/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>PolicyEngineAPI</artifactId> diff --git a/PolicyEngineClient/pom.xml b/PolicyEngineClient/pom.xml index 8e0e5f4ec..f381ecb56 100644 --- a/PolicyEngineClient/pom.xml +++ b/PolicyEngineClient/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>PolicyEngineClient</artifactId> <dependencies> diff --git a/PolicyEngineUtils/pom.xml b/PolicyEngineUtils/pom.xml index df846eec7..94625a6c7 100644 --- a/PolicyEngineUtils/pom.xml +++ b/PolicyEngineUtils/pom.xml @@ -23,24 +23,24 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>PolicyEngineUtils</artifactId> <dependencies> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>integrity-monitor</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>integrity-audit</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>ONAP-Logging</artifactId> - <version>${common-modules.version}</version> + <version>${project.version}</version> <exclusions> <exclusion> <groupId>org.powermock</groupId> diff --git a/packages/base/pom.xml b/packages/base/pom.xml index 7da4f7cdc..bf935b6f7 100755 --- a/packages/base/pom.xml +++ b/packages/base/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>packages</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>base</artifactId> @@ -200,6 +200,29 @@ </os> </activation> <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.5.0</version> + <executions> + <execution> + <id>create-version-file</id> + <goals> + <goal>exec</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <executable>/bin/bash</executable> + <arguments> + <argument>-c</argument> + <argument>mkdir -p target ; echo -e 'version="${project.version}"\ndescription="Open ONAP Policy Engine"\nbuildTag="'"${BUILD_TAG}"'"\ncommit="'"${GIT_COMMIT}"'"\ntimestamp="${maven.build.timestamp}"' >target/build.info</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> </profile> </profiles> diff --git a/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql b/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql index f1a3e9096..27f8ec42f 100644 --- a/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql +++ b/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql @@ -28,4 +28,4 @@ CREATE TABLE `onap_sdk`.`rainydaytreatments` ( PRIMARY KEY (`id`) ); -INSERT INTO `onap_sdk`.`microservicemodels` (`id`, `modelName`, `DESCRIPTION`, `Dependency`, `imported_by`, `attributes`, `ref_attributes`, `sub_attributes`, `version`) VALUES ('3', 'policy_tosca_tca', 'Micro Service Policy Tosca model', '[]', 'API', 'policyVersion=string:defaultValue-:required-true:MANY-false,policyName=string:defaultValue-:required-true:MANY-false,controlLoopSchemaType=string:defaultValue-:required-true:MANY-false,policyScope=string:defaultValue-:required-true:MANY-false,eventName=string:defaultValue-:required-true:MANY-false,', 'threshholds=Threshold:MANY-true,', '{\"Threshold\":{\"severity\":\"string:defaultValue-null:required-true:MANY-false\",\"fieldPath\":\"string:defaultValue-null:required-true:MANY-false\",\"thresholdValue\":\"integer:defaultValue-null:required-true:MANY-false\",\"closedLoopEventStatus\":\"string:defaultValue-null:required-true:MANY-false\",\"version\":\"string:defaultValue-1.0.2:required-true:MANY-false\",\"closedLoopControlName\":\"string:defaultValue-null:required-true:MANY-false\",\"direction\":\"string:defaultValue-null:required-true:MANY-false\"}}', '1.0.0'); +INSERT INTO `onap_sdk`.`microservicemodels` (`modelName`, `DESCRIPTION`, `Dependency`, `imported_by`, `attributes`, `ref_attributes`, `sub_attributes`, `version`, `enumValues`, `annotation`) VALUES ('tca_policy', 'MicroService TOSCA model', '[]', 'demo', '', 'tca_policy=tca_policy:MANY-false,', '{\"thresholds\":{\"severity\":\"string:defaultValue-null:required-null:MANY-false\",\"fieldPath\":\"string:defaultValue-null:required-null:MANY-false\",\"thresholdValue\":\"integer:defaultValue-null:required-null:MANY-false\",\"closedLoopEventStatus\":\"string:defaultValue-null:required-null:MANY-false\",\"closedLoopControlName\":\"string:defaultValue-null:required-null:MANY-false\",\"version\":\"string:defaultValue-null:required-null:MANY-false\",\"direction\":\"string:defaultValue-null:required-null:MANY-false\"},\"tca_policy\":{\"domain\":\"string:defaultValue-null:required-null:MANY-false\",\"metricsPerEventName\":\"metricsPerEventName:MANY-true\"},\"metricsPerEventName\":{\"policyVersion\":\"string:defaultValue-null:required-null:MANY-false\",\"thresholds\":\"thresholds:MANY-true\",\"policyName\":\"string:defaultValue-null:required-null:MANY-false\",\"controlLoopSchemaType\":\"string:defaultValue-null:required-null:MANY-false\",\"policyScope\":\"string:defaultValue-null:required-null:MANY-false\",\"eventName\":\"string:defaultValue-null:required-null:MANY-false\"}}', '1.1.0', '', ''); diff --git a/packages/base/src/files/install/servers/brmsgw/config.properties b/packages/base/src/files/install/servers/brmsgw/config.properties index f56e87cf3..311bd564c 100644 --- a/packages/base/src/files/install/servers/brmsgw/config.properties +++ b/packages/base/src/files/install/servers/brmsgw/config.properties @@ -84,6 +84,6 @@ test_via_jmx=${{test_via_jmx}} ping_interval=30000 -brms.dependency.version=1.1.0-SNAPSHOT +brms.dependency.version=1.1.1-SNAPSHOT CLIENT_FILE=client.properties diff --git a/packages/install/pom.xml b/packages/install/pom.xml index d3fbacf65..4590d940f 100644 --- a/packages/install/pom.xml +++ b/packages/install/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>packages</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>install</artifactId> diff --git a/packages/pom.xml b/packages/pom.xml index a4c42b280..c0a15e324 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> </parent> <artifactId>packages</artifactId> @@ -11,7 +11,7 @@ <groupId>org.onap.policy.engine</groupId> <artifactId>PolicyEngineSuite</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-engine</name> @@ -25,7 +25,6 @@ <project.target.version>1.8</project.target.version> <project.encoding>UTF-8</project.encoding> - <common-modules.version>1.1.0-SNAPSHOT</common-modules.version> <nexusproxy>https://nexus.onap.org</nexusproxy> <sitePath>/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</sitePath> <releases.path>content/repositories/releases/</releases.path> diff --git a/version.properties b/version.properties index 7f86aa15a..55fbf4416 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=1 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |