diff options
Diffstat (limited to 'plugins')
45 files changed, 223 insertions, 723 deletions
diff --git a/plugins/artifacts/pom.xml b/plugins/artifacts/pom.xml index 1888e113c..11e478bcc 100755 --- a/plugins/artifacts/pom.xml +++ b/plugins/artifacts/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-gr-toolkit/pom.xml b/plugins/features/ccsdk-gr-toolkit/pom.xml index cfda3dca8..bf75f3643 100644 --- a/plugins/features/ccsdk-gr-toolkit/pom.xml +++ b/plugins/features/ccsdk-gr-toolkit/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-properties-node/pom.xml b/plugins/features/ccsdk-properties-node/pom.xml index 1c3a4b83d..a54a2822a 100644 --- a/plugins/features/ccsdk-properties-node/pom.xml +++ b/plugins/features/ccsdk-properties-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-restapi-call-node/pom.xml b/plugins/features/ccsdk-restapi-call-node/pom.xml index 27d00c3c7..5c56332b9 100644 --- a/plugins/features/ccsdk-restapi-call-node/pom.xml +++ b/plugins/features/ccsdk-restapi-call-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-restconf-client/pom.xml b/plugins/features/ccsdk-restconf-client/pom.xml index 384459bd0..af9dd12c1 100644 --- a/plugins/features/ccsdk-restconf-client/pom.xml +++ b/plugins/features/ccsdk-restconf-client/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-sli-plugins-all/pom.xml b/plugins/features/ccsdk-sli-plugins-all/pom.xml index b419775ec..b42d20039 100644 --- a/plugins/features/ccsdk-sli-plugins-all/pom.xml +++ b/plugins/features/ccsdk-sli-plugins-all/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-sshapi-call-node/pom.xml b/plugins/features/ccsdk-sshapi-call-node/pom.xml index 8dfd5cdd0..421394760 100644 --- a/plugins/features/ccsdk-sshapi-call-node/pom.xml +++ b/plugins/features/ccsdk-sshapi-call-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/ccsdk-template-node/pom.xml b/plugins/features/ccsdk-template-node/pom.xml index fd0e86a2b..ad1299873 100644 --- a/plugins/features/ccsdk-template-node/pom.xml +++ b/plugins/features/ccsdk-template-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/features-sli-plugins/pom.xml b/plugins/features/features-sli-plugins/pom.xml index 34f1747fa..238d90ac5 100644 --- a/plugins/features/features-sli-plugins/pom.xml +++ b/plugins/features/features-sli-plugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>feature-repo-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/installer/pom.xml b/plugins/features/installer/pom.xml index a3a16e08b..68c418e7f 100755 --- a/plugins/features/installer/pom.xml +++ b/plugins/features/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/features/pom.xml b/plugins/features/pom.xml index 09b7a1cd7..c5aaae356 100755 --- a/plugins/features/pom.xml +++ b/plugins/features/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/grToolkit/installer/pom.xml b/plugins/grToolkit/installer/pom.xml index 216340daf..ef0045e04 100755 --- a/plugins/grToolkit/installer/pom.xml +++ b/plugins/grToolkit/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/grToolkit/model/pom.xml b/plugins/grToolkit/model/pom.xml index 0110565ad..15a4f89c1 100755 --- a/plugins/grToolkit/model/pom.xml +++ b/plugins/grToolkit/model/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/grToolkit/pom.xml b/plugins/grToolkit/pom.xml index 3f4105ca2..bfd621a9b 100755 --- a/plugins/grToolkit/pom.xml +++ b/plugins/grToolkit/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/grToolkit/provider/pom.xml b/plugins/grToolkit/provider/pom.xml index 2db52595f..9910ec516 100755 --- a/plugins/grToolkit/provider/pom.xml +++ b/plugins/grToolkit/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> <relativePath/> </parent> diff --git a/plugins/pom.xml b/plugins/pom.xml index dc55aa60b..cb0fdc289 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/properties-node/installer/pom.xml b/plugins/properties-node/installer/pom.xml index 49abd8836..2deca97b1 100755 --- a/plugins/properties-node/installer/pom.xml +++ b/plugins/properties-node/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/properties-node/pom.xml b/plugins/properties-node/pom.xml index 1305e70d9..c95b88979 100755 --- a/plugins/properties-node/pom.xml +++ b/plugins/properties-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/properties-node/provider/pom.xml b/plugins/properties-node/provider/pom.xml index 616fa8bdf..557c0ebac 100755 --- a/plugins/properties-node/provider/pom.xml +++ b/plugins/properties-node/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restapi-call-node/installer/pom.xml b/plugins/restapi-call-node/installer/pom.xml index 65125165f..90adbc993 100755 --- a/plugins/restapi-call-node/installer/pom.xml +++ b/plugins/restapi-call-node/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restapi-call-node/pom.xml b/plugins/restapi-call-node/pom.xml index 4ec2d8603..5e5bc7d12 100755 --- a/plugins/restapi-call-node/pom.xml +++ b/plugins/restapi-call-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restapi-call-node/provider/pom.xml b/plugins/restapi-call-node/provider/pom.xml index 54c3e1409..1bd6cc779 100755 --- a/plugins/restapi-call-node/provider/pom.xml +++ b/plugins/restapi-call-node/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java index 4236055dc..2064dc864 100755 --- a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java +++ b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/RestapiCallNode.java @@ -641,6 +641,8 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { if (format == Format.JSON) { req = XmlJsonUtil.removeLastCommaJson(req); + // Use 'EMPTY_CONTAINER' as keyword within template to have an empty container placeholder. + req = req.replaceAll("EMPTY_CONTAINER", "{}"); } long t2 = System.currentTimeMillis(); @@ -803,7 +805,7 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { URL proxyUrl = new URL(p.proxyUrl); HttpUrlConnectorProvider cp = new HttpUrlConnectorProvider(); config.connectorProvider(cp); - final Proxy proxy = + final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl.getHost(), proxyUrl.getPort())); cp.connectionFactory(new ConnectionFactory() { @@ -822,12 +824,12 @@ public class RestapiCallNode implements SvcLogicJavaPlugin { ssl = createSSLContext(p); } - ClientBuilder builder = + ClientBuilder builder = ClientBuilder.newBuilder().hostnameVerifier(new AcceptIpAddressHostNameVerifier()); - if (ssl != null) { + if (ssl != null) { HttpsURLConnection.setDefaultSSLSocketFactory(ssl.getSocketFactory()); - builder = builder.sslContext(ssl); + builder = builder.sslContext(ssl); } if (config != null) { builder = builder.withConfig(config); diff --git a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java index d6ef7463a..a4407c005 100644 --- a/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java +++ b/plugins/restapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/restapicall/XmlJsonUtil.java @@ -443,7 +443,6 @@ public final class XmlJsonUtil { i5 = s.length(); } - /*If template mandates empty construct to be present, those should not be removed.*/ if (template != null && template.contains(s.substring(i4))) { k = i1 + 1; diff --git a/plugins/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/plugins/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 595fc1de2..758b30d18 100755 --- a/plugins/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/plugins/restapi-call-node/provider/src/test/java/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -29,6 +29,7 @@ import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; + import org.codehaus.jettison.json.JSONObject; import org.junit.Before; import org.junit.Test; @@ -213,7 +214,6 @@ public class TestRestapiCallNode { rcn.sendRequest(p, ctx); } - @Test(expected = SvcLogicException.class) public void testWithInvalidURI() throws SvcLogicException { SvcLogicContext ctx = new SvcLogicContext(); @@ -339,7 +339,7 @@ public class TestRestapiCallNode { Map<String, String> p = new HashMap<>(); //p.put("templateFileName", "src/test/resources/l3smvpntemplate.json"); p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services" - + "/vpnservice=10000000-0000-0000-0000-000000000001"); + + "/vpnservice=10000000-0000-0000-0000-000000000001"); p.put("restapiUser", "admin"); p.put("restapiPassword", "admin123"); p.put("format", "json"); @@ -425,7 +425,6 @@ public class TestRestapiCallNode { rcn.sendRequest(p, ctx); } - @Test public void testDeleteNoneAsContentType() throws SvcLogicException { SvcLogicContext ctx = new SvcLogicContext(); @@ -461,81 +460,82 @@ public class TestRestapiCallNode { RestapiCallNode rcn = new RestapiCallNode(); rcn.sendRequest(p, ctx); } + /* * { - "partnerOne": { - "url": "http://localhost:7001" 4 http://uebsb93kcdc.it.att.com:3904", - "test": "/metrics" - }, - "partnerTwo": { - "url": "http://localhost:7002", - "user": "controller_user", - "password": "P@ssword", - "test": "/metrics" - }, - "partnerThree": { - "url": "http://localhost:7003", - "user": "controller_admin" - } -} + "partnerOne": { + "url": "http://localhost:7001" 4 http://uebsb93kcdc.it.att.com:3904", + "test": "/metrics" + }, + "partnerTwo": { + "url": "http://localhost:7002", + "user": "controller_user", + "password": "P@ssword", + "test": "/metrics" + }, + "partnerThree": { + "url": "http://localhost:7003", + "user": "controller_admin" + } + } */ @Test - public void testPartners() throws Exception{ - String partnerTwoKey = "partnerTwo"; - String partnerTwoUsername = "controller_user"; - String partnerTwoPassword = "P@ssword"; + public void testPartners() throws Exception { + String partnerTwoKey = "partnerTwo"; + String partnerTwoUsername = "controller_user"; + String partnerTwoPassword = "P@ssword"; - System.setProperty("SDNC_CONFIG_DIR", "src/test/resources"); + System.setProperty("SDNC_CONFIG_DIR", "src/test/resources"); RestapiCallNode rcn = new RestapiCallNode(); assertNull(rcn.partnerStore.get("partnerOne")); PartnerDetails details = rcn.partnerStore.get(partnerTwoKey); - assertEquals(partnerTwoUsername,details.username); - assertEquals(partnerTwoPassword,details.password); + assertEquals(partnerTwoUsername, details.username); + assertEquals(partnerTwoPassword, details.password); assertNull(rcn.partnerStore.get("partnerThree")); //In this scenario the caller expects username, password and url to be picked up from the partners json Map<String, String> paramMap = new HashMap<>(); paramMap.put("partner", partnerTwoKey); - rcn.handlePartner(paramMap ); - assertEquals(partnerTwoUsername,paramMap.get(RestapiCallNode.restapiUserKey)); - assertEquals(partnerTwoPassword,paramMap.get(RestapiCallNode.restapiPasswordKey)); - assertEquals("http://localhost:7002",paramMap.get(RestapiCallNode.restapiUrlString)); + rcn.handlePartner(paramMap); + assertEquals(partnerTwoUsername, paramMap.get(RestapiCallNode.restapiUserKey)); + assertEquals(partnerTwoPassword, paramMap.get(RestapiCallNode.restapiPasswordKey)); + assertEquals("http://localhost:7002", paramMap.get(RestapiCallNode.restapiUrlString)); //In this scenario the caller expects username, password and url to be picked up from the partners json //the provided suffix will be appended to the default url from the partners json paramMap = new HashMap<>(); paramMap.put("partner", partnerTwoKey); paramMap.put("restapiUrlSuffix", "/networking/v1/instance/3"); - rcn.handlePartner(paramMap); - Parameters p = new Parameters(); - RestapiCallNode.getParameters(paramMap, p); - assertEquals(partnerTwoUsername,p.restapiUser); - assertEquals(partnerTwoPassword,p.restapiPassword); - assertEquals("http://localhost:7002/networking/v1/instance/3",p.restapiUrl); + rcn.handlePartner(paramMap); + Parameters p = new Parameters(); + RestapiCallNode.getParameters(paramMap, p); + assertEquals(partnerTwoUsername, p.restapiUser); + assertEquals(partnerTwoPassword, p.restapiPassword); + assertEquals("http://localhost:7002/networking/v1/instance/3", p.restapiUrl); } @Test public void retryPolicyBean() throws Exception { - Integer retries = 3; - String first = "http://localhost:7001"; - String second = "http://localhost:7001"; - - RetryPolicy p = new RetryPolicy(new String[] {first,second}, retries); - assertEquals(retries,p.getMaximumRetries()); - assertNotNull(p.getRetryMessage()); - String next = p.getNextHostName(); - assertEquals(second,next); - assertEquals(1,p.getRetryCount()); - next = p.getNextHostName(); - assertEquals(first,next); - assertEquals(2,p.getRetryCount()); + Integer retries = 3; + String first = "http://localhost:7001"; + String second = "http://localhost:7001"; + + RetryPolicy p = new RetryPolicy(new String[] {first, second}, retries); + assertEquals(retries, p.getMaximumRetries()); + assertNotNull(p.getRetryMessage()); + String next = p.getNextHostName(); + assertEquals(second, next); + assertEquals(1, p.getRetryCount()); + next = p.getNextHostName(); + assertEquals(first, next); + assertEquals(2, p.getRetryCount()); } @Test public void testEmbeddedJsonTemplate() throws Exception { SvcLogicContext ctx = new SvcLogicContext(); String complexObj = "{\"image_name\":\"Ubuntu 14.04\",\"service-instance-id\":\"1\",\"vnf-model-customization-uuid\":\"2f\",\"vnf-id\":\"3b\"}"; - ctx.setAttribute("reqId", "1235"); + ctx.setAttribute("reqId", "1235"); ctx.setAttribute("subReqId", "054243"); ctx.setAttribute("actionName", "CREATE"); ctx.setAttribute("myPrefix", "2016-09-09 16:30:35.0"); @@ -565,30 +565,30 @@ public class TestRestapiCallNode { //This will throw a JSONException and fail the test case if rest api call node doesn't form valid JSON assertNotNull(new JSONObject(request)); } - + @Test - public void testGetMultipleUrls() throws Exception{ + public void testGetMultipleUrls() throws Exception { String[] urls = RestapiCallNode.getMultipleUrls("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana,https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato"); - assertEquals("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana",urls[0]); - assertEquals("https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato",urls[1]); - - urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,http://localhost:7001/,http://wiki.onap.org/"); - assertEquals("https://wiki.onap.org/",urls[0]); - assertEquals("http://localhost:7001/",urls[1]); - assertEquals("http://wiki.onap.org/",urls[2]); - + assertEquals("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana", urls[0]); + assertEquals("https://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Potato", urls[1]); + + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,http://localhost:7001/,http://wiki.onap.org/"); + assertEquals("https://wiki.onap.org/", urls[0]); + assertEquals("http://localhost:7001/", urls[1]); + assertEquals("http://wiki.onap.org/", urls[2]); + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/test=4,5,6,http://localhost:7001/test=1,2,3,http://wiki.onap.org/test=7,8,9,10"); - assertEquals("https://wiki.onap.org/test=4,5,6",urls[0]); - assertEquals("http://localhost:7001/test=1,2,3",urls[1]); - assertEquals("http://wiki.onap.org/test=7,8,9,10",urls[2]); + assertEquals("https://wiki.onap.org/test=4,5,6", urls[0]); + assertEquals("http://localhost:7001/test=1,2,3", urls[1]); + assertEquals("http://wiki.onap.org/test=7,8,9,10", urls[2]); - urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,https://readthedocs.org/projects/onap/"); - assertEquals("https://wiki.onap.org/",urls[0]); - assertEquals("https://readthedocs.org/projects/onap/",urls[1]); + urls = RestapiCallNode.getMultipleUrls("https://wiki.onap.org/,https://readthedocs.org/projects/onap/"); + assertEquals("https://wiki.onap.org/", urls[0]); + assertEquals("https://readthedocs.org/projects/onap/", urls[1]); } - + @Test - public void testContainsMultipleUrls() throws Exception{ + public void testContainsMultipleUrls() throws Exception { assertFalse(RestapiCallNode.containsMultipleUrls("https://wiki.onap.org/")); assertFalse(RestapiCallNode.containsMultipleUrls("http://wiki.onap.org/")); assertFalse(RestapiCallNode.containsMultipleUrls("http://localhost:8008/rest/restconf/data/abc:def/abc:action=Create,deviceType=Banana")); @@ -602,58 +602,53 @@ public class TestRestapiCallNode { } @Test - public void testKeepEmptyValue() throws Exception { - log.info("================= Testing keeping empty values ======================="); - - String template = "{\n" + - " \"name1\": \"value1\",\n" + - " \"name2\": ${empty},\n" + - " \"name3\": ${~empty},\n" + - " \"name4\": {\n" + - " \"name41\": \"value41\",\n" + - " \"name42\": ${~empty},\n" + - " \"name43\": ${~not_empty}\n" + - " },\n" + - " \"name5\": {\n"+ - " \"name51\": ${~empty},\n"+ - " \"name52\": ${empty}\n"+ - " },\n" + - " \"name6\": {\n"+ - " \"name61\": ${empty},\n"+ - " \"name62\": ${empty}\n"+ - " },\n" + - " \"name7\": \"${\"not_empty}\",\n" + - " \"name8\": \"${~\"not_empty}\",\n" + - " \"name9\": \"${\"empty}\",\n" + - " \"name10\": \"${~\"empty}\"\n" + - "}"; - - String expect = "{\n" + - " \"name1\": \"value1\",\n" + - " \"name3\": \"\",\n" + - " \"name4\": {\n" + - " \"name41\": \"value41\",\n" + - " \"name42\": \"\",\n" + - " \"name43\": \"some value\"\n" + - " },\n" + - " \"name5\": {\n" + - " \"name51\": \"\"\n" + - " },\n" + - " \"name7\": \"some value\",\n" + - " \"name8\": \"some value\",\n" + - " \"name10\": \"\"\n" + - "}"; + public void testKeepEmptyValueOrContainer() throws Exception { + log.info("================= Testing keeping empty value or container ======================="); + + String expect = "{\n" + + " \"name1\": \"value1\",\n" + + " \"name3\": \"\",\n" + + " \"name4\": {\n" + + " \"name41\": \"value41\",\n" + + " \"name42\": \"\",\n" + + " \"name43\": \"some value\"\n" + + " },\n" + + " \"name5\": {\n" + + " \"name51\": \"\"\n" + + " },\n" + + " \"name7\": \"some value\",\n" + + " \"name8\": \"some value\",\n" + + " \"name10\": \"\",\n" + + " \"list\": [\n" + + " \n" + + " {\n" + + " \"test1\": \"123\",\n" + + " \"container2\": {},\n" + + " \"container3\": {}\n" + + " },\n" + + " \n" + + " {\n" + + " \"test1\": \"456\",\n" + + " \"container2\": {},\n" + + " \"container3\": {}\n" + + " }\n" + + " ]\n" + + "}\n"; SvcLogicContext ctx = new SvcLogicContext(); ctx.setAttribute("empty", ""); ctx.setAttribute("not_empty", "some value"); - + ctx.setAttribute("tmp.list_length", "2"); + ctx.setAttribute("tmp.list[0]", "123"); + ctx.setAttribute("tmp.list[1]", "456"); + RestapiCallNode rcn = new RestapiCallNode(); - String req = rcn.buildXmlJsonRequest(ctx, template, Format.JSON); - + String req = rcn.buildXmlJsonRequest(ctx, rcn.readFile("src/test/resources/testEmptyValueNContainer.json"), Format.JSON); + log.info("Result:\n" + req); log.info("=================================================================="); assertEquals(expect, req); } + } diff --git a/plugins/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/plugins/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java deleted file mode 100755 index a130d4390..000000000 --- a/plugins/restapi-call-node/provider/src/test/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ /dev/null @@ -1,531 +0,0 @@ -/*- - * ============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.restapicall; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.HashMap; -import java.util.Map; -import org.junit.Rule; -import org.junit.Test; -import org.junit.contrib.java.lang.system.EnvironmentVariables; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestRestapiCallNode { - - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class); - @Rule - public EnvironmentVariables environmentVariables = new EnvironmentVariables(); - - - - @Test - public void testDelete() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - - Map<String, String> p = new HashMap<>(); - p.put("restapiUrl", "https://echo.getpostman.com/delete"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "pwd1"); - p.put("httpMethod", "delete"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testDeleteWithPayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - - ctx.setAttribute("prop.name", "site1"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/sdwan-site.json"); - p.put("restapiUrl", "https://echo.getpostman.com/delete"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "pwd1"); - p.put("httpMethod", "delete"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testJsonTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[1].clci", "clci"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[2].clci", "clci"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/test-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testInvalidRepeatTimes() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "a"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/test-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test(expected = SvcLogicException.class) - public void testInvalidTemplatePath() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resourcess/test-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test(expected = SvcLogicException.class) - public void testWithoutSkipSending() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/test-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "false"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - - @Test(expected = SvcLogicException.class) - public void testWithInvalidURI() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1"); - ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/test-template.json"); - p.put("restapiUrl", "http://echo. getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "false"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testVpnJsonTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001"); - ctx.setAttribute("prop.l3vpn.topology", "point_to_point"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l3smvpntemplate.json"); - p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services"); - p.put("restapiUser", "admin"); - p.put("restapiPassword", "admin123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testSiteJsonTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001"); - ctx.setAttribute("prop.l3vpn.topology", "point_to_point"); - - ctx.setAttribute("prop.l3vpn.site1_name", "10000000-0000-0000-0000-000000000002"); - ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003"); - ctx.setAttribute("prop.l3vpn.entry1-id", "1"); - ctx.setAttribute("prop.l3vpn.sna1_name", "10000000-0000-0000-0000-000000000004"); - ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e"); - ctx.setAttribute("prop.l3vpn.ac1_id", "a8098c1a-f86e-11da-bd1a-00112444be1b"); - ctx.setAttribute("prop.l3vpn.ac1-peer-ip", "192.168.1.1"); - ctx.setAttribute("prop.l3vpn.ac1-ip", "192.168.1.2"); - ctx.setAttribute("prop.l3vpn.sna1_svlan", "100"); - ctx.setAttribute("prop.l3vpn.ac1_protocol", "static"); - ctx.setAttribute("prop.l3vpn.sna1-route.ip-prefix", "192.168.1.1/24"); - ctx.setAttribute("prop.l3vpn.sna1-route.next-hop", "192.168.1.4"); - - ctx.setAttribute("prop.l3vpn.site2_name", "10000000-0000-0000-0000-000000000005"); - ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006"); - ctx.setAttribute("prop.l3vpn.entry2-id", "1"); - ctx.setAttribute("prop.l3vpn.sna2_name", "10000000-0000-0000-0000-000000000007"); - ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a"); - ctx.setAttribute("prop.l3vpn.ac2_id", "a8098c1a-f86e-11da-bd1a-00112444be1c"); - ctx.setAttribute("prop.l3vpn.ac2-peer-ip", "192.168.1.6"); - ctx.setAttribute("prop.l3vpn.ac2-ip", "192.168.1.5"); - ctx.setAttribute("prop.l3vpn.sna2_svlan", "200"); - ctx.setAttribute("prop.l3vpn.ac2_protocol", "bgp"); - ctx.setAttribute("prop.l3vpn.peer2-ip", "192.168.1.7"); - ctx.setAttribute("prop.l3vpn.ac2_protocol_bgp_as", "200"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l3smsitetemplate.json"); - p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/sites"); - p.put("restapiUser", "admin"); - p.put("restapiPassword", "admin123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testVrfJsonTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.l3vpn.vrf1-id", "10000000-0000-0000-0000-000000000007"); - ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003"); - ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e"); - ctx.setAttribute("prop.l3vpn.vrf2-id", "10000000-0000-0000-0000-000000000009"); - ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006"); - ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l3smvrftemplate.json"); - p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vrf-attributes"); - p.put("restapiUser", "admin"); - p.put("restapiPassword", "admin123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testDeleteVpnJsonTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001"); - ctx.setAttribute("prop.l3vpn.topology", "point_to_point"); - - Map<String, String> p = new HashMap<>(); - //p.put("templateFileName", "src/test/resources/l3smvpntemplate.json"); - p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services" - + "/vpnservice=10000000-0000-0000-0000-000000000001"); - p.put("restapiUser", "admin"); - p.put("restapiPassword", "admin123"); - p.put("format", "json"); - p.put("httpMethod", "delete"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testL2DciTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.dci-connects.id", "Id1"); - ctx.setAttribute("prop.dci-connects.name", "Name1"); - ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1"); - ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2"); - ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1"); - ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2"); - ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1"); - ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2"); - ctx.setAttribute("prop.dci-connects.vni", "1"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l2-dci-connects-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testL3DciTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.dci-connects.id", "Id1"); - ctx.setAttribute("prop.dci-connects.name", "Name1"); - ctx.setAttribute("prop.dci-connects.local_networks_length", "2"); - ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1"); - ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2"); - ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1"); - ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2"); - ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1"); - ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2"); - ctx.setAttribute("prop.dci-connects.vni", "1"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l3-dci-connects-template.json"); - p.put("restapiUrl", "http://echo.getpostman.com"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "abc123"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "response"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - - } - - @Test - public void testControllerTokenTemplate() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.user", "admin"); - ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.password", "admin123"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/actokentemplate.json"); - p.put("restapiUrl", "https://ipwan:18002/controller/v2/tokens"); - p.put("format", "json"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - - @Test - public void testDeleteNoneAsContentType() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - - Map<String, String> p = new HashMap<>(); - p.put("restapiUrl", "https://echo.getpostman.com/delete"); - p.put("restapiUser", "user1"); - p.put("restapiPassword", "pwd1"); - p.put("httpMethod", "delete"); - p.put("format", "none"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - - @Test - public void testPostNoneAsContentType() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001"); - ctx.setAttribute("prop.l3vpn.topology", "point_to_point"); - - Map<String, String> p = new HashMap<>(); - p.put("templateFileName", "src/test/resources/l3smvpntemplate.json"); - p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services"); - p.put("restapiUser", "admin"); - p.put("restapiPassword", "admin123"); - p.put("format", "none"); - p.put("httpMethod", "post"); - p.put("responsePrefix", "restapi-result"); - p.put("skipSending", "true"); - - RestapiCallNode rcn = new RestapiCallNode(); - rcn.sendRequest(p, ctx); - } - /* - * { - "partnerOne": { - "url": "http://localhost:7001" 4 http://uebsb93kcdc.it.att.com:3904", - "test": "/metrics" - }, - "partnerTwo": { - "url": "http://localhost:7002", - "user": "controller_user", - "password": "P@ssword", - "test": "/metrics" - }, - "partnerThree": { - "url": "http://localhost:7003", - "user": "controller_admin" - } -} - */ - @Test - public void testPartners() throws Exception{ - - environmentVariables.set("deployer_pass", "sdncp-123"); - assertEquals("sdncp-123", System.getenv("deployer_pass")); - - String partnerTwoKey = "partnerTwo"; - String partnerTwoUsername = "controller_user"; - String partnerTwoPassword = "P@ssword"; - - System.setProperty("SDNC_CONFIG_DIR", "src/test/resources"); - RestapiCallNode rcn = new RestapiCallNode(); - assertNull(rcn.partnerStore.get("partnerOne")); - PartnerDetails details = rcn.partnerStore.get(partnerTwoKey); - assertEquals(partnerTwoUsername,details.username); - assertEquals(partnerTwoPassword,details.password); - assertNull(rcn.partnerStore.get("partnerThree")); - - //In this scenario the caller expects username, password and url to be picked up from the partners json - Map<String, String> paramMap = new HashMap<String,String>(); - paramMap.put("partner", partnerTwoKey); - rcn.handlePartner(paramMap ); - assertEquals(partnerTwoUsername,paramMap.get(rcn.restapiUserKey)); - assertEquals(partnerTwoPassword,paramMap.get(rcn.restapiPasswordKey)); - assertEquals("http://localhost:7002",paramMap.get(rcn.restapiUrlString)); - - //In this scenario the caller expects username, password and url to be picked up from the partners json - //the provided suffix will be appended to the default url from the partners json - paramMap = new HashMap<String,String>(); - paramMap.put("partner", partnerTwoKey); - paramMap.put("restapiUrlSuffix", "/networking/v1/instance/3"); - rcn.handlePartner(paramMap); - p = new Parameters(); - RestapiCallNode.getParameters(paramMap, p); - assertEquals(partnerTwoUsername,p.restapiUser); - assertEquals(partnerTwoPassword,p.restapiPassword); - assertEquals("http://localhost:7002/networking/v1/instance/3",p.restapiUrl); - - paramMap = new HashMap<String, String>(); - paramMap.put("partner","partnerFour" ); - paramMap.put("httpMethod", "delete"); - paramMap.put("skipSending", "true"); - rcn.handlePartner(paramMap); - Parameters p = new Parameters(); - RestapiCallNode.getParameters(paramMap, p); - assertEquals(p.restapiPassword, "sdncp-123"); - assertEquals(p.restapiUser, "m30402@sdncp.att.com"); - assertEquals(p.restapiUrl, "http://localhost:7004"); - } - - @Test - public void retryPolicyBean() throws Exception { - Integer retries = 3; - String first = "http://localhost:7001"; - String second = "http://localhost:7001"; - - RetryPolicy p = new RetryPolicy(new String[] {first,second}, retries); - assertEquals(retries,p.getMaximumRetries()); - assertNotNull(p.getRetryMessage()); - String next = p.getNextHostName(); - assertEquals(second,next); - assertEquals(1,p.getRetryCount()); - next = p.getNextHostName(); - assertEquals(first,next); - assertEquals(2,p.getRetryCount()); - } -} diff --git a/plugins/restapi-call-node/provider/src/test/resources/testEmptyValueNContainer.json b/plugins/restapi-call-node/provider/src/test/resources/testEmptyValueNContainer.json new file mode 100644 index 000000000..b444e0e5b --- /dev/null +++ b/plugins/restapi-call-node/provider/src/test/resources/testEmptyValueNContainer.json @@ -0,0 +1,24 @@ +{ + "name1": "value1", + "name3": "", + "name4": { + "name41": "value41", + "name42": "", + "name43": "some value" + }, + "name5": { + "name51": "" + }, + "name7": "some value", + "name8": "some value", + "name10": "", + "list": [ + ${repeat:tmp.list_length: + { + "test1": ${tmp.list[${1}]}, + "container1": {}, + "container2": EMPTY_CONTAINER, + "container3": EMPTY_CONTAINER + }, + }] +} diff --git a/plugins/restconf-client/installer/pom.xml b/plugins/restconf-client/installer/pom.xml index 05783f120..5ab98e5fb 100755 --- a/plugins/restconf-client/installer/pom.xml +++ b/plugins/restconf-client/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restconf-client/pom.xml b/plugins/restconf-client/pom.xml index e37faf970..7c428f29f 100755 --- a/plugins/restconf-client/pom.xml +++ b/plugins/restconf-client/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/restconf-client/provider/pom.xml b/plugins/restconf-client/provider/pom.xml index d073bd820..fa55b7475 100755 --- a/plugins/restconf-client/provider/pom.xml +++ b/plugins/restconf-client/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> @@ -69,6 +69,16 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-parser-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-repo-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java index 4a2e18198..2e4a6c34c 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java @@ -87,8 +87,9 @@ import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.SchemaNode; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserException; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; + +import org.opendaylight.yangtools.yang.parser.api.YangParserException; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -185,7 +186,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { String pp = p.responsePrefix != null ? p.responsePrefix + '.' : ""; Map<String, String> props = new HashMap<>((Map)ctx.toProperties()); String uri = parseUrl(p.restapiUrl, p.httpMethod); - InstanceIdentifierContext<?> insIdCtx = getInsIdCtx(p, uri); + InstanceIdentifierContext insIdCtx = getInsIdCtx(p, uri); String req = null; if (p.httpMethod != GET && p.httpMethod != DELETE) { @@ -311,7 +312,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @return instance identifier context * @throws SvcLogicException when getting schema context fails */ - private InstanceIdentifierContext<?> getInsIdCtx(YangParameters params, + private InstanceIdentifierContext getInsIdCtx(YangParameters params, String uri) throws SvcLogicException { EffectiveModelContext context = getSchemaContext(params); @@ -394,7 +395,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @throws SvcLogicException when the data format type is wrong */ public String updateReq(String req, YangParameters p, - InstanceIdentifierContext<?> insIdCtx) + InstanceIdentifierContext insIdCtx) throws SvcLogicException { SchemaNode schemaNode = insIdCtx.getSchemaNode(); diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java index 134868c15..ee5dacdce 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java @@ -25,7 +25,6 @@ package org.onap.ccsdk.sli.plugins.restconfapicall; import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.getParameters; import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.parseParam; -import static org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forFile; import java.io.File; import java.io.IOException; import java.net.URI; @@ -39,10 +38,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.plugins.restapicall.HttpMethod; import org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.YangParameters; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.model.parser.api.YangParser; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserException; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; -import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException; +import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; +import org.opendaylight.yangtools.yang.parser.api.YangParser; +import org.opendaylight.yangtools.yang.parser.api.YangParserException; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; +import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException; /** * Utilities for restconf api call node. @@ -193,7 +193,7 @@ public final class RestconfApiUtils { YangParser parser = parserFactory.createParser(); for (File file : yangFiles) { try { - parser.addSource(forFile(file)); + parser.addSource(YangTextSchemaSource.forPath(file.toPath())); } catch (IOException | YangSyntaxErrorException e) { throw new SvcLogicException(YANG_FILE_ERR + e.getMessage(), e); } diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java index 9b0a31d09..efbbc0458 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java @@ -262,7 +262,7 @@ public final class MdsalPropertiesNodeUtils { String uri1 = uri.replaceAll(UNDERSCORE, COLON); try { - InstanceIdentifierContext<?> id = toInstanceIdentifier( + InstanceIdentifierContext id = toInstanceIdentifier( uri1, context, Optional.ofNullable(null)); return new SchemaPathHolder(id, uri1); } catch (IllegalArgumentException | RestconfDocumentedException @@ -335,7 +335,7 @@ public final class MdsalPropertiesNodeUtils { if (node.contains(UNDERSCORE)) { secondHalf = node.substring(values[0].length()+1); } - InstanceIdentifierContext<?> id; + InstanceIdentifierContext id; for (int i = 0; i< values.length-1; i++) { val = values[i]; val = firstHalf + val + COLON + secondHalf; diff --git a/plugins/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml b/plugins/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml index efa8fce9d..20a3ab2b5 100755 --- a/plugins/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml +++ b/plugins/restconf-client/provider/src/main/resources/org/opendaylight/blueprint/restconf-client-blueprint.xml @@ -30,7 +30,7 @@ <reference xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0" id="yangParserFactory" - interface="org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory" + interface="org.opendaylight.yangtools.yang.parser.api.YangParserFactory" ext:proxy-method="classes"/> diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfapicall/TestRestconfApiUtils.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfapicall/TestRestconfApiUtils.java index a76bb52bf..153f6c2ad 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfapicall/TestRestconfApiUtils.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfapicall/TestRestconfApiUtils.java @@ -6,8 +6,8 @@ import static org.junit.Assert.assertNull; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; -import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; +import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory; /*- * ============LICENSE_START======================================================= @@ -34,7 +34,7 @@ public class TestRestconfApiUtils { @Test public void testGetSchemaCtxFromDir() throws SvcLogicException { - YangParserFactory factory = new YangParserFactoryImpl(); + YangParserFactory factory = new DefaultYangParserFactory(); // Test with valid subdirectories diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java index 64173306d..02d52d215 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/TestRestconfDiscoveryNode.java @@ -29,7 +29,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode; import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode; -import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl; +import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory; import java.io.IOException; import java.net.URI; @@ -38,7 +38,7 @@ 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.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -107,7 +107,7 @@ public class TestRestconfDiscoveryNode { Map<String, String> p = new HashMap<>(); RestconfDiscoveryNode rdn = new RestconfDiscoveryNode( - new RestconfApiCallNode(new RestapiCallNode(), new YangParserFactoryImpl())); + new RestconfApiCallNode(new RestapiCallNode(), new DefaultYangParserFactory())); rdn.establishSubscription(p, ctx); } @@ -117,7 +117,7 @@ public class TestRestconfDiscoveryNode { ctx.setAttribute("restapi-result.response-code", "200"); ctx.setAttribute("response-code", "404"); RestconfDiscoveryNode rdn = new RestconfDiscoveryNode( - new RestconfApiCallNode(new RestapiCallNode(), new YangParserFactoryImpl())); + new RestconfApiCallNode(new RestapiCallNode(), new DefaultYangParserFactory())); assertThat(rdn.getResponseCode("restapi-result", ctx), is("200")); assertThat(rdn.getResponseCode(null, ctx), @@ -133,7 +133,7 @@ public class TestRestconfDiscoveryNode { ctx.setAttribute("ietf-subscribed-notifications:establish-subscripti" + "on.output.identifier", "89"); RestconfDiscoveryNode rdn = new RestconfDiscoveryNode( - new RestconfApiCallNode(new RestapiCallNode(), new YangParserFactoryImpl())); + new RestconfApiCallNode(new RestapiCallNode(), new DefaultYangParserFactory())); assertThat(rdn.getOutputIdentifier("restapi-result", ctx), is("89")); } @@ -144,7 +144,7 @@ public class TestRestconfDiscoveryNode { "futh9ho6eofy3wjsap7wqktemlqm4bbsmnar3vrtbyrzukbv5itd6m1cftldpjarny" + "le3sdcqq9hftc4lebz464b5ffxmlbvg9"; RestconfDiscoveryNode rdn = new RestconfDiscoveryNode( - new RestconfApiCallNode(new RestapiCallNode(), new YangParserFactoryImpl())); + new RestconfApiCallNode(new RestapiCallNode(), new DefaultYangParserFactory())); assertThat(rdn.getTokenId(customHttpHeaders), is("x-ik2ps4ikvzupbx0486ft1ebzs7rt85futh9ho6eofy3wjsap7wqkt" + diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java index a5353fad4..7f04bbaa9 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java @@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.plugins.restapicall.HttpResponse; import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode; import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; -import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; +import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.doReturn; @@ -94,7 +94,7 @@ public class DataFormatSerializerTest { p.put("responsePrefix", "response"); p.put("skipSending", "true"); restApi = new RestapiCallNode(); - parserFactory = new YangParserFactoryImpl(); + parserFactory = new DefaultYangParserFactory(); restconf = mock(RestconfApiCallNode.class); dfCaptor = new DfCaptor(); createMethodMocks(); diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java index 9abbb16b7..ca148033b 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java @@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.plugins.restapicall.HttpResponse; import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode; import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; -import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory; -import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl; +import org.opendaylight.yangtools.yang.parser.api.YangParserFactory; +import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.doReturn; @@ -83,7 +83,7 @@ public class IdentifierValidationTest { p.put("responsePrefix", "response"); p.put("skipSending", "true"); restApi = new RestapiCallNode(); - parserFactory = new YangParserFactoryImpl(); + parserFactory = new DefaultYangParserFactory(); restconf = mock(RestconfApiCallNode.class); dfCaptor = new DfCaptor(); createMethodMocks(); diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java index 2bcd45e2b..ff5871519 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java @@ -83,7 +83,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont1.cont2.ll3[1]", "abc"); params.put("test-yang_cont1.cont2.ll4[0]", "abc"); params.put("test-yang_cont1.cont2.ll4[1]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( @@ -293,7 +293,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont1.cont2.ll5[0]", "abc"); params.put("test-yang_cont1.cont2.ll5[1]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -401,7 +401,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont8.ll7[0]", "abc"); params.put("test-yang_cont8.ll7[1]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -460,7 +460,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont9.ll8[0]", "abc"); params.put("test-yang_cont9.cont11.leaf25", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -498,7 +498,7 @@ public final class PropertiesSerializerTest { Map<String, String> params = new HashMap<>(); params.put("test-yang_cont8.cont6.test-augment_leaf21", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -540,7 +540,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont13.leaf28", "abc"); params.put("test-yang_cont13.ll9[0]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -589,7 +589,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont9.cont11.cont13.list9[0].leaf27", "abc"); params.put("test-yang_cont9.cont11.cont13.leaf28", "abc"); params.put("test-yang_cont9.cont11.cont13.ll9[0]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -643,7 +643,7 @@ public final class PropertiesSerializerTest { params.put("test-augment_cont13.list9[0].leaf27", "abc"); params.put("test-augment_cont13.leaf28", "abc"); params.put("test-augment_cont13.ll9[0]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -695,7 +695,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont1.cont2.cont4.test-augment_cont13.leaf28", "abc"); params.put("test-yang_cont1.cont2.cont4.test-augment_cont13.ll9[0]", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -763,7 +763,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_create-sfc.input.cont13.ll9[0]", "abc"); params.put("test-yang_create-sfc.input.test-augment_leaf36", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -877,7 +877,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_create-sfc.output.cont13.ll9[0]", "abc"); params.put("test-yang_create-sfc.output.test-augment_leaf37", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -985,7 +985,7 @@ public final class PropertiesSerializerTest { params.put("test-yang_cont18.cont18.list12[1].list12[0].leaf36", "xyz"); params.put("test-yang_cont18.cont18.list12[1].list12[1].leaf36", "hey!"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -1056,7 +1056,7 @@ public final class PropertiesSerializerTest { params.put("leaf41", "hi"); params.put("test-yang_cont18.leaf41", "abc"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( iCtx.getSchemaNode(), context, uri); @@ -1078,7 +1078,7 @@ public final class PropertiesSerializerTest { params.put("identity-test_test.con1.interfaces.int-list[0].available.ll[0]", "identity-types:Loopback"); params.put("identity-test_test.con1.interfaces.int-list[0].available.leaf1", "identity-types-second:Ethernet"); params.put("identity-test_test.con1.interfaces.int-list[0].available.leaf2", "identity-types-second:iden2"); - InstanceIdentifierContext<?> iCtx = ParserIdentifier + InstanceIdentifierContext iCtx = ParserIdentifier .toInstanceIdentifier(uri, context, null); PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer( diff --git a/plugins/sshapi-call-node/installer/pom.xml b/plugins/sshapi-call-node/installer/pom.xml index 216c05590..ca96a0a6d 100755 --- a/plugins/sshapi-call-node/installer/pom.xml +++ b/plugins/sshapi-call-node/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/sshapi-call-node/pom.xml b/plugins/sshapi-call-node/pom.xml index 460608fe2..30d6b7818 100755 --- a/plugins/sshapi-call-node/pom.xml +++ b/plugins/sshapi-call-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/sshapi-call-node/provider/pom.xml b/plugins/sshapi-call-node/provider/pom.xml index 525ee363b..d57d5586e 100755 --- a/plugins/sshapi-call-node/provider/pom.xml +++ b/plugins/sshapi-call-node/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/template-node/installer/pom.xml b/plugins/template-node/installer/pom.xml index 80792bac6..a3d443c7b 100644 --- a/plugins/template-node/installer/pom.xml +++ b/plugins/template-node/installer/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/template-node/pom.xml b/plugins/template-node/pom.xml index 5d8f79337..fddc9bce6 100644 --- a/plugins/template-node/pom.xml +++ b/plugins/template-node/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> diff --git a/plugins/template-node/provider/pom.xml b/plugins/template-node/provider/pom.xml index 65d6975f6..73fb88e17 100644 --- a/plugins/template-node/provider/pom.xml +++ b/plugins/template-node/provider/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.3.3</version> + <version>2.4.1</version> </parent> <groupId>org.onap.ccsdk.sli.plugins</groupId> |