aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-05 11:58:19 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-05 11:58:19 +0000
commitc3f8dd9e309bcbf2c466e551f3c03125e5d3bbb3 (patch)
treea753fd4f96f54e7c3a86e2f57a9c2a04181e237e /controlloop/common
parent07e29100f99036fe7170b7ff43dca651983b888d (diff)
parentc4c99f0d6cb5eeb7475ccac5c00c960b1d8f83ed (diff)
Merge "Add CCVPN Bandwidth on demand policy"
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java84
-rw-r--r--controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java19
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java6
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/feature/bin/create-cl-usecases21
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/feature/bin/push-policies-usecases13
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java23
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java54
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java50
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java43
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java43
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java4
-rw-r--r--controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java11
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java22
13 files changed, 368 insertions, 25 deletions
diff --git a/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java b/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java
index b9eaf7ed4..ab6a77813 100644
--- a/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java
+++ b/controlloop/common/actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* SdncActorServiceProvider
* ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.
@@ -37,6 +37,11 @@ import org.onap.policy.sdnc.SdncHealRequest;
import org.onap.policy.sdnc.SdncHealRequestHeaderInfo;
import org.onap.policy.sdnc.SdncHealRequestInfo;
import org.onap.policy.sdnc.SdncHealServiceInfo;
+import org.onap.policy.sdnc.SdncHealVfModuleParameter;
+import org.onap.policy.sdnc.SdncHealVfModuleParametersInfo;
+import org.onap.policy.sdnc.SdncHealVfModuleRequestInput;
+import org.onap.policy.sdnc.SdncHealVnfInfo;
+
import org.onap.policy.sdnc.SdncRequest;
import org.slf4j.Logger;
@@ -55,6 +60,9 @@ public class SdncActorServiceProvider implements Actor {
// Strings for recipes
private static final String RECIPE_REROUTE = "Reroute";
+ // Strings for recipes
+ private static final String RECIPE_BW_ON_DEMAND = "BandwidthOnDemand";
+
private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_REROUTE);
private static final ImmutableMap<String, List<String>> targets =
new ImmutableMap.Builder<String, List<String>>().put(RECIPE_REROUTE, ImmutableList.of(TARGET_VM)).build();
@@ -81,34 +89,92 @@ public class SdncActorServiceProvider implements Actor {
/**
* Construct a request.
- *
+ *
* @param onset the onset event
* @param operation the control loop operation
* @param policy the policy
* @return the constructed request
*/
- public static SdncRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
+ public SdncRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
Policy policy) {
+ switch (policy.getRecipe()) {
+ case RECIPE_REROUTE:
+ return constructReOptimizeRequest(onset);
+ case RECIPE_BW_ON_DEMAND:
+ logger.info("Construct request for receipe {}" , RECIPE_BW_ON_DEMAND);
+ return constructBwOnDemandRequest(onset);
+ default:
+ logger.info("Unsupported recipe {} " + policy.getRecipe());
+ return null;
+ }
+ }
- if (!policy.getRecipe().equalsIgnoreCase(RECIPE_REROUTE)) {
+ private SdncRequest constructBwOnDemandRequest(VirtualControlLoopEvent onset) {
+ // Construct an Sdnc request
+ String serviceInstance = onset.getAai().get("service-instance.service-instance-id");
+ if (serviceInstance == null || serviceInstance.isEmpty()) {
+ // This indicates that AAI Enrichment needs to be done by event producer.
return null;
}
+ SdncHealVfModuleParameter bandwidth = new SdncHealVfModuleParameter();
+ bandwidth.setName("bandwidth");
+ bandwidth.setValue(onset.getAai().get("bandwidth"));
+
+ SdncHealVfModuleParameter timeStamp = new SdncHealVfModuleParameter();
+ timeStamp.setName("bandwidth-change-time");
+ timeStamp.setValue(onset.getAai().get("bandwidth-change-time"));
+
+ SdncHealVfModuleParametersInfo vfParametersInfo = new SdncHealVfModuleParametersInfo();
+ vfParametersInfo.addParameters(bandwidth);
+ vfParametersInfo.addParameters(timeStamp);
+
+ SdncHealVfModuleRequestInput vfRequestInfo = new SdncHealVfModuleRequestInput();
+ vfRequestInfo.setVfModuleParametersInfo(vfParametersInfo);
+
+ SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
+ serviceInfo.setServiceInstanceId(serviceInstance);
+
+ SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
+ requestInfo.setRequestAction("SdwanBWPolicyChange");
+
+ SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo();
+ headerInfo.setSvcAction("update");
+ headerInfo.setSvcRequestId(UUID.randomUUID().toString());
+ SdncRequest request = new SdncRequest();
+ request.setNsInstanceId(serviceInstance);
+ request.setRequestId(onset.getRequestId());
+ request.setUrl("/GENERIC-RESOURCE-API:vnf-topology-operation");
+
+ SdncHealVnfInfo vnfInfo = new SdncHealVnfInfo();
+ vnfInfo.setVnfId(onset.getAai().get("vnfId"));
+
+ SdncHealRequest healRequest = new SdncHealRequest();
+ healRequest.setVnfInfo(vnfInfo);
+ healRequest.setRequestHeaderInfo(headerInfo);
+ healRequest.setVfModuleRequestInput(vfRequestInfo);
+ healRequest.setRequestInfo(requestInfo);
+ healRequest.setServiceInfo(serviceInfo);
+ request.setHealRequest(healRequest);
+ return request;
+ }
+
+ private SdncRequest constructReOptimizeRequest(VirtualControlLoopEvent onset) {
// Construct an Sdnc request
String serviceInstance = onset.getAai().get("service-instance.service-instance-id");
if (serviceInstance == null || serviceInstance.isEmpty()) {
- // This indicates that AAI Enrichment needs to be done by event producer.
+ // This indicates that AAI Enrichment needs to be done by event producer.
return null;
}
SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo();
serviceInfo.setServiceInstanceId(serviceInstance);
-
+
String networkId = onset.getAai().get("network-information.network-id");
if (networkId == null || networkId.isEmpty()) {
- // This indicates that AAI Enrichment needs to be done by event producer.
+ // This indicates that AAI Enrichment needs to be done by event producer.
return null;
}
- SdncHealNetworkInfo networkInfo = new SdncHealNetworkInfo();
+ SdncHealNetworkInfo networkInfo = new SdncHealNetworkInfo();
networkInfo.setNetworkId(networkId);
SdncHealRequestInfo requestInfo = new SdncHealRequestInfo();
@@ -121,6 +187,7 @@ public class SdncActorServiceProvider implements Actor {
SdncRequest request = new SdncRequest();
request.setNsInstanceId(serviceInstance);
request.setRequestId(onset.getRequestId());
+ request.setUrl("/GENERIC-RESOURCE-API:network-topology-operation");
SdncHealRequest healRequest = new SdncHealRequest();
healRequest.setRequestHeaderInfo(headerInfo);
@@ -128,7 +195,6 @@ public class SdncActorServiceProvider implements Actor {
healRequest.setRequestInfo(requestInfo);
healRequest.setServiceInfo(serviceInfo);
request.setHealRequest(healRequest);
-
return request;
}
} \ No newline at end of file
diff --git a/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java b/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java
index 633234f44..f968f8609 100644
--- a/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java
+++ b/controlloop/common/actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* TestSdncActorServiceProvider
* ================================================================================
- * Copyright (C) 2018 Huawei. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Modifications Copyright (C) 2018 AT&T Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -68,31 +68,32 @@ public class SdncActorServiceProviderTest {
Policy policy = new Policy();
policy.setRecipe("Reroute");
- assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ SdncActorServiceProvider provider = new SdncActorServiceProvider();
+ assertNull(provider.constructRequest(onset, operation, policy));
onset.getAai().put("network-information.network-id", "network-5555");
- assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNull(provider.constructRequest(onset, operation, policy));
PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNull(provider.constructRequest(onset, operation, policy));
UUID requestId = UUID.randomUUID();
onset.setRequestId(requestId);
- assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNull(provider.constructRequest(onset, operation, policy));
PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
- assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNull(provider.constructRequest(onset, operation, policy));
onset.getAai().put("service-instance.service-instance-id", "service-instance-01");
- assertNotNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNotNull(provider.constructRequest(onset, operation, policy));
policy.setRecipe("Reroute");
- assertNotNull(SdncActorServiceProvider.constructRequest(onset, operation, policy));
+ assertNotNull(provider.constructRequest(onset, operation, policy));
SdncRequest request =
- SdncActorServiceProvider.constructRequest(onset, operation, policy);
+ provider.constructRequest(onset, operation, policy);
assertEquals(requestId, Objects.requireNonNull(request).getRequestId());
assertEquals("reoptimize", request.getHealRequest().getRequestHeaderInfo().getSvcAction());
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index 2ea1c48f4..9d60e2d86 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -3,6 +3,7 @@
* controlloop operation manager
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
@@ -309,13 +310,14 @@ public class ControlLoopOperationManager implements Serializable {
return operationRequest;
case "SDNC":
- this.operationRequest = SdncActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+ SdncActorServiceProvider provider = new SdncActorServiceProvider();
+ this.operationRequest = provider.constructRequest((VirtualControlLoopEvent) onset,
operation.clOperation, this.policy);
this.currentOperation = operation;
if (this.operationRequest == null) {
this.policyResult = PolicyResult.FAILURE;
}
- return operationRequest;
+ return operationRequest;
default:
throw new ControlLoopException("invalid actor " + policy.getActor() + " on policy");
}
diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/bin/create-cl-usecases b/controlloop/common/feature-controlloop-management/src/main/feature/bin/create-cl-usecases
index 5662e7c92..99843aa10 100644
--- a/controlloop/common/feature-controlloop-management/src/main/feature/bin/create-cl-usecases
+++ b/controlloop/common/feature-controlloop-management/src/main/feature/bin/create-cl-usecases
@@ -5,6 +5,7 @@
# ONAP
# ================================================================================
# Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
@@ -67,6 +68,11 @@ imeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+
pe%3A+Reroute%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_fail
ure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+# CCVPN Bandwidth On Demand Policy Parameters
+CCVPN_BW_CONTROL_LOOP_NAME="ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c22b"
+CCVPN_BW_POLICY_NAME="CCVPNBandwidthOnDemand"
+CCVPN_BW_CONTROL_LOOP_YAML="controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c22b%0D%0A++trigger_policy%3A+unique-policy-id-16-BandwidthOnDemand%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-16-BandwidthOnDemand%0D%0A++++name%3A+CCVPNBandwidthOnDemand%0D%0A++++description%3A%0D%0A++++actor%3A+SDNC%0D%0A++++recipe%3A+BandwidthOnDemand%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+
# Generic Scope and Version
POLICY_SCOPE="usecases"
POLICY_VERSION="v0.0.1"
@@ -107,6 +113,10 @@ read -e -i "${CCVPN_CONTROL_LOOP_NAME}" -p "CCVPN Control Loop Name> " CCVPN_CON
read -e -i "${CCVPN_POLICY_NAME}" -p "CCVPN Policy Name> " CCVPN_POLICY_NAME
read -e -i "${CCVPN_CONTROL_LOOP_YAML}" -p "CCVPN Control Loop Yaml> " CCVPN_CONTROL_LOOP_YAML
+read -e -i "${CCVPN_BW_CONTROL_LOOP_NAME}" -p "CCVPN BW Control Loop Name> " CCVPN_BW_CONTROL_LOOP_NAME
+read -e -i "${CCVPN_BW_POLICY_NAME}" -p "CCVPN BW Policy Name> " CCVPN_BW_POLICY_NAME
+read -e -i "${CCVPN_BW_CONTROL_LOOP_YAML}" -p "CCVPN BW Control Loop Yaml> " CCVPN_BW_CONTROL_LOOP_YAML
+
read -e -i "${POLICY_SCOPE}" -p "Generic Policy Scope> " POLICY_SCOPE
read -e -i "${POLICY_VERSION}" -p "Generic Policy Version> " POLICY_VERSION
@@ -149,6 +159,10 @@ if [ -z "${CCVPN_CONTROL_LOOP_NAME}" ]; then echo "Aborting: CCVPN Control Loop
if [ -z "${CCVPN_POLICY_NAME}" ]; then echo "Aborting: CCVPN Policy Name not provided"; exit 1; fi
if [ -z "${CCVPN_CONTROL_LOOP_YAML}" ]; then echo "Aborting: CCVPN Control Loop Yaml not provided"; exit 1; fi
+if [ -z "${CCVPN_BW_CONTROL_LOOP_NAME}" ]; then echo "Aborting: CCVPN BW Control Loop Name not provided"; exit 1; fi
+if [ -z "${CCVPN_BW_POLICY_NAME}" ]; then echo "Aborting: CCVPN BW Policy Name not provided"; exit 1; fi
+if [ -z "${CCVPN_BW_CONTROL_LOOP_YAML}" ]; then echo "Aborting: CCVPN BW Control Loop Yaml not provided"; exit 1; fi
+
if [ -z "${POLICY_SCOPE}" ]; then echo "Aborting: Template Policy Scope not provided"; exit 1; fi
if [ -z "${POLICY_VERSION}" ]; then echo "Aborting: Template Policy Version not provided"; exit 1; fi
@@ -199,6 +213,10 @@ echo "CCVPN Drools Fact Generation: CCVPN Control Loop Control Name: ${CCVPN_CON
echo "CCVPN Drools Fact Generation: CCVPN Control Loop Policy Name: ${CCVPN_POLICY_NAME}"
echo "CCVPN Drools Fact Generation: CCVPN Control Loop Yaml: ${CCVPN_CONTROL_LOOP_YAML}"
echo
+echo "CCVPN BW Drools Fact Generation: CCVPN BW Control Loop Control Name: ${CCVPN_BW_CONTROL_LOOP_NAME}"
+echo "CCVPN BW Drools Fact Generation: CCVPN BW Control Loop Policy Name: ${CCVPN_BW_POLICY_NAME}"
+echo "CCVPN BW Drools Fact Generation: CCVPN BW Control Loop Yaml: ${CCVPN_BW_CONTROL_LOOP_YAML}"
+echo
echo "Generic Drools Fact: Control Loop Policy Scope: ${POLICY_SCOPE}"
echo "Generic: Control Loop Policy Version: ${POLICY_VERSION}"
echo
@@ -295,6 +313,9 @@ mvn archetype:generate \
-DccvpnClosedLoopControlName="${CCVPN_CONTROL_LOOP_NAME}" \
-DccvpnPolicyName="${CCVPN_POLICY_NAME}" \
-DccvpnControlLoopYaml="${CCVPN_CONTROL_LOOP_YAML}" \
+ -DccvpnBwClosedLoopControlName="${CCVPN_BW_CONTROL_LOOP_NAME}" \
+ -DccvpnBwPolicyName="${CCVPN_BW_POLICY_NAME}" \
+ -DccvpnBwControlLoopYaml="${CCVPN_BW_CONTROL_LOOP_YAML}" \
-DpolicyScope="${POLICY_SCOPE}" \
-DpolicyVersion="${POLICY_VERSION}" \
-DbrmsgwTopic="${BRMSGW_TOPIC}" \
diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/bin/push-policies-usecases b/controlloop/common/feature-controlloop-management/src/main/feature/bin/push-policies-usecases
index dc64c3ece..307d7825a 100644
--- a/controlloop/common/feature-controlloop-management/src/main/feature/bin/push-policies-usecases
+++ b/controlloop/common/feature-controlloop-management/src/main/feature/bin/push-policies-usecases
@@ -5,6 +5,7 @@
# ONAP
# ================================================================================
# Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
@@ -138,6 +139,18 @@ curl -k --silent --user @1b3rt:31nst31n -X PUT --header 'Content-Type: text/plai
sleep 2
echo
+echo "Inserting CCVPN Bandwidth On Demand Policy..."
+curl -k --silent --user @1b3rt:31nst31n -X PUT --header 'Content-Type: text/plain' -d '{
+ "closedLoopControlName": "ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c22b",
+ "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-CCVPN-2179b738-fd36-4843-a71a-a8c24c70c22b%0D%0A++trigger_policy%3A+unique-policy-id-16-BandwidthOnDemand%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-16-BandwidthOnDemand%0D%0A++++name%3A+CCVPNBandwidthOnDemand%0D%0A++++description%3A%0D%0A++++actor%3A+SDNC%0D%0A++++recipe%3A+BandwidthOnDemand%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard",
+ "policyName": "ccvpnBandwidthOnDemand",
+ "policyScope": "DCAE",
+ "policyVersion": "1.2.0"
+}' "https://localhost:9696/policy/pdp/engine/topics/sources/ueb/${BRMSGW_TOPIC}/events" | python -m json.tool
+
+sleep 2
+
+echo
echo "Policy insertions completed."
echo
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java
index 74122b845..983084878 100644
--- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Huawei. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.
@@ -38,6 +38,12 @@ public class SdncHealRequest implements Serializable {
@SerializedName("network-information")
private SdncHealNetworkInfo networkInfo;
+ @SerializedName("vnf-information")
+ private SdncHealVnfInfo vnfInfo;
+
+ @SerializedName("vf-module-request-input")
+ private SdncHealVfModuleRequestInput vfModuleRequestInput;
+
public SdncHealRequest() {
// Default constructor for SdncHealRequest
}
@@ -74,4 +80,19 @@ public class SdncHealRequest implements Serializable {
this.networkInfo = networkInfo;
}
+ public SdncHealVnfInfo getVnfInfo() {
+ return vnfInfo;
+ }
+
+ public void setVnfInfo(SdncHealVnfInfo vnfInfo) {
+ this.vnfInfo = vnfInfo;
+ }
+
+ public SdncHealVfModuleRequestInput getVfModuleRequestInput() {
+ return vfModuleRequestInput;
+ }
+
+ public void setVfModuleRequestInput(SdncHealVfModuleRequestInput input) {
+ this.vfModuleRequestInput = input;
+ }
}
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java
new file mode 100644
index 000000000..0ad772301
--- /dev/null
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SdncHealVfModuleParameter implements Serializable {
+
+ private static final long serialVersionUID = 3208673205100673119L;
+
+ @SerializedName("name")
+ private String name;
+
+ @SerializedName("value")
+ private String value;
+
+ public SdncHealVfModuleParameter() {
+ // Default constructor for SdncHealVfModuleParameter
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java
new file mode 100644
index 000000000..0463c6a5a
--- /dev/null
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+public class SdncHealVfModuleParametersInfo implements Serializable {
+
+ private static final long serialVersionUID = 3208673205100673119L;
+
+ @SerializedName("param")
+ private List<SdncHealVfModuleParameter> parameters;
+
+ public SdncHealVfModuleParametersInfo() {
+ // Default constructor for SdncHealVfModuleParametersInfo
+ parameters = new LinkedList<>();
+ }
+
+ public List<SdncHealVfModuleParameter> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(List<SdncHealVfModuleParameter> parameters) {
+ this.parameters = parameters;
+ }
+
+ public void addParameters(SdncHealVfModuleParameter parameter) {
+ parameters.add(parameter);
+ }
+}
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java
new file mode 100644
index 000000000..98cfc7ee7
--- /dev/null
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SdncHealVfModuleRequestInput implements Serializable {
+
+ private static final long serialVersionUID = 3208673205100673119L;
+
+ @SerializedName("vf-module-input-parameters")
+ private SdncHealVfModuleParametersInfo vfModuleParametersInfo;
+
+ public SdncHealVfModuleRequestInput() {
+ // Default constructor for SdncHealVfModuleRequestInput
+ }
+
+ public SdncHealVfModuleParametersInfo getVfModuleParametersInfo() {
+ return vfModuleParametersInfo;
+ }
+
+ public void setVfModuleParametersInfo(SdncHealVfModuleParametersInfo info) {
+ this.vfModuleParametersInfo = info;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java
new file mode 100644
index 000000000..16a6203ec
--- /dev/null
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SdncHealVnfInfo implements Serializable {
+
+ private static final long serialVersionUID = 3208673205100673119L;
+
+ @SerializedName("vnf-id")
+ private String vnfId;
+
+ public SdncHealVnfInfo() {
+ // Default constructor for SdncHealVnfInfo
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+}
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java
index 9d8c9798e..c5ce6b295 100644
--- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Huawei. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
@@ -96,7 +96,7 @@ public final class SdncManager implements Runnable {
responseError.setResponseOutput(responseOutput);
headers.put("Accept", "application/json");
- String sdncUrl = sdncUrlBase + "/GENERIC-RESOURCE-API:network-topology-operation";
+ String sdncUrl = sdncUrlBase + sdncRequest.getUrl();
try {
String sdncRequestJson = Serialization.gsonPretty.toJson(sdncRequest);
diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java
index ad824f6c9..7590c0da4 100644
--- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java
+++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Huawei. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.
@@ -29,6 +29,7 @@ public class SdncRequest implements Serializable {
// These fields are not serialized and not part of JSON
private transient String nsInstanceId;
private transient UUID requestId;
+ private transient String url;
@SerializedName("input")
private SdncHealRequest healRequest;
@@ -60,4 +61,12 @@ public class SdncRequest implements Serializable {
public void setHealRequest(SdncHealRequest healRequest) {
this.healRequest = healRequest;
}
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
index 47bdf01ed..4b22fa3ff 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/SdncSimulatorJaxRs.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* simulators
* ================================================================================
- * Copyright (C) 2018 Huawei. All rights reserved.
+ * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.
@@ -55,4 +55,24 @@ public class SdncSimulatorJaxRs {
response.setResponseOutput(responseOutput);
return Serialization.gsonPretty.toJson(response);
}
+
+ /**
+ * SDNC vnf topology operation.
+ *
+ * @return the response
+ */
+ @POST
+ @Path("/GENERIC-RESOURCE-API:vnf-topology-operation")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces("application/json")
+ public String sdncVnfTopologyOperation() {
+ final SdncResponse response = new SdncResponse();
+ response.setRequestId(UUID.randomUUID().toString());
+ SdncResponseOutput responseOutput = new SdncResponseOutput();
+ responseOutput.setResponseCode("200");
+ responseOutput.setAckFinalIndicator("Y");
+ responseOutput.setSvcRequestId(UUID.randomUUID().toString());
+ response.setResponseOutput(responseOutput);
+ return Serialization.gsonPretty.toJson(response);
+ }
}