summaryrefslogtreecommitdiffstats
path: root/lcm/provider
diff options
context:
space:
mode:
Diffstat (limited to 'lcm/provider')
-rw-r--r--lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java48
-rw-r--r--lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java72
-rw-r--r--lcm/provider/src/test/resources/graphs/lcm/LCM_activate-ne-sw.xml30
-rw-r--r--lcm/provider/src/test/resources/graphs/lcm/LCM_download-ne-sw.xml30
-rw-r--r--lcm/provider/src/test/resources/graphs/lcm/graph.versions2
5 files changed, 182 insertions, 0 deletions
diff --git a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
index 0074dfc65..6fd494360 100644
--- a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
+++ b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
@@ -761,6 +761,54 @@ public class LcmProvider implements AutoCloseable, LCMService {
}
@Override
+ public ListenableFuture<RpcResult<DownloadNeSwOutput>> downloadNeSw(DownloadNeSwInput input) {
+ DownloadNeSwInputBuilder iBuilder = new DownloadNeSwInputBuilder(input);
+ DownloadNeSwOutputBuilder oBuilder = new DownloadNeSwOutputBuilder();
+
+ try {
+ CommonLcmFields retval = callDG("download-ne-sw", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ if (retval.getPayload() != null) {
+ oBuilder.setPayload(retval.getPayload());
+ }
+ } catch (LcmRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<DownloadNeSwOutput> rpcResult =
+ RpcResultBuilder.<DownloadNeSwOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<ActivateNeSwOutput>> activateNeSw(ActivateNeSwInput input) {
+ ActivateNeSwInputBuilder iBuilder = new ActivateNeSwInputBuilder(input);
+ ActivateNeSwOutputBuilder oBuilder = new ActivateNeSwOutputBuilder();
+
+ try {
+ CommonLcmFields retval = callDG("activate-ne-sw", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ if (retval.getPayload() != null) {
+ oBuilder.setPayload(retval.getPayload());
+ }
+ } catch (LcmRpcInvocationException e) {
+ LOG.debug(exceptionMessage, e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<ActivateNeSwOutput> rpcResult =
+ RpcResultBuilder.<ActivateNeSwOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
public ListenableFuture<RpcResult<StopOutput>> stop(StopInput input) {
StopInputBuilder iBuilder = new StopInputBuilder(input);
StopOutputBuilder oBuilder = new StopOutputBuilder();
diff --git a/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java b/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
index 8e82ccadf..e0d8e577e 100644
--- a/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
+++ b/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
@@ -106,6 +106,10 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNeSwInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNeSwOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNeSwInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNeSwOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ZULU;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.action.identifiers.ActionIdentifiersBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder;
@@ -1151,6 +1155,74 @@ public class TestLcmProvider {
}
@Test
+ public void testDownloadNeSw() {
+ DownloadNeSwInputBuilder builder = new DownloadNeSwInputBuilder();
+
+ CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder();
+ hdrBuilder.setApiVer("1");
+ hdrBuilder.setFlags(null);
+ hdrBuilder.setOriginatorId("jUnit");
+ hdrBuilder.setRequestId("123");
+ hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date())));
+ builder.setCommonHeader(hdrBuilder.build());
+
+ ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder();
+ aBuilder.setServiceInstanceId("SVCID-123");
+ aBuilder.setVfModuleId("vf-module-1");
+ aBuilder.setVnfcName("my-vnfc");
+ aBuilder.setVnfId("123");
+ aBuilder.setVserverId("123");
+ builder.setActionIdentifiers(aBuilder.build());
+
+ builder.setAction(Action.DownloadNeSw);
+ builder.setPayload(mock(Payload.class));
+
+
+ try {
+ DownloadNeSwOutput results = provider.downloadNeSw(builder.build()).get().getResult();
+ LOG.info("DownloadNeSw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
+ assert(results.getStatus().getCode() == 400);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Caught exception", e);
+ fail("DownloadNeSw threw exception");
+ }
+ }
+
+ @Test
+ public void testActivateNeSw() {
+ ActivateNeSwInputBuilder builder = new ActivateNeSwInputBuilder();
+
+ CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder();
+ hdrBuilder.setApiVer("1");
+ hdrBuilder.setFlags(null);
+ hdrBuilder.setOriginatorId("jUnit");
+ hdrBuilder.setRequestId("123");
+ hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date())));
+ builder.setCommonHeader(hdrBuilder.build());
+
+ ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder();
+ aBuilder.setServiceInstanceId("SVCID-123");
+ aBuilder.setVfModuleId("vf-module-1");
+ aBuilder.setVnfcName("my-vnfc");
+ aBuilder.setVnfId("123");
+ aBuilder.setVserverId("123");
+ builder.setActionIdentifiers(aBuilder.build());
+
+ builder.setAction(Action.ActivateNeSw);
+ builder.setPayload(mock(Payload.class));
+
+
+ try {
+ ActivateNeSwOutput results = provider.activateNeSw(builder.build()).get().getResult();
+ LOG.info("ActivateNeSw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
+ assert(results.getStatus().getCode() == 400);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Caught exception", e);
+ fail("ActivateNeSw threw exception");
+ }
+ }
+
+ @Test
public void testStop() {
StopInputBuilder builder = new StopInputBuilder();
diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-ne-sw.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-ne-sw.xml
new file mode 100644
index 000000000..99f74b6e9
--- /dev/null
+++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-ne-sw.xml
@@ -0,0 +1,30 @@
+<!--
+ ============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=========================================================
+ -->
+
+<service-logic xmlns="http://www.onap.org/sdnc/svclogic"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd"
+ module='LCM' version='1.0.0'>
+ <method rpc='activate-ne-sw' mode='sync'>
+ <set>
+ <parameter name='status.code' value='400' />
+ <parameter name='status.message' value='SUCCESS' />
+ </set>
+ </method>
+</service-logic>
diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_download-ne-sw.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_download-ne-sw.xml
new file mode 100644
index 000000000..fd586cce5
--- /dev/null
+++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_download-ne-sw.xml
@@ -0,0 +1,30 @@
+<!--
+ ============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=========================================================
+ -->
+
+<service-logic xmlns="http://www.onap.org/sdnc/svclogic"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd"
+ module='LCM' version='1.0.0'>
+ <method rpc='download-ne-sw' mode='sync'>
+ <set>
+ <parameter name='status.code' value='400' />
+ <parameter name='status.message' value='SUCCESS' />
+ </set>
+ </method>
+</service-logic>
diff --git a/lcm/provider/src/test/resources/graphs/lcm/graph.versions b/lcm/provider/src/test/resources/graphs/lcm/graph.versions
index 233aa459f..466be55b6 100644
--- a/lcm/provider/src/test/resources/graphs/lcm/graph.versions
+++ b/lcm/provider/src/test/resources/graphs/lcm/graph.versions
@@ -30,6 +30,8 @@ LCM resume-traffic 1.0.0 sync
LCM distribute-traffic 1.0.0 sync
LCM upgrade-pre-check 1.0.0 sync
LCM upgrade-software 1.0.0 sync
+LCM download-ne-sw 1.0.0 sync
+LCM activate-ne-sw 1.0.0 sync
LCM upgrade-post-check 1.0.0 sync
LCM upgrade-backup 1.0.0 sync
LCM upgrade-backout 1.0.0 sync