diff options
8 files changed, 369 insertions, 9 deletions
diff --git a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java index ac046188..7a25e77b 100644 --- a/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java +++ b/fabric-discovery-plugin/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/fabricdiscovery/TestFabricDiscoveryPlugin.java @@ -55,4 +55,25 @@ public class TestFabricDiscoveryPlugin { } } + @Test + public void validateParameterEnableFailure() throws Exception { + SvcLogicContext ctx = new SvcLogicContext(); + String stream = C_STREAM; + final String W_ENABLE_STR = "bad enable parameter"; + + Map<String, String> p = new HashMap<>(); + p.put("stream", stream); + p.put("enable", W_ENABLE_STR); + + FabricDiscoveryPlugin fdp = new FabricDiscoveryPlugin(); + try { + fdp.processDcNotificationStream(p, ctx); + LOG.info("Connection to Stream:{} succeeded.", stream); + } catch (Exception e) { + LOG.info("Received Exception while connecting to Fabric Discovery notification server: {}", e.getMessage()); + } finally { + Assert.assertEquals("Failure", ctx.getAttribute(FB_DISCOVERY_STATUS)); + } + } + } diff --git a/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json new file mode 100644 index 00000000..f1807568 --- /dev/null +++ b/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * 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========================================================= + */ + +{ + "l2-dci-connect": { + "id": ${prop.dci-connects.id}, + "name": ${prop.dci-connects.name}, + "description": ${prop.dci-connects.description}, + "network_id": ${prop.dci-connects.local_networks[0]}, + "evpn_irts": ${prop.dci-connects.evpn_irts}, + "evpn_erts": ${prop.dci-connects.evpn_erts}, + "vni": ${prop.dci-connects.vni} + } +} diff --git a/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json b/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json index 3f0e2030..c011b077 100644 --- a/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json +++ b/restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json @@ -20,15 +20,15 @@ { "l3-dci-connect": { - "id": "${prop.l3-dci-connects.id}", - "name": "${prop.l3-dci-connects.name}", - "description": "${prop.l3-dci-connects.description}", - "router_id": "${prop.l3-dci-connects.router_id}", + "id": ${prop.dci-connects.id}, + "name": ${prop.dci-connects.name}, + "description": ${prop.dci-connects.description}, + "router_id": ${prop.dci-connects.router_id}, "firewall_enable": false, - "local_networks": ["${prop.l3-dci-connects.local_networks}"], + "local_networks": ${prop.dci-connects.local_networks}, "local_network_all": false, - "evpn_irts": ["${prop.l3-dci-connects.evpn_irts}"], - "evpn_erts": ["${prop.l3-dci-connects.evpn_erts}"], - "l3_vni": "${prop.l3-dci-connects.l3_vni}" + "evpn_irts": ${prop.dci-connects.evpn_irts}, + "evpn_erts": ${prop.dci-connects.evpn_erts}, + "l3_vni": ${prop.dci-connects.vni} } } diff --git a/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json b/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json new file mode 100644 index 00000000..e7b56928 --- /dev/null +++ b/restapi-call-node/provider/src/main/resources/l3smsitetemplate.json @@ -0,0 +1,164 @@ +/*- + * ============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========================================================= + */ + +[ + { + "site-id": ${prop.l3vpn.site1_name}, + "vpn-policies": { + "vpn-policy": [ + { + "vpn-policy-id": ${prop.l3vpn.vpn-policy1-id}, + "entries": [ + { + "id": ${prop.l3vpn.entry1-id}, + "vpn": { + "vpn-id": ${prop.l3vpn.name}, + "site-role": "huawei-ac-net-l3vpn-svc:any-to-any-role" + } + } + ] + } + ] + }, + "site-network-accesses": { + "site-network-access": [ + { + "site-network-access-id": ${prop.l3vpn.sna1_name}, + "bearer": { + "appointed-access": { + "ne-id": ${prop.l3vpn.pe1_id}, + "ltp-id": ${prop.l3vpn.ac1_id}, + "vlan": { + "type": "huawei-ac-net-l3vpn-svc:vlan-dot1q", + "vlan-id": ${prop.l3vpn.sna1_svlan} + } + } + }, + "ip-connection": { + "ipv4": { + "address-allocation-type": "huawei-ac-net-l3vpn-svc:static-address", + "addresses": { + "provider-address": ${prop.l3vpn.ac1-peer-ip}, + "customer-address": ${prop.l3vpn.ac1-ip}, + "mask": "24" + } + } + }, + "service": { + "mtu": "1500" + }, + "routing-protocols": { + "routing-protocol": [ + { + "type": "huawei-ac-net-l3vpn-svc:static", + "static": { + "cascaded-lan-prefixes": [ + { + "ipv4-lan-prefixes": [ + { + "ip-prefix": ${prop.l3vpn.sna1-route}, + "next-hop": ${prop.l3vpn.sna1-route} + } + ] + } + ] + } + } + ] + }, + "vpn-attachment": { + "vpn-policy-id": ${prop.l3vpn.name} + } + } + ] + }, + { + "site-id": ${prop.l3vpn.site2_name}, + "vpn-policies": { + "vpn-policy": [ + { + "vpn-policy-id": ${prop.l3vpn.vpn-policy2-id}, + "entries": [ + { + "id": ${prop.l3vpn.entry2-id}, + "vpn": { + "vpn-id": ${prop.l3vpn.name}, + "site-role": "huawei-ac-net-l3vpn-svc:any-to-any-role" + } + } + ] + } + ] + }, + "site-network-accesses": { + "site-network-access": [ + { + "site-network-access-id": ${prop.l3vpn.sna2_name}, + "bearer": { + "appointed-access": { + "ne-id": ${prop.l3vpn.pe2_id}, + "ltp-id": ${prop.l3vpn.ac2_id}, + "vlan": { + "type": "huawei-ac-net-l3vpn-svc:vlan-dot1q", + "vlan-id": ${prop.l3vpn.sna2_svlan} + } + } + }, + "ip-connection": { + "ipv4": { + "address-allocation-type": "huawei-ac-net-l3vpn-svc:static-address", + "addresses": { + "provider-address": ${prop.l3vpn.ac2-peer-ip}, + "customer-address": ${prop.l3vpn.ac2-ip}, + "mask": "24" + } + } + }, + "service": { + "mtu": "1500" + }, + "routing-protocols": { + "routing-protocol": [ + { + "type": "huawei-ac-net-l3vpn-svc:static", + "static": { + "cascaded-lan-prefixes": [ + { + "ipv4-lan-prefixes": [ + { + "ip-prefix": ${prop.l3vpn.sna2-route}, + "next-hop": ${prop.l3vpn.sna2-route} + } + ] + } + ] + } + } + ] + }, + "vpn-attachment": { + "vpn-policy-id": ${prop.l3vpn.name} + } + } + ] + } +] + diff --git a/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json b/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json new file mode 100644 index 00000000..c0a7c192 --- /dev/null +++ b/restapi-call-node/provider/src/main/resources/l3smvpntemplate.json @@ -0,0 +1,28 @@ +/*- + * ============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========================================================= + */ + +{ + "vpn-id": ${prop.l3vpn.name}, + "customer-name": "huawei", + "vpn-service-topology": ${prop.l3vpn.topology}, + "route-exchange-policy": "huawei-ac-net-l3vpn-svc:vpnv4-way" +} + diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 2d3b4010..1dcc97bc 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -23,7 +23,6 @@ package jtest.org.onap.ccsdk.sli.plugins.restapicall; import java.util.HashMap; import java.util.Map; - import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -255,4 +254,60 @@ public class TestRestapiCallNode { 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<String, String>(); + 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<String, String>(); + 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); + + } } diff --git a/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json new file mode 100644 index 00000000..f1807568 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * 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========================================================= + */ + +{ + "l2-dci-connect": { + "id": ${prop.dci-connects.id}, + "name": ${prop.dci-connects.name}, + "description": ${prop.dci-connects.description}, + "network_id": ${prop.dci-connects.local_networks[0]}, + "evpn_irts": ${prop.dci-connects.evpn_irts}, + "evpn_erts": ${prop.dci-connects.evpn_erts}, + "vni": ${prop.dci-connects.vni} + } +} diff --git a/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json new file mode 100644 index 00000000..c011b077 --- /dev/null +++ b/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * Copyright (C) 2017 Intel Corp. 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========================================================= + */ + +{ + "l3-dci-connect": { + "id": ${prop.dci-connects.id}, + "name": ${prop.dci-connects.name}, + "description": ${prop.dci-connects.description}, + "router_id": ${prop.dci-connects.router_id}, + "firewall_enable": false, + "local_networks": ${prop.dci-connects.local_networks}, + "local_network_all": false, + "evpn_irts": ${prop.dci-connects.evpn_irts}, + "evpn_erts": ${prop.dci-connects.evpn_erts}, + "l3_vni": ${prop.dci-connects.vni} + } +} |