summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.so/src/main
diff options
context:
space:
mode:
authorzhaoyh6 <zhaoyh6@asiainfo.com>2022-03-01 14:58:07 +0800
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2022-03-10 15:09:32 +0000
commit448c221502fac54c52e088caca56b9aa45797ef7 (patch)
treed7504ea0c277055042b91cd2cb61b820e5c8eecd /models-interactions/model-actors/actor.so/src/main
parentbf4c0bd31b6045a25ecf24b9508bc256cb724b20 (diff)
Closed loop operation guarantee for ccvpn
Issue-ID: REQ-1074 Signed-off-by: zhaoyh6 <zhaoyh6@asiainfo.com> Change-Id: Ib2c60a1e5ebd1fda5e04e75c265e863733caa278
Diffstat (limited to 'models-interactions/model-actors/actor.so/src/main')
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java79
-rw-r--r--models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java2
2 files changed, 81 insertions, 0 deletions
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java
new file mode 100644
index 000000000..48e20e309
--- /dev/null
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2022 CTC, Inc. and others. 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.policy.controlloop.actor.so;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import org.onap.policy.common.endpoints.event.comm.Topic;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
+import org.onap.policy.so.SoRequestCll;
+
+public class ModifyCll extends SoOperation {
+ public static final String NAME = "ModifyCloudLeasedLine";
+
+ private static final List<String> PROPERTY_NAMES = List.of(
+ OperationProperties.EVENT_PAYLOAD);
+
+ /**
+ * Constructs the object.
+ *
+ * @param params operation parameters
+ * @param config configuration for this operation
+ */
+ public ModifyCll(ControlLoopOperationParams params, HttpPollingConfig config) {
+ super(params, config, PROPERTY_NAMES);
+ }
+
+ @Override
+ protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
+
+ SoRequestCll soRequest = makeRequest();
+
+ String path = getPath();
+ String url = getClient().getBaseUrl() + path;
+
+ String strRequest = prettyPrint(soRequest);
+ logMessage(NetLoggerUtil.EventType.OUT, Topic.CommInfrastructure.REST, url, strRequest);
+
+ Entity<String> entity = Entity.entity(strRequest, MediaType.APPLICATION_JSON);
+ Map<String, Object> headers = createSimpleHeaders();
+
+ return handleResponse(outcome, url, callback -> getClient().put(callback, path, entity, headers));
+ }
+
+ protected SoRequestCll makeRequest() {
+
+ String payload = getRequiredProperty(OperationProperties.EVENT_PAYLOAD, "event payload");
+ try {
+ return getCoder().convert(payload, SoRequestCll.class);
+ } catch (CoderException e) {
+ throw new IllegalArgumentException("invalid payload value: " + payload, e);
+ }
+ }
+}
diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java
index 195fbcb96..f1505ed46 100644
--- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java
+++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActor.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2020 Wipro Limited.
+ * Modifications Copyright (C) 2022 CTC, Inc. and others.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,5 +39,6 @@ public class SoActor extends HttpActor<HttpPollingActorParams> {
addOperator(new HttpPollingOperator(NAME, VfModuleCreate.NAME, VfModuleCreate::new));
addOperator(new HttpPollingOperator(NAME, VfModuleDelete.NAME, VfModuleDelete::new));
addOperator(new HttpPollingOperator(NAME, ModifyNssi.NAME, ModifyNssi::new));
+ addOperator(new HttpPollingOperator(NAME, ModifyNssi.NAME, ModifyCll::new));
}
}