summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-04 16:27:18 -0400
committerJim Hahn <jrh3@att.com>2020-08-06 19:19:46 -0400
commitdeed677c3dc8751209d50e7d35132c929fe6800d (patch)
tree01f3149d4a03206e134d889d50834ae8d141a0ce /models-interactions/model-actors/actorServiceProvider/src
parent364ef26929f06637bca03dd7bfb5e8ac69b611f8 (diff)
Modify Actors to use properties when provided
Modified the Actors to use properties when the application provides them instead of going to the event context for the data. This sometimes entailed moving code out of the Operation subclass constructor that used or validated the context data. Combined some property names and renamed others. Changed VF Count from AtomicInteger to Integer. Issue-ID: POLICY-2746 Change-Id: Ib8730538309bb77d2f4f6161e9a20a49362d8972 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actorServiceProvider/src')
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java118
-rw-r--r--models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java12
2 files changed, 115 insertions, 15 deletions
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
index 42846460d..c36b61e8b 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationProperties.java
@@ -25,28 +25,112 @@ package org.onap.policy.controlloop.actorserviceprovider;
* exhaustive, as additional property names may be returned by company-defined Actors.
*/
public class OperationProperties {
- public static final String AAI_MODEL_CLOUD_REGION = "AAI/modelInvariantId/cloudRegion";
- public static final String AAI_MODEL_INVARIANT_GENERIC_VNF = "AAI/modelInvariantId/genericVnf";
- public static final String AAI_MODEL_SERVICE = "AAI/modelInvariantId/service";
- public static final String AAI_MODEL_TENANT = "AAI/modelInvariantId/tenant";
- public static final String AAI_MODEL_VNF = "AAI/modelInvariantId/vnf";
- public static final String AAI_RESOURCE_SERVICE_INSTANCE = "AAI/resourceId/serviceInstanceId";
- public static final String AAI_RESOURCE_VNF = "AAI/resourceId/modelInvariantId/vnf";
+
+ /**
+ * A&AI Default Cloud Region. Obtained as follows:
+ * <ol>
+ * <li>invoke the custom query getDefaultCloudRegion() method</li>
+ * </ol>
+ */
+ public static final String AAI_DEFAULT_CLOUD_REGION = "AAI/defaultCloudRegion";
+
+ /**
+ * A&AI Default Tenant. Obtained as follows:
+ * <ol>
+ * <li>invoke the custom query getDefaultTenant() method</li>
+ * </ol>
+ */
+ public static final String AAI_DEFAULT_TENANT = "AAI/defaultTenant";
+
+ /**
+ * A&AI Service instance. Obtained as follows:
+ * <ol>
+ * <li>invoke the custom query getServiceInstance() method</li>
+ * </ol>
+ */
+ public static final String AAI_SERVICE = "AAI/service";
+
+ /**
+ * A&AI Service model. Obtained as follows:
+ * <ol>
+ * <li>invoke the custom query getServiceInstance() method</li>
+ * <li>using the service instance, invoke the getModelVersionId() method</li>
+ * </ol>
+ */
+ public static final String AAI_SERVICE_MODEL = "AAI/service/model";
+
+ /**
+ * A&AI VNF. Obtained as follows:
+ * <ol>
+ * <li>using the target model invariant ID, invoke the custom query
+ * getGenericVnfByModelInvariantId() method to get the VNF</li>
+ * <li>using the VNF item, invoke the getModelVersionId() method to get the
+ * version</li>
+ * </ol>
+ */
+ public static final String AAI_VNF = "AAI/vnf";
+
+ /**
+ * A&AI VNF Model. Obtained as follows:
+ * <ol>
+ * <li>using the target model invariant ID, invoke the custom query
+ * getGenericVnfByModelInvariantId() method to get the VNF</li>
+ * <li>using the VNF item, invoke the getModelVersionId() method to get the
+ * version</li>
+ * <li>using the version, invoke the custom query getModelVerByVersionId() method</li>
+ * </ol>
+ */
+ public static final String AAI_VNF_MODEL = "AAI/vnf/model";
+
+ /**
+ * A&AI VNF id for the target resource ID. Obtained as follows:
+ * <ol>
+ * <li>using the target resource ID, invoke the custom query
+ * getGenericVnfByModelInvariantId() method to get the generic VNF</li>
+ * </ol>
+ */
+ public static final String AAI_RESOURCE_VNF = "AAI/resourceId/vnf";
+
+ /**
+ * A&AI PNF. Obtained as follows:
+ * <ol>
+ * <li>using the target entity, invoke AaiGetPnfOperation</li>
+ * </ol>
+ */
public static final String AAI_PNF = "AAI/pnf";
+
+ /**
+ * A&AI link to the vserver. Obtained as follows:
+ * <ol>
+ * <li>using the vserver name from the enrichment data, perform an A&AI tenant
+ * query</li>
+ * <li>get the "result-data" field from the tenant output</li>
+ * <li>get the "resource-link" field from that</li>
+ * <li>strip off the "/aai/v16" prefix</li>
+ * </ol>
+ */
public static final String AAI_VSERVER_LINK = "AAI/vserver/link";
+ /**
+ * Optional A&AI properties (Map-String-String) for CDS GRPC. If an application
+ * provides this, it will be used instead of constructing the map from the other
+ * properties.
+ */
+ public static final String OPT_CDS_GRPC_AAI_PROPERTIES = "cds/grpc/aai/properties";
+
/*
* These are typically extracted from the event or from the event's enrichment data.
+ *
+ * NOTE: all of the values must be of the form "enrichment/{enrichment-field-name}".
*/
public static final String ENRICHMENT_BANDWIDTH = "enrichment/bandwidth";
- public static final String ENRICHMENT_BANDWIDTH_CHANGE_TIME = "enrichment/bandwidth/changeTime";
- public static final String ENRICHMENT_GENERIC_VNF_ID = "enrichment/genericVnf/id";
- public static final String ENRICHMENT_NETWORK_ID = "enrichment/network/id";
- public static final String ENRICHMENT_SERVICE_ID = "enrichment/service/id";
- public static final String ENRICHMENT_SERVICE_INSTANCE_ID = "enrichment/serviceInstance/id";
- public static final String ENRICHMENT_VNF_ID = "enrichment/vnf/id";
- public static final String ENRICHMENT_VSERVER_ID = "enrichment/vserver/id";
- public static final String ENRICHMENT_VSERVER_NAME = "enrichment/vserver/name";
+ public static final String ENRICHMENT_BANDWIDTH_CHANGE_TIME = "enrichment/bandwidth-change-time";
+ public static final String ENRICHMENT_GENERIC_VNF_ID = "enrichment/generic-vnf.vnf-id";
+ public static final String ENRICHMENT_NETWORK_ID = "enrichment/network-information.network-id";
+ public static final String ENRICHMENT_SERVICE_ID = "enrichment/service-instance.service-instance-id";
+ public static final String ENRICHMENT_VNF_ID = "enrichment/vnfId";
+ public static final String ENRICHMENT_VSERVER_ID = "enrichment/vserver.vserver-id";
+ public static final String ENRICHMENT_VSERVER_NAME = "enrichment/vserver.vserver-name";
public static final String EVENT_ADDITIONAL_PARAMS = "event/additionalParams";
public static final String EVENT_PAYLOAD = "event/payload";
@@ -54,6 +138,10 @@ public class OperationProperties {
/*
* These are data computed and/or tracked by the invoker.
*/
+
+ /**
+ * An Integer containing the count.
+ */
public static final String DATA_VF_COUNT = "data/vfCount";
diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
index 9ce53aa7a..0aa112234 100644
--- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
+++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java
@@ -140,6 +140,17 @@ public abstract class OperationPartial implements Operation {
}
/**
+ * Determines if a property has been assigned for the operation.
+ *
+ * @param name property name
+ * @return {@code true} if the given property has been assigned for the operation,
+ * {@code false} otherwise
+ */
+ public boolean containsProperty(String name) {
+ return properties.containsKey(name);
+ }
+
+ /**
* Sets a property.
*
* @param name property name
@@ -326,6 +337,7 @@ public abstract class OperationPartial implements Operation {
/**
* Generates and sets {@link #subRequestId} to a new subrequest ID.
+ *
* @param attempt attempt number, typically starting with 1
*/
public void generateSubRequestId(int attempt) {