aboutsummaryrefslogtreecommitdiffstats
path: root/appc-provider/appc-provider-bundle
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2019-11-29 16:16:28 +0100
committerTakamune Cho <takamune.cho@att.com>2019-12-09 23:54:29 +0000
commit0682bef2851542f431b5c86a1cad2a28f5479eee (patch)
tree6084d5cc6b82cbb2ab7565227bcd9b4ce7bf9ce4 /appc-provider/appc-provider-bundle
parentcea67fafd905f169b8db5c4be0b47959b66c32e3 (diff)
VNFC Support for Ansible actions
Introduced AutoNodeList parameter for ansible request template which allows to generate NodeList section from infromation about VMs and VNFC in the AAI. List is being filtered by vnfc-name,vserver-id, vnfc-type and vf-module-id parameters which can be specified in the request-parameters of payload section. Change-Id: I3d5b79ab6ff778116856b513612721a9637363df Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Issue-ID: APPC-1729
Diffstat (limited to 'appc-provider/appc-provider-bundle')
-rw-r--r--appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/AbstractBaseService.java98
1 files changed, 96 insertions, 2 deletions
diff --git a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/AbstractBaseService.java b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/AbstractBaseService.java
index 6657c2fdd..eec8097fe 100644
--- a/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/AbstractBaseService.java
+++ b/appc-provider/appc-provider-bundle/src/main/java/org/onap/appc/provider/lcm/service/AbstractBaseService.java
@@ -127,7 +127,7 @@ public abstract class AbstractBaseService extends AbstractBaseUtils {
return validatedStatus;
}
- validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVnfId(), "vnf-id");
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVnfId(), ACTID_KEYS.VNF_ID.getKeyName());
if (validatedStatus == null) {
validatedStatus = validateExcludedActIds(actionIdentifiers, EnumSet.of(ACTID_KEYS.VNF_ID));
}
@@ -136,6 +136,28 @@ public abstract class AbstractBaseService extends AbstractBaseUtils {
}
/**
+ * Validate input as well as VF MODULE ID in actionIdentifier
+ *
+ * @param commonHeader of the input
+ * @param action of the input
+ * @param actionIdentifiers of the input
+ * @return null if validation passed, otherwise, return Status with validation failure details.
+ */
+ Status validateVfModuleId(CommonHeader commonHeader, Action action, ActionIdentifiers actionIdentifiers) {
+ Status validatedStatus = validateInput(commonHeader, action, actionIdentifiers);
+ if (validatedStatus != null) {
+ return validatedStatus;
+ }
+
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVfModuleId(), ACTID_KEYS.VF_MODULE_ID.getKeyName());
+ if (validatedStatus == null) {
+ validatedStatus = validateExcludedActIds(actionIdentifiers, EnumSet.of(ACTID_KEYS.VF_MODULE_ID));
+ }
+
+ return validatedStatus;
+ }
+
+ /**
* Validate input as well as VSERVER ID in actionIdentifier
*
* @param commonHeader of the input
@@ -149,7 +171,7 @@ public abstract class AbstractBaseService extends AbstractBaseUtils {
return validatedStatus;
}
- validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVserverId(), "vserver-id");
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVserverId(), ACTID_KEYS.VSERVER_ID.getKeyName());
if (validatedStatus == null) {
validatedStatus = validateExcludedActIds(actionIdentifiers, EnumSet.of(ACTID_KEYS.VSERVER_ID));
}
@@ -158,6 +180,78 @@ public abstract class AbstractBaseService extends AbstractBaseUtils {
}
/**
+ * Validate input as well as VNFC NAME in actionIdentifier
+ *
+ * @param commonHeader of the input
+ * @param action of the input
+ * @param actionIdentifiers of the input
+ * @return null if validation passed, otherwise, return Status with validation failure details.
+ */
+ Status validateVnfcName(CommonHeader commonHeader, Action action, ActionIdentifiers actionIdentifiers) {
+ Status validatedStatus = validateInput(commonHeader, action, actionIdentifiers);
+ if (validatedStatus != null) {
+ return validatedStatus;
+ }
+
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVnfcName(), ACTID_KEYS.VNFC_NAME.getKeyName());
+ if (validatedStatus == null) {
+ validatedStatus = validateExcludedActIds(actionIdentifiers, EnumSet.of(ACTID_KEYS.VNFC_NAME));
+ }
+
+ return validatedStatus;
+ }
+
+ /**
+ * Validate input as well as VNFC NAME in actionIdentifier
+ *
+ * @param commonHeader of the input
+ * @param action of the input
+ * @param actionIdentifiers of the input
+ * @return null if validation passed, otherwise, return Status with validation failure details.
+ */
+ Status validateAllVnfActIds(CommonHeader commonHeader, Action action, ActionIdentifiers actionIdentifiers) {
+ Status validatedStatus = validateInput(commonHeader, action, actionIdentifiers);
+ if (validatedStatus != null) {
+ return validatedStatus;
+ }
+
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVnfId(), ACTID_KEYS.VNF_ID.getKeyName());
+
+ if (validatedStatus != null) {
+ return validatedStatus;
+ }
+
+ Status validatedFinalStatus = null;
+
+ for (ACTID_KEYS key : ACTID_KEYS.values()) {
+ if (key.equals(ACTID_KEYS.SERVICE_INSTANCE_ID) || key.equals(ACTID_KEYS.VNF_ID)) {
+ continue;
+ }
+ validatedStatus = null;
+ switch (key) {
+ case VF_MODULE_ID:
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVfModuleId(),
+ ACTID_KEYS.VF_MODULE_ID.getKeyName());
+ break;
+ case VSERVER_ID:
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVserverId(),
+ ACTID_KEYS.VSERVER_ID.getKeyName());
+ break;
+ case VNFC_NAME:
+ validatedStatus = validateMustHaveParamValue(actionIdentifiers.getVnfcName(),
+ ACTID_KEYS.VNFC_NAME.getKeyName());
+ break;
+ }
+ if (validatedStatus == null) {
+ validatedFinalStatus = validateExcludedActIds(actionIdentifiers, EnumSet.of(ACTID_KEYS.VNF_ID, key));
+ break;
+ }
+ }
+
+ return validatedFinalStatus;
+ }
+
+ /**
* Validate a value of the must have parameter
* @param value the value of the parameter
* @param keyName the key name of the parameter