diff options
Diffstat (limited to 'properties-node')
9 files changed, 590 insertions, 15 deletions
diff --git a/properties-node/provider/pom.xml b/properties-node/provider/pom.xml index 9dcdb9b62..b3a1cf533 100755 --- a/properties-node/provider/pom.xml +++ b/properties-node/provider/pom.xml @@ -27,6 +27,11 @@ <scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
</dependency>
@@ -38,6 +43,10 @@ <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/JsonParser.java b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/JsonParser.java new file mode 100644 index 000000000..89243a055 --- /dev/null +++ b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/JsonParser.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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 + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.plugins.prop; + +import org.codehaus.jettison.json.JSONArray; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import static com.google.common.base.Preconditions.checkNotNull; + +public final class JsonParser { + + private static final Logger log = LoggerFactory.getLogger(JsonParser.class); + + private JsonParser() { + // Preventing instantiation of the same. + } + + @SuppressWarnings("unchecked") + public static Map<String, String> convertToProperties(String s) + throws SvcLogicException { + + checkNotNull(s, "Input should not be null."); + + try { + JSONObject json = new JSONObject(s); + Map<String, Object> wm = new HashMap<>(); + Iterator<String> ii = json.keys(); + while (ii.hasNext()) { + String key1 = ii.next(); + wm.put(key1, json.get(key1)); + } + + Map<String, String> mm = new HashMap<>(); + + while (!wm.isEmpty()) + for (String key : new ArrayList<>(wm.keySet())) { + Object o = wm.get(key); + wm.remove(key); + + if (o instanceof Boolean || o instanceof Number || o instanceof String) { + mm.put(key, o.toString()); + + log.info("Added property: {} : {}", key, o.toString()); + } else if (o instanceof JSONObject) { + JSONObject jo = (JSONObject) o; + Iterator<String> i = jo.keys(); + while (i.hasNext()) { + String key1 = i.next(); + wm.put(key + "." + key1, jo.get(key1)); + } + } else if (o instanceof JSONArray) { + JSONArray ja = (JSONArray) o; + mm.put(key + "_length", String.valueOf(ja.length())); + + log.info("Added property: {}_length: {}", key, String.valueOf(ja.length())); + + for (int i = 0; i < ja.length(); i++) + wm.put(key + '[' + i + ']', ja.get(i)); + } + } + return mm; + } catch (JSONException e) { + throw new SvcLogicException("Unable to convert JSON to properties " + e.getLocalizedMessage(), e); + } + } +} diff --git a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/Parameters.java b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/Parameters.java new file mode 100644 index 000000000..e15f0822d --- /dev/null +++ b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/Parameters.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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 + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.plugins.prop; + +public class Parameters { + public String fileName; + public String contextPrefix; +} diff --git a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java index b4886d552..63fdeded8 100644 --- a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java +++ b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java @@ -21,6 +21,7 @@ package org.onap.ccsdk.sli.plugins.prop; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -38,27 +39,62 @@ public class PropertiesNode implements SvcLogicJavaPlugin { private static final Logger log = LoggerFactory.getLogger(PropertiesNode.class); public void readProperties(Map<String, String> paramMap, SvcLogicContext ctx) throws SvcLogicException { - String fileName = parseParam(paramMap, "fileName", true, null); - String contextPrefix = parseParam(paramMap, "contextPrefix", false, null); - + Parameters param = getParameters(paramMap); + Properties prop = new Properties(); try { - Properties pp = new Properties(); - InputStream in = new FileInputStream(fileName); - pp.load(in); - for (Object key : pp.keySet()) { - String pfx = contextPrefix != null ? contextPrefix + '.' : ""; - String name = (String) key; - String value = pp.getProperty(name); - if (value != null && value.trim().length() > 0) { - ctx.setAttribute(pfx + name, value.trim()); - log.info("+++ " + pfx + name + ": [" + value + "]"); + File file = new File(param.fileName); + InputStream in = new FileInputStream(file); + Map<String, String> mm = null; + String pfx = param.contextPrefix != null ? param.contextPrefix + '.' : ""; + if ("json".equalsIgnoreCase(getFileExtension(param.fileName))){ + byte[] data = new byte[(int) file.length()]; + in.read(data); + in.close(); + String str = new String(data, "UTF-8"); + mm = JsonParser.convertToProperties(str); + } else { + prop.load(in); + for (Object key : prop.keySet()) { + String name = (String) key; + String value = prop.getProperty(name); + if (value != null && value.trim().length() > 0) { + ctx.setAttribute(pfx + name, value.trim()); + log.info("+++ " + pfx + name + ": [" + value + "]"); + } + } + } + if (mm != null){ + for (Map.Entry<String,String> entry : mm.entrySet()){ + ctx.setAttribute(pfx + entry.getKey(), entry.getValue()); + log.info("+++ " + pfx + entry.getKey() + ": [" + entry.getValue() + "]"); } } + } catch (IOException e) { - throw new SvcLogicException("Cannot read property file: " + fileName + ": " + e.getMessage(), e); + throw new SvcLogicException("Cannot read property file: " + param.fileName + ": " + e.getMessage(), e); } } + /* Getting extension has to do the following + * "" --> "" + * "name" --> "" + * "name.txt" --> "txt" + * ".htpasswd" --> "" + * "name.with.many.dots.myext" --> "myext" + */ + private static String getFileExtension(String fileName) { + if(fileName.lastIndexOf(".") != -1 && fileName.lastIndexOf(".") != 0) + return fileName.substring(fileName.lastIndexOf(".")+1); + else return ""; + } + + protected Parameters getParameters(Map<String, String> paramMap) throws SvcLogicException { + Parameters p = new Parameters(); + p.fileName = parseParam(paramMap, "fileName", true, null); + p.contextPrefix = parseParam(paramMap, "contextPrefix", false, null); + return p; + } + private String parseParam(Map<String, String> paramMap, String name, boolean required, String def) throws SvcLogicException { String s = paramMap.get(name); diff --git a/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestJsonParser.java b/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestJsonParser.java new file mode 100644 index 000000000..0681124d9 --- /dev/null +++ b/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestJsonParser.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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 + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package jtest.org.onap.ccsdk.sli.plugins.prop; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.plugins.prop.JsonParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestJsonParser { + + private static final Logger log = LoggerFactory.getLogger(TestJsonParser.class); + + @Test + public void test() throws SvcLogicException, IOException { + BufferedReader in = new BufferedReader( + new InputStreamReader(ClassLoader.getSystemResourceAsStream("test.json")) + ); + StringBuilder b = new StringBuilder(); + String line; + while ((line = in.readLine()) != null) + b.append(line).append('\n'); + + Map<String, String> mm = JsonParser.convertToProperties(b.toString()); + + logProperties(mm); + + in.close(); + } + + @Test(expected = NullPointerException.class) + public void testNullString() throws SvcLogicException { + JsonParser.convertToProperties(null); + } + + private void logProperties(Map<String, String> mm) { + List<String> ll = new ArrayList<>(); + for (Object o : mm.keySet()) + ll.add((String) o); + Collections.sort(ll); + log.info("Properties:"); + for (String name : ll) + log.info("--- {}: {}", name, mm.get(name)); + } +} diff --git a/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java b/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java new file mode 100644 index 000000000..894eee997 --- /dev/null +++ b/properties-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/prop/TestPropertiesNode.java @@ -0,0 +1,247 @@ +package jtest.org.onap.ccsdk.sli.plugins.prop; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.plugins.prop.PropertiesNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestPropertiesNode { + + private static final Logger log = LoggerFactory.getLogger(TestPropertiesNode.class); + + @Test + public void testJSONFileParsing() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.json"); + p.put("contextPrefix", "test-json"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("test-json.message"),"The provisioned access " + + "bandwidth is at or exceeds 50% of the total server capacity."); + } + + @Test + public void testJSONFileArrayParsing() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.json"); + p.put("contextPrefix", "test-json"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("test-json.equipment-data[0].max-server-speed"),"1600000"); + assertEquals(ctx.getAttribute("test-json.resource-state.used"),"1605000"); + assertEquals(ctx.getAttribute("test-json.resource-rule.service-model"),"DUMMY"); + assertEquals(ctx.getAttribute("test-json.resource-rule.endpoint-position"),"VCE-Cust"); + } + + @Test + public void testJSONFileParsingPrefixCheck() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.json"); + p.put("contextPrefix", ""); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000"); + assertEquals(ctx.getAttribute("resource-state.used"),"1605000"); + assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY"); + assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust"); + assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" + + "speed * number-primary-servers"); + } + + @Test + public void testJSONFileParsingNoPrefix() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.json"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000"); + assertEquals(ctx.getAttribute("resource-state.used"),"1605000"); + assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY"); + assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust"); + assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" + + "speed * number-primary-servers"); + } + + @Test + public void testJSONFileParsingCtxCheck() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.json"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000"); + assertEquals(ctx.getAttribute("resource-state.used"),"1605000"); + assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY"); + assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust"); + assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" + + "speed * number-primary-servers"); + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } + + @Test(expected = SvcLogicException.class) + public void testToPropertiesInvalidJson() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test-invalid.json"); + p.put("contextPrefix", "invalid"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } + + @Test + public void testTXTFileParsing() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.txt"); + p.put("contextPrefix", "test-txt"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("test-txt.service-data.service-information.service-type"),"AVPN"); + assertEquals(ctx.getAttribute("test-txt.service-configuration-notification-input.response-code"),"0"); + assertEquals(ctx.getAttribute("test-txt.operational-data.avpn-ip-port-information.port-" + + "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED"); + assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" + + "access-information.l1-customer-handoff"),"_1000BASELX"); + assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" + + "access-information.vlan-tag-control"),"_1Q"); + } + + @Test + public void testTXTFileParsingPrefixCheck() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.txt"); + p.put("contextPrefix", ""); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN"); + assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0"); + assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" + + "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.l1-customer-handoff"),"_1000BASELX"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.vlan-tag-control"),"_1Q"); + } + + @Test + public void testTXTFileParsingNoPrefix() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.txt"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN"); + assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0"); + assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" + + "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.l1-customer-handoff"),"_1000BASELX"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.vlan-tag-control"),"_1Q"); + } + + @Test + public void testTXTFileParsingCtxCheck() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/test/resources/test.txt"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN"); + assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0"); + assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" + + "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.l1-customer-handoff"),"_1000BASELX"); + assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" + + "access-information.vlan-tag-control"),"_1Q"); + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } + + @Test(expected = SvcLogicException.class) + public void testToPropertiesInvalidParam() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + p.put("responsePrefix", "response"); + p.put("skipSending", "true"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } + + @Test(expected = SvcLogicException.class) + public void testToPropertiesNoParam() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } + + @Test(expected = SvcLogicException.class) + public void testToPropertiesFilePathError() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); + + Map<String, String> p = new HashMap<String, String>(); + p.put("fileName", "src/tests/resources/test.txt"); + + PropertiesNode rcn = new PropertiesNode(); + rcn.readProperties(p, ctx); + + assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1"); + } +} diff --git a/properties-node/provider/src/test/resources/test-invalid.json b/properties-node/provider/src/test/resources/test-invalid.json new file mode 100644 index 000000000..21af3ac1d --- /dev/null +++ b/properties-node/provider/src/test/resources/test-invalid.json @@ -0,0 +1,29 @@ + "equipment-data": [ + { + "server-count": "4", + "max-server-speed": "1600000", + "number-primary-servers": "2", + "equipment-id": "Server1", + "server-model": "Unknown", + "server-id": "Server1", + "test-node" : { + "test-inner-node" : "Test-Value" + } + } + ], + "resource-state": { + "threshold-value": "1600000", + "last-added": "1605000", + "used": "1605000", + "limit-value": "1920000" + }, + "resource-rule": { + "endpoint-position": "VCE-Cust", + "soft-limit-expression": "0.6 * max-server-speed * number-primary-servers", + "resource-name": "Bandwidth", + "service-model": "DUMMY", + "hard-limit-expression": "max-server-speed * number-primary-servers", + "equipment-level": "Server" + }, + "message": "The provisioned access bandwidth is at or exceeds 50% of the total server capacity." +} diff --git a/properties-node/provider/src/test/resources/test.json b/properties-node/provider/src/test/resources/test.json new file mode 100644 index 000000000..75155393c --- /dev/null +++ b/properties-node/provider/src/test/resources/test.json @@ -0,0 +1,30 @@ +{ + "equipment-data": [ + { + "server-count": "4", + "max-server-speed": "1600000", + "number-primary-servers": "2", + "equipment-id": "Server1", + "server-model": "Unknown", + "server-id": "Server1", + "test-node" : { + "test-inner-node" : "Test-Value" + } + } + ], + "resource-state": { + "threshold-value": "1600000", + "last-added": "1605000", + "used": "1605000", + "limit-value": "1920000" + }, + "resource-rule": { + "endpoint-position": "VCE-Cust", + "soft-limit-expression": "0.6 * max-server-speed * number-primary-servers", + "resource-name": "Bandwidth", + "service-model": "DUMMY", + "hard-limit-expression": "max-server-speed * number-primary-servers", + "equipment-level": "Server" + }, + "message": "The provisioned access bandwidth is at or exceeds 50% of the total server capacity." +} diff --git a/properties-node/provider/src/test/resources/test.txt b/properties-node/provider/src/test/resources/test.txt new file mode 100644 index 000000000..79e8acff4 --- /dev/null +++ b/properties-node/provider/src/test/resources/test.txt @@ -0,0 +1,30 @@ +operational-data.avpn-ip-port-information.port-level-cos.queueing.pe-egress-class-queueing-policing-codes.cos2v-queueing-code = P +operational-data.avpn-ip-port-information.port-level-cos.queueing.pe-egress-class-queueing-policing-codes.cos3-queueing-code = W +operational-data.avpn-ip-port-information.port-level-cos.queueing.pe-per-class-queueing-behaviors.cos2-queueing = WRED +operational-data.avpn-ip-port-information.port-level-cos.queueing.pe-per-class-queueing-behaviors.cos2v-queueing = QueueLimit +operational-data.avpn-ip-port-information.port-level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing = WRED +operational-data.avpn-ip-port-information.port-level-cos.shaping.pe-egress-per-class-shaping-behaviors.cos2-shaping = Disable +operational-data.avpn-ip-port-information.port-level-cos.shaping.pe-egress-per-class-shaping-behaviors.cos2v-shaping = Enable +operational-data.avpn-ip-port-information.port-level-cos.shaping.pe-egress-per-class-shaping-behaviors.cos3-shaping = Disable +operational-data.avpn-ip-port-information.port-level-cos.shaping.pe-egress-per-class-shaping-codes.cos2-shaping-code = W +operational-data.avpn-ip-port-information.port-level-cos.shaping.pe-egress-per-class-shaping-codes.cos2v-shaping-code = P +service-configuration-notification-input.ack-final-indicator = Y +service-configuration-notification-input.response-code = 0 +service-configuration-notification-input.response-message = Plc Activation Failed: Device gblond2005me6 Sync-from Failed. Please check device IP address and NCS setup. +service-configuration-notification-input.service-information.service-instance-id = TEST7 +service-configuration-notification-input.service-information.service-type = AVPN +service-configuration-notification-input.svc-request-id = TEST7 +service-data.avpn-ip-port-information.avpn-access-information.access-circuit-id = DHEC.54831.170.ATI +service-data.avpn-ip-port-information.avpn-access-information.access-interface = _1G +service-data.avpn-ip-port-information.avpn-access-information.access-speed = 10000 +service-data.avpn-ip-port-information.avpn-access-information.access-speed-units = Kbps +service-data.avpn-ip-port-information.avpn-access-information.l1-customer-handoff = _1000BASELX +service-data.avpn-ip-port-information.avpn-access-information.managed-ce = N +service-data.avpn-ip-port-information.avpn-access-information.vlan-tag-control = _1Q +service-data.avpn-ip-port-information.clli = LONDENEH +service-data.avpn-ip-port-information.contracted-port-speed = 10000 +service-data.avpn-ip-port-information.contracted-port-speed-units = Kbps +service-data.avpn-ip-port-information.endpoint-information.bundle-id = 33 +service-data.avpn-ip-port-information.endpoint-information.interface-string = ae0 +service-data.service-information.service-instance-id = ICORESITE-2751508 +service-data.service-information.service-type = AVPN
\ No newline at end of file |