summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
Diffstat (limited to 'lcm')
-rw-r--r--lcm/model/src/main/yang/lcm.yang25
-rw-r--r--lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java21
-rw-r--r--lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java36
-rw-r--r--lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml30
-rw-r--r--lcm/provider/src/test/resources/graphs/lcm/graph.versions1
5 files changed, 113 insertions, 0 deletions
diff --git a/lcm/model/src/main/yang/lcm.yang b/lcm/model/src/main/yang/lcm.yang
index 9976dd9e..a03fff60 100644
--- a/lcm/model/src/main/yang/lcm.yang
+++ b/lcm/model/src/main/yang/lcm.yang
@@ -111,6 +111,7 @@ module LCM {
enum "StartApplication";
enum "QuiesceTraffic";
enum "ResumeTraffic";
+ enum "DistributeTraffic";
enum "UpgradePreCheck";
enum "UpgradeSoftware";
enum "UpgradePostCheck";
@@ -517,6 +518,30 @@ module LCM {
}
/**********************************************************************************
+ * Define the VNF distribute traffic service
+ **********************************************************************************/
+ rpc distribute-traffic {
+ description "An operation to distribute traffic gracefully on the VF.
+ It distributes traffic gracefully without stopping the application";
+ input {
+ uses common-header;
+ leaf action {
+ type action;
+ mandatory true;
+ }
+ uses action-identifiers;
+ leaf payload {
+ type payload;
+ mandatory true;
+ }
+ }
+ output {
+ uses common-header;
+ uses status;
+ }
+ }
+
+ /**********************************************************************************
* Define the VNF UpgradePreCheck service
**********************************************************************************/
rpc upgrade-pre-check {
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 787a94e2..939836be 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
@@ -351,6 +351,27 @@ public class LcmProvider implements AutoCloseable, LCMService {
}
@Override
+ public Future<RpcResult<DistributeTrafficOutput>> distributeTraffic(DistributeTrafficInput input) {
+ DistributeTrafficInputBuilder iBuilder = new DistributeTrafficInputBuilder(input);
+ DistributeTrafficOutputBuilder oBuilder = new DistributeTrafficOutputBuilder();
+
+ try {
+ CommonLcmFields retval = callDG("distribute-traffic", iBuilder.build());
+ oBuilder.setStatus(retval.getStatusBuilder().build());
+ oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+ } catch (LcmRpcInvocationException e) {
+ LOG.debug("Caught exception", e);
+ oBuilder.setCommonHeader(e.getCommonHeader());
+ oBuilder.setStatus(e.getStatus());
+ }
+
+ RpcResult<DistributeTrafficOutput> rpcResult =
+ RpcResultBuilder.<DistributeTrafficOutput> status(true).withResult(oBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
public Future<RpcResult<ConfigureOutput>> configure(ConfigureInput input) {
ConfigureInputBuilder iBuilder = new ConfigureInputBuilder(input);
ConfigureOutputBuilder oBuilder = new ConfigureOutputBuilder();
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 38920e0b..234eb615 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
@@ -73,6 +73,8 @@ 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.ConfigureOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckInputBuilder;
@@ -527,6 +529,40 @@ public class TestLcmProvider {
}
@Test
+ public void testDistributeTraffic() {
+ DistributeTrafficInputBuilder builder = new DistributeTrafficInputBuilder();
+
+ 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.DistributeTraffic);
+ builder.setPayload(mock(Payload.class));
+
+
+ try {
+ DistributeTrafficOutput results = provider.distributeTraffic(builder.build()).get().getResult();
+ LOG.info("DistributeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
+ assert(results.getStatus().getCode() == 400);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Caught exception", e);
+ fail("DistributeTraffic threw exception");
+ }
+ }
+
+ @Test
public void testConfigure() {
ConfigureInputBuilder builder = new ConfigureInputBuilder();
diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml
new file mode 100644
index 00000000..14ff1134
--- /dev/null
+++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.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='distribute-traffic' 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 4ca21daf..233aa459 100644
--- a/lcm/provider/src/test/resources/graphs/lcm/graph.versions
+++ b/lcm/provider/src/test/resources/graphs/lcm/graph.versions
@@ -27,6 +27,7 @@ LCM stop-application 1.0.0 sync
LCM start-application 1.0.0 sync
LCM quiesce-traffic 1.0.0 sync
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 upgrade-post-check 1.0.0 sync