aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java
diff options
context:
space:
mode:
authorReshmasree <reshmasree.chamarthi2@wipro.com>2020-09-02 08:30:19 -0700
committerReshmasree <reshmasree.chamarthi2@wipro.com>2020-09-06 06:10:28 -0700
commit521f95dfd4328eeb4c1634317ed33888ba7cc5a0 (patch)
treefd92317d8fb88523583e2d1fef2059d3870e5cad /bpmn/MSOCommonBPMN/src/main/java
parentf99da95f1f808d05e25e041e84e030612a43561d (diff)
Implement subprocess for calling SDNR from RAN NSSMF
-Also added common methods in oofUtils Issue-ID: SO-3215 Signed-off-by: Reshmasree <reshmasree.chamarthi2@wipro.com> Change-Id: Id85112db648f6607d7075da857a45e1ed5ca23ec
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java76
2 files changed, 138 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java
new file mode 100644
index 0000000000..0f35b38f72
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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.so.client.dmaapproperties;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class SdnrDmaapPublisher extends DmaapPublisher {
+
+
+ public SdnrDmaapPublisher() throws IOException {
+ super();
+ }
+
+ @Override
+ public String getAuth() {
+
+ return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
+ }
+
+ @Override
+ public String getKey() {
+
+ return UrnPropertiesReader.getVariable("mso.msoKey");
+ }
+
+ @Override
+ public String getTopic() {
+ return UrnPropertiesReader.getVariable("sdnc.dmaap.publisher.topic");
+ }
+
+ @Override
+ public Optional<String> getHost() {
+ return Optional.ofNullable(UrnPropertiesReader.getVariable("sdnc.dmaap.host"));
+ }
+}
+
+
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java
new file mode 100644
index 0000000000..d9656f7ea2
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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.so.client.sdnc.common;
+
+import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank;
+import javax.inject.Provider;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaapproperties.SdnrDmaapPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component("SendRequestToSdnr")
+public class SendRequestToSdnr implements JavaDelegate {
+ private static final Logger logger = LoggerFactory.getLogger(SendRequestToSdnr.class);
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ @Autowired
+ private Provider<SdnrDmaapPublisher> sdnrDmaapPublisher;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+
+ logger.debug("SendRequestToSdnr_start");
+
+ String requestId = (String) execution.getVariable("correlator");
+ if (isBlank(requestId)) {
+ String msg = "Cannot process SDNR Request : correlator is null";
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+ }
+
+ String messageType = (String) execution.getVariable("messageType");
+ if (isBlank(messageType)) {
+ String msg = "Cannot process SDNR Request : messageType is null";
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+ }
+
+ String timeout = (String) execution.getVariable("timeout");
+ if (isBlank(timeout)) {
+ timeout = UrnPropertiesReader.getVariable("sdnc.dmaap.callback.timeout", execution);
+ if (isBlank(timeout)) {
+ logger.debug("Setting SDNR timeout to default : PT30M");
+ timeout = "PT30M";
+ }
+ }
+ logger.debug("Async Callback Timeout will be: " + timeout);
+ String msg = (String) execution.getVariable("sdnrRequest");
+ logger.debug("msg to be sent on dmaap " + msg);
+ sdnrDmaapPublisher.get().send(msg);
+
+ }
+}
+
+