package org.onap.ccsdk.sli.plugins.yangserializers.dfserializer;
+import java.util.HashMap;
+import java.util.Map;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import java.util.HashMap;
-import java.util.Map;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.GET;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PATCH;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.POST;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PUT;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.parseUrl;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.DECODE_ANYXML_RESPONSE;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.DECODE_FROM_JSON_RPC;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.DECODE_FROM_XML_RPC;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_ANYXML;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_ID;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_ID_PUT;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_RPC;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_YANG;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_YANG_AUG_POST;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_JSON_YANG_PUT;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_ID;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_ID_PUT;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_RPC;
import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_YANG;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_YANG_AUG_POST;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DataFormatUtilsTest.ENCODE_TO_XML_YANG_PUT;
/**
doAnswer(dfCaptor).when(restconf).serializeRequest(
any(Map.class), any(YangParameters.class), any(String.class),
any(InstanceIdentifierContext.class));
+ doAnswer(dfCaptor).when(restconf).updateReq(
+ any(String.class), any(YangParameters.class),
+ any(InstanceIdentifierContext.class));
}
/**
*/
@Test
public void encodeToJsonId() throws SvcLogicException {
- String pre = "identity-test:test.";
+ String pre = "identity-test_test.";
SvcLogicContext ctx = createAttList(pre);
ctx.setAttribute(pre + "l", "abc");
p.put("dirPath", "src/test/resources");
assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_ID));
}
+ /**
+ * Verifies encoding of parameters to JSON data format any xml in it.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeForAnyXml() throws SvcLogicException {
+ String pre = "execution-service_process.";
+ SvcLogicContext ctx = createAnyXmlAttList(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/api/v1/execution-service/process");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_ANYXML));
+ }
+
+ /**
+ * Verifies encoding of parameters to JSON data format with identity-ref
+ * and inter-file linking for put operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToJsonIdWithPut() throws SvcLogicException {
+ String pre = "identity-test_test.";
+ SvcLogicContext ctx = createAttList(pre);
+ ctx.setAttribute(pre + "l", "abc");
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "put");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/identity-test:test");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_ID_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to JSON data format with identity-ref
+ * and inter-file linking for patch operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToJsonIdWithPatch() throws SvcLogicException {
+ String pre = "identity-test_test.";
+ SvcLogicContext ctx = createAttList(pre);
+ ctx.setAttribute(pre + "l", "abc");
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "patch");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/identity-test:test");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_ID_PUT));
+ }
+
/**
* Verifies encoding of parameters to XML data format with identity-ref
* and inter-file linking.
*/
@Test
public void encodeToXmlId() throws SvcLogicException {
- String pre = "identity-test:test.";
+ String pre = "identity-test_test.";
SvcLogicContext ctx = createAttList(pre);
p.put("dirPath", "src/test/resources");
p.put("format", "xml");
assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_ID));
}
+ /**
+ * Verifies encoding of parameters to XML data format with identity-ref
+ * and inter-file linking for put operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToXmlIdWithPut() throws SvcLogicException {
+ String pre = "identity-test_test.";
+ SvcLogicContext ctx = createAttList(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "xml");
+ p.put("httpMethod", "put");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/identity-test:test");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_ID_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to XML data format with identity-ref
+ * and inter-file linking for patch operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToXmlIdWithPatch() throws SvcLogicException {
+ String pre = "identity-test_test.";
+ SvcLogicContext ctx = createAttList(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "xml");
+ p.put("httpMethod", "patch");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/identity-test:test");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_ID_PUT));
+ }
+
/**
* Verifies decoding of parameters from JSON data format with identity-ref
* and inter-file linking.
public void decodeToJsonId() throws SvcLogicException {
createMockForDecode(ENCODE_TO_JSON_ID);
SvcLogicContext ctx = new SvcLogicContext();
- String pre = "identity-test:test.";
+ String pre = "identity-test_test.";
p.put("dirPath", "src/test/resources");
p.put("format", "json");
p.put("httpMethod", "get");
public void decodeToXmlId() throws SvcLogicException {
createMockForDecode(ENCODE_TO_XML_ID);
SvcLogicContext ctx = new SvcLogicContext();
- String pre = "identity-test:test.";
+ String pre = "identity-test_test.";
p.put("dirPath", "src/test/resources");
p.put("format", "xml");
p.put("httpMethod", "get");
*/
@Test
public void encodeToJsonYang() throws SvcLogicException {
- String pre = "test-yang:cont1.cont2.";
+ String pre = "test-yang_cont1.cont2.";
SvcLogicContext ctx = createAttListYang(pre);
p.put("dirPath", "src/test/resources");
p.put("format", "json");
assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_YANG));
}
+ /**
+ * Verifies encoding of parameters to JSON data format with containers,
+ * grouping and augment for put operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToJsonYangWithPut() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "put");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_YANG_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to JSON data format with containers,
+ * grouping and augment for patch operation-type.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToJsonYangWithPatch() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "patch");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_YANG_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to JSON data format with augment as
+ * root child.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToJsonWithAugAsRootChild() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_JSON_YANG_AUG_POST));
+ }
+
/**
* Verifies decoding of parameters from JSON data format with containers,
* grouping and augment.
public void decodeToJsonYang() throws SvcLogicException {
createMockForDecode(ENCODE_TO_JSON_YANG);
SvcLogicContext ctx = new SvcLogicContext();
- String pre = "test-yang:cont1.cont2.";
+ String pre = "test-yang_cont1.cont2.";
p.put("dirPath", "src/test/resources");
p.put("format", "json");
p.put("httpMethod", "get");
*/
@Test
public void encodeToXmlYang() throws SvcLogicException {
- String pre = "test-yang:cont1.cont2.";
+ String pre = "test-yang_cont1.cont2.";
SvcLogicContext ctx = createAttListYang(pre);
p.put("dirPath", "src/test/resources");
p.put("format", "xml");
assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_YANG));
}
+ /**
+ * Verifies encoding of parameters to XML data format with containers,
+ * grouping and augment for put operation-type
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToXmlYangWithPut() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "xml");
+ p.put("httpMethod", "put");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_YANG_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to XML data format with containers,
+ * grouping and augment for patch operation-type
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToXmlYangWithPatch() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "xml");
+ p.put("httpMethod", "put");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_YANG_PUT));
+ }
+
+ /**
+ * Verifies encoding of parameters to XML data format with augment as
+ * root child.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void encodeToXmlWithAugAsRootChild() throws SvcLogicException {
+ String pre = "test-yang_cont1.cont2.";
+ SvcLogicContext ctx = createAttListYang(pre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "xml");
+ p.put("httpMethod", "post");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/restconf/operations/test-yang:cont1/cont2/cont4");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_XML_YANG_AUG_POST));
+ }
+
/**
* Verifies decoding of parameters from XML data format with containers,
* grouping and augment.
public void decodeToXmlYang() throws SvcLogicException {
createMockForDecode(ENCODE_TO_XML_YANG);
SvcLogicContext ctx = new SvcLogicContext();
- String pre = "test-yang:cont1.cont2.";
+ String pre = "test-yang_cont1.cont2.";
p.put("dirPath", "src/test/resources");
p.put("format", "xml");
p.put("httpMethod", "get");
@Test
public void codecToJsonRpc() throws SvcLogicException {
createMockForDecode(DECODE_FROM_JSON_RPC);
- String inPre = "test-yang:create-sfc.input.";
- String outPre = "test-yang:create-sfc.output.";
+ String inPre = "test-yang_create-sfc.input.";
+ String outPre = "test-yang_create-sfc.output.";
SvcLogicContext ctx = createAttListRpc(inPre);
p.put("dirPath", "src/test/resources");
p.put("format", "json");
verifyAttListRpc(ctx, outPre);
}
+ /**
+ * Verifies encoding of and decoding from, JSON for ANYXML.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void codecForNormalAnyXml() throws SvcLogicException {
+ createMockForDecode(DECODE_ANYXML_RESPONSE);
+ String inPre = "execution-service_process.";
+ SvcLogicContext ctx = createAnyXmlAttList(inPre);
+ p.put("dirPath", "src/test/resources");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "pp");
+ p.put("restapiUrl", "http://echo.getpostman" +
+ ".com/api/v1/execution-service/process");
+ restconf.sendRequest(p, ctx);
+ assertThat(dfCaptor.getResult(), is(ENCODE_TO_ANYXML));
+ verifyOutputOfAnyXml(ctx);
+ }
+
/**
* Verifies encoding of and decoding from, XML respectively for data
* format with containers, grouping and augment.
@Test
public void codecToXmlRpc() throws SvcLogicException {
createMockForDecode(DECODE_FROM_XML_RPC);
- String inPre = "test-yang:create-sfc.input.";
- String outPre = "test-yang:create-sfc.output.";
+ String inPre = "test-yang_create-sfc.input.";
+ String outPre = "test-yang_create-sfc.output.";
SvcLogicContext ctx = createAttListRpc(inPre);
p.put("dirPath", "src/test/resources");
p.put("format", "xml");
verifyAttListRpc(ctx, outPre);
}
+ /**
+ * Verifies URL parser returning path with only schema information for all
+ * kind of URL.
+ *
+ * @throws SvcLogicException when test case fails
+ */
+ @Test
+ public void validateUrlParser() throws SvcLogicException {
+ String actVal = "identity-test:test";
+ String putId = "/for-put";
+ String url1 = "http://echo.getpostman.com/restconf/operations/" +
+ actVal;
+ String url2 = "http://echo.getpostman.com/restconf/data/" + actVal;
+ String url3 = "https://echo.getpostman.com/restconf/operations/" +
+ actVal;
+ String url4 = "https://echo.getpostman.com/restconf/data/" + actVal +
+ putId;
+ String url5 = "http://localhost:8282/restconf/operations/" + actVal;
+ String url6 = "https://localhost:8282/restconf/operations/" + actVal;
+ String url7 = "http://localhost:8282/restconf/data/" + actVal +
+ putId;
+ String url8 = "https://localhost:8282/restconf/data/" + actVal;
+ String url9 = "http://182.2.61.24:2250/restconf/data/" + actVal;
+ String url10 = "https://182.2.61.24:2250/restconf/operations/" + actVal;
+ String url11 = "https://182.2.61.24:2250/api/v1/execution-service" +
+ "/process";
+ String url12 = "https://182.2.61.24:2250/api/v1/execution-service" +
+ "/process/payload";
+ String url13 = "https://182.2.61.24:2250/api/v1/execution-service" +
+ "/process/payload/";
+ String val1 = parseUrl(url1, POST);
+ String val2 = parseUrl(url2, GET);
+ String val3 = parseUrl(url3, PATCH);
+ String val4 = parseUrl(url4, PUT);
+ String val5 = parseUrl(url5, GET);
+ String val6 = parseUrl(url6, POST);
+ String val7 = parseUrl(url7, PUT);
+ String val8 = parseUrl(url8, POST);
+ String val9 = parseUrl(url9, GET);
+ String val10 = parseUrl(url10, POST);
+ String val11 = parseUrl(url11, POST);
+ String val12 = parseUrl(url12, POST);
+ String val13 = parseUrl(url13, POST);
+ assertThat(val1, is(actVal));
+ assertThat(val2, is(actVal));
+ assertThat(val3, is(actVal));
+ assertThat(val4, is(actVal + putId));
+ assertThat(val5, is(actVal));
+ assertThat(val6, is(actVal));
+ assertThat(val7, is(actVal + putId));
+ assertThat(val8, is(actVal));
+ assertThat(val9, is(actVal));
+ assertThat(val10, is(actVal));
+ assertThat(val11, is("execution-service:process"));
+ assertThat(val12, is("execution-service:process/payload"));
+ assertThat(val13, is("execution-service:process/payload/"));
+ }
+
+ /**
+ * Creates attribute list for encoding JSON or XML with ANYXML YANG
+ * file.
+ *
+ * @param pre prefix
+ * @return service logic context
+ */
+ private SvcLogicContext createAnyXmlAttList(String pre) {
+ SvcLogicContext ctx = new SvcLogicContext();
+ String pre1 = pre + "commonHeader.";
+ String pre2 = pre + "actionIdentifiers.";
+ ctx.setAttribute(pre + "isNonAppend", "true");
+ ctx.setAttribute(pre1 + "originatorId", "SDNC_DG");
+ ctx.setAttribute(pre1 + "requestId", "123456-1000");
+ ctx.setAttribute(pre1 + "subRequestId", "sub-123456-1000");
+ ctx.setAttribute(pre2 + "blueprintName",
+ "baseconfiguration");
+ ctx.setAttribute(pre2 + "blueprintVersion", "1.0.0");
+ ctx.setAttribute(pre2 + "actionName", "assign-activate");
+ ctx.setAttribute(pre2 + "mode", "sync");
+ ctx.setAttribute(pre + "payload." +
+ "template-prefix", "vDNS-test");
+ ctx.setAttribute(pre + "payload.resource-assignment-request" +
+ ".resource-assignment-properties",
+ "{\n" +
+ " \"service-instance-id\": " +
+ "\"1234\",\n" +
+ " \"vnf-id\": \"3526\",\n" +
+ " \"customer-name\": \"htipl\",\n" +
+ " \"subscriber-name\": \"huawei\"\n" +
+ " }");
+ return ctx;
+ }
+
/**
* Creates attribute list for encoding JSON or XML with identity-ref YANG
* file.
ctx.setAttribute(pre + "leaf12", "abc");
ctx.setAttribute(pre + "ll5[0]", "abc");
ctx.setAttribute(pre + "ll5[1]", "abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont5.leaf13", "true");
- ctx.setAttribute(pre + "cont4.test-augment:list7[0].leaf14", "test");
- ctx.setAttribute(pre + "cont4.test-augment:list7[1].leaf14", "create");
- ctx.setAttribute(pre + "cont4.test-augment:leaf15", "abc");
- ctx.setAttribute(pre + "cont4.test-augment:ll6[0]", "unbounded");
- ctx.setAttribute(pre + "cont4.test-augment:ll6[1]", "8");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.cont12.leaf26",
+ ctx.setAttribute(pre + "cont4.test-augment_cont5.leaf13", "true");
+ ctx.setAttribute(pre + "cont4.test-augment_list7[0].leaf14", "test");
+ ctx.setAttribute(pre + "cont4.test-augment_list7[1].leaf14", "create");
+ ctx.setAttribute(pre + "cont4.test-augment_leaf15", "abc");
+ ctx.setAttribute(pre + "cont4.test-augment_ll6[0]", "unbounded");
+ ctx.setAttribute(pre + "cont4.test-augment_ll6[1]", "8");
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.cont12.leaf26",
"abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.list9[0].leaf27",
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.list9[0].leaf27",
"abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.list9[1].leaf27",
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.list9[1].leaf27",
"abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.leaf28", "abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.ll9[0]", "abc");
- ctx.setAttribute(pre + "cont4.test-augment:cont13.ll9[1]", "abc");
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.leaf28", "abc");
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.ll9[0]", "abc");
+ ctx.setAttribute(pre + "cont4.test-augment_cont13.ll9[1]", "abc");
return ctx;
}
assertThat(ctx.getAttribute(pre + "leaf12"), is("abc"));
assertThat(ctx.getAttribute(pre + "ll5[0]"), is("abc"));
assertThat(ctx.getAttribute(pre + "ll5[1]"), is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont5.leaf13"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont5.leaf13"),
is("true"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:list7[0].leaf14"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_list7[0].leaf14"),
is("test"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:list7[1].leaf14"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_list7[1].leaf14"),
is("create"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:leaf15"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_leaf15"),
is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:ll6[0]"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_ll6[0]"),
is("unbounded"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:ll6[1]"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_ll6[1]"),
is("8"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13" +
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13" +
".cont12.leaf26"), is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13.list9[0]" +
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13.list9[0]" +
".leaf27"), is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13.list9[1]" +
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13.list9[1]" +
".leaf27"), is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13.leaf28"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13.leaf28"),
is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13.ll9[0]"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13.ll9[0]"),
is("abc"));
- assertThat(ctx.getAttribute(pre + "cont4.test-augment:cont13.ll9[1]"),
+ assertThat(ctx.getAttribute(pre + "cont4.test-augment_cont13.ll9[1]"),
is("abc"));
}
assertThat(ctx.getAttribute(pre + "cont13.leaf28"), is("abc"));
}
+ /**
+ * Verifies the attribute list for decoding from JSON or XML with
+ * ANYXML YANG file.
+ *
+ * @param ctx service logic context
+ */
+ private void verifyOutputOfAnyXml(SvcLogicContext ctx) {
+ System.out.println(ctx.getAttribute("pp.status.eventType"));
+ assertThat(ctx.getAttribute("pp.status.eventType"), is(
+ "EVENT_COMPONENT_EXECUTED"));
+ assertThat(ctx.getAttribute("pp.actionIdentifiers.blueprintName"),
+ is("golden"));
+ assertThat(ctx.getAttribute("pp.actionIdentifiers.mode"),
+ is("sync"));
+ assertThat(ctx.getAttribute("pp.stepData.name"),
+ is("resource-assignment"));
+ assertThat(ctx.getAttribute("pp.status.message"),
+ is("success"));
+ assertThat(ctx.getAttribute("pp.commonHeader.originatorId"),
+ is("System"));
+ assertThat(ctx.getAttribute("pp.status.code"),
+ is("200"));
+ assertThat(ctx.getAttribute("pp.commonHeader.requestId"),
+ is("1234"));
+ assertThat(ctx.getAttribute("pp.commonHeader.subRequestId"),
+ is("1234-12234"));
+ assertThat(ctx.getAttribute("pp.commonHeader.timestamp"),
+ is("2019-05-18T23:42:41.658Z"));
+ assertThat(ctx.getAttribute("pp.status.timestamp"),
+ is("2019-05-18T23:42:41.950Z"));
+ assertThat(ctx.getAttribute("pp.actionIdentifiers.blueprintV" +
+ "ersion"), is("1.0.0"));
+ assertThat(ctx.getAttribute("pp.actionIdentifiers.actionName"),
+ is("resource-assignment"));
+ assertThat(ctx.getAttribute("pp.payload.resource-assignment-resp" +
+ "onse.meshed-template.vf-module-1"),
+ is("<interface>\n <description>This i" +
+ "s the Virtual Firewall entity</description>\n" +
+ " <vfw>10.0.101.20/24</vfw>\n" +
+ "</interface>"));
+ assertThat(ctx.getAttribute("pp.actionIdentifiers.actionName"),
+ is("resource-assignment"));
+ }
+
+
/**
* Captures the data format messages by mocking it, which can be used in
* testing the value.