summaryrefslogtreecommitdiffstats
path: root/lcm/provider/src/test/java
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2019-12-04 21:14:48 +0800
committerEnbo Wang <wangenbo@huawei.com>2019-12-04 21:14:48 +0800
commit1ee69b1f0a3fde8d77393f541b12ff6daee11600 (patch)
treee621b1abd37834b8791a504ff99b7ab689610165 /lcm/provider/src/test/java
parent32dab99f3a01cedb20b6af8b85343c61fbd7a6fb (diff)
Add LCM APIs for DownloadNeSw and ActivateNeSw actions
Add two LCM APIs of DownloadNeSw and ActivateNeSw for PNF Software Upgrade. Change-Id: I5a8f143c2d7d54fd96772eeb1d31b2d2e8bfb523 Issue-ID: SDNC-856 Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Diffstat (limited to 'lcm/provider/src/test/java')
-rw-r--r--lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java72
1 files changed, 72 insertions, 0 deletions
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();