+ String vnfId = "ibcx0001v";
+ String resourceKey = "generic-vnf.vnf-id = '" + vnfId + "'";
+ String resourceType = "generic-vnf";
+ String queryPrefix = "vnfInfo";
+ SvcLogicContext ctx = mockAai.readResource(resourceKey, queryPrefix, resourceType);
+
+ // System.out.println("VNF TYPE " + queryPrefix + ".vnf.vnf-type");
+
+ assertEquals(ctx.getAttribute("vnfInfo.vnf-type"), "vUSP-Metaswitch");
+
+ }
+ private void printContext(SvcLogicContext ctx) throws Exception {
+ for (String key : ctx.getAttributeKeySet()) {
+ log.info(" KEY " + key);
+ log.info(" VALUE " + ctx.getAttribute(key));
+ }
+ }
+
+ @Test
+ public void testGetGroupNotationForExistingValue() throws Exception {
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("req-vf-module-id", "vfmodule01");
+ ctx.setAttribute("tmp.vnfInfo.vm[0].vf-module-id", "vfmodule01");
+ ctx.setAttribute("tmp.vnfInfo.vm[0].vnfc-function-code", "fc1");
+ ctx.setAttribute("tmp.vnfInfo.vm[0].group-notation", "gn1");
+ ctx.setAttribute("tmp.vnfInfo.vm[1].vf-module-id", "vfmodule01");
+ ctx.setAttribute("tmp.vnfInfo.vm[1].vnfc-function-code", "fc1");
+ ctx.setAttribute("tmp.vnfInfo.vm[0].vnfc-function-code", "fc1");
+ ctx.setAttribute("tmp.vnfInfo.vm[0].group-notation", "gn2");
+ MockAaiService aai=new MockAaiService(aaiClient);
+ String groupNotationValue1 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 2);
+ assertEquals (groupNotationValue1,null);
+
+ ctx.setAttribute("tmp.vnfInfo.vm[0].group-notation", "gn1");
+ ctx.setAttribute("tmp.vnfInfo.vm[1].group-notation", "gn1");
+ String groupNotationValue2 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 2);
+ assertEquals (groupNotationValue2,"gn1");
+
+ ctx.setAttribute("tmp.vnfInfo.vm[2].vf-module-id", "vfmodule01");
+ ctx.setAttribute("tmp.vnfInfo.vm[2].vnfc-function-code", "fc1");
+ ctx.setAttribute("tmp.vnfInfo.vm[2].group-notation", "gn2");
+ String groupNotationValue3 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 3);
+ assertEquals (groupNotationValue3,null);
+
+ ctx.setAttribute("tmp.vnfInfo.vm[2].group-notation", "gn1");
+ String groupNotationValue4 = aai.getGroupNotationForExistigValue(ctx, "tmp.vnfInfo", "fc1", 3);
+ assertEquals (groupNotationValue4,"gn1");
+
+ }