summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java46
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java4
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java76
-rw-r--r--controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java16
-rw-r--r--controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java8
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java68
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java14
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java56
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java22
-rw-r--r--controlloop/common/model-impl/aai/pom.xml41
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java100
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java85
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java74
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java228
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java85
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java217
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java129
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java117
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java119
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java172
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java100
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java85
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java74
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java237
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java85
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java)26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java)69
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java217
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java)29
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java129
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java)26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java)26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java)26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java)52
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java)26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java)57
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java)47
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java)50
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java117
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java)62
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java119
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java172
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java84
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java126
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java91
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java137
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java)29
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java24
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java46
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java94
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java24
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java46
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java26
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java28
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java (renamed from controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java)35
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java10
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java92
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java93
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java142
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java53
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java49
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java79
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java162
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java151
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java67
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java163
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java65
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java66
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java76
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java94
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java97
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java169
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java53
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java50
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java)36
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java79
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java)39
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java170
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java163
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java)34
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java)42
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java)30
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java68
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java)151
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java172
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java65
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java)52
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java66
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java77
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java101
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java74
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java105
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java77
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java)33
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java39
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java59
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java33
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java60
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java51
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java83
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java76
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java (renamed from controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java)21
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java63
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java144
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java922
-rw-r--r--controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java550
-rw-r--r--controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java233
-rw-r--r--controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java4
-rw-r--r--controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java34
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl1
-rw-r--r--controlloop/templates/archetype-cl-beijing/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl3
111 files changed, 5054 insertions, 4985 deletions
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index f2d0991e2..0db66c5af 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -31,14 +31,14 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.AAINQInstanceFilters;
-import org.onap.policy.aai.AAINQInventoryResponseItem;
-import org.onap.policy.aai.AAINQNamedQuery;
-import org.onap.policy.aai.AAINQQueryParameters;
-import org.onap.policy.aai.AAINQRequest;
-import org.onap.policy.aai.AAINQResponse;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.AaiManager;
+import org.onap.policy.aai.AaiNqInstanceFilters;
+import org.onap.policy.aai.AaiNqInventoryResponseItem;
+import org.onap.policy.aai.AaiNqNamedQuery;
+import org.onap.policy.aai.AaiNqQueryParameters;
+import org.onap.policy.aai.AaiNqRequest;
+import org.onap.policy.aai.AaiNqResponse;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appclcm.LCMCommonHeader;
import org.onap.policy.appclcm.LCMRequest;
import org.onap.policy.appclcm.LCMRequestWrapper;
@@ -115,12 +115,12 @@ public class AppcLcmActorServiceProvider implements Actor {
*
* @return the vnf-id of the target vnf to act upon or null if not found
*/
- private static String parseAaiResponse(List<AAINQInventoryResponseItem> items, String resourceId) {
+ private static String parseAaiResponse(List<AaiNqInventoryResponseItem> items, String resourceId) {
String vnfId = null;
- for (AAINQInventoryResponseItem item : items) {
- if ((item.getGenericVNF() != null) && (item.getGenericVNF().getModelInvariantId() != null)
- && (resourceId.equals(item.getGenericVNF().getModelInvariantId()))) {
- vnfId = item.getGenericVNF().getVnfID();
+ for (AaiNqInventoryResponseItem item : items) {
+ if ((item.getGenericVnf() != null) && (item.getGenericVnf().getModelInvariantId() != null)
+ && (resourceId.equals(item.getGenericVnf().getModelInvariantId()))) {
+ vnfId = item.getGenericVnf().getVnfId();
break;
} else {
if ((item.getItems() != null) && (item.getItems().getInventoryResponseItems() != null)) {
@@ -140,17 +140,17 @@ public class AppcLcmActorServiceProvider implements Actor {
* @param sourceVnfId the vnf id of the source entity reporting the alert
*
* @return the target entities vnf id to act upon
- * @throws AAIException it an error occurs
+ * @throws AaiException it an error occurs
*/
- public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AAIException {
+ public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AaiException {
// TODO: This request id should not be hard coded in future releases
UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
- AAINQRequest aaiRequest = new AAINQRequest();
- aaiRequest.setQueryParameters(new AAINQQueryParameters());
- aaiRequest.getQueryParameters().setNamedQuery(new AAINQNamedQuery());
- aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUUID(requestId);
+ AaiNqRequest aaiRequest = new AaiNqRequest();
+ aaiRequest.setQueryParameters(new AaiNqQueryParameters());
+ aaiRequest.getQueryParameters().setNamedQuery(new AaiNqNamedQuery());
+ aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUuid(requestId);
Map<String, Map<String, String>> filter = new HashMap<>();
Map<String, String> filterItem = new HashMap<>();
@@ -158,20 +158,20 @@ public class AppcLcmActorServiceProvider implements Actor {
filterItem.put("vnf-id", sourceVnfId);
filter.put("generic-vnf", filterItem);
- aaiRequest.setInstanceFilters(new AAINQInstanceFilters());
+ aaiRequest.setInstanceFilters(new AaiNqInstanceFilters());
aaiRequest.getInstanceFilters().getInstanceFilter().add(filter);
- AAINQResponse aaiResponse = new AAIManager(new RESTManager()).postQuery(getPeManagerEnvProperty("aai.url"),
+ AaiNqResponse aaiResponse = new AaiManager(new RESTManager()).postQuery(getPeManagerEnvProperty("aai.url"),
getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiRequest,
requestId);
if (aaiResponse == null) {
- throw new AAIException("The named query response was null");
+ throw new AaiException("The named query response was null");
}
String targetVnfId = parseAaiResponse(aaiResponse.getInventoryResponseItems(), resourceId);
if (targetVnfId == null) {
- throw new AAIException("Target vnf-id could not be found");
+ throw new AaiException("Target vnf-id could not be found");
}
return targetVnfId;
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
index 50b03c6b4..72d43d318 100644
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
@@ -32,7 +32,7 @@ import java.util.UUID;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appclcm.LCMCommonHeader;
import org.onap.policy.appclcm.LCMRequest;
import org.onap.policy.appclcm.LCMRequestWrapper;
@@ -312,7 +312,7 @@ public class AppcLcmServiceProviderTest {
String targetVnfId = null;
try {
targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01");
- } catch (AAIException e) {
+ } catch (AaiException e) {
logger.warn(e.toString());
fail("no vnf-id found");
}
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index 738cf3d04..231b8fae5 100644
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -30,15 +30,15 @@ import java.util.Map;
import java.util.UUID;
import org.drools.core.WorkingMemory;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.AAINQExtraProperty;
-import org.onap.policy.aai.AAINQInstanceFilters;
-import org.onap.policy.aai.AAINQInventoryResponseItem;
-import org.onap.policy.aai.AAINQNamedQuery;
-import org.onap.policy.aai.AAINQQueryParameters;
-import org.onap.policy.aai.AAINQRequest;
-import org.onap.policy.aai.AAINQResponse;
-import org.onap.policy.aai.AAINQResponseWrapper;
+import org.onap.policy.aai.AaiManager;
+import org.onap.policy.aai.AaiNqExtraProperty;
+import org.onap.policy.aai.AaiNqInstanceFilters;
+import org.onap.policy.aai.AaiNqInventoryResponseItem;
+import org.onap.policy.aai.AaiNqNamedQuery;
+import org.onap.policy.aai.AaiNqQueryParameters;
+import org.onap.policy.aai.AaiNqRequest;
+import org.onap.policy.aai.AaiNqResponse;
+import org.onap.policy.aai.AaiNqResponseWrapper;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
@@ -121,19 +121,19 @@ public class SOActorServiceProvider implements Actor {
}
// Perform named query request and handle response
- AAINQResponseWrapper aaiResponseWrapper = performAaiNamedQueryRequest(onset);
+ AaiNqResponseWrapper aaiResponseWrapper = performAaiNamedQueryRequest(onset);
if (aaiResponseWrapper == null) {
// Tracing and error handling handied in the "performAaiNamedQueryRequest()" method
return null;
}
- AAINQInventoryResponseItem vnfItem;
- AAINQInventoryResponseItem vnfServiceItem;
- AAINQInventoryResponseItem tenantItem;
+ AaiNqInventoryResponseItem vnfItem;
+ AaiNqInventoryResponseItem vnfServiceItem;
+ AaiNqInventoryResponseItem tenantItem;
// Extract the items we're interested in from the response
try {
- vnfItem = aaiResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems()
+ vnfItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems()
.getInventoryResponseItems().get(0);
} catch (Exception e) {
logger.error("VNF Item not found in AAI response {}", Serialization.gsonPretty.toJson(aaiResponseWrapper),
@@ -150,7 +150,7 @@ public class SOActorServiceProvider implements Actor {
}
try {
- tenantItem = aaiResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems()
+ tenantItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems()
.getInventoryResponseItems().get(1);
} catch (Exception e) {
logger.error("Tenant Item not found in AAI response {}",
@@ -189,14 +189,14 @@ public class SOActorServiceProvider implements Actor {
//
// modelInfo
//
- AAINQInventoryResponseItem vfModuleItem = vnfItem.getItems().getInventoryResponseItems().get(nonBaseIndex);
+ AaiNqInventoryResponseItem vfModuleItem = vnfItem.getItems().getInventoryResponseItems().get(nonBaseIndex);
request.getRequestDetails().getModelInfo().setModelType("vfModule");
request.getRequestDetails().getModelInfo()
.setModelInvariantId(vfModuleItem.getVfModule().getModelInvariantId());
request.getRequestDetails().getModelInfo().setModelVersionId(vfModuleItem.getVfModule().getModelVersionId());
- for (AAINQExtraProperty prop : vfModuleItem.getExtraProperties().getExtraProperty()) {
+ for (AaiNqExtraProperty prop : vfModuleItem.getExtraProperties().getExtraProperty()) {
if (prop.getPropertyName().equals(modelNamePropertyKey)) {
request.getRequestDetails().getModelInfo().setModelName(prop.getPropertyValue());
} else if (prop.getPropertyName().equals(modelVersionPropertyKey)) {
@@ -237,12 +237,12 @@ public class SOActorServiceProvider implements Actor {
// Service Item
relatedInstanceListElement1.getRelatedInstance()
- .setInstanceId(vnfServiceItem.getServiceInstance().getServiceInstanceID());
+ .setInstanceId(vnfServiceItem.getServiceInstance().getServiceInstanceId());
relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo());
relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
relatedInstanceListElement1.getRelatedInstance().getModelInfo()
.setModelInvariantId(vnfServiceItem.getServiceInstance().getModelInvariantId());
- for (AAINQExtraProperty prop : vnfServiceItem.getExtraProperties().getExtraProperty()) {
+ for (AaiNqExtraProperty prop : vnfServiceItem.getExtraProperties().getExtraProperty()) {
if (prop.getPropertyName().equals(modelNamePropertyKey)) {
relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue());
} else if (prop.getPropertyName().equals(modelVersionPropertyKey)) {
@@ -252,12 +252,12 @@ public class SOActorServiceProvider implements Actor {
}
// VNF Item
- relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfItem.getGenericVNF().getVnfID());
+ relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfItem.getGenericVnf().getVnfId());
relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo());
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
relatedInstanceListElement2.getRelatedInstance().getModelInfo()
- .setModelInvariantId(vnfItem.getGenericVNF().getModelInvariantId());
- for (AAINQExtraProperty prop : vnfItem.getExtraProperties().getExtraProperty()) {
+ .setModelInvariantId(vnfItem.getGenericVnf().getModelInvariantId());
+ for (AaiNqExtraProperty prop : vnfItem.getExtraProperties().getExtraProperty()) {
if (prop.getPropertyName().equals(modelNamePropertyKey)) {
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue());
} else if (prop.getPropertyName().equals(modelVersionPropertyKey)) {
@@ -269,15 +269,15 @@ public class SOActorServiceProvider implements Actor {
}
}
relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelCustomizationName(vnfItem
- .getGenericVNF().getVnfType().substring(vnfItem.getGenericVNF().getVnfType().lastIndexOf('/') + 1));
+ .getGenericVnf().getVnfType().substring(vnfItem.getGenericVnf().getVnfType().lastIndexOf('/') + 1));
// Insert the Service Item and VNF Item
request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
// Save the instance IDs for the VNF and service to static fields
- preserveInstanceIds(vnfItem.getGenericVNF().getVnfID(),
- vnfServiceItem.getServiceInstance().getServiceInstanceID());
+ preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(),
+ vnfServiceItem.getServiceInstance().getServiceInstanceId());
if (logger.isDebugEnabled()) {
logger.debug("SO request sent: {}", Serialization.gsonPretty.toJson(request));
@@ -306,17 +306,17 @@ public class SOActorServiceProvider implements Actor {
* @param onset the virtial control loop event
* @returns the response to the AAI Named Query
*/
- private AAINQResponseWrapper performAaiNamedQueryRequest(VirtualControlLoopEvent onset) {
+ private AaiNqResponseWrapper performAaiNamedQueryRequest(VirtualControlLoopEvent onset) {
// create AAI named-query request with UUID started with ""
- AAINQRequest aaiNqRequest = new AAINQRequest();
- AAINQQueryParameters aaiNqQueryParam = new AAINQQueryParameters();
- AAINQNamedQuery aaiNqNamedQuery = new AAINQNamedQuery();
- final AAINQInstanceFilters aaiNqInstanceFilter = new AAINQInstanceFilters();
+ AaiNqRequest aaiNqRequest = new AaiNqRequest();
+ AaiNqQueryParameters aaiNqQueryParam = new AaiNqQueryParameters();
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ final AaiNqInstanceFilters aaiNqInstanceFilter = new AaiNqInstanceFilters();
// queryParameters
// UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID
- aaiNqNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
+ aaiNqNamedQuery.setNamedQueryUuid(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
aaiNqQueryParam.setNamedQuery(aaiNqNamedQuery);
aaiNqRequest.setQueryParameters(aaiNqQueryParam);
//
@@ -334,7 +334,7 @@ public class SOActorServiceProvider implements Actor {
logger.debug("AAI Request sent: {}", Serialization.gsonPretty.toJson(aaiNqRequest));
}
- AAINQResponse aaiNqResponse = new AAIManager(new RESTManager()).postQuery(getPeManagerEnvProperty("aai.url"),
+ AaiNqResponse aaiNqResponse = new AaiManager(new RESTManager()).postQuery(getPeManagerEnvProperty("aai.url"),
getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiNqRequest,
onset.getRequestID());
@@ -345,11 +345,11 @@ public class SOActorServiceProvider implements Actor {
}
// Create AAINQResponseWrapper
- AAINQResponseWrapper aaiNqResponseWrapper = new AAINQResponseWrapper(onset.getRequestID(), aaiNqResponse);
+ AaiNqResponseWrapper aaiNqResponseWrapper = new AaiNqResponseWrapper(onset.getRequestID(), aaiNqResponse);
if (logger.isDebugEnabled()) {
logger.debug("AAI Named Query Response: ");
- logger.debug(Serialization.gsonPretty.toJson(aaiNqResponseWrapper.getAainqresponse()));
+ logger.debug(Serialization.gsonPretty.toJson(aaiNqResponseWrapper.getAaiNqResponse()));
}
return aaiNqResponseWrapper;
@@ -363,8 +363,8 @@ public class SOActorServiceProvider implements Actor {
* for the non base index
* @return the base or non base index or -1 if the index was not found
*/
- private int findIndex(List<AAINQInventoryResponseItem> inventoryResponseItems, boolean baseIndexFlag) {
- for (AAINQInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
+ private int findIndex(List<AaiNqInventoryResponseItem> inventoryResponseItems, boolean baseIndexFlag) {
+ for (AaiNqInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
if (invenoryResponseItem.getVfModule() != null
&& baseIndexFlag == invenoryResponseItem.getVfModule().getIsBaseVfModule()) {
return inventoryResponseItems.indexOf(invenoryResponseItem);
@@ -381,9 +381,9 @@ public class SOActorServiceProvider implements Actor {
* @return number of non base index modules
*/
- private int findNonBaseModules(List<AAINQInventoryResponseItem> inventoryResponseItems) {
+ private int findNonBaseModules(List<AaiNqInventoryResponseItem> inventoryResponseItems) {
int nonBaseModuleCount = 0;
- for (AAINQInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
+ for (AaiNqInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
if (invenoryResponseItem.getVfModule() != null
&& (!invenoryResponseItem.getVfModule().getIsBaseVfModule())) {
nonBaseModuleCount++;
diff --git a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
index 839b07e2b..83f44a1ed 100644
--- a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
+++ b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java
@@ -25,8 +25,8 @@ import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.AAIManager;
+import org.onap.policy.aai.AaiGetVnfResponse;
+import org.onap.policy.aai.AaiManager;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
@@ -86,13 +86,13 @@ public class VFCActorServiceProvider implements Actor {
* @return the constructed request
*/
public static VFCRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy, AAIGETVnfResponse vnfResponse) {
+ Policy policy, AaiGetVnfResponse vnfResponse) {
// Construct an VFC request
VFCRequest request = new VFCRequest();
String serviceInstance = onset.getAAI().get("service-instance.service-instance-id");
if (serviceInstance == null || "".equals(serviceInstance)) {
- AAIGETVnfResponse tempVnfResp = vnfResponse;
+ AaiGetVnfResponse tempVnfResp = vnfResponse;
if (tempVnfResp == null) { // if the response is null, we haven't queried
// This does the AAI query since we haven't already
tempVnfResp = getAaiServiceInstance(onset);
@@ -122,8 +122,8 @@ public class VFCActorServiceProvider implements Actor {
return request;
}
- private static AAIGETVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event) {
- AAIGETVnfResponse response = null;
+ private static AaiGetVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event) {
+ AaiGetVnfResponse response = null;
UUID requestId = event.getRequestID();
String vnfName = event.getAAI().get("generic-vnf.vnf-name");
String vnfId = event.getAAI().get("generic-vnf.vnf-id");
@@ -133,11 +133,11 @@ public class VFCActorServiceProvider implements Actor {
try {
if (vnfName != null) {
String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
- response = new AAIManager(new RESTManager()).getQueryByVnfName(url, aaiUsername, aaiPassword, requestId,
+ response = new AaiManager(new RESTManager()).getQueryByVnfName(url, aaiUsername, aaiPassword, requestId,
vnfName);
} else if (vnfId != null) {
String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf/";
- response = new AAIManager(new RESTManager()).getQueryByVnfID(url, aaiUsername, aaiPassword, requestId,
+ response = new AaiManager(new RESTManager()).getQueryByVnfId(url, aaiUsername, aaiPassword, requestId,
vnfId);
} else {
logger.error("getAAIServiceInstance failed");
diff --git a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
index 39be472ae..8c0ab22eb 100644
--- a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
+++ b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
@@ -30,7 +30,7 @@ import java.util.UUID;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AaiGetVnfResponse;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.policy.Policy;
@@ -90,13 +90,13 @@ public class TestVFCActorServiceProvider {
onset.getAAI().put("service-instance.service-instance-id", "");
assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, null));
- assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse()));
+ assertNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()));
policy.setRecipe("Restart");
- assertNotNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse()));
+ assertNotNull(VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()));
VFCRequest request =
- VFCActorServiceProvider.constructRequest(onset, operation, policy, new AAIGETVnfResponse());
+ VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse());
assertEquals(requestId, request.getRequestId());
assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId());
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index 224e33559..39a4886a2 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -28,10 +28,10 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.UUID;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.AAIGETVserverResponse;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.AaiGetVnfResponse;
+import org.onap.policy.aai.AaiGetVserverResponse;
+import org.onap.policy.aai.AaiManager;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopNotificationType;
@@ -78,8 +78,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
private LinkedList<ControlLoopOperation> controlLoopHistory = new LinkedList<>();
private ControlLoopOperationManager currentOperation = null;
private transient TargetLock targetLock = null;
- private AAIGETVnfResponse vnfResponse = null;
- private AAIGETVserverResponse vserverResponse = null;
+ private AaiGetVnfResponse vnfResponse = null;
+ private AaiGetVserverResponse vserverResponse = null;
private static String aaiHostURL;
private static String aaiUser;
private static String aaiPassword;
@@ -334,9 +334,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
*
* @return a ControlLoopOperationManager
* @throws ControlLoopException if an error occurs
- * @throws AAIException if an error occurs retrieving information from A&AI
+ * @throws AaiException if an error occurs retrieving information from A&AI
*/
- public ControlLoopOperationManager processControlLoop() throws ControlLoopException, AAIException {
+ public ControlLoopOperationManager processControlLoop() throws ControlLoopException, AaiException {
//
// Check if they activated us
//
@@ -497,9 +497,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
*
* @param event the event
* @return the status
- * @throws AAIException if an error occurs retrieving information from A&AI
+ * @throws AaiException if an error occurs retrieving information from A&AI
*/
- public NEW_EVENT_STATUS onNewEvent(VirtualControlLoopEvent event) throws AAIException {
+ public NEW_EVENT_STATUS onNewEvent(VirtualControlLoopEvent event) throws AaiException {
try {
this.checkEventSyntax(event);
if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ONSET) {
@@ -590,11 +590,11 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
return 0;
}
- public AAIGETVnfResponse getVnfResponse() {
+ public AaiGetVnfResponse getVnfResponse() {
return vnfResponse;
}
- public AAIGETVserverResponse getVserverResponse() {
+ public AaiGetVserverResponse getVserverResponse() {
return vserverResponse;
}
@@ -641,12 +641,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* Query A&AI for an event.
*
* @param event the event
- * @throws AAIException if an error occurs retrieving information from A&AI
+ * @throws AaiException if an error occurs retrieving information from A&AI
*/
- public void queryAai(VirtualControlLoopEvent event) throws AAIException {
+ public void queryAai(VirtualControlLoopEvent event) throws AaiException {
if ((event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED) != null
|| event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED) != null) && isClosedLoopDisabled(event)) {
- throw new AAIException("is-closed-loop-disabled is set to true on VServer or VNF");
+ throw new AaiException("is-closed-loop-disabled is set to true on VServer or VNF");
}
try {
@@ -659,7 +659,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
} catch (Exception e) {
logger.error("Exception from queryAai: ", e);
- throw new AAIException("Exception from queryAai: " + e.toString());
+ throw new AaiException("Exception from queryAai: " + e.toString());
}
}
@@ -669,40 +669,40 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* @param aaiResponse the response from A&AI
* @param queryByVnfId <code>true</code> if the query was based on vnf-id, <code>false</code> if
* the query was based on vnf-name
- * @throws AAIException if an error occurs processing the response
+ * @throws AaiException if an error occurs processing the response
*/
- private static void processVNFResponse(AAIGETVnfResponse aaiResponse, boolean queryByVNFID) throws AAIException {
+ private static void processVNFResponse(AaiGetVnfResponse aaiResponse, boolean queryByVNFID) throws AaiException {
String queryTypeString = (queryByVNFID ? "vnf-id" : "vnf-name");
if (aaiResponse == null) {
- throw new AAIException("AAI Response is null (query by " + queryTypeString + ")");
+ throw new AaiException("AAI Response is null (query by " + queryTypeString + ")");
}
if (aaiResponse.getRequestError() != null) {
- throw new AAIException("AAI Responded with a request error (query by " + queryTypeString + ")");
+ throw new AaiException("AAI Responded with a request error (query by " + queryTypeString + ")");
}
if (aaiResponse.getIsClosedLoopDisabled() != null) {
String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)
|| "Y".equalsIgnoreCase(value)) {
- throw new AAIException("is-closed-loop-disabled is set to true (query by " + queryTypeString + ")");
+ throw new AaiException("is-closed-loop-disabled is set to true (query by " + queryTypeString + ")");
}
}
}
- private static void processVServerResponse(AAIGETVserverResponse aaiResponse) throws AAIException {
+ private static void processVServerResponse(AaiGetVserverResponse aaiResponse) throws AaiException {
if (aaiResponse == null) {
- throw new AAIException("AAI Response is null (query by vserver-name)");
+ throw new AaiException("AAI Response is null (query by vserver-name)");
}
if (aaiResponse.getRequestError() != null) {
- throw new AAIException("AAI responded with a request error (query by vserver-name)");
+ throw new AaiException("AAI responded with a request error (query by vserver-name)");
}
if (aaiResponse.getIsClosedLoopDisabled() != null) {
String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)
|| "Y".equalsIgnoreCase(value)) {
- throw new AAIException("is-closed-loop-disabled is set to true (query by vserver-name)");
+ throw new AaiException("is-closed-loop-disabled is set to true (query by vserver-name)");
}
}
}
@@ -730,12 +730,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* Get the A&AI VService information for an event.
*
* @param event the event
- * @return a AAIGETVserverResponse
+ * @return a AaiGetVserverResponse
* @throws ControlLoopException if an error occurs
*/
- public static AAIGETVserverResponse getAAIVserverInfo(VirtualControlLoopEvent event) throws ControlLoopException {
+ public static AaiGetVserverResponse getAAIVserverInfo(VirtualControlLoopEvent event) throws ControlLoopException {
UUID requestId = event.getRequestID();
- AAIGETVserverResponse response = null;
+ AaiGetVserverResponse response = null;
String vserverName = event.getAAI().get(VSERVER_VSERVER_NAME);
try {
@@ -746,7 +746,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
String url = aaiHostURL + aaiGetQueryByVserver;
logger.info("AAI Host URL by VServer: {}", url);
- response = new AAIManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestId,
+ response = new AaiManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestId,
vserverName);
}
} catch (Exception e) {
@@ -761,12 +761,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
* Get A&AI VNF information for an event.
*
* @param event the event
- * @return a AAIGETVnfResponse
+ * @return a AaiGetVnfResponse
* @throws ControlLoopException if an error occurs
*/
- public static AAIGETVnfResponse getAAIVnfInfo(VirtualControlLoopEvent event) throws ControlLoopException {
+ public static AaiGetVnfResponse getAAIVnfInfo(VirtualControlLoopEvent event) throws ControlLoopException {
UUID requestId = event.getRequestID();
- AAIGETVnfResponse response = null;
+ AaiGetVnfResponse response = null;
String vnfName = event.getAAI().get(GENERIC_VNF_VNF_NAME);
String vnfId = event.getAAI().get(GENERIC_VNF_VNF_ID);
@@ -779,14 +779,14 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
String url = aaiHostURL + aaiGetQueryByVnfName;
logger.info("AAI Host URL by VNF name: {}", url);
- response = new AAIManager(new RESTManager()).getQueryByVnfName(url, aaiUser, aaiPassword, requestId,
+ response = new AaiManager(new RESTManager()).getQueryByVnfName(url, aaiUser, aaiPassword, requestId,
vnfName);
} else if (vnfId != null) {
String aaiGetQueryByVnfId = "/aai/v11/network/generic-vnfs/generic-vnf/";
String url = aaiHostURL + aaiGetQueryByVnfId;
logger.info("AAI Host URL by VNF ID: {}", url);
response =
- new AAIManager(new RESTManager()).getQueryByVnfID(url, aaiUser, aaiPassword, requestId, vnfId);
+ new AaiManager(new RESTManager()).getQueryByVnfId(url, aaiUser, aaiPassword, requestId, vnfId);
}
} catch (Exception e) {
logger.error("getAAIVnfInfo exception: ", e);
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 7c900249c..97eaf9048 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
@@ -32,7 +32,7 @@ import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import org.eclipse.persistence.config.PersistenceUnitProperties;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appclcm.LCMResponseWrapper;
@@ -134,9 +134,9 @@ public class ControlLoopOperationManager implements Serializable {
* @param policy the policy
* @return the target
* @throws ControlLoopException if an error occurs
- * @throws AAIException if an error occurs retrieving information from A&AI
+ * @throws AaiException if an error occurs retrieving information from A&AI
*/
- public String getTarget(Policy policy) throws ControlLoopException, AAIException {
+ public String getTarget(Policy policy) throws ControlLoopException, AaiException {
if (policy.getTarget() == null) {
throw new ControlLoopException("The target is null");
}
@@ -167,9 +167,9 @@ public class ControlLoopOperationManager implements Serializable {
* If the vnf-name was retrieved from the onset then the vnf-id must be obtained
* from the event manager's A&AI GET query
*/
- String vnfId = this.eventManager.getVnfResponse().getVnfID();
+ String vnfId = this.eventManager.getVnfResponse().getVnfId();
if (vnfId == null) {
- throw new AAIException("No vnf-id found");
+ throw new AaiException("No vnf-id found");
}
return vnfId;
}
@@ -186,10 +186,10 @@ public class ControlLoopOperationManager implements Serializable {
* @param policy the policy
* @param em the event manager
* @throws ControlLoopException if an error occurs
- * @throws AAIException if an error occurs retrieving information from A&AI
+ * @throws AaiException if an error occurs retrieving information from A&AI
*/
public ControlLoopOperationManager(ControlLoopEvent onset, Policy policy, ControlLoopEventManager em)
- throws ControlLoopException, AAIException {
+ throws ControlLoopException, AaiException {
this.onset = onset;
this.policy = policy;
this.guardApprovalStatus = "NONE";
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index ea057c9d9..4ff8338a6 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -39,15 +39,15 @@ import org.apache.commons.io.IOUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.AAIGETVserverResponse;
+import org.onap.policy.aai.AaiGetVnfResponse;
+import org.onap.policy.aai.AaiGetVserverResponse;
import org.onap.policy.aai.RelatedToProperty;
import org.onap.policy.aai.RelatedToPropertyItem;
import org.onap.policy.aai.Relationship;
import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.RelationshipDataItem;
import org.onap.policy.aai.RelationshipList;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopNotificationType;
@@ -109,7 +109,7 @@ public class ControlLoopEventManagerTest {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
- AAIGETVnfResponse response = getQueryByVnfId2(
+ AaiGetVnfResponse response = getQueryByVnfId2(
PolicyEngine.manager.getEnvironmentProperty("aai.url")
+ "/aai/v11/network/generic-vnfs/generic-vnf/",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -128,7 +128,7 @@ public class ControlLoopEventManagerTest {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
- AAIGETVnfResponse response = getQueryByVnfName2(
+ AaiGetVnfResponse response = getQueryByVnfName2(
PolicyEngine.manager.getEnvironmentProperty("aai.url")
+ "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -146,7 +146,7 @@ public class ControlLoopEventManagerTest {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
onset.setClosedLoopControlName(pair.key.getControlLoop().getControlLoopName());
try {
- AAIGETVserverResponse response = getQueryByVserverName2(
+ AaiGetVserverResponse response = getQueryByVserverName2(
PolicyEngine.manager.getEnvironmentProperty("aai.url") + "/aai/v11/nodes/vservers?vserver-name=",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
PolicyEngine.manager.getEnvironmentProperty("aai.password"), UUID.randomUUID(),
@@ -169,7 +169,7 @@ public class ControlLoopEventManagerTest {
try {
logger.info("testIsClosedLoopDisabled --");
- AAIGETVnfResponse response = getQueryByVnfId2(
+ AaiGetVnfResponse response = getQueryByVnfId2(
PolicyEngine.manager.getEnvironmentProperty("aai.url")
+ "/aai/v11/network/generic-vnfs/generic-vnf/",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -191,7 +191,7 @@ public class ControlLoopEventManagerTest {
// disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
// logger.info("QueryByVnfName - isClosedLoopDisabled: " + disabled);
- AAIGETVserverResponse response2 = getQueryByVserverName2(
+ AaiGetVserverResponse response2 = getQueryByVserverName2(
PolicyEngine.manager.getEnvironmentProperty("aai.url") + "/aai/v11/nodes/vservers?vserver-name=",
PolicyEngine.manager.getEnvironmentProperty("aai.user"),
PolicyEngine.manager.getEnvironmentProperty("aai.password"), UUID.randomUUID(),
@@ -263,14 +263,14 @@ public class ControlLoopEventManagerTest {
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {
status = manager.onNewEvent(event);
- } catch (AAIException e) {
+ } catch (AaiException e) {
logger.warn(e.toString());
fail("A&AI Query Failed");
}
assertNotNull(status);
assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.FIRST_ONSET, status);
- AAIGETVnfResponse response = manager.getVnfResponse();
+ AaiGetVnfResponse response = manager.getVnfResponse();
assertNotNull(response);
assertNull(manager.getVserverResponse());
@@ -286,12 +286,12 @@ public class ControlLoopEventManagerTest {
try {
status = manager.onNewEvent(event2);
- } catch (AAIException e) {
+ } catch (AaiException e) {
logger.warn(e.toString());
fail("A&AI Query Failed");
}
assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.SUBSEQUENT_ONSET, status);
- AAIGETVnfResponse response2 = manager.getVnfResponse();
+ AaiGetVnfResponse response2 = manager.getVnfResponse();
assertNotNull(response2);
// We should not have queried AAI, so the stored response should be the same
assertEquals(response, response2);
@@ -301,11 +301,11 @@ public class ControlLoopEventManagerTest {
/**
* Simulate a response.
*/
- public static AAIGETVnfResponse getQueryByVnfId2(String urlGet, String username, String password, UUID requestId,
+ public static AaiGetVnfResponse getQueryByVnfId2(String urlGet, String username, String password, UUID requestId,
String key) {
- AAIGETVnfResponse response = new AAIGETVnfResponse();
+ AaiGetVnfResponse response = new AaiGetVnfResponse();
- response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491");
+ response.setVnfId("83f674e8-7555-44d7-9a39-bdc3770b0491");
response.setVnfName("lll_vnf_010317");
response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1");
response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
@@ -355,11 +355,11 @@ public class ControlLoopEventManagerTest {
/**
* Simulate a response.
*/
- public static AAIGETVnfResponse getQueryByVnfName2(String urlGet, String username, String password, UUID requestId,
+ public static AaiGetVnfResponse getQueryByVnfName2(String urlGet, String username, String password, UUID requestId,
String key) {
- AAIGETVnfResponse response = new AAIGETVnfResponse();
+ AaiGetVnfResponse response = new AaiGetVnfResponse();
- response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491");
+ response.setVnfId("83f674e8-7555-44d7-9a39-bdc3770b0491");
response.setVnfName("lll_vnf_010317");
response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1");
response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
@@ -409,11 +409,11 @@ public class ControlLoopEventManagerTest {
/**
* Simulate a response.
*/
- public static AAIGETVserverResponse getQueryByVserverName2(String urlGet, String username, String password,
+ public static AaiGetVserverResponse getQueryByVserverName2(String urlGet, String username, String password,
UUID requestId, String key) {
- AAIGETVserverResponse response = new AAIGETVserverResponse();
+ AaiGetVserverResponse response = new AaiGetVserverResponse();
- response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8");
+ response.setVserverId("d0668d4f-c25e-4a1b-87c4-83845c01efd8");
response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0");
response.setVserverName2("vjunos0");
response.setVserverSelflink(
@@ -626,7 +626,7 @@ public class ControlLoopEventManagerTest {
}
@Test
- public void testProcessControlLoop() throws ControlLoopException, IOException, AAIException {
+ public void testProcessControlLoop() throws ControlLoopException, IOException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -708,7 +708,7 @@ public class ControlLoopEventManagerTest {
}
@Test
- public void testFinishOperation() throws IOException, ControlLoopException, AAIException {
+ public void testFinishOperation() throws IOException, ControlLoopException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/testSOactor.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -794,7 +794,7 @@ public class ControlLoopEventManagerTest {
}
@Test
- public void testOnNewEvent() throws IOException, AAIException {
+ public void testOnNewEvent() throws IOException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -940,7 +940,7 @@ public class ControlLoopEventManagerTest {
}
@Test
- public void testQueryAai() throws IOException, AAIException {
+ public void testQueryAai() throws IOException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -1020,7 +1020,7 @@ public class ControlLoopEventManagerTest {
manager.queryAai(onsetEvent);
fail("test should throw an exception here");
} catch (Exception e) {
- assertEquals("Exception from queryAai: org.onap.policy.aai.util.AAIException: AAI Response is null "
+ assertEquals("Exception from queryAai: org.onap.policy.aai.util.AaiException: AAI Response is null "
+ "(query by vnf-id)", e.getMessage());
}
@@ -1030,7 +1030,7 @@ public class ControlLoopEventManagerTest {
manager.queryAai(onsetEvent);
fail("test should throw an exception here");
} catch (Exception e) {
- assertEquals("Exception from queryAai: org.onap.policy.aai.util.AAIException: AAI Response is null "
+ assertEquals("Exception from queryAai: org.onap.policy.aai.util.AaiException: AAI Response is null "
+ "(query by vnf-name)", e.getMessage());
}
@@ -1040,7 +1040,7 @@ public class ControlLoopEventManagerTest {
manager.queryAai(onsetEvent);
fail("test should throw an exception here");
} catch (Exception e) {
- assertEquals("Exception from queryAai: org.onap.policy.aai.util.AAIException: AAI Response is null "
+ assertEquals("Exception from queryAai: org.onap.policy.aai.util.AaiException: AAI Response is null "
+ "(query by vserver-name)", e.getMessage());
}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index 0d811bbd8..8efa3706d 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
@@ -40,7 +40,7 @@ import org.apache.commons.io.IOUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.aai.util.AAIException;
+import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
@@ -136,7 +136,7 @@ public class ControlLoopOperationManagerTest {
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {
status = eventManager.onNewEvent(onset);
- } catch (AAIException e) {
+ } catch (AaiException e) {
logger.warn(e.toString());
fail("A&AI Query Failed");
}
@@ -237,7 +237,7 @@ public class ControlLoopOperationManagerTest {
assertNotNull(manager.getOperationResult());
assertTrue(manager.getOperationResult().equals(PolicyResult.FAILURE_RETRIES));
assertTrue(manager.getHistory().size() == 2);
- } catch (ControlLoopException | AAIException e) {
+ } catch (ControlLoopException | AaiException e) {
fail(e.getMessage());
}
}
@@ -267,7 +267,7 @@ public class ControlLoopOperationManagerTest {
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {
status = eventManager.onNewEvent(onset);
- } catch (AAIException e) {
+ } catch (AaiException e) {
logger.warn(e.toString());
fail("A&AI Query Failed");
}
@@ -335,13 +335,13 @@ public class ControlLoopOperationManagerTest {
assertFalse(manager.isOperationRunning());
assertTrue(manager.getHistory().size() == 1);
assertTrue(manager.getOperationResult().equals(PolicyResult.FAILURE_TIMEOUT));
- } catch (ControlLoopException | AAIException e) {
+ } catch (ControlLoopException | AaiException e) {
fail(e.getMessage());
}
}
@Test
- public void testMethods() throws IOException, ControlLoopException, AAIException {
+ public void testMethods() throws IOException, ControlLoopException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/testSOactor.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -434,7 +434,7 @@ public class ControlLoopOperationManagerTest {
onsetEvent.getAAI().remove("generic-vnf.vnf-id");
manager.getVnfResponse();
- clom.getEventManager().getVnfResponse().setVnfID("generic-vnf.vnf-id");
+ clom.getEventManager().getVnfResponse().setVnfId("generic-vnf.vnf-id");
assertEquals("generic-vnf.vnf-id", clom.getTarget(policy));
policy.getTarget().setType(TargetType.VFC);
@@ -468,7 +468,7 @@ public class ControlLoopOperationManagerTest {
}
@Test
- public void testConstructor() throws IOException, ControlLoopException, AAIException {
+ public void testConstructor() throws IOException, ControlLoopException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -523,7 +523,7 @@ public class ControlLoopOperationManagerTest {
}
@Test
- public void testStartOperation() throws IOException, ControlLoopException, AAIException {
+ public void testStartOperation() throws IOException, ControlLoopException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -627,7 +627,7 @@ public class ControlLoopOperationManagerTest {
}
@Test
- public void testOnResponse() throws IOException, ControlLoopException, AAIException {
+ public void testOnResponse() throws IOException, ControlLoopException, AaiException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
@@ -720,7 +720,7 @@ public class ControlLoopOperationManagerTest {
}
@Test
- public void testCompleteOperation() throws ControlLoopException, AAIException, IOException {
+ public void testCompleteOperation() throws ControlLoopException, AaiException, IOException {
InputStream is = new FileInputStream(new File("src/test/resources/test.yaml"));
final String yamlString = IOUtils.toString(is, StandardCharsets.UTF_8);
diff --git a/controlloop/common/model-impl/aai/pom.xml b/controlloop/common/model-impl/aai/pom.xml
index 5d527819b..bc5a9151e 100644
--- a/controlloop/common/model-impl/aai/pom.xml
+++ b/controlloop/common/model-impl/aai/pom.xml
@@ -47,4 +47,45 @@
<scope>provided</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>onap-java-style</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ <configuration>
+ <!-- Use Google Java Style Guide:
+ https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
+ with minor changes -->
+ <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+ <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
+ <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+ <includeResources>true</includeResources>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <includeTestResources>true</includeTestResources>
+ <excludes>
+ </excludes>
+ <consoleOutput>true</consoleOutput>
+ <failOnViolation>true</failOnViolation>
+ <violationSeverity>warning</violationSeverity>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>0.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java
deleted file mode 100644
index ef205cfea..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAIGETResponse implements Serializable {
-
- /**
- * define common fields for AAIGETVnfResponse and AAIGETVserverResponse
- */
- private static final long serialVersionUID = 7311418432051756161L;
-
- @SerializedName("in-maint")
- private String inMaint;
-
- @SerializedName("is-closed-loop-disabled")
- private String isClosedLoopDisabled;
-
- @SerializedName("model-invariant-id")
- private String modelInvariantId;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- @SerializedName("relationship-list")
- private RelationshipList relationshipList;
-
- @SerializedName("requestError")
- private AAINQRequestError requestError;
-
- public String getInMaint() {
- return inMaint;
- }
-
- public String getIsClosedLoopDisabled() {
- return isClosedLoopDisabled;
- }
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public RelationshipList getRelationshipList() {
- return relationshipList;
- }
-
- public AAINQRequestError getRequestError() {
- return requestError;
- }
-
- public void setInMaint(String inMaint) {
- this.inMaint = inMaint;
- }
-
- public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
- this.isClosedLoopDisabled = isClosedLoopDisabled;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public void setRelationshipList(RelationshipList relationshipList) {
- this.relationshipList = relationshipList;
- }
-
- public void setRequestError(AAINQRequestError requestError) {
- this.requestError = requestError;
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java
deleted file mode 100644
index a67963698..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAIGETVnfResponse extends AAIGETResponse implements Serializable {
-
- private static final long serialVersionUID = -6247505944905898870L;
-
- @SerializedName("vnf-id")
- private String vnfID;
-
- @SerializedName("vnf-name")
- private String vnfName;
-
- @SerializedName("vnf-type")
- private String vnfType;
-
- @SerializedName("service-id")
- private String serviceId;
-
- @SerializedName("orchestration-status")
- private String orchestrationStatus;
-
- public String getVnfID() {
- return vnfID;
- }
-
- public String getVnfName() {
- return vnfName;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public String getServiceId() {
- return serviceId;
- }
-
- public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
-
- public void setVnfID(String vnfID) {
- this.vnfID = vnfID;
- }
-
- public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
- }
-
- public void setVnfType(String vnfType) {
- this.vnfType = vnfType;
- }
-
- public void setServiceId(String serviceId) {
- this.serviceId = serviceId;
- }
-
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
-} \ No newline at end of file
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
deleted file mode 100644
index 05dffc1dd..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAIGETVserverResponse extends AAIGETResponse implements Serializable {
-
- private static final long serialVersionUID = -6247505944905898870L;
-
- @SerializedName("vserver-id")
- private String vserverID;
-
- @SerializedName("vserver-name")
- private String vserverName;
-
- @SerializedName("vserver-name2")
- private String vserverName2;
-
- @SerializedName("vserver-selflink")
- private String vserverSelflink;
-
- public String getVserverID() {
- return vserverID;
- }
-
- public String getVserverName() {
- return vserverName;
- }
-
- public String getVserverName2() {
- return vserverName2;
- }
-
- public String getVserverSelflink() {
- return vserverSelflink;
- }
-
- public void setVserverID(String vserverID) {
- this.vserverID = vserverID;
- }
-
- public void setVserverName(String vserverName) {
- this.vserverName = vserverName;
- }
-
- public void setVserverName2(String vserverName2) {
- this.vserverName2 = vserverName2;
- }
-
- public void setVserverSelflink(String vserverSelflink) {
- this.vserverSelflink = vserverSelflink;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
deleted file mode 100644
index 53d32b056..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.rest.RESTManager;
-import org.onap.policy.rest.RESTManager.Pair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.gson.JsonSyntaxException;
-
-/**
- * This class handles communication towards and responses from A&AI for this module.
- */
-public final class AAIManager {
-
- /** The Constant LINE_SEPARATOR. */
- private static final String LINE_SEPARATOR = System.lineSeparator();
-
- /** The Constant logger. */
- private static final Logger logger = LoggerFactory.getLogger(AAIManager.class);
-
- /** The Constant netLogger. */
- private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER);
-
- /** The rest manager. */
- // The REST manager used for processing REST calls for this AAI manager
- private final RESTManager restManager;
-
- /**
- * Constructor, create the AAI manager with the specified REST manager.
- *
- * @param restManager the rest manager to use for REST calls
- */
- public AAIManager(final RESTManager restManager) {
- this.restManager = restManager;
- }
-
- /**
- * Post a query to A&AI.
- *
- * @param url the A&AI URL
- * @param username the user name for authentication
- * @param password the password for authentication
- * @param request the request to issue towards A&AI
- * @param requestID the UUID of the request
- * @return the response from A&AI
- */
- public AAINQResponse postQuery(String url, String username, String password, AAINQRequest request, UUID requestID) {
-
- Map<String, String> headers = createHeaders(requestID);
-
- url = url + "/aai/search/named-query";
-
- logger.debug("RESTManager.post before");
- String requestJson = Serialization.gsonPretty.toJson(request);
- netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, requestJson);
- Pair<Integer, String> httpDetails = restManager.post(url, username, password, headers, "application/json", requestJson);
- logger.debug("RESTManager.post after");
-
- if (httpDetails == null) {
- logger.info("AAI POST Null Response to {}", url);
- return null;
- }
-
- int httpResponseCode = httpDetails.a;
-
- logger.info(url);
- logger.info("{}", httpResponseCode);
- logger.info(httpDetails.b);
-
- if (httpDetails.b != null) {
- return composeResponse(httpDetails, url, AAINQResponse.class);
- }
- return null;
- }
-
- /**
- * Perform a GET request for a particular virtual server towards A&AI.
- *
- * @param urlGet the A&AI URL
- * @param username the user name for authentication
- * @param password the password for authentication
- * @param requestID the UUID of the request
- * @param key the key of the virtual server
- * @return the response for the virtual server from A&AI
- */
- public AAIGETVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestID, String key) {
- return getQuery(urlGet, username, password, requestID, key, AAIGETVserverResponse.class);
- }
-
- /**
- * Perform a GET request for a particular VNF by VNF ID towards A&AI.
- *
- * @param urlGet the A&AI URL
- * @param username the user name for authentication
- * @param password the password for authentication
- * @param requestID the UUID of the request
- * @param key the ID of the VNF
- * @return the response for the virtual server from A&AI
- */
- public AAIGETVnfResponse getQueryByVnfID(String urlGet, String username, String password, UUID requestID, String key) {
- return getQuery(urlGet, username, password, requestID, key, AAIGETVnfResponse.class);
- }
-
- /**
- * Perform a GET request for a particular VNF by VNF name towards A&AI.
- *
- * @param urlGet the A&AI URL
- * @param username the user name for authentication
- * @param password the password for authentication
- * @param requestID the UUID of the request
- * @param key the name of the VNF
- * @return the response for the virtual server from A&AI
- */
- public AAIGETVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestID, String key) {
- return getQuery(urlGet, username, password, requestID, key, AAIGETVnfResponse.class);
- }
-
- /**
- * Perform a GET query for a particular entity towards A&AI.
- *
- * @param <T> the generic type for the response
- * @param urlGet the A&AI URL
- * @param username the user name for authentication
- * @param password the password for authentication
- * @param requestID the UUID of the request
- * @param key the name of the VNF
- * @param classOfT the class of the response to return
- * @return the response for the virtual server from A&AI
- */
- private <T> T getQuery(final String url, final String username, final String password, final UUID requestID, final String key, final Class<T> classOfResponse) {
-
- Map<String, String> headers = createHeaders(requestID);
-
- String urlGet = url + key;
-
- int attemptsLeft = 3;
-
- while(attemptsLeft-- > 0){
- netLogger.info("[OUT|{}|{}|]", "AAI", urlGet);
- Pair<Integer, String> httpDetailsGet = restManager.get(urlGet, username, password, headers);
- if (httpDetailsGet == null) {
- logger.info("AAI GET Null Response to {}", urlGet);
- return null;
- }
-
- int httpResponseCode = httpDetailsGet.a;
-
- logger.info(urlGet);
- logger.info("{}", httpResponseCode);
- logger.info(httpDetailsGet.b);
-
- if (httpResponseCode == 200) {
- T responseGet = composeResponse(httpDetailsGet, urlGet, classOfResponse);
- if (responseGet != null) {
- return responseGet;
- }
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
-
- }
-
- return null;
- }
-
- /**
- * Create the headers for the HTTP request.
- *
- * @param requestID the request ID to insert in the headers
- * @return the HTTP headers
- */
- private Map<String, String> createHeaders(final UUID requestID) {
- Map<String, String> headers = new HashMap<>();
-
- headers.put("X-FromAppId", "POLICY");
- headers.put("X-TransactionId", requestID.toString());
- headers.put("Accept", "application/json");
-
- return headers;
- }
-
- /**
- * This method uses Google's GSON to create a response object from a JSON string.
- *
- * @param <T> the generic type
- * @param httpDetails the HTTP response
- * @param url the URL from which the response came
- * @param classOfResponse The response class
- * @return an instance of the response class
- * @throws JsonSyntaxException on GSON errors instantiating the response
- */
- private <T> T composeResponse(final Pair<Integer, String> httpDetails, final String url, final Class<T> classOfResponse) {
- try {
- T response = Serialization.gsonPretty.fromJson(httpDetails.b, classOfResponse);
- netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, httpDetails.b);
- return response;
- } catch (JsonSyntaxException e) {
- logger.error("postQuery threw: ", e);
- return null;
- }
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java
deleted file mode 100644
index e7a8f19c3..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQCloudRegion implements Serializable {
-
- private static final long serialVersionUID = -897231529157222683L;
-
- @SerializedName("cloud-owner")
- private String cloudOwner;
-
- @SerializedName("cloud-region-id")
- private String cloudRegionId;
-
- @SerializedName("cloud-region-version")
- private String cloudRegionVersion;
-
- @SerializedName("complex-name")
- private String complexName;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- public String getCloudOwner() {
- return cloudOwner;
- }
-
- public String getCloudRegionId() {
- return cloudRegionId;
- }
-
- public String getCloudRegionVersion() {
- return cloudRegionVersion;
- }
-
- public String getComplexName() {
- return complexName;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public void setCloudOwner(String cloudOwner) {
- this.cloudOwner = cloudOwner;
- }
-
- public void setCloudRegionId(String cloudRegionId) {
- this.cloudRegionId = cloudRegionId;
- }
-
- public void setCloudRegionVersion(String cloudRegionVersion) {
- this.cloudRegionVersion = cloudRegionVersion;
- }
-
- public void setComplexName(String complexName) {
- this.complexName = complexName;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java
deleted file mode 100644
index 62903a083..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQGenericVNF implements Serializable {
-
- private static final long serialVersionUID = 834322706248060559L;
-
- @SerializedName("vnf-id")
- private String vnfID;
-
- @SerializedName("vnf-name")
- private String vnfName;
-
- @SerializedName("vnf-name2")
- private String vnfName2;
-
- @SerializedName("vnf-type")
- private String vnfType;
-
- @SerializedName("service-id")
- private String serviceId;
-
- @SerializedName("prov-status")
- private String provStatus;
-
- @SerializedName("operational-state")
- private String operationalState;
-
- @SerializedName("ipv4-oam-address")
- private String ipv4OamAddress;
-
- @SerializedName("ipv4-loopback0-address")
- private String ipv4Loopback0Address;
-
- @SerializedName("in-maint")
- private Boolean inMaint;
-
- @SerializedName("is-closed-loop-disabled")
- private Boolean isClosedLoopDisabled;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- @SerializedName("encrypted-access-flag")
- private Boolean encrypedAccessFlag;
-
- @SerializedName("persona-model-id")
- private String personaModelId;
-
- @SerializedName("persona-model-version")
- private String personaModelVersion;
-
- @SerializedName("model-invariant-id")
- private String modelInvariantId;
-
- @SerializedName("model-version-id")
- private String modelVersionId;
-
- public String getVnfID() {
- return vnfID;
- }
-
- public String getVnfName() {
- return vnfName;
- }
-
- public String getVnfName2() {
- return vnfName2;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public String getServiceId() {
- return serviceId;
- }
-
- public String getProvStatus() {
- return provStatus;
- }
-
- public String getOperationalState() {
- return operationalState;
- }
-
- public String getIpv4OamAddress() {
- return ipv4OamAddress;
- }
-
- public String getIpv4Loopback0Address() {
- return ipv4Loopback0Address;
- }
-
- public Boolean getInMaint() {
- return inMaint;
- }
-
- public Boolean getIsClosedLoopDisabled() {
- return isClosedLoopDisabled;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public Boolean getEncrypedAccessFlag() {
- return encrypedAccessFlag;
- }
-
- public String getPersonaModelId() {
- return personaModelId;
- }
-
- public String getPersonaModelVersion() {
- return personaModelVersion;
- }
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- public void setVnfID(String vnfID) {
- this.vnfID = vnfID;
- }
-
- public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
- }
-
- public void setVnfName2(String vnfName2) {
- this.vnfName2 = vnfName2;
- }
-
- public void setVnfType(String vnfType) {
- this.vnfType = vnfType;
- }
-
- public void setServiceId(String serviceId) {
- this.serviceId = serviceId;
- }
-
- public void setProvStatus(String provStatus) {
- this.provStatus = provStatus;
- }
-
- public void setOperationalState(String operationalState) {
- this.operationalState = operationalState;
- }
-
- public void setIpv4OamAddress(String ipv4OamAddress) {
- this.ipv4OamAddress = ipv4OamAddress;
- }
-
- public void setIpv4Loopback0Address(String ipv4Loopback0Address) {
- this.ipv4Loopback0Address = ipv4Loopback0Address;
- }
-
- public void setInMaint(Boolean inMaint) {
- this.inMaint = inMaint;
- }
-
- public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
- this.isClosedLoopDisabled = isClosedLoopDisabled;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public void setEncrypedAccessFlag(Boolean encrypedAccessFlag) {
- this.encrypedAccessFlag = encrypedAccessFlag;
- }
-
- public void setPersonaModelId(String personaModelId) {
- this.personaModelId = personaModelId;
- }
-
- public void setPersonaModelVersion(String personaModelVersion) {
- this.personaModelVersion = personaModelVersion;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java
deleted file mode 100644
index e9a387eff..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQInventoryResponseItem implements Serializable {
-
- private static final long serialVersionUID = 7142072567154675183L;
-
- @SerializedName("model-name")
- private String modelName;
-
- @SerializedName("vf-module")
- private AAINQVfModule vfModule;
-
- @SerializedName("service-instance")
- private AAINQServiceInstance serviceInstance;
-
- @SerializedName("vserver")
- private AAINQVServer vserver;
-
- @SerializedName("tenant")
- private AAINQTenant tenant;
-
- @SerializedName("cloud-region")
- private AAINQCloudRegion cloudRegion;
-
- @SerializedName("generic-vnf")
- private AAINQGenericVNF genericVNF;
-
- @SerializedName("extra-properties")
- private AAINQExtraProperties extraProperties;
-
- @SerializedName("inventory-response-items")
- private AAINQInventoryResponseItems items;
-
- public String getModelName() {
- return modelName;
- }
-
- public AAINQVfModule getVfModule() {
- return vfModule;
- }
-
- public AAINQServiceInstance getServiceInstance() {
- return serviceInstance;
- }
-
- public AAINQVServer getVserver() {
- return vserver;
- }
-
- public AAINQTenant getTenant() {
- return tenant;
- }
-
- public AAINQCloudRegion getCloudRegion() {
- return cloudRegion;
- }
-
- public AAINQGenericVNF getGenericVNF() {
- return genericVNF;
- }
-
- public AAINQExtraProperties getExtraProperties() {
- return extraProperties;
- }
-
- public AAINQInventoryResponseItems getItems() {
- return items;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- public void setVfModule(AAINQVfModule vfModule) {
- this.vfModule = vfModule;
- }
-
- public void setServiceInstance(AAINQServiceInstance serviceInstance) {
- this.serviceInstance = serviceInstance;
- }
-
- public void setVserver(AAINQVServer vserver) {
- this.vserver = vserver;
- }
-
- public void setTenant(AAINQTenant tenant) {
- this.tenant = tenant;
- }
-
- public void setCloudRegion(AAINQCloudRegion cloudRegion) {
- this.cloudRegion = cloudRegion;
- }
-
- public void setGenericVNF(AAINQGenericVNF genericVNF) {
- this.genericVNF = genericVNF;
- }
-
- public void setExtraProperties(AAINQExtraProperties extraProperties) {
- this.extraProperties = extraProperties;
- }
-
- public void setItems(AAINQInventoryResponseItems items) {
- this.items = items;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java
deleted file mode 100644
index 3ae366ea5..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQServiceInstance implements Serializable {
- private static final long serialVersionUID = -8000944396593889586L;
-
- @SerializedName("service-instance-id")
- private String serviceInstanceID;
-
- @SerializedName("service-instance-name")
- private String serviceInstanceName;
-
- @SerializedName("persona-model-id")
- private String personaModelId;
-
- @SerializedName("persona-model-version")
- private String personaModelVersion;
-
- @SerializedName("service-instance-location-id")
- private String serviceInstanceLocationId;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- @SerializedName("model-invariant-id")
- private String modelInvariantId;
-
- @SerializedName("model-version-id")
- private String modelVersionId;
-
- public String getServiceInstanceID() {
- return serviceInstanceID;
- }
-
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
-
- public String getPersonaModelId() {
- return personaModelId;
- }
-
- public String getPersonaModelVersion() {
- return personaModelVersion;
- }
-
- public String getServiceInstanceLocationId() {
- return serviceInstanceLocationId;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- public void setServiceInstanceID(String serviceInstanceID) {
- this.serviceInstanceID = serviceInstanceID;
- }
-
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
-
- public void setPersonaModelId(String personaModelId) {
- this.personaModelId = personaModelId;
- }
-
- public void setPersonaModelVersion(String personaModelVersion) {
- this.personaModelVersion = personaModelVersion;
- }
-
- public void setServiceInstanceLocationId(String serviceInstanceLocationId) {
- this.serviceInstanceLocationId = serviceInstanceLocationId;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java
deleted file mode 100644
index 180ac3680..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQVServer implements Serializable {
- private static final long serialVersionUID = -6718526692734215643L;
-
- @SerializedName("vserver-id")
- private String vserverId;
-
- @SerializedName("vserver-name")
- private String vserverName;
-
- @SerializedName("vserver-name2")
- private String vserverName2;
-
- @SerializedName("prov-status")
- private String provStatus;
-
- @SerializedName("vserver-selflink")
- private String vserverSelflink;
-
- @SerializedName("in-maint")
- private Boolean inMaint;
-
- @SerializedName("is-closed-loop-disabled")
- private Boolean isClosedLoopDisabled;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- public String getVserverId() {
- return vserverId;
- }
-
- public String getVserverName() {
- return vserverName;
- }
-
- public String getVserverName2() {
- return vserverName2;
- }
-
- public String getProvStatus() {
- return provStatus;
- }
-
- public String getVserverSelflink() {
- return vserverSelflink;
- }
-
- public Boolean getInMaint() {
- return inMaint;
- }
-
- public Boolean getIsClosedLoopDisabled() {
- return isClosedLoopDisabled;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public void setVserverId(String vserverId) {
- this.vserverId = vserverId;
- }
-
- public void setVserverName(String vserverName) {
- this.vserverName = vserverName;
- }
-
- public void setVserverName2(String vserverName2) {
- this.vserverName2 = vserverName2;
- }
-
- public void setProvStatus(String provStatus) {
- this.provStatus = provStatus;
- }
-
- public void setVserverSelflink(String vserverSelflink) {
- this.vserverSelflink = vserverSelflink;
- }
-
- public void setInMaint(Boolean inMaint) {
- this.inMaint = inMaint;
- }
-
- public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
- this.isClosedLoopDisabled = isClosedLoopDisabled;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
-
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java
deleted file mode 100644
index 97c794f07..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQVfModule implements Serializable {
- private static final long serialVersionUID = 8019133081429638231L;
-
- @SerializedName("vf-module-id")
- private String vfModuleId;
-
- @SerializedName("vf-module-name")
- private String vfModuleName;
-
- @SerializedName("heat-stack-id")
- private String heatStackId;
-
- @SerializedName("orchestration-status")
- private String orchestrationStatus;
-
- @SerializedName("is-base-vf-module")
- private Boolean isBaseVfModule;
-
- @SerializedName("resource-version")
- private String resourceVersion;
-
- @SerializedName("persona-model-id")
- private String personaModelId;
-
- @SerializedName("persona-model-version")
- private String personaModelVersion;
-
- @SerializedName("widget-model-id")
- private String widgetModelId;
-
- @SerializedName("widget-model-version")
- private String widgetModelVersion;
-
- @SerializedName("contrail-service-instance-fqdn")
- private String contrailServiceInstanceFqdn;
-
- @SerializedName("model-invariant-id")
- private String modelInvariantId;
-
- @SerializedName("model-version-id")
- private String modelVersionId;
-
- public String getVfModuleId() {
- return vfModuleId;
- }
-
- public String getVfModuleName() {
- return vfModuleName;
- }
-
- public String getHeatStackId() {
- return heatStackId;
- }
-
- public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
-
- public Boolean getIsBaseVfModule() {
- return isBaseVfModule;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public String getPersonaModelId() {
- return personaModelId;
- }
-
- public String getPersonaModelVersion() {
- return personaModelVersion;
- }
-
- public String getWidgetModelId() {
- return widgetModelId;
- }
-
- public String getWidgetModelVersion() {
- return widgetModelVersion;
- }
-
- public String getContrailServiceInstanceFqdn() {
- return contrailServiceInstanceFqdn;
- }
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-
- public void setHeatStackId(String heatStackId) {
- this.heatStackId = heatStackId;
- }
-
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
-
- public void setIsBaseVfModule(Boolean isBaseVfModule) {
- this.isBaseVfModule = isBaseVfModule;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public void setPersonaModelId(String personaModelId) {
- this.personaModelId = personaModelId;
- }
-
- public void setPersonaModelVersion(String personaModelVersion) {
- this.personaModelVersion = personaModelVersion;
- }
-
- public void setWidgetModelId(String widgetModelId) {
- this.widgetModelId = widgetModelId;
- }
-
- public void setWidgetModelVersion(String widgetModelVersion) {
- this.widgetModelVersion = widgetModelVersion;
- }
-
- public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) {
- this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java
new file mode 100644
index 000000000..e47d31912
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiGetResponse implements Serializable {
+
+ /**
+ * define common fields for AAIGETVnfResponse and AAIGETVserverResponse.
+ */
+ private static final long serialVersionUID = 7311418432051756161L;
+
+ @SerializedName("in-maint")
+ private String inMaint;
+
+ @SerializedName("is-closed-loop-disabled")
+ private String isClosedLoopDisabled;
+
+ @SerializedName("model-invariant-id")
+ private String modelInvariantId;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ @SerializedName("relationship-list")
+ private RelationshipList relationshipList;
+
+ @SerializedName("requestError")
+ private AaiNqRequestError requestError;
+
+ public String getInMaint() {
+ return inMaint;
+ }
+
+ public String getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public AaiNqRequestError getRequestError() {
+ return requestError;
+ }
+
+ public void setInMaint(String inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+ public void setRequestError(AaiNqRequestError requestError) {
+ this.requestError = requestError;
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java
new file mode 100644
index 000000000..ccc0fa4c3
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiGetVnfResponse extends AaiGetResponse implements Serializable {
+
+ private static final long serialVersionUID = -6247505944905898870L;
+
+ @SerializedName("vnf-id")
+ private String vnfId;
+
+ @SerializedName("vnf-name")
+ private String vnfName;
+
+ @SerializedName("vnf-type")
+ private String vnfType;
+
+ @SerializedName("service-id")
+ private String serviceId;
+
+ @SerializedName("orchestration-status")
+ private String orchestrationStatus;
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java
new file mode 100644
index 000000000..ca258a93c
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiGetVserverResponse extends AaiGetResponse implements Serializable {
+
+ private static final long serialVersionUID = -6247505944905898870L;
+
+ @SerializedName("vserver-id")
+ private String vserverId;
+
+ @SerializedName("vserver-name")
+ private String vserverName;
+
+ @SerializedName("vserver-name2")
+ private String vserverName2;
+
+ @SerializedName("vserver-selflink")
+ private String vserverSelflink;
+
+ public String getVserverId() {
+ return vserverId;
+ }
+
+ public String getVserverName() {
+ return vserverName;
+ }
+
+ public String getVserverName2() {
+ return vserverName2;
+ }
+
+ public String getVserverSelflink() {
+ return vserverSelflink;
+ }
+
+ public void setVserverId(String vserverId) {
+ this.vserverId = vserverId;
+ }
+
+ public void setVserverName(String vserverName) {
+ this.vserverName = vserverName;
+ }
+
+ public void setVserverName2(String vserverName2) {
+ this.vserverName2 = vserverName2;
+ }
+
+ public void setVserverSelflink(String vserverSelflink) {
+ this.vserverSelflink = vserverSelflink;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
new file mode 100644
index 000000000..4aa231cb8
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
@@ -0,0 +1,237 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.JsonSyntaxException;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.policy.aai.util.Serialization;
+import org.onap.policy.rest.RESTManager;
+import org.onap.policy.rest.RESTManager.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class handles communication towards and responses from A&AI for this module.
+ */
+public final class AaiManager {
+
+ /** The Constant LINE_SEPARATOR. */
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ /** The Constant logger. */
+ private static final Logger logger = LoggerFactory.getLogger(AaiManager.class);
+
+ /** The Constant netLogger. */
+ private static final Logger netLogger =
+ LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER);
+
+ /** The rest manager. */
+ // The REST manager used for processing REST calls for this AAI manager
+ private final RESTManager restManager;
+
+ /**
+ * Constructor, create the AAI manager with the specified REST manager.
+ *
+ * @param restManager the rest manager to use for REST calls
+ */
+ public AaiManager(final RESTManager restManager) {
+ this.restManager = restManager;
+ }
+
+ /**
+ * Post a query to A&AI.
+ *
+ * @param url the A&AI URL
+ * @param username the user name for authentication
+ * @param password the password for authentication
+ * @param request the request to issue towards A&AI
+ * @param requestId the UUID of the request
+ * @return the response from A&AI
+ */
+ public AaiNqResponse postQuery(String url, String username, String password, AaiNqRequest request, UUID requestId) {
+
+ final Map<String, String> headers = createHeaders(requestId);
+
+ url = url + "/aai/search/named-query";
+
+ logger.debug("RESTManager.post before");
+ String requestJson = Serialization.gsonPretty.toJson(request);
+ netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, requestJson);
+ Pair<Integer, String> httpDetails =
+ restManager.post(url, username, password, headers, "application/json", requestJson);
+ logger.debug("RESTManager.post after");
+
+ if (httpDetails == null) {
+ logger.info("AAI POST Null Response to {}", url);
+ return null;
+ }
+
+ int httpResponseCode = httpDetails.a;
+
+ logger.info(url);
+ logger.info("{}", httpResponseCode);
+ logger.info(httpDetails.b);
+
+ if (httpDetails.b != null) {
+ return composeResponse(httpDetails, url, AaiNqResponse.class);
+ }
+ return null;
+ }
+
+ /**
+ * Perform a GET request for a particular virtual server towards A&AI.
+ *
+ * @param urlGet the A&AI URL
+ * @param username the user name for authentication
+ * @param password the password for authentication
+ * @param requestId the UUID of the request
+ * @param key the key of the virtual server
+ * @return the response for the virtual server from A&AI
+ */
+ public AaiGetVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestId,
+ String key) {
+ return getQuery(urlGet, username, password, requestId, key, AaiGetVserverResponse.class);
+ }
+
+ /**
+ * Perform a GET request for a particular VNF by VNF ID towards A&AI.
+ *
+ * @param urlGet the A&AI URL
+ * @param username the user name for authentication
+ * @param password the password for authentication
+ * @param requestId the UUID of the request
+ * @param key the ID of the VNF
+ * @return the response for the virtual server from A&AI
+ */
+ public AaiGetVnfResponse getQueryByVnfId(String urlGet, String username, String password, UUID requestId,
+ String key) {
+ return getQuery(urlGet, username, password, requestId, key, AaiGetVnfResponse.class);
+ }
+
+ /**
+ * Perform a GET request for a particular VNF by VNF name towards A&AI.
+ *
+ * @param urlGet the A&AI URL
+ * @param username the user name for authentication
+ * @param password the password for authentication
+ * @param requestId the UUID of the request
+ * @param key the name of the VNF
+ * @return the response for the virtual server from A&AI
+ */
+ public AaiGetVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestId,
+ String key) {
+ return getQuery(urlGet, username, password, requestId, key, AaiGetVnfResponse.class);
+ }
+
+ /**
+ * Perform a GET query for a particular entity towards A&AI.
+ *
+ * @param <T> the generic type for the response
+ * @param urlGet the A&AI URL
+ * @param username the user name for authentication
+ * @param password the password for authentication
+ * @param requestId the UUID of the request
+ * @param key the name of the VNF
+ * @param classOfT the class of the response to return
+ * @return the response for the virtual server from A&AI
+ */
+ private <T> T getQuery(final String url, final String username, final String password, final UUID requestId,
+ final String key, final Class<T> classOfResponse) {
+
+ Map<String, String> headers = createHeaders(requestId);
+
+ String urlGet = url + key;
+
+ int attemptsLeft = 3;
+
+ while (attemptsLeft-- > 0) {
+ netLogger.info("[OUT|{}|{}|]", "AAI", urlGet);
+ Pair<Integer, String> httpDetailsGet = restManager.get(urlGet, username, password, headers);
+ if (httpDetailsGet == null) {
+ logger.info("AAI GET Null Response to {}", urlGet);
+ return null;
+ }
+
+ int httpResponseCode = httpDetailsGet.a;
+
+ logger.info(urlGet);
+ logger.info("{}", httpResponseCode);
+ logger.info(httpDetailsGet.b);
+
+ if (httpResponseCode == 200) {
+ T responseGet = composeResponse(httpDetailsGet, urlGet, classOfResponse);
+ if (responseGet != null) {
+ return responseGet;
+ }
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+
+ }
+
+ return null;
+ }
+
+ /**
+ * Create the headers for the HTTP request.
+ *
+ * @param requestId the request ID to insert in the headers
+ * @return the HTTP headers
+ */
+ private Map<String, String> createHeaders(final UUID requestId) {
+ Map<String, String> headers = new HashMap<>();
+
+ headers.put("X-FromAppId", "POLICY");
+ headers.put("X-TransactionId", requestId.toString());
+ headers.put("Accept", "application/json");
+
+ return headers;
+ }
+
+ /**
+ * This method uses Google's GSON to create a response object from a JSON string.
+ *
+ * @param <T> the generic type
+ * @param httpDetails the HTTP response
+ * @param url the URL from which the response came
+ * @param classOfResponse The response class
+ * @return an instance of the response class
+ * @throws JsonSyntaxException on GSON errors instantiating the response
+ */
+ private <T> T composeResponse(final Pair<Integer, String> httpDetails, final String url,
+ final Class<T> classOfResponse) {
+ try {
+ T response = Serialization.gsonPretty.fromJson(httpDetails.b, classOfResponse);
+ netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, httpDetails.b);
+ return response;
+ } catch (JsonSyntaxException e) {
+ logger.error("postQuery threw: ", e);
+ return null;
+ }
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java
new file mode 100644
index 000000000..b0715bc7a
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqCloudRegion implements Serializable {
+
+ private static final long serialVersionUID = -897231529157222683L;
+
+ @SerializedName("cloud-owner")
+ private String cloudOwner;
+
+ @SerializedName("cloud-region-id")
+ private String cloudRegionId;
+
+ @SerializedName("cloud-region-version")
+ private String cloudRegionVersion;
+
+ @SerializedName("complex-name")
+ private String complexName;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public String getCloudRegionId() {
+ return cloudRegionId;
+ }
+
+ public String getCloudRegionVersion() {
+ return cloudRegionVersion;
+ }
+
+ public String getComplexName() {
+ return complexName;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public void setCloudRegionId(String cloudRegionId) {
+ this.cloudRegionId = cloudRegionId;
+ }
+
+ public void setCloudRegionVersion(String cloudRegionVersion) {
+ this.cloudRegionVersion = cloudRegionVersion;
+ }
+
+ public void setComplexName(String complexName) {
+ this.complexName = complexName;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java
index 2322ef2f9..abe779f32 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,23 +20,23 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQExtraProperties implements Serializable {
- private static final long serialVersionUID = 4109625574744702319L;
+public class AaiNqExtraProperties implements Serializable {
+ private static final long serialVersionUID = 4109625574744702319L;
- @SerializedName("extra-property")
- private List<AAINQExtraProperty> extraProperty = new LinkedList<>();
+ @SerializedName("extra-property")
+ private List<AaiNqExtraProperty> extraProperty = new LinkedList<>();
- public List<AAINQExtraProperty> getExtraProperty() {
- return extraProperty;
- }
+ public List<AaiNqExtraProperty> getExtraProperty() {
+ return extraProperty;
+ }
- public void setExtraProperty(List<AAINQExtraProperty> extraProperty) {
- this.extraProperty = extraProperty;
- }
+ public void setExtraProperty(List<AaiNqExtraProperty> extraProperty) {
+ this.extraProperty = extraProperty;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java
index 5761a543b..d63fe1f08 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,41 +20,40 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqExtraProperty implements Serializable {
+
+ private static final long serialVersionUID = -3861240617222397736L;
+
+ @SerializedName("property-name")
+ private String propertyName;
+
+ @SerializedName("property-value")
+ private String propertyValue;
+
+ public AaiNqExtraProperty() {}
+
+ public AaiNqExtraProperty(String propertyName, String propertyValue) {
+ this.propertyName = propertyName;
+ this.propertyValue = propertyValue;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getPropertyValue() {
+ return propertyValue;
+ }
+
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
-public class AAINQExtraProperty implements Serializable {
-
- private static final long serialVersionUID = -3861240617222397736L;
-
- @SerializedName("property-name")
- private String propertyName;
-
- @SerializedName("property-value")
- private String propertyValue;
-
- public AAINQExtraProperty() {
- }
-
- public AAINQExtraProperty(String propertyName, String propertyValue) {
- this.propertyName = propertyName;
- this.propertyValue = propertyValue;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public String getPropertyValue() {
- return propertyValue;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public void setPropertyValue(String propertyValue) {
- this.propertyValue = propertyValue;
- }
+ public void setPropertyValue(String propertyValue) {
+ this.propertyValue = propertyValue;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java
new file mode 100644
index 000000000..342fefbec
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java
@@ -0,0 +1,217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqGenericVnf implements Serializable {
+
+ private static final long serialVersionUID = 834322706248060559L;
+
+ @SerializedName("vnf-id")
+ private String vnfId;
+
+ @SerializedName("vnf-name")
+ private String vnfName;
+
+ @SerializedName("vnf-name2")
+ private String vnfName2;
+
+ @SerializedName("vnf-type")
+ private String vnfType;
+
+ @SerializedName("service-id")
+ private String serviceId;
+
+ @SerializedName("prov-status")
+ private String provStatus;
+
+ @SerializedName("operational-state")
+ private String operationalState;
+
+ @SerializedName("ipv4-oam-address")
+ private String ipv4OamAddress;
+
+ @SerializedName("ipv4-loopback0-address")
+ private String ipv4Loopback0Address;
+
+ @SerializedName("in-maint")
+ private Boolean inMaint;
+
+ @SerializedName("is-closed-loop-disabled")
+ private Boolean isClosedLoopDisabled;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ @SerializedName("encrypted-access-flag")
+ private Boolean encrypedAccessFlag;
+
+ @SerializedName("persona-model-id")
+ private String personaModelId;
+
+ @SerializedName("persona-model-version")
+ private String personaModelVersion;
+
+ @SerializedName("model-invariant-id")
+ private String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ private String modelVersionId;
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public String getVnfName2() {
+ return vnfName2;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public String getOperationalState() {
+ return operationalState;
+ }
+
+ public String getIpv4OamAddress() {
+ return ipv4OamAddress;
+ }
+
+ public String getIpv4Loopback0Address() {
+ return ipv4Loopback0Address;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public Boolean getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public Boolean getEncrypedAccessFlag() {
+ return encrypedAccessFlag;
+ }
+
+ public String getPersonaModelId() {
+ return personaModelId;
+ }
+
+ public String getPersonaModelVersion() {
+ return personaModelVersion;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public void setVnfName2(String vnfName2) {
+ this.vnfName2 = vnfName2;
+ }
+
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public void setOperationalState(String operationalState) {
+ this.operationalState = operationalState;
+ }
+
+ public void setIpv4OamAddress(String ipv4OamAddress) {
+ this.ipv4OamAddress = ipv4OamAddress;
+ }
+
+ public void setIpv4Loopback0Address(String ipv4Loopback0Address) {
+ this.ipv4Loopback0Address = ipv4Loopback0Address;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public void setEncrypedAccessFlag(Boolean encrypedAccessFlag) {
+ this.encrypedAccessFlag = encrypedAccessFlag;
+ }
+
+ public void setPersonaModelId(String personaModelId) {
+ this.personaModelId = personaModelId;
+ }
+
+ public void setPersonaModelVersion(String personaModelVersion) {
+ this.personaModelVersion = personaModelVersion;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java
index 24b833f25..21cd87f82 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,28 +20,25 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqInstanceFilters implements Serializable {
-public class AAINQInstanceFilters implements Serializable {
+ private static final long serialVersionUID = 8993824591338121185L;
- /**
- *
- */
- private static final long serialVersionUID = 8993824591338121185L;
-
- @SerializedName("instance-filter")
- private List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<>();
+ @SerializedName("instance-filter")
+ private List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<>();
- public List<Map<String, Map<String, String>>> getInstanceFilter() {
- return instanceFilter;
- }
+ public List<Map<String, Map<String, String>>> getInstanceFilter() {
+ return instanceFilter;
+ }
- public void setInstanceFilter(List<Map<String, Map<String, String>>> instanceFilter) {
- this.instanceFilter = instanceFilter;
- }
+ public void setInstanceFilter(List<Map<String, Map<String, String>>> instanceFilter) {
+ this.instanceFilter = instanceFilter;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java
new file mode 100644
index 000000000..53ec65fff
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqInventoryResponseItem implements Serializable {
+
+ private static final long serialVersionUID = 7142072567154675183L;
+
+ @SerializedName("model-name")
+ private String modelName;
+
+ @SerializedName("vf-module")
+ private AaiNqVfModule vfModule;
+
+ @SerializedName("service-instance")
+ private AaiNqServiceInstance serviceInstance;
+
+ @SerializedName("vserver")
+ private AaiNqVServer vserver;
+
+ @SerializedName("tenant")
+ private AaiNqTenant tenant;
+
+ @SerializedName("cloud-region")
+ private AaiNqCloudRegion cloudRegion;
+
+ @SerializedName("generic-vnf")
+ private AaiNqGenericVnf genericVnf;
+
+ @SerializedName("extra-properties")
+ private AaiNqExtraProperties extraProperties;
+
+ @SerializedName("inventory-response-items")
+ private AaiNqInventoryResponseItems items;
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public AaiNqVfModule getVfModule() {
+ return vfModule;
+ }
+
+ public AaiNqServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
+
+ public AaiNqVServer getVserver() {
+ return vserver;
+ }
+
+ public AaiNqTenant getTenant() {
+ return tenant;
+ }
+
+ public AaiNqCloudRegion getCloudRegion() {
+ return cloudRegion;
+ }
+
+ public AaiNqGenericVnf getGenericVnf() {
+ return genericVnf;
+ }
+
+ public AaiNqExtraProperties getExtraProperties() {
+ return extraProperties;
+ }
+
+ public AaiNqInventoryResponseItems getItems() {
+ return items;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public void setVfModule(AaiNqVfModule vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ public void setServiceInstance(AaiNqServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ public void setVserver(AaiNqVServer vserver) {
+ this.vserver = vserver;
+ }
+
+ public void setTenant(AaiNqTenant tenant) {
+ this.tenant = tenant;
+ }
+
+ public void setCloudRegion(AaiNqCloudRegion cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+
+ public void setGenericVnf(AaiNqGenericVnf genericVnf) {
+ this.genericVnf = genericVnf;
+ }
+
+ public void setExtraProperties(AaiNqExtraProperties extraProperties) {
+ this.extraProperties = extraProperties;
+ }
+
+ public void setItems(AaiNqInventoryResponseItems items) {
+ this.items = items;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java
index e05bcccb4..3ebbc1644 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,23 +20,23 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQInventoryResponseItems implements Serializable {
- private static final long serialVersionUID = 7602807659381179004L;
+public class AaiNqInventoryResponseItems implements Serializable {
+ private static final long serialVersionUID = 7602807659381179004L;
- @SerializedName("inventory-response-item")
- private List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>();
+ @SerializedName("inventory-response-item")
+ private List<AaiNqInventoryResponseItem> inventoryResponseItems = new LinkedList<>();
- public List<AAINQInventoryResponseItem> getInventoryResponseItems() {
- return inventoryResponseItems;
- }
+ public List<AaiNqInventoryResponseItem> getInventoryResponseItems() {
+ return inventoryResponseItems;
+ }
- public void setInventoryResponseItems(List<AAINQInventoryResponseItem> inventoryResponseItems) {
- this.inventoryResponseItems = inventoryResponseItems;
- }
+ public void setInventoryResponseItems(List<AaiNqInventoryResponseItem> inventoryResponseItems) {
+ this.inventoryResponseItems = inventoryResponseItems;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java
index 4dddbbe4a..1d18eb857 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,22 +20,22 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.UUID;
-import com.google.gson.annotations.SerializedName;
-
-public class AAINQNamedQuery implements Serializable {
- private static final long serialVersionUID = -3277980060302645333L;
+public class AaiNqNamedQuery implements Serializable {
+ private static final long serialVersionUID = -3277980060302645333L;
- @SerializedName("named-query-uuid")
- private UUID namedQueryUUID;
+ @SerializedName("named-query-uuid")
+ private UUID namedQueryUuid;
- public UUID getNamedQueryUUID() {
- return namedQueryUUID;
- }
+ public UUID getNamedQueryUuid() {
+ return namedQueryUuid;
+ }
- public void setNamedQueryUUID(UUID namedQueryUUID) {
- this.namedQueryUUID = namedQueryUUID;
- }
+ public void setNamedQueryUuid(UUID namedQueryUuid) {
+ this.namedQueryUuid = namedQueryUuid;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java
index 2ebf1c2e3..438e5b269 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,21 +20,21 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqQueryParameters implements Serializable {
+ private static final long serialVersionUID = -4291227193197126982L;
-public class AAINQRequestError implements Serializable {
- private static final long serialVersionUID = -7742674155387022932L;
-
- @SerializedName("serviceException")
- private AAINQServiceExcept serviceExcept;
+ @SerializedName("named-query")
+ private AaiNqNamedQuery namedQuery;
- public AAINQServiceExcept getServiceExcept() {
- return serviceExcept;
- }
+ public AaiNqNamedQuery getNamedQuery() {
+ return namedQuery;
+ }
- public void setServiceExcept(AAINQServiceExcept serviceExcept) {
- this.serviceExcept = serviceExcept;
- }
+ public void setNamedQuery(AaiNqNamedQuery namedQuery) {
+ this.namedQuery = namedQuery;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java
index db7317168..9e60ed1a6 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,32 +20,32 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqRequest implements Serializable {
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("query-parameters")
+ private AaiNqQueryParameters queryParameters;
+
+ @SerializedName("instance-filters")
+ private AaiNqInstanceFilters instanceFilters;
+
+ public AaiNqQueryParameters getQueryParameters() {
+ return queryParameters;
+ }
+
+ public AaiNqInstanceFilters getInstanceFilters() {
+ return instanceFilters;
+ }
+
+ public void setQueryParameters(AaiNqQueryParameters queryParameters) {
+ this.queryParameters = queryParameters;
+ }
-public class AAINQRequest implements Serializable {
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("query-parameters")
- private AAINQQueryParameters queryParameters;
-
- @SerializedName("instance-filters")
- private AAINQInstanceFilters instanceFilters;
-
- public AAINQQueryParameters getQueryParameters() {
- return queryParameters;
- }
-
- public AAINQInstanceFilters getInstanceFilters() {
- return instanceFilters;
- }
-
- public void setQueryParameters(AAINQQueryParameters queryParameters) {
- this.queryParameters = queryParameters;
- }
-
- public void setInstanceFilters(AAINQInstanceFilters instanceFilters) {
- this.instanceFilters = instanceFilters;
- }
+ public void setInstanceFilters(AaiNqInstanceFilters instanceFilters) {
+ this.instanceFilters = instanceFilters;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java
index 3843676aa..4a7ce504b 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,21 +20,21 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqRequestError implements Serializable {
+ private static final long serialVersionUID = -7742674155387022932L;
-public class AAINQQueryParameters implements Serializable {
- private static final long serialVersionUID = -4291227193197126982L;
-
- @SerializedName("named-query")
- private AAINQNamedQuery namedQuery;
+ @SerializedName("serviceException")
+ private AaiNqServiceExcept serviceExcept;
- public AAINQNamedQuery getNamedQuery() {
- return namedQuery;
- }
+ public AaiNqServiceExcept getServiceExcept() {
+ return serviceExcept;
+ }
- public void setNamedQuery(AAINQNamedQuery namedQuery) {
- this.namedQuery = namedQuery;
- }
+ public void setServiceExcept(AaiNqServiceExcept serviceExcept) {
+ this.serviceExcept = serviceExcept;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java
index a6e8715c4..36eb0c299 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,35 +20,34 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-import org.onap.policy.aai.AAINQInventoryResponseItem;
-
-public class AAINQResponse implements Serializable {
- private static final long serialVersionUID = 8411407444051746101L;
-
- @SerializedName("inventory-response-item")
- private List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>();
-
- @SerializedName("requestError")
- private AAINQRequestError requestError;
-
- public List<AAINQInventoryResponseItem> getInventoryResponseItems() {
- return inventoryResponseItems;
- }
-
- public AAINQRequestError getRequestError() {
- return requestError;
- }
-
- public void setRequestError(AAINQRequestError requestError) {
- this.requestError = requestError;
- }
-
- public void setInventoryResponseItems(List<AAINQInventoryResponseItem> inventoryResponseItems) {
- this.inventoryResponseItems = inventoryResponseItems;
- }
-} \ No newline at end of file
+public class AaiNqResponse implements Serializable {
+ private static final long serialVersionUID = 8411407444051746101L;
+
+ @SerializedName("inventory-response-item")
+ private List<AaiNqInventoryResponseItem> inventoryResponseItems = new LinkedList<>();
+
+ @SerializedName("requestError")
+ private AaiNqRequestError requestError;
+
+ public List<AaiNqInventoryResponseItem> getInventoryResponseItems() {
+ return inventoryResponseItems;
+ }
+
+ public AaiNqRequestError getRequestError() {
+ return requestError;
+ }
+
+ public void setRequestError(AaiNqRequestError requestError) {
+ this.requestError = requestError;
+ }
+
+ public void setInventoryResponseItems(List<AaiNqInventoryResponseItem> inventoryResponseItems) {
+ this.inventoryResponseItems = inventoryResponseItems;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java
index e8d1620de..a04d6768a 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -22,34 +22,31 @@ package org.onap.policy.aai;
import java.util.UUID;
-import org.onap.policy.aai.AAINQResponse;
+public class AaiNqResponseWrapper {
-public class AAINQResponseWrapper {
+ private UUID requestId;
+ private AaiNqResponse aaiNqResponse;
- private UUID requestID;
- private AAINQResponse aainqresponse;
-
- public AAINQResponseWrapper() {
- }
-
- public AAINQResponseWrapper(UUID requestID, AAINQResponse aainqresponse){
- this.requestID = requestID;
- this.aainqresponse = aainqresponse;
- }
+ public AaiNqResponseWrapper() {}
- public UUID getRequestID() {
- return requestID;
- }
+ public AaiNqResponseWrapper(UUID requestId, AaiNqResponse aaiNqResponse) {
+ this.requestId = requestId;
+ this.aaiNqResponse = aaiNqResponse;
+ }
- public void setRequestID(UUID requestID) {
- this.requestID = requestID;
- }
+ public UUID getRequestId() {
+ return requestId;
+ }
- public AAINQResponse getAainqresponse() {
- return aainqresponse;
- }
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
- public void setAainqresponse(AAINQResponse aainqresponse) {
- this.aainqresponse = aainqresponse;
- }
+ public AaiNqResponse getAaiNqResponse() {
+ return aaiNqResponse;
+ }
+
+ public void setAaiNqResponse(AaiNqResponse aaiNqResponse) {
+ this.aaiNqResponse = aaiNqResponse;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java
index 12fb1a0c4..77ac46d3d 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,31 +20,31 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqServiceExcept implements Serializable {
+ private static final long serialVersionUID = 2858343404484338546L;
+
+ @SerializedName("messageId")
+ private String messageId;
+
+ @SerializedName("text")
+ private String text;
+
+ @SerializedName("variables")
+ private String[] variables;
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
-public class AAINQServiceExcept implements Serializable {
- private static final long serialVersionUID = 2858343404484338546L;
-
- @SerializedName("messageId")
- private String messageId;
-
- @SerializedName("text")
- private String text;
-
- @SerializedName("variables")
- private String[] variables;
-
- public String getMessageId() {
- return messageId;
- }
-
- public String getText() {
- return text;
- }
-
- public String[] getVariables() {
- return variables;
- }
+ public String[] getVariables() {
+ return variables;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java
new file mode 100644
index 000000000..a3aa65920
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqServiceInstance implements Serializable {
+ private static final long serialVersionUID = -8000944396593889586L;
+
+ @SerializedName("service-instance-id")
+ private String serviceInstanceId;
+
+ @SerializedName("service-instance-name")
+ private String serviceInstanceName;
+
+ @SerializedName("persona-model-id")
+ private String personaModelId;
+
+ @SerializedName("persona-model-version")
+ private String personaModelVersion;
+
+ @SerializedName("service-instance-location-id")
+ private String serviceInstanceLocationId;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ @SerializedName("model-invariant-id")
+ private String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ private String modelVersionId;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public String getPersonaModelId() {
+ return personaModelId;
+ }
+
+ public String getPersonaModelVersion() {
+ return personaModelVersion;
+ }
+
+ public String getServiceInstanceLocationId() {
+ return serviceInstanceLocationId;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public void setPersonaModelId(String personaModelId) {
+ this.personaModelId = personaModelId;
+ }
+
+ public void setPersonaModelVersion(String personaModelVersion) {
+ this.personaModelVersion = personaModelVersion;
+ }
+
+ public void setServiceInstanceLocationId(String serviceInstanceLocationId) {
+ this.serviceInstanceLocationId = serviceInstanceLocationId;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java
index a370b7ddb..c8c6d106f 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java
@@ -20,45 +20,45 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import com.google.gson.annotations.SerializedName;
+public class AaiNqTenant implements Serializable {
+ private static final long serialVersionUID = 4702784101671984364L;
+
+ @SerializedName("tenant-id")
+ private String tenantId;
+
+ @SerializedName("tenant-name")
+ private String tenantName;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
-public class AAINQTenant implements Serializable {
- private static final long serialVersionUID = 4702784101671984364L;
+ public String getTenantId() {
+ return tenantId;
+ }
- @SerializedName("tenant-id")
- private String tenantId;
-
- @SerializedName("tenant-name")
- private String tenantName;
-
- @SerializedName("resource-version")
- private String resourceVersion;
+ public String getTenantName() {
+ return tenantName;
+ }
- public String getTenantId() {
- return tenantId;
- }
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
- public String getTenantName() {
- return tenantName;
- }
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
- public String getResourceVersion() {
- return resourceVersion;
- }
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
- public void setTenantName(String tenantName) {
- this.tenantName = tenantName;
- }
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
-
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java
new file mode 100644
index 000000000..9ec86c12a
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqVServer implements Serializable {
+ private static final long serialVersionUID = -6718526692734215643L;
+
+ @SerializedName("vserver-id")
+ private String vserverId;
+
+ @SerializedName("vserver-name")
+ private String vserverName;
+
+ @SerializedName("vserver-name2")
+ private String vserverName2;
+
+ @SerializedName("prov-status")
+ private String provStatus;
+
+ @SerializedName("vserver-selflink")
+ private String vserverSelflink;
+
+ @SerializedName("in-maint")
+ private Boolean inMaint;
+
+ @SerializedName("is-closed-loop-disabled")
+ private Boolean isClosedLoopDisabled;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ public String getVserverId() {
+ return vserverId;
+ }
+
+ public String getVserverName() {
+ return vserverName;
+ }
+
+ public String getVserverName2() {
+ return vserverName2;
+ }
+
+ public String getProvStatus() {
+ return provStatus;
+ }
+
+ public String getVserverSelflink() {
+ return vserverSelflink;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public Boolean getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setVserverId(String vserverId) {
+ this.vserverId = vserverId;
+ }
+
+ public void setVserverName(String vserverName) {
+ this.vserverName = vserverName;
+ }
+
+ public void setVserverName2(String vserverName2) {
+ this.vserverName2 = vserverName2;
+ }
+
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+
+ public void setVserverSelflink(String vserverSelflink) {
+ this.vserverSelflink = vserverSelflink;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java
new file mode 100644
index 000000000..923092a25
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class AaiNqVfModule implements Serializable {
+ private static final long serialVersionUID = 8019133081429638231L;
+
+ @SerializedName("vf-module-id")
+ private String vfModuleId;
+
+ @SerializedName("vf-module-name")
+ private String vfModuleName;
+
+ @SerializedName("heat-stack-id")
+ private String heatStackId;
+
+ @SerializedName("orchestration-status")
+ private String orchestrationStatus;
+
+ @SerializedName("is-base-vf-module")
+ private Boolean isBaseVfModule;
+
+ @SerializedName("resource-version")
+ private String resourceVersion;
+
+ @SerializedName("persona-model-id")
+ private String personaModelId;
+
+ @SerializedName("persona-model-version")
+ private String personaModelVersion;
+
+ @SerializedName("widget-model-id")
+ private String widgetModelId;
+
+ @SerializedName("widget-model-version")
+ private String widgetModelVersion;
+
+ @SerializedName("contrail-service-instance-fqdn")
+ private String contrailServiceInstanceFqdn;
+
+ @SerializedName("model-invariant-id")
+ private String modelInvariantId;
+
+ @SerializedName("model-version-id")
+ private String modelVersionId;
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public String getVfModuleName() {
+ return vfModuleName;
+ }
+
+ public String getHeatStackId() {
+ return heatStackId;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public Boolean getIsBaseVfModule() {
+ return isBaseVfModule;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public String getPersonaModelId() {
+ return personaModelId;
+ }
+
+ public String getPersonaModelVersion() {
+ return personaModelVersion;
+ }
+
+ public String getWidgetModelId() {
+ return widgetModelId;
+ }
+
+ public String getWidgetModelVersion() {
+ return widgetModelVersion;
+ }
+
+ public String getContrailServiceInstanceFqdn() {
+ return contrailServiceInstanceFqdn;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ public void setVfModuleName(String vfModuleName) {
+ this.vfModuleName = vfModuleName;
+ }
+
+ public void setHeatStackId(String heatStackId) {
+ this.heatStackId = heatStackId;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public void setIsBaseVfModule(Boolean isBaseVfModule) {
+ this.isBaseVfModule = isBaseVfModule;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public void setPersonaModelId(String personaModelId) {
+ this.personaModelId = personaModelId;
+ }
+
+ public void setPersonaModelVersion(String personaModelVersion) {
+ this.personaModelVersion = personaModelVersion;
+ }
+
+ public void setWidgetModelId(String widgetModelId) {
+ this.widgetModelId = widgetModelId;
+ }
+
+ public void setWidgetModelVersion(String widgetModelVersion) {
+ this.widgetModelVersion = widgetModelVersion;
+ }
+
+ public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) {
+ this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java
deleted file mode 100644
index 934fb1edc..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-public class PNF implements Serializable {
- private static final long serialVersionUID = -3535108358668248501L;
-
- private String pnfName;
- private PNFType pnfType;
-
- public PNF() {
-
- }
-
- public PNF(PNF pnf) {
- this.pnfName = pnf.pnfName;
- this.pnfType = pnf.pnfType;
- }
-
- public String getPNFName() {
- return pnfName;
- }
-
- public void setPNFName(String pNFName) {
- pnfName = pNFName;
- }
-
- public PNFType getPNFType() {
- return pnfType;
- }
-
- public void setPNFType(PNFType pNFType) {
- pnfType = pNFType;
- }
-
- @Override
- public String toString() {
- return "PNF [PNFName=" + pnfName + ", PNFType=" + pnfType + "]";
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
- result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PNF other = (PNF) obj;
- if (pnfName == null) {
- if (other.pnfName != null)
- return false;
- } else if (!pnfName.equals(other.pnfName))
- return false;
- return pnfType == other.pnfType;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java
deleted file mode 100644
index 159e5cb28..000000000
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import java.io.Serializable;
-
-public class PNFInstance implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3694152433472165034L;
-
- private String pnfName;
- private String pnfInstanceName;
- private PNFType pnfType;
- private String pnfSerial;
-
- public PNFInstance() {
-
- }
-
- public PNFInstance(PNFInstance instance) {
- if (instance == null) {
- return;
- }
- this.pnfName = instance.pnfName;
- this.pnfInstanceName = instance.pnfInstanceName;
- this.pnfType = instance.pnfType;
- this.pnfSerial = instance.pnfSerial;
- }
-
- public String getPNFName() {
- return pnfName;
- }
-
- public void setPNFName(String pNFName) {
- pnfName = pNFName;
- }
-
- public String getPNFInstanceName() {
- return pnfInstanceName;
- }
-
- public void setPNFInstanceName(String pNFInstanceName) {
- pnfInstanceName = pNFInstanceName;
- }
-
- public PNFType getPNFType() {
- return pnfType;
- }
-
- public void setPNFType(PNFType pNFType) {
- pnfType = pNFType;
- }
-
- public String getPNFSerial() {
- return pnfSerial;
- }
-
- public void setPNFSerial(String pNFSerial) {
- pnfSerial = pNFSerial;
- }
-
- @Override
- public String toString() {
- return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType
- + ", PNFSerial=" + pnfSerial + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode());
- result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
- result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode());
- result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PNFInstance other = (PNFInstance) obj;
- if (pnfInstanceName == null) {
- if (other.pnfInstanceName != null)
- return false;
- } else if (!pnfInstanceName.equals(other.pnfInstanceName))
- return false;
- if (pnfName == null) {
- if (other.pnfName != null)
- return false;
- } else if (!pnfName.equals(other.pnfName))
- return false;
- if (pnfSerial == null) {
- if (other.pnfSerial != null)
- return false;
- } else if (!pnfSerial.equals(other.pnfSerial))
- return false;
- return pnfType == other.pnfType;
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java
new file mode 100644
index 000000000..2ef0bde46
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import java.io.Serializable;
+
+public class Pnf implements Serializable {
+ private static final long serialVersionUID = -3535108358668248501L;
+
+ private String pnfName;
+ private PnfType pnfType;
+
+ public Pnf() {
+
+ }
+
+ public Pnf(Pnf pnf) {
+ this.pnfName = pnf.pnfName;
+ this.pnfType = pnf.pnfType;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public PnfType getPnfType() {
+ return pnfType;
+ }
+
+ public void setPnfType(PnfType pnfType) {
+ this.pnfType = pnfType;
+ }
+
+ @Override
+ public String toString() {
+ return "PNF [PNFName=" + pnfName + ", PNFType=" + pnfType + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
+ result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Pnf other = (Pnf) obj;
+ if (pnfName == null) {
+ if (other.pnfName != null) {
+ return false;
+ }
+ } else if (!pnfName.equals(other.pnfName)) {
+ return false;
+ }
+ return pnfType == other.pnfType;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java
new file mode 100644
index 000000000..9d9e26c2c
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import java.io.Serializable;
+
+public class PnfInstance implements Serializable {
+
+ private static final long serialVersionUID = -3694152433472165034L;
+
+ private String pnfName;
+ private String pnfInstanceName;
+ private PnfType pnfType;
+ private String pnfSerial;
+
+ public PnfInstance() {
+
+ }
+
+ /**
+ * Create an instance from a given instance.
+ *
+ * @param instance the instance
+ */
+ public PnfInstance(PnfInstance instance) {
+ if (instance == null) {
+ return;
+ }
+ this.pnfName = instance.pnfName;
+ this.pnfInstanceName = instance.pnfInstanceName;
+ this.pnfType = instance.pnfType;
+ this.pnfSerial = instance.pnfSerial;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getPnfInstanceName() {
+ return pnfInstanceName;
+ }
+
+ public void setPnfInstanceName(String pnfInstanceName) {
+ this.pnfInstanceName = pnfInstanceName;
+ }
+
+ public PnfType getPnfType() {
+ return pnfType;
+ }
+
+ public void setPnfType(PnfType pnfType) {
+ this.pnfType = pnfType;
+ }
+
+ public String getPnfSerial() {
+ return pnfSerial;
+ }
+
+ public void setPnfSerial(String pnfSerial) {
+ this.pnfSerial = pnfSerial;
+ }
+
+ @Override
+ public String toString() {
+ return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType
+ + ", PNFSerial=" + pnfSerial + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode());
+ result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode());
+ result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode());
+ result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PnfInstance other = (PnfInstance) obj;
+ if (pnfInstanceName == null) {
+ if (other.pnfInstanceName != null) {
+ return false;
+ }
+ } else if (!pnfInstanceName.equals(other.pnfInstanceName)) {
+ return false;
+ }
+ if (pnfName == null) {
+ if (other.pnfName != null) {
+ return false;
+ }
+ } else if (!pnfName.equals(other.pnfName)) {
+ return false;
+ }
+ if (pnfSerial == null) {
+ if (other.pnfSerial != null) {
+ return false;
+ }
+ } else if (!pnfSerial.equals(other.pnfSerial)) {
+ return false;
+ }
+ return pnfType == other.pnfType;
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java
index 5774b364f..29dd2690c 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -20,18 +20,17 @@
package org.onap.policy.aai;
-public enum PNFType {
- ENODEB("eNodeB"),
- PSERVER("pserver");
-
- private String type;
-
- private PNFType(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return this.type;
- }
+public enum PnfType {
+ ENODEB("eNodeB"), PSERVER("pserver");
+
+ private String type;
+
+ private PnfType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java
index a55c04138..ab6d0a6ee 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java
@@ -20,24 +20,24 @@
package org.onap.policy.aai;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-
public class RelatedToProperty implements Serializable {
- private static final long serialVersionUID = 2088088164920423658L;
+ private static final long serialVersionUID = 2088088164920423658L;
+
+ @SerializedName("related-to-property")
+ private List<RelatedToPropertyItem> relatedTo = new LinkedList<>();
- @SerializedName("related-to-property")
- private List<RelatedToPropertyItem> relatedTo = new LinkedList<>();
+ public List<RelatedToPropertyItem> getRelatedTo() {
+ return relatedTo;
+ }
- public List<RelatedToPropertyItem> getRelatedTo() {
- return relatedTo;
- }
- public void setRelatedTo(List<RelatedToPropertyItem> relatedTo) {
- this.relatedTo = relatedTo;
- }
+ public void setRelatedTo(List<RelatedToPropertyItem> relatedTo) {
+ this.relatedTo = relatedTo;
+ }
}
- \ No newline at end of file
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
index e23f45c11..ee7d108b5 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java
@@ -20,29 +20,31 @@
package org.onap.policy.aai;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class RelatedToPropertyItem implements Serializable {
- private static final long serialVersionUID = 5644372985092588637L;
-
- @SerializedName("property-key")
- private String propertyKey;
- @SerializedName("property-value")
- private String propertyValue;
-
- public String getPropertyKey() {
- return propertyKey;
- }
- public String getPropertyValue() {
- return propertyValue;
- }
-
- public void setPropertyKey(String propertyKey) {
- this.propertyKey = propertyKey;
- }
- public void setPropertyValue(String propertyValue) {
- this.propertyValue = propertyValue;
- }
+ private static final long serialVersionUID = 5644372985092588637L;
+
+ @SerializedName("property-key")
+ private String propertyKey;
+ @SerializedName("property-value")
+ private String propertyValue;
+
+ public String getPropertyKey() {
+ return propertyKey;
+ }
+
+ public String getPropertyValue() {
+ return propertyValue;
+ }
+
+ public void setPropertyKey(String propertyKey) {
+ this.propertyKey = propertyKey;
+ }
+
+ public void setPropertyValue(String propertyValue) {
+ this.propertyValue = propertyValue;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
index ba5d596ea..732b645be 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java
@@ -20,54 +20,54 @@
package org.onap.policy.aai;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class Relationship implements Serializable {
- private static final long serialVersionUID = -68508443869003054L;
-
- @SerializedName("related-to")
- private String relatedTo;
-
- @SerializedName("related-link")
- private String relatedLink;
-
- @SerializedName("relationship-data")
- private RelationshipData relationshipData = new RelationshipData();
-
- @SerializedName("related-to-property")
- private RelatedToProperty relatedToProperty = new RelatedToProperty();
-
- public String getRelatedTo() {
- return relatedTo;
- }
-
- public String getRelatedLink() {
- return relatedLink;
- }
-
- public RelationshipData getRelationshipData() {
- return relationshipData;
- }
-
- public RelatedToProperty getRelatedToProperty() {
- return relatedToProperty;
- }
-
- public void setRelatedTo(String relatedTo) {
- this.relatedTo = relatedTo;
- }
-
- public void setRelatedLink(String relatedLink) {
- this.relatedLink = relatedLink;
- }
-
- public void setRelationshipData(RelationshipData relationshipData) {
- this.relationshipData = relationshipData;
- }
-
- public void setRelatedToProperty(RelatedToProperty relatedToProperty) {
- this.relatedToProperty = relatedToProperty;
- }
+ private static final long serialVersionUID = -68508443869003054L;
+
+ @SerializedName("related-to")
+ private String relatedTo;
+
+ @SerializedName("related-link")
+ private String relatedLink;
+
+ @SerializedName("relationship-data")
+ private RelationshipData relationshipData = new RelationshipData();
+
+ @SerializedName("related-to-property")
+ private RelatedToProperty relatedToProperty = new RelatedToProperty();
+
+ public String getRelatedTo() {
+ return relatedTo;
+ }
+
+ public String getRelatedLink() {
+ return relatedLink;
+ }
+
+ public RelationshipData getRelationshipData() {
+ return relationshipData;
+ }
+
+ public RelatedToProperty getRelatedToProperty() {
+ return relatedToProperty;
+ }
+
+ public void setRelatedTo(String relatedTo) {
+ this.relatedTo = relatedTo;
+ }
+
+ public void setRelatedLink(String relatedLink) {
+ this.relatedLink = relatedLink;
+ }
+
+ public void setRelationshipData(RelationshipData relationshipData) {
+ this.relationshipData = relationshipData;
+ }
+
+ public void setRelatedToProperty(RelatedToProperty relatedToProperty) {
+ this.relatedToProperty = relatedToProperty;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java
index be9e8bfda..454f9871a 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java
@@ -20,22 +20,22 @@
package org.onap.policy.aai;
-import java.util.List;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
-
-import com.google.gson.annotations.SerializedName;
+import java.util.List;
public class RelationshipData implements Serializable {
- private static final long serialVersionUID = 6809180843309562121L;
- @SerializedName("relationship-data")
- private List<RelationshipDataItem> relationshipDataList = new LinkedList<>();
+ private static final long serialVersionUID = 6809180843309562121L;
+ @SerializedName("relationship-data")
+ private List<RelationshipDataItem> relationshipDataList = new LinkedList<>();
- public List<RelationshipDataItem> getRelationshipData() {
- return relationshipDataList;
- }
+ public List<RelationshipDataItem> getRelationshipData() {
+ return relationshipDataList;
+ }
- public void setRelationshipData(List<RelationshipDataItem> relationshipData) {
- this.relationshipDataList = relationshipData;
- }
+ public void setRelationshipData(List<RelationshipDataItem> relationshipData) {
+ this.relationshipDataList = relationshipData;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
index eb3a6c85b..bab45d486 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
@@ -20,29 +20,31 @@
package org.onap.policy.aai;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class RelationshipDataItem implements Serializable {
- private static final long serialVersionUID = 550450041634939767L;
-
- @SerializedName("relationship-key")
- private String relationshipKey;
- @SerializedName("relationship-value")
- private String relationshipValue;
-
- public String getRelationshipKey() {
- return relationshipKey;
- }
- public String getRelationshipValue() {
- return relationshipValue;
- }
-
- public void setRelationshipKey(String relationshipKey) {
- this.relationshipKey = relationshipKey;
- }
- public void setRelationshipValue(String relationshipValue) {
- this.relationshipValue = relationshipValue;
- }
+ private static final long serialVersionUID = 550450041634939767L;
+
+ @SerializedName("relationship-key")
+ private String relationshipKey;
+ @SerializedName("relationship-value")
+ private String relationshipValue;
+
+ public String getRelationshipKey() {
+ return relationshipKey;
+ }
+
+ public String getRelationshipValue() {
+ return relationshipValue;
+ }
+
+ public void setRelationshipKey(String relationshipKey) {
+ this.relationshipKey = relationshipKey;
+ }
+
+ public void setRelationshipValue(String relationshipValue) {
+ this.relationshipValue = relationshipValue;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java
index 681574f47..179785717 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java
@@ -20,23 +20,23 @@
package org.onap.policy.aai;
-import java.util.List;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
-
-import com.google.gson.annotations.SerializedName;
+import java.util.List;
public class RelationshipItem implements Serializable {
- private static final long serialVersionUID = 1543404460741069628L;
-
- @SerializedName("related-to-property")
- private List<RelatedToPropertyItem> relatedToProperty = new LinkedList<>();
+ private static final long serialVersionUID = 1543404460741069628L;
+
+ @SerializedName("related-to-property")
+ private List<RelatedToPropertyItem> relatedToProperty = new LinkedList<>();
- public List<RelatedToPropertyItem> getRelatedToProperty() {
- return relatedToProperty;
- }
+ public List<RelatedToPropertyItem> getRelatedToProperty() {
+ return relatedToProperty;
+ }
- public void setRelatedToProperty(List<RelatedToPropertyItem> relatedToProperty) {
- this.relatedToProperty = relatedToProperty;
- }
+ public void setRelatedToProperty(List<RelatedToPropertyItem> relatedToProperty) {
+ this.relatedToProperty = relatedToProperty;
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
index d181f131e..347676820 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
@@ -21,22 +21,24 @@
package org.onap.policy.aai;
import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
-import java.util.List;
-import java.util.LinkedList;
+import java.util.LinkedList;
+import java.util.List;
public class RelationshipList implements Serializable {
- private static final long serialVersionUID = 6115655704973981989L;
+ private static final long serialVersionUID = 6115655704973981989L;
- @SerializedName("relationship-list")
+ @SerializedName("relationship-list")
private List<Relationship> relationships = new LinkedList<>();
-
- public List<Relationship> getRelationshipList() {
- return relationships;
- }
- public void setRelationshipList(List<Relationship> relationshipList) {
- this.relationships = relationshipList;
- }
-
-
+
+ public List<Relationship> getRelationshipList() {
+ return relationships;
+ }
+
+ public void setRelationshipList(List<Relationship> relationshipList) {
+ this.relationships = relationshipList;
+ }
+
+
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java
index 7e65ece22..45ddac431 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java
@@ -20,29 +20,28 @@
package org.onap.policy.aai.util;
-public class AAIException extends Exception {
+public class AaiException extends Exception {
- private static final long serialVersionUID = 9220983727706207465L;
+ private static final long serialVersionUID = 9220983727706207465L;
- public AAIException() {
- super();
- }
+ public AaiException() {
+ super();
+ }
- public AAIException(String message, Throwable cause, boolean enableSuppression,
- boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+ public AaiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
- public AAIException(String message, Throwable cause) {
- super(message, cause);
- }
+ public AaiException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public AAIException(String message) {
- super(message);
- }
+ public AaiException(String message) {
+ super(message);
+ }
- public AAIException(Throwable cause) {
- super(cause);
- }
+ public AaiException(Throwable cause) {
+ super(cause);
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
index 934700993..2c8263467 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java
@@ -25,11 +25,9 @@ import com.google.gson.GsonBuilder;
public final class Serialization {
- private Serialization(){
- }
+ private Serialization() {}
- public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
- .setPrettyPrinting()
-// .registerTypeAdapter(AAIQueryParameters.class, new notificationTypeAdapter())
- .create();
+ public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting()
+ // .registerTypeAdapter(AAIQueryParameters.class, new notificationTypeAdapter())
+ .create();
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
deleted file mode 100644
index 9a4050f1a..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAIGETVnfResponseTest {
- private static final Logger logger = LoggerFactory.getLogger(AAIGETVnfResponseTest.class);
-
- @Test
- public void test() {
- AAIGETVnfResponse response = new AAIGETVnfResponse();
-
- response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491");
- response.setVnfName("lll_vnf_010317");
- response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1");
- response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- response.setOrchestrationStatus("Created");
- response.setInMaint("false");
- response.setIsClosedLoopDisabled("false");
- response.setResourceVersion("1494001988835");
- response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa");
- assertEquals("83f674e8-7555-44d7-9a39-bdc3770b0491", response.getVnfID());
- assertEquals("lll_vnf_010317", response.getVnfName());
- assertEquals("Basa-122216-Service/VidVsamp12BaseVolume 1", response.getVnfType());
- assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", response.getServiceId());
- assertEquals("Created", response.getOrchestrationStatus());
- assertEquals("false", response.getInMaint());
- assertEquals("false", response.getIsClosedLoopDisabled());
- assertEquals("1494001988835", response.getResourceVersion());
- assertEquals("f18be3cd-d446-456e-9109-121d9b62feaa", response.getModelInvariantId());
-
- RelationshipList relationshipList = new RelationshipList();
- Relationship relationship = new Relationship();
- RelationshipData relationshipData = new RelationshipData();
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
-
- relationshipDataItem.setRelationshipKey("customer.global-customer-id");
- relationshipDataItem.setRelationshipValue("MSO_1610_ST");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- relationshipDataItem.setRelationshipKey("service-subscription.service-type");
- relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- relationshipDataItem.setRelationshipKey("service-instance.service-instance-id");
- relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- RelatedToPropertyItem item = new RelatedToPropertyItem();
- item.setPropertyKey("service-instance.service-instance-name");
- item.setPropertyValue("lll_svc_010317");
- relatedToProperty.getRelatedTo().add(item);
- assertEquals("service-instance.service-instance-name", item.getPropertyKey());
- assertEquals("lll_svc_010317", item.getPropertyValue());
-
- relationship.setRelatedTo("service-instance");
- relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
- relationship.setRelationshipData(relationshipData);
- relationship.setRelatedToProperty(relatedToProperty);
-
- relationshipList.getRelationshipList().add(relationship);
- response.setRelationshipList(relationshipList);
-
- logger.info(Serialization.gsonPretty.toJson(response));
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
deleted file mode 100644
index 65c2cdc81..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAIGETVserverResponseTest {
- private static final Logger logger = LoggerFactory.getLogger(AAIGETVserverResponseTest.class);
-
- @Test
- public void test() {
- AAIGETVserverResponse response = new AAIGETVserverResponse();
-
- response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8");
- response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0");
- response.setVserverName2("vjunos0");
- response.setVserverSelflink("https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8");
- response.setInMaint("false");
- response.setIsClosedLoopDisabled("false");
- response.setResourceVersion("1494001931513");
-
- assertEquals("d0668d4f-c25e-4a1b-87c4-83845c01efd8", response.getVserverID());
- assertEquals("USMSO1SX7NJ0103UJZZ01-vjunos0", response.getVserverName());
- assertEquals("vjunos0", response.getVserverName2());
- assertEquals("https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/"
- + "aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8",
- response.getVserverSelflink());
- assertEquals("false", response.getInMaint());
- assertEquals("false", response.getIsClosedLoopDisabled());
- assertEquals("1494001931513", response.getResourceVersion());
-
- RelationshipList relationshipList = new RelationshipList();
- Relationship relationship = new Relationship();
- RelationshipData relationshipData = new RelationshipData();
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
-
- relationshipDataItem.setRelationshipKey("customer.global-customer-id");
- relationshipDataItem.setRelationshipValue("MSO_1610_ST");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- relationshipDataItem.setRelationshipKey("service-subscription.service-type");
- relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- relationshipDataItem.setRelationshipKey("service-instance.service-instance-id");
- relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
- relationshipData.getRelationshipData().add(relationshipDataItem);
-
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- RelatedToPropertyItem item = new RelatedToPropertyItem();
- item.setPropertyKey("service-instance.service-instance-name");
- item.setPropertyValue("lll_svc_010317");
- relatedToProperty.getRelatedTo().add(item);
-
- relationship.setRelatedTo("service-instance");
- relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
- relationship.setRelationshipData(relationshipData);
- relationship.setRelatedToProperty(relatedToProperty);
-
- relationshipList.getRelationshipList().add(relationship);
- response.setRelationshipList(relationshipList);
- assertEquals(response.getRelationshipList(), relationshipList);
- response.setRequestError(null);
- assertNull(response.getRequestError());
-
- logger.info(Serialization.gsonPretty.toJson(response));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java
deleted file mode 100644
index 5e1351d13..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.rest.RESTManager;
-import org.onap.policy.rest.RESTManager.Pair;
-
-public class AAIManagerTest {
- RESTManager restManagerMock;
- UUID aaiNQRequestUUID = UUID.randomUUID();
- Pair<Integer, String> httpResponseOK;
- Pair<Integer, String> httpResponseErr0;
- Pair<Integer, String> httpResponseErr1;
- Pair<Integer, String> httpResponseWait;
-
- @Before
- public void beforeTestAAIManager() {
- restManagerMock = mock(RESTManager.class);
-
- Map<String, String> expectedHeaders = new HashMap<>();
- expectedHeaders.put("X-FromAppId", "POLICY");
- expectedHeaders.put("X-TransactionId", aaiNQRequestUUID.toString());
- expectedHeaders.put("Accept", "application/json");
-
- AAINQResponse aaiNQResponse = new AAINQResponseTest().getAAINQResponse();
- httpResponseOK = restManagerMock.new Pair<>(200, Serialization.gsonPretty.toJson(aaiNQResponse));
- httpResponseErr0 = restManagerMock.new Pair<>(200, null);
- httpResponseErr1 = restManagerMock.new Pair<>(200, "{");
- httpResponseWait = restManagerMock.new Pair<>(503, null);
- }
-
- @Test
- public void testAAIManagerAAINQRequest() {
-
- AAIManager aaiManager = new AAIManager(restManagerMock);
- assertNotNull(aaiManager);
-
- UUID aaiNQUUID = UUID.randomUUID();
-
- AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters();
- AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery();
- aaiNQNamedQuery.setNamedQueryUUID(aaiNQUUID);
- aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery);
-
- AAINQRequest aaiNQRequest = new AAINQRequest();
- aaiNQRequest.setQueryParameters(aaiNQQueryParameters);
-
- when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap(), anyString(), anyString())).thenReturn(httpResponseOK);
-
- AAINQResponse aaiNQOKResponse = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Dorothy", "Gale", aaiNQRequest, aaiNQRequestUUID);
- assertNotNull(aaiNQOKResponse);
-
- when(restManagerMock.post(isNull(), eq("Dorothy"), anyString(), anyMap(), anyString(), anyString())).thenReturn(null);
-
- AAINQResponse aaiNQNullResponse = aaiManager.postQuery(null, "Dorothy", "Gale", null, aaiNQRequestUUID);
- assertNull(aaiNQNullResponse);
-
- when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr0);
-
- AAINQResponse aaiNQNOKResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID);
- assertNull(aaiNQNOKResponse0);
-
- when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr1);
-
- AAINQResponse aaiNQNOKResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID);
- assertNull(aaiNQNOKResponse1);
- }
-
- @Test
- public void testAAIManagerQueryByVserverName() {
- AAIManager aaiManager = new AAIManager(restManagerMock);
- assertNotNull(aaiManager);
-
- UUID vserverNameRequestId = UUID.randomUUID();
-
- when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK);
-
- AAIGETVserverResponse vserverResponse = aaiManager.getQueryByVserverName("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vserverName");
- assertNotNull(vserverResponse);
-
- AAIGETVserverResponse vserverNullResponse = aaiManager.getQueryByVserverName(null, "Dorothy", "Gale", vserverNameRequestId, "vserverName");
- assertNull(vserverNullResponse);
-
- when(restManagerMock.get(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap())).thenReturn(httpResponseErr0);
-
- AAIGETVserverResponse vserverNOKResponse0 = aaiManager.getQueryByVserverName("http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName");
- assertNull(vserverNOKResponse0);
- }
-
- @Test
- public void testAAIManagerQueryByVNFId() {
- AAIManager aaiManager = new AAIManager(restManagerMock);
- assertNotNull(aaiManager);
-
- UUID vserverNameRequestId = UUID.randomUUID();
-
- when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK);
-
- AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfID");
- assertNotNull(vnfResponse);
- }
-
- @Test
- public void testAAIManagerQueryByVNFName() {
- AAIManager aaiManager = new AAIManager(restManagerMock);
- assertNotNull(aaiManager);
-
- UUID vserverNameRequestId = UUID.randomUUID();
-
- when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK);
-
- AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfName");
- assertNotNull(vnfResponse);
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java
deleted file mode 100644
index 5d1fe278c..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AAINQCloudRegionTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion();
- aaiNQCloudRegion.setCloudOwner("Rackspace");
- aaiNQCloudRegion.setCloudRegionId("DFW");
- aaiNQCloudRegion.setCloudRegionVersion("v1");
- aaiNQCloudRegion.setComplexName("SharedNode");
- aaiNQCloudRegion.setResourceVersion("1504789196021");
- assertNotNull(aaiNQCloudRegion);
- assertEquals("Rackspace", aaiNQCloudRegion.getCloudOwner());
- assertEquals("DFW", aaiNQCloudRegion.getCloudRegionId());
- assertEquals("v1", aaiNQCloudRegion.getCloudRegionVersion());
- assertEquals("SharedNode", aaiNQCloudRegion.getComplexName());
- assertEquals("1504789196021", aaiNQCloudRegion.getResourceVersion());
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java
deleted file mode 100644
index 148f5df4b..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AAINQExtraPropertiesTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties();
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
- assertNotNull(aaiNQExtraProperties);
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java
deleted file mode 100644
index fba01bc22..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AAINQGenericVNFTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF();
- aaiNQGenericVNF.setEncrypedAccessFlag(true);
- aaiNQGenericVNF.setInMaint(false);
- aaiNQGenericVNF.setIpv4Loopback0Address("aa");
- aaiNQGenericVNF.setIpv4OamAddress("oamAddress");
- aaiNQGenericVNF.setIsClosedLoopDisabled(false);
- aaiNQGenericVNF.setModelInvariantId("653d2caa-7e47-4614-95b3-26c8d82755b8");
- aaiNQGenericVNF.setModelVersionId("98f410f6-4c63-447b-97d2-42508437cec0");
- aaiNQGenericVNF.setOperationalState("active");
- aaiNQGenericVNF.setPersonaModelId("653d2caa-7e47-4614-95b3-26c8d82755b8");
- aaiNQGenericVNF.setPersonaModelVersion("98f410f6-4c63-447b-97d2-42508437cec0");
- aaiNQGenericVNF.setProvStatus("complete");
- aaiNQGenericVNF.setResourceVersion("1505056714553");
- aaiNQGenericVNF.setServiceId("e8cb8968-5411-478b-906a-f28747de72cd");
- aaiNQGenericVNF.setVnfID("ed8b2bce-6b27-4089-992c-4a2c66024bcd");
- aaiNQGenericVNF.setVnfName("vCPEInfraVNF14a");
- aaiNQGenericVNF.setVnfName2("malumabb12");
- aaiNQGenericVNF.setVnfType("vCPEInfraService10/vCPEInfraService10 0");
- assertNotNull(aaiNQGenericVNF);
-
- assertEquals(true, aaiNQGenericVNF.getEncrypedAccessFlag());
- assertEquals(false, aaiNQGenericVNF.getInMaint());
- assertEquals("aa", aaiNQGenericVNF.getIpv4Loopback0Address());
- assertEquals("oamAddress", aaiNQGenericVNF.getIpv4OamAddress());
- assertEquals(false, aaiNQGenericVNF.getIsClosedLoopDisabled());
- assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNQGenericVNF.getModelInvariantId());
- assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNQGenericVNF.getModelVersionId());
- assertEquals("active", aaiNQGenericVNF.getOperationalState());
- assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNQGenericVNF.getPersonaModelId());
- assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNQGenericVNF.getPersonaModelVersion());
- assertEquals("complete", aaiNQGenericVNF.getProvStatus());
- assertEquals("1505056714553", aaiNQGenericVNF.getResourceVersion());
- assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNQGenericVNF.getServiceId());
- assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNQGenericVNF.getVnfID());
- assertEquals("vCPEInfraVNF14a", aaiNQGenericVNF.getVnfName());
- assertEquals("malumabb12", aaiNQGenericVNF.getVnfName2());
- assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNQGenericVNF.getVnfType());
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java
deleted file mode 100644
index 71f8cef60..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import java.util.LinkedList;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQInventoryResponseItemTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemTest.class);
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem();
- aaiNQInventoryResponseItem.setModelName("service-instance");
- AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion();
- aaiNQCloudRegion.setCloudOwner("OWNER");
- aaiNQCloudRegion.setCloudRegionId("REGIONID");
- aaiNQCloudRegion.setCloudRegionVersion("2.5");
- aaiNQCloudRegion.setComplexName("COMPLEXNAME");
- aaiNQCloudRegion.setResourceVersion("1485365988");
- aaiNQInventoryResponseItem.setCloudRegion(aaiNQCloudRegion);
- AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties();
- aaiNQExtraProperties.setExtraProperty(new LinkedList<>());
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
- aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
- aaiNQInventoryResponseItem.setExtraProperties(aaiNQExtraProperties);
- AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF();
- aaiNQGenericVNF.setVnfID("dhv-test-gvnf");
- aaiNQGenericVNF.setVnfName("dhv-test-gvnf-name");
- aaiNQGenericVNF.setVnfName2("dhv-test-gvnf-name2");
- aaiNQGenericVNF.setVnfType("SW");
- aaiNQGenericVNF.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
- aaiNQGenericVNF.setProvStatus("PREPROV");
- aaiNQGenericVNF.setOperationalState("dhv-test-operational-state");
- aaiNQGenericVNF.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
- aaiNQGenericVNF.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
- aaiNQGenericVNF.setInMaint(false);
- aaiNQGenericVNF.setIsClosedLoopDisabled(false);
- aaiNQGenericVNF.setResourceVersion("1485366450");
- aaiNQGenericVNF.setEncrypedAccessFlag(true);
- aaiNQGenericVNF.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
- aaiNQGenericVNF.setPersonaModelVersion("1.0");
- aaiNQInventoryResponseItem.setGenericVNF(aaiNQGenericVNF);
- AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems();
- AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem();
- serviceItem.setModelName("service-instance");
- serviceItem.setServiceInstance(new AAINQServiceInstance());
- serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
- serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
- serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
- serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
- serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
- serviceItem.getServiceInstance().setResourceVersion("1485366092");
- serviceItem.setExtraProperties(new AAINQExtraProperties());
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
-
- AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem();
- vfModuleItem.setModelName("vf-module");
- vfModuleItem.setVfModule(new AAINQVfModule());
- vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
- vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
- vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
- vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
- vfModuleItem.getVfModule().setIsBaseVfModule(true);
- vfModuleItem.getVfModule().setResourceVersion("1485366450");
- vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
- vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
- vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
- vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
- vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- vfModuleItem.setExtraProperties(new AAINQExtraProperties());
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
-
- aaiNQInventoryResponseItems.getInventoryResponseItems().add(serviceItem);
- aaiNQInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem);
- aaiNQInventoryResponseItem.setItems(aaiNQInventoryResponseItems);
- aaiNQInventoryResponseItem.setModelName("model-name");
- AAINQServiceInstance serviceInstance = new AAINQServiceInstance();
- serviceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
- serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1");
- serviceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
- serviceInstance.setPersonaModelVersion("1.0");
- serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
- serviceInstance.setResourceVersion("1485366092");
- aaiNQInventoryResponseItem.setServiceInstance(serviceInstance);
- AAINQTenant aaiNQTenant = new AAINQTenant();
- aaiNQTenant.setTenantId("dhv-test-tenant");
- aaiNQTenant.setTenantName("dhv-test-tenant-name");
- aaiNQTenant.setResourceVersion("1485366334");
- aaiNQInventoryResponseItem.setTenant(aaiNQTenant);
- AAINQVfModule aaiNQVfModule = new AAINQVfModule();
- aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261");
- aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074");
- aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300");
- aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523");
- aaiNQVfModule.setIsBaseVfModule(true);
- aaiNQVfModule.setResourceVersion("1485366450");
- aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
- aaiNQVfModule.setPersonaModelVersion("1.0");
- aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571");
- aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317");
- aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- aaiNQInventoryResponseItem.setVfModule(aaiNQVfModule);
- AAINQVServer aaiNQVServer = new AAINQVServer();
- aaiNQVServer.setVserverId("dhv-test-vserver");
- aaiNQVServer.setVserverName("dhv-test-vserver-name");
- aaiNQVServer.setVserverName2("dhv-test-vserver-name2");
- aaiNQVServer.setProvStatus("PREPROV");
- aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink");
- aaiNQVServer.setInMaint(false);
- aaiNQVServer.setIsClosedLoopDisabled(false);
- aaiNQVServer.setResourceVersion("1485366417");
- aaiNQInventoryResponseItem.setVserver(aaiNQVServer);
- assertNotNull(aaiNQInventoryResponseItem);
-
- logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItem));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java
deleted file mode 100644
index caeec7910..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import java.util.LinkedList;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQInventoryResponseItemsTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemsTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems();
- AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem();
- serviceItem.setModelName("service-instance");
- assertEquals("service-instance", serviceItem.getModelName());
-
- serviceItem.setServiceInstance(new AAINQServiceInstance());
- serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
- serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
- serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
- serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
- serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
- serviceItem.getServiceInstance().setResourceVersion("1485366092");
- serviceItem.setExtraProperties(new AAINQExtraProperties());
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
-
- AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem();
- vfModuleItem.setModelName("vf-module");
- vfModuleItem.setVfModule(new AAINQVfModule());
- vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
- vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
- vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
- vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
- vfModuleItem.getVfModule().setIsBaseVfModule(true);
- vfModuleItem.getVfModule().setResourceVersion("1485366450");
- vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
- vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
- vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
- vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
- vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- vfModuleItem.setExtraProperties(new AAINQExtraProperties());
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
-
- AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem();
- genericVNFItem.setModelName("generic-vnf");
- genericVNFItem.setGenericVNF(new AAINQGenericVNF());
- genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf");
- genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name");
- genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2");
- genericVNFItem.getGenericVNF().setVnfType("SW");
- genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
- genericVNFItem.getGenericVNF().setProvStatus("PREPROV");
- genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state");
- genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
- genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
- genericVNFItem.getGenericVNF().setInMaint(false);
- genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false);
- genericVNFItem.getGenericVNF().setResourceVersion("1485366450");
- genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true);
- genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
- genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0");
- genericVNFItem.setExtraProperties(new AAINQExtraProperties());
- genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>());
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
- genericVNFItem.setItems(new AAINQInventoryResponseItems());
- genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>());
- genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem);
- genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem);
-
- AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem();
- cloudItem.setCloudRegion(new AAINQCloudRegion());
- cloudItem.getCloudRegion().setCloudOwner("OWNER");
- cloudItem.getCloudRegion().setCloudRegionId("REGIONID");
- cloudItem.getCloudRegion().setCloudRegionVersion("2.5");
- cloudItem.getCloudRegion().setComplexName("COMPLEXNAME");
- cloudItem.getCloudRegion().setResourceVersion("1485365988");
-
- AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem();
- tenantItem.setTenant(new AAINQTenant());
- tenantItem.getTenant().setTenantId("dhv-test-tenant");
- tenantItem.getTenant().setTenantName("dhv-test-tenant-name");
- tenantItem.getTenant().setResourceVersion("1485366334");
- tenantItem.setItems(new AAINQInventoryResponseItems());
- tenantItem.getItems().setInventoryResponseItems(new LinkedList<>());
- tenantItem.getItems().getInventoryResponseItems().add(cloudItem);
- AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem();
- vserverItem.setVserver(new AAINQVServer());
- vserverItem.getVserver().setVserverId("dhv-test-vserver");
- vserverItem.getVserver().setVserverName("dhv-test-vserver-name");
- vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2");
- vserverItem.getVserver().setProvStatus("PREPROV");
- vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink");
- vserverItem.getVserver().setInMaint(false);
- vserverItem.getVserver().setIsClosedLoopDisabled(false);
- vserverItem.getVserver().setResourceVersion("1485366417");
- vserverItem.setItems(new AAINQInventoryResponseItems());
- vserverItem.getItems().setInventoryResponseItems(new LinkedList<>());
- vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem);
- vserverItem.getItems().getInventoryResponseItems().add(tenantItem);
- aaiNQInventoryResponseItems.getInventoryResponseItems().add(vserverItem);
- assertNotNull(aaiNQInventoryResponseItems);
- logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItems));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java
deleted file mode 100644
index 64e722613..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import java.util.UUID;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQRequestTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQRequestTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQRequest aaiNQRequest = new AAINQRequest();
- AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters();
- AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters();
-
- aaiNQRequest.setInstanceFilters(aaiNQInstanceFilters);
- assertNotNull(aaiNQRequest.getInstanceFilters());
- AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery();
- UUID uuid = UUID.randomUUID();
- aaiNQNamedQuery.setNamedQueryUUID(uuid);
- aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery);
- aaiNQRequest.setQueryParameters(aaiNQQueryParameters);
-
- assertNotNull(aaiNQRequest);
-
- assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid);
- assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery);
- assertEquals(aaiNQRequest.getQueryParameters(), aaiNQQueryParameters);
-
- logger.info(Serialization.gsonPretty.toJson(aaiNQRequest));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java
deleted file mode 100644
index 8df71fce1..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.LinkedList;
-import java.util.UUID;
-
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQResponseWrapperTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem();
- serviceItem.setModelName("service-instance");
- serviceItem.setServiceInstance(new AAINQServiceInstance());
- serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
- serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
- serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
- serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
- serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
- serviceItem.getServiceInstance().setResourceVersion("1485366092");
- serviceItem.setExtraProperties(new AAINQExtraProperties());
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
-
- AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem();
- vfModuleItem.setModelName("vf-module");
- vfModuleItem.setVfModule(new AAINQVfModule());
- vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
- vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
- vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
- vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
- vfModuleItem.getVfModule().setIsBaseVfModule(true);
- vfModuleItem.getVfModule().setResourceVersion("1485366450");
- vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
- vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
- vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
- vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
- vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- vfModuleItem.setExtraProperties(new AAINQExtraProperties());
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
-
- AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem();
- genericVNFItem.setModelName("generic-vnf");
- genericVNFItem.setGenericVNF(new AAINQGenericVNF());
- genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf");
- genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name");
- genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2");
- genericVNFItem.getGenericVNF().setVnfType("SW");
- genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
- genericVNFItem.getGenericVNF().setProvStatus("PREPROV");
- genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state");
- genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
- genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
- genericVNFItem.getGenericVNF().setInMaint(false);
- genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false);
- genericVNFItem.getGenericVNF().setResourceVersion("1485366450");
- genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true);
- genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
- genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0");
- genericVNFItem.setExtraProperties(new AAINQExtraProperties());
- genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>());
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
- genericVNFItem.setItems(new AAINQInventoryResponseItems());
- genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>());
- genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem);
- genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem);
-
- AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem();
- cloudItem.setCloudRegion(new AAINQCloudRegion());
- cloudItem.getCloudRegion().setCloudOwner("OWNER");
- cloudItem.getCloudRegion().setCloudRegionId("REGIONID");
- cloudItem.getCloudRegion().setCloudRegionVersion("2.5");
- cloudItem.getCloudRegion().setComplexName("COMPLEXNAME");
- cloudItem.getCloudRegion().setResourceVersion("1485365988");
-
- AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem();
- tenantItem.setTenant(new AAINQTenant());
- tenantItem.getTenant().setTenantId("dhv-test-tenant");
- tenantItem.getTenant().setTenantName("dhv-test-tenant-name");
- tenantItem.getTenant().setResourceVersion("1485366334");
- tenantItem.setItems(new AAINQInventoryResponseItems());
- tenantItem.getItems().setInventoryResponseItems(new LinkedList<>());
- tenantItem.getItems().getInventoryResponseItems().add(cloudItem);
-
- AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem();
- vserverItem.setVserver(new AAINQVServer());
- vserverItem.getVserver().setVserverId("dhv-test-vserver");
- vserverItem.getVserver().setVserverName("dhv-test-vserver-name");
- vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2");
- vserverItem.getVserver().setProvStatus("PREPROV");
- vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink");
- vserverItem.getVserver().setInMaint(false);
- vserverItem.getVserver().setIsClosedLoopDisabled(false);
- vserverItem.getVserver().setResourceVersion("1485366417");
- vserverItem.setItems(new AAINQInventoryResponseItems());
- vserverItem.getItems().setInventoryResponseItems(new LinkedList<>());
- vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem);
- vserverItem.getItems().getInventoryResponseItems().add(tenantItem);
-
- AAINQResponse aaiResponse = new AAINQResponse();
- aaiResponse.getInventoryResponseItems().add(vserverItem);
- AAINQResponseWrapper aaiNQResponseWarapper = new AAINQResponseWrapper();
- aaiNQResponseWarapper.setAainqresponse(aaiResponse);
- aaiNQResponseWarapper.setRequestID(UUID.randomUUID());
- assertNotNull(aaiNQResponseWarapper);
- logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper));
-
- AAINQResponse aaiResponse2 = new AAINQResponse();
- aaiResponse2.getInventoryResponseItems().add(vserverItem);
- AAINQResponseWrapper aaiNQResponseWarapper2 = new AAINQResponseWrapper(UUID.randomUUID(), aaiResponse);
- assertNotNull(aaiNQResponseWarapper2);
- assertNotNull(aaiNQResponseWarapper2.getRequestID());
- assertNotNull(aaiNQResponseWarapper2.getAainqresponse());
- logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper2));
- }
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java
deleted file mode 100644
index 3b3d13c1e..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQServiceInstanceTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQServiceInstanceTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQServiceInstance aaiNQServiceInstance = new AAINQServiceInstance();
- aaiNQServiceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
- aaiNQServiceInstance.setServiceInstanceName("dhv-test-service-instance-name1");
- aaiNQServiceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
- aaiNQServiceInstance.setPersonaModelVersion("1.0");
- aaiNQServiceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
- aaiNQServiceInstance.setResourceVersion("1485366092");
- aaiNQServiceInstance.setModelInvariantId("SomeID");
- aaiNQServiceInstance.setModelVersionId("SomeVersion");
- assertNotNull(aaiNQServiceInstance);
- assertEquals("dhv-test-vhnfportal-service-instance-id", aaiNQServiceInstance.getServiceInstanceID());
- assertEquals("dhv-test-service-instance-name1", aaiNQServiceInstance.getServiceInstanceName());
- assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNQServiceInstance.getPersonaModelId());
- assertEquals("1.0", aaiNQServiceInstance.getPersonaModelVersion());
- assertEquals("dhv-test-service-instance-location-id1", aaiNQServiceInstance.getServiceInstanceLocationId());
- assertEquals("1485366092", aaiNQServiceInstance.getResourceVersion());
- assertEquals("SomeID", aaiNQServiceInstance.getModelInvariantId());
- assertEquals("SomeVersion", aaiNQServiceInstance.getModelVersionId());
- logger.info(Serialization.gsonPretty.toJson(aaiNQServiceInstance));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java
deleted file mode 100644
index 556d82c2e..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQVServerTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQVServerTest.class);
-
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQVServer aaiNQVServer = new AAINQVServer();
- aaiNQVServer.setVserverId("dhv-test-vserver");
- aaiNQVServer.setVserverName("dhv-test-vserver-name");
- aaiNQVServer.setVserverName2("dhv-test-vserver-name2");
- aaiNQVServer.setProvStatus("PREPROV");
- aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink");
- aaiNQVServer.setInMaint(false);
- aaiNQVServer.setIsClosedLoopDisabled(false);
- aaiNQVServer.setResourceVersion("1485366417");
- assertNotNull(aaiNQVServer);
- assertEquals("dhv-test-vserver", aaiNQVServer.getVserverId());
- assertEquals("dhv-test-vserver-name", aaiNQVServer.getVserverName());
- assertEquals("dhv-test-vserver-name2", aaiNQVServer.getVserverName2());
- assertEquals("PREPROV", aaiNQVServer.getProvStatus());
- assertEquals("dhv-test-vserver-selflink", aaiNQVServer.getVserverSelflink());
- assertEquals(false, aaiNQVServer.getInMaint());
- assertEquals(false, aaiNQVServer.getIsClosedLoopDisabled());
- assertEquals("1485366417", aaiNQVServer.getResourceVersion());
- logger.info(Serialization.gsonPretty.toJson(aaiNQVServer));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java
deleted file mode 100644
index 7595f88cd..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AAINQVfModuleTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQVfModuleTest.class);
-
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQVfModule aaiNQVfModule = new AAINQVfModule();
- aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261");
- aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074");
- aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300");
- aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523");
- aaiNQVfModule.setIsBaseVfModule(true);
- aaiNQVfModule.setResourceVersion("1485366450");
- aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
- aaiNQVfModule.setPersonaModelVersion("1.0");
- aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571");
- aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317");
- aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- aaiNQVfModule.setModelInvariantId("SomeId");
- aaiNQVfModule.setModelVersionId("SomeVersion");
- assertNotNull(aaiNQVfModule);
- assertEquals("example-vf-module-id-val-49261", aaiNQVfModule.getVfModuleId());
- assertEquals("example-vf-module-name-val-73074", aaiNQVfModule.getVfModuleName());
- assertEquals("example-heat-stack-id-val-86300", aaiNQVfModule.getHeatStackId());
- assertEquals("example-orchestration-status-val-56523", aaiNQVfModule.getOrchestrationStatus());
- assertEquals(true, aaiNQVfModule.getIsBaseVfModule());
- assertEquals("1485366450", aaiNQVfModule.getResourceVersion());
- assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNQVfModule.getPersonaModelId());
- assertEquals("1.0", aaiNQVfModule.getPersonaModelVersion());
- assertEquals("example-widget-model-id-val-92571", aaiNQVfModule.getWidgetModelId());
- assertEquals("example-widget-model-version-val-83317", aaiNQVfModule.getWidgetModelVersion());
- assertEquals("example-contrail-service-instance-fqdn-val-86796", aaiNQVfModule.getContrailServiceInstanceFqdn());
- assertEquals("SomeId", aaiNQVfModule.getModelInvariantId());
- assertEquals("SomeVersion", aaiNQVfModule.getModelVersionId());
- logger.info(Serialization.gsonPretty.toJson(aaiNQVfModule));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java
new file mode 100644
index 000000000..d78952111
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiGetVnfResponseTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiGetVnfResponseTest.class);
+
+ @Test
+ public void test() {
+ AaiGetVnfResponse response = new AaiGetVnfResponse();
+
+ response.setVnfId("83f674e8-7555-44d7-9a39-bdc3770b0491");
+ response.setVnfName("lll_vnf_010317");
+ response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1");
+ response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ response.setOrchestrationStatus("Created");
+ response.setInMaint("false");
+ response.setIsClosedLoopDisabled("false");
+ response.setResourceVersion("1494001988835");
+ response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa");
+ assertEquals("83f674e8-7555-44d7-9a39-bdc3770b0491", response.getVnfId());
+ assertEquals("lll_vnf_010317", response.getVnfName());
+ assertEquals("Basa-122216-Service/VidVsamp12BaseVolume 1", response.getVnfType());
+ assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", response.getServiceId());
+ assertEquals("Created", response.getOrchestrationStatus());
+ assertEquals("false", response.getInMaint());
+ assertEquals("false", response.getIsClosedLoopDisabled());
+ assertEquals("1494001988835", response.getResourceVersion());
+ assertEquals("f18be3cd-d446-456e-9109-121d9b62feaa", response.getModelInvariantId());
+
+ final RelationshipList relationshipList = new RelationshipList();
+ final Relationship relationship = new Relationship();
+ RelationshipData relationshipData = new RelationshipData();
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+
+ relationshipDataItem.setRelationshipKey("customer.global-customer-id");
+ relationshipDataItem.setRelationshipValue("MSO_1610_ST");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ relationshipDataItem.setRelationshipKey("service-subscription.service-type");
+ relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ relationshipDataItem.setRelationshipKey("service-instance.service-instance-id");
+ relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ RelatedToPropertyItem item = new RelatedToPropertyItem();
+ item.setPropertyKey("service-instance.service-instance-name");
+ item.setPropertyValue("lll_svc_010317");
+ relatedToProperty.getRelatedTo().add(item);
+ assertEquals("service-instance.service-instance-name", item.getPropertyKey());
+ assertEquals("lll_svc_010317", item.getPropertyValue());
+
+ relationship.setRelatedTo("service-instance");
+ relationship.setRelatedLink(
+ "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/"
+ + "MSO-dev-service-type/service-instances/service-instance/"
+ + "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
+ relationship.setRelationshipData(relationshipData);
+ relationship.setRelatedToProperty(relatedToProperty);
+
+ relationshipList.getRelationshipList().add(relationship);
+ response.setRelationshipList(relationshipList);
+
+ logger.info(Serialization.gsonPretty.toJson(response));
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java
new file mode 100644
index 000000000..6962b31f4
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiGetVserverResponseTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiGetVserverResponseTest.class);
+
+ @Test
+ public void test() {
+ AaiGetVserverResponse response = new AaiGetVserverResponse();
+
+ response.setVserverId("d0668d4f-c25e-4a1b-87c4-83845c01efd8");
+ response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0");
+ response.setVserverName2("vjunos0");
+ response.setVserverSelflink(
+ "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8");
+ response.setInMaint("false");
+ response.setIsClosedLoopDisabled("false");
+ response.setResourceVersion("1494001931513");
+
+ assertEquals("d0668d4f-c25e-4a1b-87c4-83845c01efd8", response.getVserverId());
+ assertEquals("USMSO1SX7NJ0103UJZZ01-vjunos0", response.getVserverName());
+ assertEquals("vjunos0", response.getVserverName2());
+ assertEquals("https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/"
+ + "aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver"
+ + "/d0668d4f-c25e-4a1b-87c4-83845c01efd8", response.getVserverSelflink());
+ assertEquals("false", response.getInMaint());
+ assertEquals("false", response.getIsClosedLoopDisabled());
+ assertEquals("1494001931513", response.getResourceVersion());
+
+ final RelationshipList relationshipList = new RelationshipList();
+ final Relationship relationship = new Relationship();
+ RelationshipData relationshipData = new RelationshipData();
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+
+ relationshipDataItem.setRelationshipKey("customer.global-customer-id");
+ relationshipDataItem.setRelationshipValue("MSO_1610_ST");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ relationshipDataItem.setRelationshipKey("service-subscription.service-type");
+ relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ relationshipDataItem.setRelationshipKey("service-instance.service-instance-id");
+ relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ RelatedToPropertyItem item = new RelatedToPropertyItem();
+ item.setPropertyKey("service-instance.service-instance-name");
+ item.setPropertyValue("lll_svc_010317");
+ relatedToProperty.getRelatedTo().add(item);
+
+ relationship.setRelatedTo("service-instance");
+ relationship.setRelatedLink(
+ "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/"
+ + "MSO-dev-service-type/service-instances/service-instance/"
+ + "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970");
+ relationship.setRelationshipData(relationshipData);
+ relationship.setRelatedToProperty(relatedToProperty);
+
+ relationshipList.getRelationshipList().add(relationship);
+ response.setRelationshipList(relationshipList);
+ assertEquals(response.getRelationshipList(), relationshipList);
+ response.setRequestError(null);
+ assertNull(response.getRequestError());
+
+ logger.info(Serialization.gsonPretty.toJson(response));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java
new file mode 100644
index 000000000..32a029560
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.startsWith;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.onap.policy.rest.RESTManager;
+import org.onap.policy.rest.RESTManager.Pair;
+
+public class AaiManagerTest {
+ RESTManager restManagerMock;
+ UUID aaiNqRequestUuid = UUID.randomUUID();
+ Pair<Integer, String> httpResponseOk;
+ Pair<Integer, String> httpResponseErr0;
+ Pair<Integer, String> httpResponseErr1;
+ Pair<Integer, String> httpResponseWait;
+
+ /**
+ * Set up test cases.
+ */
+ @Before
+ public void beforeTestAaiManager() {
+ restManagerMock = mock(RESTManager.class);
+
+ Map<String, String> expectedHeaders = new HashMap<>();
+ expectedHeaders.put("X-FromAppId", "POLICY");
+ expectedHeaders.put("X-TransactionId", aaiNqRequestUuid.toString());
+ expectedHeaders.put("Accept", "application/json");
+
+ AaiNqResponse aaiNqResponse = new AaiNqResponseTest().getAaiNqResponse();
+ httpResponseOk = restManagerMock.new Pair<>(200, Serialization.gsonPretty.toJson(aaiNqResponse));
+ httpResponseErr0 = restManagerMock.new Pair<>(200, null);
+ httpResponseErr1 = restManagerMock.new Pair<>(200, "{");
+ httpResponseWait = restManagerMock.new Pair<>(503, null);
+ }
+
+ @Test
+ public void testAaiManagerAaiNqRequest() {
+
+ AaiManager aaiManager = new AaiManager(restManagerMock);
+ assertNotNull(aaiManager);
+
+ UUID aaiNqUuid = UUID.randomUUID();
+
+ AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters();
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ aaiNqNamedQuery.setNamedQueryUuid(aaiNqUuid);
+ aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery);
+
+ AaiNqRequest aaiNqRequest = new AaiNqRequest();
+ aaiNqRequest.setQueryParameters(aaiNqQueryParameters);
+
+ when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap(),
+ anyString(), anyString())).thenReturn(httpResponseOk);
+
+ AaiNqResponse aaiNqOkResponse = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Dorothy", "Gale",
+ aaiNqRequest, aaiNqRequestUuid);
+ assertNotNull(aaiNqOkResponse);
+
+ when(restManagerMock.post(isNull(), eq("Dorothy"), anyString(), anyMap(), anyString(), anyString()))
+ .thenReturn(null);
+
+ AaiNqResponse aaiNqNullResponse = aaiManager.postQuery(null, "Dorothy", "Gale", null, aaiNqRequestUuid);
+ assertNull(aaiNqNullResponse);
+
+ when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Witch"), eq("West"), anyMap(),
+ anyString(), anyString())).thenReturn(httpResponseErr0);
+
+ AaiNqResponse aaiNqNotOkResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West",
+ aaiNqRequest, aaiNqRequestUuid);
+ assertNull(aaiNqNotOkResponse0);
+
+ when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(),
+ anyString(), anyString())).thenReturn(httpResponseErr1);
+
+ AaiNqResponse aaiNqNotOkResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West",
+ aaiNqRequest, aaiNqRequestUuid);
+ assertNull(aaiNqNotOkResponse1);
+ }
+
+ @Test
+ public void testAaiManagerQueryByVserverName() {
+ AaiManager aaiManager = new AaiManager(restManagerMock);
+ assertNotNull(aaiManager);
+
+ UUID vserverNameRequestId = UUID.randomUUID();
+
+ when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap()))
+ .thenReturn(httpResponseOk);
+
+ AaiGetVserverResponse vserverResponse = aaiManager.getQueryByVserverName("http://somewhere.over.the.rainbow",
+ "Dorothy", "Gale", vserverNameRequestId, "vserverName");
+ assertNotNull(vserverResponse);
+
+ AaiGetVserverResponse vserverNullResponse =
+ aaiManager.getQueryByVserverName(null, "Dorothy", "Gale", vserverNameRequestId, "vserverName");
+ assertNull(vserverNullResponse);
+
+ when(restManagerMock.get(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap()))
+ .thenReturn(httpResponseErr0);
+
+ AaiGetVserverResponse vserverNotOkResponse0 = aaiManager.getQueryByVserverName(
+ "http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName");
+ assertNull(vserverNotOkResponse0);
+ }
+
+ @Test
+ public void testAaiManagerQueryByVnfId() {
+ AaiManager aaiManager = new AaiManager(restManagerMock);
+ assertNotNull(aaiManager);
+
+ UUID vserverNameRequestId = UUID.randomUUID();
+
+ when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap()))
+ .thenReturn(httpResponseOk);
+
+ AaiGetVnfResponse vnfResponse = aaiManager.getQueryByVnfId("http://somewhere.over.the.rainbow", "Dorothy",
+ "Gale", vserverNameRequestId, "vnfID");
+ assertNotNull(vnfResponse);
+ }
+
+ @Test
+ public void testAaiManagerQueryByVnfName() {
+ AaiManager aaiManager = new AaiManager(restManagerMock);
+ assertNotNull(aaiManager);
+
+ UUID vserverNameRequestId = UUID.randomUUID();
+
+ when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap()))
+ .thenReturn(httpResponseOk);
+
+ AaiGetVnfResponse vnfResponse = aaiManager.getQueryByVnfId("http://somewhere.over.the.rainbow", "Dorothy",
+ "Gale", vserverNameRequestId, "vnfName");
+ assertNotNull(vnfResponse);
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java
new file mode 100644
index 000000000..dea981a0a
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AaiNqCloudRegionTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion();
+ aaiNqCloudRegion.setCloudOwner("Rackspace");
+ aaiNqCloudRegion.setCloudRegionId("DFW");
+ aaiNqCloudRegion.setCloudRegionVersion("v1");
+ aaiNqCloudRegion.setComplexName("SharedNode");
+ aaiNqCloudRegion.setResourceVersion("1504789196021");
+ assertNotNull(aaiNqCloudRegion);
+ assertEquals("Rackspace", aaiNqCloudRegion.getCloudOwner());
+ assertEquals("DFW", aaiNqCloudRegion.getCloudRegionId());
+ assertEquals("v1", aaiNqCloudRegion.getCloudRegionVersion());
+ assertEquals("SharedNode", aaiNqCloudRegion.getComplexName());
+ assertEquals("1504789196021", aaiNqCloudRegion.getResourceVersion());
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java
new file mode 100644
index 000000000..adbd9379b
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AaiNqExtraPropertiesTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties();
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-name", "service-instance"));
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ aaiNqExtraProperties.getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
+ aaiNqExtraProperties.getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
+ assertNotNull(aaiNqExtraProperties);
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java
index 78189c857..25f125945 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,32 +17,32 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-public class AAINQExtraPropertyTest {
+public class AaiNqExtraPropertyTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
- @Test
- public void test() {
- AAINQExtraProperty aaiNQExtraProperty = new AAINQExtraProperty();
- aaiNQExtraProperty.setPropertyName("model.model-name");
- aaiNQExtraProperty.setPropertyValue("service-instance");
- assertNotNull(aaiNQExtraProperty);
+ @Test
+ public void test() {
+ AaiNqExtraProperty aaiNqExtraProperty = new AaiNqExtraProperty();
+ aaiNqExtraProperty.setPropertyName("model.model-name");
+ aaiNqExtraProperty.setPropertyValue("service-instance");
+ assertNotNull(aaiNqExtraProperty);
- assertEquals("model.model-name", aaiNQExtraProperty.getPropertyName());
- assertEquals("service-instance", aaiNQExtraProperty.getPropertyValue());
- }
+ assertEquals("model.model-name", aaiNqExtraProperty.getPropertyName());
+ assertEquals("service-instance", aaiNqExtraProperty.getPropertyValue());
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java
new file mode 100644
index 000000000..680e66e7c
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AaiNqGenericVnfTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf();
+ aaiNqGenericVnf.setEncrypedAccessFlag(true);
+ aaiNqGenericVnf.setInMaint(false);
+ aaiNqGenericVnf.setIpv4Loopback0Address("aa");
+ aaiNqGenericVnf.setIpv4OamAddress("oamAddress");
+ aaiNqGenericVnf.setIsClosedLoopDisabled(false);
+ aaiNqGenericVnf.setModelInvariantId("653d2caa-7e47-4614-95b3-26c8d82755b8");
+ aaiNqGenericVnf.setModelVersionId("98f410f6-4c63-447b-97d2-42508437cec0");
+ aaiNqGenericVnf.setOperationalState("active");
+ aaiNqGenericVnf.setPersonaModelId("653d2caa-7e47-4614-95b3-26c8d82755b8");
+ aaiNqGenericVnf.setPersonaModelVersion("98f410f6-4c63-447b-97d2-42508437cec0");
+ aaiNqGenericVnf.setProvStatus("complete");
+ aaiNqGenericVnf.setResourceVersion("1505056714553");
+ aaiNqGenericVnf.setServiceId("e8cb8968-5411-478b-906a-f28747de72cd");
+ aaiNqGenericVnf.setVnfId("ed8b2bce-6b27-4089-992c-4a2c66024bcd");
+ aaiNqGenericVnf.setVnfName("vCPEInfraVNF14a");
+ aaiNqGenericVnf.setVnfName2("malumabb12");
+ aaiNqGenericVnf.setVnfType("vCPEInfraService10/vCPEInfraService10 0");
+ assertNotNull(aaiNqGenericVnf);
+
+ assertEquals(true, aaiNqGenericVnf.getEncrypedAccessFlag());
+ assertEquals(false, aaiNqGenericVnf.getInMaint());
+ assertEquals("aa", aaiNqGenericVnf.getIpv4Loopback0Address());
+ assertEquals("oamAddress", aaiNqGenericVnf.getIpv4OamAddress());
+ assertEquals(false, aaiNqGenericVnf.getIsClosedLoopDisabled());
+ assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getModelInvariantId());
+ assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getModelVersionId());
+ assertEquals("active", aaiNqGenericVnf.getOperationalState());
+ assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getPersonaModelId());
+ assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getPersonaModelVersion());
+ assertEquals("complete", aaiNqGenericVnf.getProvStatus());
+ assertEquals("1505056714553", aaiNqGenericVnf.getResourceVersion());
+ assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNqGenericVnf.getServiceId());
+ assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNqGenericVnf.getVnfId());
+ assertEquals("vCPEInfraVNF14a", aaiNqGenericVnf.getVnfName());
+ assertEquals("malumabb12", aaiNqGenericVnf.getVnfName2());
+ assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNqGenericVnf.getVnfType());
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java
index f3bceaa16..1508891b4 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java
@@ -17,32 +17,31 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-public class AAINQInstanceFiltersTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters();
- assertNotNull(aaiNQInstanceFilters);
-
- aaiNQInstanceFilters.setInstanceFilter(aaiNQInstanceFilters.getInstanceFilter());;
- assertNotNull(aaiNQInstanceFilters);
- assertNotNull(aaiNQInstanceFilters.getInstanceFilter());
- }
+public class AaiNqInstanceFiltersTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters();
+ assertNotNull(aaiNqInstanceFilters);
+
+ aaiNqInstanceFilters.setInstanceFilter(aaiNqInstanceFilters.getInstanceFilter());;
+ assertNotNull(aaiNqInstanceFilters);
+ assertNotNull(aaiNqInstanceFilters.getInstanceFilter());
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java
new file mode 100644
index 000000000..8b5265a00
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.LinkedList;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqInventoryResponseItemTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqInventoryResponseItem aaiNqInventoryResponseItem = new AaiNqInventoryResponseItem();
+ aaiNqInventoryResponseItem.setModelName("service-instance");
+ AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion();
+ aaiNqCloudRegion.setCloudOwner("OWNER");
+ aaiNqCloudRegion.setCloudRegionId("REGIONID");
+ aaiNqCloudRegion.setCloudRegionVersion("2.5");
+ aaiNqCloudRegion.setComplexName("COMPLEXNAME");
+ aaiNqCloudRegion.setResourceVersion("1485365988");
+ aaiNqInventoryResponseItem.setCloudRegion(aaiNqCloudRegion);
+ AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties();
+ aaiNqExtraProperties.setExtraProperty(new LinkedList<>());
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-name", "generic-vnf"));
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ aaiNqExtraProperties.getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
+ aaiNqExtraProperties.getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
+ aaiNqInventoryResponseItem.setExtraProperties(aaiNqExtraProperties);
+ AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf();
+ aaiNqGenericVnf.setVnfId("dhv-test-gvnf");
+ aaiNqGenericVnf.setVnfName("dhv-test-gvnf-name");
+ aaiNqGenericVnf.setVnfName2("dhv-test-gvnf-name2");
+ aaiNqGenericVnf.setVnfType("SW");
+ aaiNqGenericVnf.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
+ aaiNqGenericVnf.setProvStatus("PREPROV");
+ aaiNqGenericVnf.setOperationalState("dhv-test-operational-state");
+ aaiNqGenericVnf.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
+ aaiNqGenericVnf.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
+ aaiNqGenericVnf.setInMaint(false);
+ aaiNqGenericVnf.setIsClosedLoopDisabled(false);
+ aaiNqGenericVnf.setResourceVersion("1485366450");
+ aaiNqGenericVnf.setEncrypedAccessFlag(true);
+ aaiNqGenericVnf.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
+ aaiNqGenericVnf.setPersonaModelVersion("1.0");
+ aaiNqInventoryResponseItem.setGenericVnf(aaiNqGenericVnf);
+ AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem();
+ serviceItem.setModelName("service-instance");
+ serviceItem.setServiceInstance(new AaiNqServiceInstance());
+ serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
+ serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
+ serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
+ serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
+ serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
+ serviceItem.getServiceInstance().setResourceVersion("1485366092");
+ serviceItem.setExtraProperties(new AaiNqExtraProperties());
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "service-instance"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
+
+ AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem();
+ vfModuleItem.setModelName("vf-module");
+ vfModuleItem.setVfModule(new AaiNqVfModule());
+ vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
+ vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
+ vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
+ vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
+ vfModuleItem.getVfModule().setIsBaseVfModule(true);
+ vfModuleItem.getVfModule().setResourceVersion("1485366450");
+ vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
+ vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
+ vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
+ vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
+ vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
+ vfModuleItem.setExtraProperties(new AaiNqExtraProperties());
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "vf-module"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
+
+ AaiNqInventoryResponseItems aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems();
+ aaiNqInventoryResponseItems.getInventoryResponseItems().add(serviceItem);
+ aaiNqInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem);
+ aaiNqInventoryResponseItem.setItems(aaiNqInventoryResponseItems);
+ aaiNqInventoryResponseItem.setModelName("model-name");
+ AaiNqServiceInstance serviceInstance = new AaiNqServiceInstance();
+ serviceInstance.setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
+ serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1");
+ serviceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
+ serviceInstance.setPersonaModelVersion("1.0");
+ serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
+ serviceInstance.setResourceVersion("1485366092");
+ aaiNqInventoryResponseItem.setServiceInstance(serviceInstance);
+ AaiNqTenant aaiNqTenant = new AaiNqTenant();
+ aaiNqTenant.setTenantId("dhv-test-tenant");
+ aaiNqTenant.setTenantName("dhv-test-tenant-name");
+ aaiNqTenant.setResourceVersion("1485366334");
+ aaiNqInventoryResponseItem.setTenant(aaiNqTenant);
+ AaiNqVfModule aaiNqVfModule = new AaiNqVfModule();
+ aaiNqVfModule.setVfModuleId("example-vf-module-id-val-49261");
+ aaiNqVfModule.setVfModuleName("example-vf-module-name-val-73074");
+ aaiNqVfModule.setHeatStackId("example-heat-stack-id-val-86300");
+ aaiNqVfModule.setOrchestrationStatus("example-orchestration-status-val-56523");
+ aaiNqVfModule.setIsBaseVfModule(true);
+ aaiNqVfModule.setResourceVersion("1485366450");
+ aaiNqVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
+ aaiNqVfModule.setPersonaModelVersion("1.0");
+ aaiNqVfModule.setWidgetModelId("example-widget-model-id-val-92571");
+ aaiNqVfModule.setWidgetModelVersion("example-widget-model-version-val-83317");
+ aaiNqVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
+ aaiNqInventoryResponseItem.setVfModule(aaiNqVfModule);
+ AaiNqVServer aaiNqVServer = new AaiNqVServer();
+ aaiNqVServer.setVserverId("dhv-test-vserver");
+ aaiNqVServer.setVserverName("dhv-test-vserver-name");
+ aaiNqVServer.setVserverName2("dhv-test-vserver-name2");
+ aaiNqVServer.setProvStatus("PREPROV");
+ aaiNqVServer.setVserverSelflink("dhv-test-vserver-selflink");
+ aaiNqVServer.setInMaint(false);
+ aaiNqVServer.setIsClosedLoopDisabled(false);
+ aaiNqVServer.setResourceVersion("1485366417");
+ aaiNqInventoryResponseItem.setVserver(aaiNqVServer);
+ assertNotNull(aaiNqInventoryResponseItem);
+
+ logger.info(Serialization.gsonPretty.toJson(aaiNqInventoryResponseItem));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java
new file mode 100644
index 000000000..99c6e5e92
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.LinkedList;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqInventoryResponseItemsTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemsTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem();
+ serviceItem.setModelName("service-instance");
+ assertEquals("service-instance", serviceItem.getModelName());
+
+ serviceItem.setServiceInstance(new AaiNqServiceInstance());
+ serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
+ serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
+ serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
+ serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
+ serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
+ serviceItem.getServiceInstance().setResourceVersion("1485366092");
+ serviceItem.setExtraProperties(new AaiNqExtraProperties());
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "service-instance"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
+
+ AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem();
+ vfModuleItem.setModelName("vf-module");
+ vfModuleItem.setVfModule(new AaiNqVfModule());
+ vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
+ vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
+ vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
+ vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
+ vfModuleItem.getVfModule().setIsBaseVfModule(true);
+ vfModuleItem.getVfModule().setResourceVersion("1485366450");
+ vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
+ vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
+ vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
+ vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
+ vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
+ vfModuleItem.setExtraProperties(new AaiNqExtraProperties());
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "vf-module"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
+
+ AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem();
+ genericVnfItem.setModelName("generic-vnf");
+ genericVnfItem.setGenericVnf(new AaiNqGenericVnf());
+ genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf");
+ genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name");
+ genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2");
+ genericVnfItem.getGenericVnf().setVnfType("SW");
+ genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
+ genericVnfItem.getGenericVnf().setProvStatus("PREPROV");
+ genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state");
+ genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
+ genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
+ genericVnfItem.getGenericVnf().setInMaint(false);
+ genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false);
+ genericVnfItem.getGenericVnf().setResourceVersion("1485366450");
+ genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true);
+ genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
+ genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0");
+ genericVnfItem.setExtraProperties(new AaiNqExtraProperties());
+ genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>());
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "generic-vnf"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-type", "widget"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
+ genericVnfItem.setItems(new AaiNqInventoryResponseItems());
+ genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem);
+ genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem);
+
+ AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem();
+ cloudItem.setCloudRegion(new AaiNqCloudRegion());
+ cloudItem.getCloudRegion().setCloudOwner("OWNER");
+ cloudItem.getCloudRegion().setCloudRegionId("REGIONID");
+ cloudItem.getCloudRegion().setCloudRegionVersion("2.5");
+ cloudItem.getCloudRegion().setComplexName("COMPLEXNAME");
+ cloudItem.getCloudRegion().setResourceVersion("1485365988");
+
+ AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem();
+ tenantItem.setTenant(new AaiNqTenant());
+ tenantItem.getTenant().setTenantId("dhv-test-tenant");
+ tenantItem.getTenant().setTenantName("dhv-test-tenant-name");
+ tenantItem.getTenant().setResourceVersion("1485366334");
+ tenantItem.setItems(new AaiNqInventoryResponseItems());
+ tenantItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ tenantItem.getItems().getInventoryResponseItems().add(cloudItem);
+ AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem();
+ vserverItem.setVserver(new AaiNqVServer());
+ vserverItem.getVserver().setVserverId("dhv-test-vserver");
+ vserverItem.getVserver().setVserverName("dhv-test-vserver-name");
+ vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2");
+ vserverItem.getVserver().setProvStatus("PREPROV");
+ vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink");
+ vserverItem.getVserver().setInMaint(false);
+ vserverItem.getVserver().setIsClosedLoopDisabled(false);
+ vserverItem.getVserver().setResourceVersion("1485366417");
+ vserverItem.setItems(new AaiNqInventoryResponseItems());
+ vserverItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem);
+ vserverItem.getItems().getInventoryResponseItems().add(tenantItem);
+
+ AaiNqInventoryResponseItems aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems();
+ aaiNqInventoryResponseItems.getInventoryResponseItems().add(vserverItem);
+ assertNotNull(aaiNqInventoryResponseItems);
+ logger.info(Serialization.gsonPretty.toJson(aaiNqInventoryResponseItems));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java
index 510683387..2e65a843d 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.util.UUID;
@@ -27,22 +29,20 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-public class AAINQNamedQueryTest {
+public class AaiNqNamedQueryTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
- @Test
- public void test() {
- AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery();
- UUID uuid = UUID.randomUUID();
- aaiNQNamedQuery.setNamedQueryUUID(uuid);
- assertNotNull(aaiNQNamedQuery);
- assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid);
- }
+ @Test
+ public void test() {
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ UUID uuid = UUID.randomUUID();
+ aaiNqNamedQuery.setNamedQueryUuid(uuid);
+ assertNotNull(aaiNqNamedQuery);
+ assertEquals(aaiNqNamedQuery.getNamedQueryUuid(), uuid);
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java
index 0561fa690..1f0a8354a 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.util.UUID;
@@ -27,24 +29,22 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-public class AAINQQueryParametersTest {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters();
- AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery();
- aaiNQNamedQuery.setNamedQueryUUID(UUID.randomUUID());
- aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery);
- assertNotNull(aaiNQNamedQuery);
- assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery);
- }
+public class AaiNqQueryParametersTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters();
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ aaiNqNamedQuery.setNamedQueryUuid(UUID.randomUUID());
+ aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery);
+ assertNotNull(aaiNqNamedQuery);
+ assertEquals(aaiNqQueryParameters.getNamedQuery(), aaiNqNamedQuery);
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java
index d13689814..e943c0c01 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,23 +17,25 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
-public class AAINQRequestErrorTest {
+public class AaiNqRequestErrorTest {
+
+ @Test
+ public void test() {
+ AaiNqRequestError aainqRequestError = new AaiNqRequestError();
+ AaiNqServiceExcept serviceExcept = new AaiNqServiceExcept();
+ aainqRequestError.setServiceExcept(serviceExcept);
+ assertEquals(aainqRequestError.getServiceExcept(), serviceExcept);
- @Test
- public void test() {
- AAINQRequestError aainqRequestError = new AAINQRequestError();
- AAINQServiceExcept serviceExcept = new AAINQServiceExcept();
- aainqRequestError.setServiceExcept(serviceExcept);
- assertEquals(aainqRequestError.getServiceExcept(), serviceExcept);
-
- assertNull(serviceExcept.getMessageId());
- assertNull(serviceExcept.getText());
- assertNull(serviceExcept.getVariables());
- }
+ assertNull(serviceExcept.getMessageId());
+ assertNull(serviceExcept.getText());
+ assertNull(serviceExcept.getVariables());
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java
new file mode 100644
index 000000000..1ac5e457b
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqRequestTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqRequestTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqRequest aaiNqRequest = new AaiNqRequest();
+ AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters();
+
+ aaiNqRequest.setInstanceFilters(aaiNqInstanceFilters);
+ assertNotNull(aaiNqRequest.getInstanceFilters());
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ UUID uuid = UUID.randomUUID();
+ aaiNqNamedQuery.setNamedQueryUuid(uuid);
+
+ AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters();
+ aaiNqQueryParameters.setNamedQuery(aaiNqNamedQuery);
+ aaiNqRequest.setQueryParameters(aaiNqQueryParameters);
+
+ assertNotNull(aaiNqRequest);
+
+ assertEquals(aaiNqNamedQuery.getNamedQueryUuid(), uuid);
+ assertEquals(aaiNqQueryParameters.getNamedQuery(), aaiNqNamedQuery);
+ assertEquals(aaiNqRequest.getQueryParameters(), aaiNqQueryParameters);
+
+ logger.info(Serialization.gsonPretty.toJson(aaiNqRequest));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java
index e481f0aca..c715a22c2 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
import java.util.LinkedList;
@@ -26,34 +27,42 @@ import org.onap.policy.aai.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AAINQResponseTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQResponseTest.class);
+public class AaiNqResponseTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseTest.class);
+
+ @Test
+ public void test() {
+ getAaiNqResponse();
+ }
- @Test
- public void Test() {
- getAAINQResponse();
- }
-
- public AAINQResponse getAAINQResponse() {
- AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem();
+ /**
+ * Get A&AI NQ response.
+ *
+ * @return the A&AI NG response
+ */
+ public AaiNqResponse getAaiNqResponse() {
+ AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem();
serviceItem.setModelName("service-instance");
- serviceItem.setServiceInstance(new AAINQServiceInstance());
- serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id");
+ serviceItem.setServiceInstance(new AaiNqServiceInstance());
+ serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
serviceItem.getServiceInstance().setResourceVersion("1485366092");
- serviceItem.setExtraProperties(new AAINQExtraProperties());
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
- serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
+ serviceItem.setExtraProperties(new AaiNqExtraProperties());
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "service-instance"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
- AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem();
+ AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem();
vfModuleItem.setModelName("vf-module");
- vfModuleItem.setVfModule(new AAINQVfModule());
+ vfModuleItem.setVfModule(new AaiNqVfModule());
vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
@@ -65,62 +74,70 @@ public class AAINQResponseTest {
vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
- vfModuleItem.setExtraProperties(new AAINQExtraProperties());
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
- vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
+ vfModuleItem.setExtraProperties(new AaiNqExtraProperties());
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "vf-module"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
- AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem();
- genericVNFItem.setModelName("generic-vnf");
- genericVNFItem.setGenericVNF(new AAINQGenericVNF());
- genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf");
- genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name");
- genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2");
- genericVNFItem.getGenericVNF().setVnfType("SW");
- genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
- genericVNFItem.getGenericVNF().setProvStatus("PREPROV");
- genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state");
- genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
- genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
- genericVNFItem.getGenericVNF().setInMaint(false);
- genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false);
- genericVNFItem.getGenericVNF().setResourceVersion("1485366450");
- genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true);
- genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
- genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0");
- genericVNFItem.setExtraProperties(new AAINQExtraProperties());
- genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>());
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
- genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
- genericVNFItem.setItems(new AAINQInventoryResponseItems());
- genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>());
- genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem);
- genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem);
+ AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem();
+ genericVnfItem.setModelName("generic-vnf");
+ genericVnfItem.setGenericVnf(new AaiNqGenericVnf());
+ genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf");
+ genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name");
+ genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2");
+ genericVnfItem.getGenericVnf().setVnfType("SW");
+ genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
+ genericVnfItem.getGenericVnf().setProvStatus("PREPROV");
+ genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state");
+ genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
+ genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
+ genericVnfItem.getGenericVnf().setInMaint(false);
+ genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false);
+ genericVnfItem.getGenericVnf().setResourceVersion("1485366450");
+ genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true);
+ genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
+ genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0");
+ genericVnfItem.setExtraProperties(new AaiNqExtraProperties());
+ genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>());
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "generic-vnf"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-type", "widget"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
+ genericVnfItem.setItems(new AaiNqInventoryResponseItems());
+ genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem);
+ genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem);
- AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem();
- cloudItem.setCloudRegion(new AAINQCloudRegion());
+ AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem();
+ cloudItem.setCloudRegion(new AaiNqCloudRegion());
cloudItem.getCloudRegion().setCloudOwner("OWNER");
cloudItem.getCloudRegion().setCloudRegionId("REGIONID");
cloudItem.getCloudRegion().setCloudRegionVersion("2.5");
cloudItem.getCloudRegion().setComplexName("COMPLEXNAME");
cloudItem.getCloudRegion().setResourceVersion("1485365988");
- AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem();
- tenantItem.setTenant(new AAINQTenant());
+ AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem();
+ tenantItem.setTenant(new AaiNqTenant());
tenantItem.getTenant().setTenantId("dhv-test-tenant");
tenantItem.getTenant().setTenantName("dhv-test-tenant-name");
tenantItem.getTenant().setResourceVersion("1485366334");
- tenantItem.setItems(new AAINQInventoryResponseItems());
+ tenantItem.setItems(new AaiNqInventoryResponseItems());
tenantItem.getItems().setInventoryResponseItems(new LinkedList<>());
tenantItem.getItems().getInventoryResponseItems().add(cloudItem);
- AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem();
- vserverItem.setVserver(new AAINQVServer());
+ AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem();
+ vserverItem.setVserver(new AaiNqVServer());
vserverItem.getVserver().setVserverId("dhv-test-vserver");
vserverItem.getVserver().setVserverName("dhv-test-vserver-name");
vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2");
@@ -129,15 +146,15 @@ public class AAINQResponseTest {
vserverItem.getVserver().setInMaint(false);
vserverItem.getVserver().setIsClosedLoopDisabled(false);
vserverItem.getVserver().setResourceVersion("1485366417");
- vserverItem.setItems(new AAINQInventoryResponseItems());
+ vserverItem.setItems(new AaiNqInventoryResponseItems());
vserverItem.getItems().setInventoryResponseItems(new LinkedList<>());
- vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem);
+ vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem);
vserverItem.getItems().getInventoryResponseItems().add(tenantItem);
- AAINQResponse aaiResponse = new AAINQResponse();
+ AaiNqResponse aaiResponse = new AaiNqResponse();
aaiResponse.getInventoryResponseItems().add(vserverItem);
logger.info(Serialization.gsonPretty.toJson(aaiResponse));
-
+
return aaiResponse;
- }
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java
new file mode 100644
index 000000000..0d6a49361
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.LinkedList;
+import java.util.UUID;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqResponseWrapperTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem();
+ serviceItem.setModelName("service-instance");
+ serviceItem.setServiceInstance(new AaiNqServiceInstance());
+ serviceItem.getServiceInstance().setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
+ serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1");
+ serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
+ serviceItem.getServiceInstance().setPersonaModelVersion("1.0");
+ serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
+ serviceItem.getServiceInstance().setResourceVersion("1485366092");
+ serviceItem.setExtraProperties(new AaiNqExtraProperties());
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "service-instance"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ serviceItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4"));
+ serviceItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9"));
+
+ AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem();
+ vfModuleItem.setModelName("vf-module");
+ vfModuleItem.setVfModule(new AaiNqVfModule());
+ vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261");
+ vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074");
+ vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300");
+ vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523");
+ vfModuleItem.getVfModule().setIsBaseVfModule(true);
+ vfModuleItem.getVfModule().setResourceVersion("1485366450");
+ vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
+ vfModuleItem.getVfModule().setPersonaModelVersion("1.0");
+ vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571");
+ vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317");
+ vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
+ vfModuleItem.setExtraProperties(new AaiNqExtraProperties());
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "vf-module"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget"));
+ vfModuleItem.getExtraProperties().getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5"));
+ vfModuleItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a"));
+
+ AaiNqInventoryResponseItem genericVnfItem = new AaiNqInventoryResponseItem();
+ genericVnfItem.setModelName("generic-vnf");
+ genericVnfItem.setGenericVnf(new AaiNqGenericVnf());
+ genericVnfItem.getGenericVnf().setVnfId("dhv-test-gvnf");
+ genericVnfItem.getGenericVnf().setVnfName("dhv-test-gvnf-name");
+ genericVnfItem.getGenericVnf().setVnfName2("dhv-test-gvnf-name2");
+ genericVnfItem.getGenericVnf().setVnfType("SW");
+ genericVnfItem.getGenericVnf().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4");
+ genericVnfItem.getGenericVnf().setProvStatus("PREPROV");
+ genericVnfItem.getGenericVnf().setOperationalState("dhv-test-operational-state");
+ genericVnfItem.getGenericVnf().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address");
+ genericVnfItem.getGenericVnf().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address");
+ genericVnfItem.getGenericVnf().setInMaint(false);
+ genericVnfItem.getGenericVnf().setIsClosedLoopDisabled(false);
+ genericVnfItem.getGenericVnf().setResourceVersion("1485366450");
+ genericVnfItem.getGenericVnf().setEncrypedAccessFlag(true);
+ genericVnfItem.getGenericVnf().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c");
+ genericVnfItem.getGenericVnf().setPersonaModelVersion("1.0");
+ genericVnfItem.setExtraProperties(new AaiNqExtraProperties());
+ genericVnfItem.getExtraProperties().setExtraProperty(new LinkedList<>());
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name", "generic-vnf"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-type", "widget"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-version", "1.0"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c"));
+ genericVnfItem.getExtraProperties().getExtraProperty()
+ .add(new AaiNqExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9"));
+ genericVnfItem.setItems(new AaiNqInventoryResponseItems());
+ genericVnfItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ genericVnfItem.getItems().getInventoryResponseItems().add(serviceItem);
+ genericVnfItem.getItems().getInventoryResponseItems().add(vfModuleItem);
+
+ AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem();
+ cloudItem.setCloudRegion(new AaiNqCloudRegion());
+ cloudItem.getCloudRegion().setCloudOwner("OWNER");
+ cloudItem.getCloudRegion().setCloudRegionId("REGIONID");
+ cloudItem.getCloudRegion().setCloudRegionVersion("2.5");
+ cloudItem.getCloudRegion().setComplexName("COMPLEXNAME");
+ cloudItem.getCloudRegion().setResourceVersion("1485365988");
+
+ AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem();
+ tenantItem.setTenant(new AaiNqTenant());
+ tenantItem.getTenant().setTenantId("dhv-test-tenant");
+ tenantItem.getTenant().setTenantName("dhv-test-tenant-name");
+ tenantItem.getTenant().setResourceVersion("1485366334");
+ tenantItem.setItems(new AaiNqInventoryResponseItems());
+ tenantItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ tenantItem.getItems().getInventoryResponseItems().add(cloudItem);
+
+ AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem();
+ vserverItem.setVserver(new AaiNqVServer());
+ vserverItem.getVserver().setVserverId("dhv-test-vserver");
+ vserverItem.getVserver().setVserverName("dhv-test-vserver-name");
+ vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2");
+ vserverItem.getVserver().setProvStatus("PREPROV");
+ vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink");
+ vserverItem.getVserver().setInMaint(false);
+ vserverItem.getVserver().setIsClosedLoopDisabled(false);
+ vserverItem.getVserver().setResourceVersion("1485366417");
+ vserverItem.setItems(new AaiNqInventoryResponseItems());
+ vserverItem.getItems().setInventoryResponseItems(new LinkedList<>());
+ vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem);
+ vserverItem.getItems().getInventoryResponseItems().add(tenantItem);
+
+ AaiNqResponse aaiResponse = new AaiNqResponse();
+ aaiResponse.getInventoryResponseItems().add(vserverItem);
+ AaiNqResponseWrapper aaiNqResponseWarapper = new AaiNqResponseWrapper();
+ aaiNqResponseWarapper.setAaiNqResponse(aaiResponse);
+ aaiNqResponseWarapper.setRequestId(UUID.randomUUID());
+ assertNotNull(aaiNqResponseWarapper);
+ logger.info(Serialization.gsonPretty.toJson(aaiNqResponseWarapper));
+
+ AaiNqResponse aaiResponse2 = new AaiNqResponse();
+ aaiResponse2.getInventoryResponseItems().add(vserverItem);
+ AaiNqResponseWrapper aaiNqResponseWarapper2 = new AaiNqResponseWrapper(UUID.randomUUID(), aaiResponse);
+ assertNotNull(aaiNqResponseWarapper2);
+ assertNotNull(aaiNqResponseWarapper2.getRequestId());
+ assertNotNull(aaiNqResponseWarapper2.getAaiNqResponse());
+ logger.info(Serialization.gsonPretty.toJson(aaiNqResponseWarapper2));
+ }
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java
new file mode 100644
index 000000000..add616dce
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqServiceInstanceTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqServiceInstanceTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqServiceInstance aaiNqServiceInstance = new AaiNqServiceInstance();
+ aaiNqServiceInstance.setServiceInstanceId("dhv-test-vhnfportal-service-instance-id");
+ aaiNqServiceInstance.setServiceInstanceName("dhv-test-service-instance-name1");
+ aaiNqServiceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4");
+ aaiNqServiceInstance.setPersonaModelVersion("1.0");
+ aaiNqServiceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1");
+ aaiNqServiceInstance.setResourceVersion("1485366092");
+ aaiNqServiceInstance.setModelInvariantId("SomeID");
+ aaiNqServiceInstance.setModelVersionId("SomeVersion");
+ assertNotNull(aaiNqServiceInstance);
+ assertEquals("dhv-test-vhnfportal-service-instance-id", aaiNqServiceInstance.getServiceInstanceId());
+ assertEquals("dhv-test-service-instance-name1", aaiNqServiceInstance.getServiceInstanceName());
+ assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNqServiceInstance.getPersonaModelId());
+ assertEquals("1.0", aaiNqServiceInstance.getPersonaModelVersion());
+ assertEquals("dhv-test-service-instance-location-id1", aaiNqServiceInstance.getServiceInstanceLocationId());
+ assertEquals("1485366092", aaiNqServiceInstance.getResourceVersion());
+ assertEquals("SomeID", aaiNqServiceInstance.getModelInvariantId());
+ assertEquals("SomeVersion", aaiNqServiceInstance.getModelVersionId());
+ logger.info(Serialization.gsonPretty.toJson(aaiNqServiceInstance));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java
index b696c7bd4..c1755f9cb 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,29 +30,27 @@ import org.onap.policy.aai.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AAINQTenantTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQTenantTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- AAINQTenant aaiNQTenant = new AAINQTenant();
- aaiNQTenant.setTenantId("dhv-test-tenant");
- aaiNQTenant.setTenantName("dhv-test-tenant-name");
- aaiNQTenant.setResourceVersion("1485366334");
- assertNotNull(aaiNQTenant);
- assertEquals("dhv-test-tenant", aaiNQTenant.getTenantId());
- assertEquals("dhv-test-tenant-name", aaiNQTenant.getTenantName());
- assertEquals("1485366334", aaiNQTenant.getResourceVersion());
-
- logger.info(Serialization.gsonPretty.toJson(aaiNQTenant));
- }
+public class AaiNqTenantTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqTenantTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqTenant aaiNqTenant = new AaiNqTenant();
+ aaiNqTenant.setTenantId("dhv-test-tenant");
+ aaiNqTenant.setTenantName("dhv-test-tenant-name");
+ aaiNqTenant.setResourceVersion("1485366334");
+ assertNotNull(aaiNqTenant);
+ assertEquals("dhv-test-tenant", aaiNqTenant.getTenantId());
+ assertEquals("dhv-test-tenant-name", aaiNqTenant.getTenantName());
+ assertEquals("1485366334", aaiNqTenant.getResourceVersion());
+
+ logger.info(Serialization.gsonPretty.toJson(aaiNqTenant));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java
new file mode 100644
index 000000000..9f49ecfef
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqVServerTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqVServerTest.class);
+
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqVServer aaiNqVServer = new AaiNqVServer();
+ aaiNqVServer.setVserverId("dhv-test-vserver");
+ aaiNqVServer.setVserverName("dhv-test-vserver-name");
+ aaiNqVServer.setVserverName2("dhv-test-vserver-name2");
+ aaiNqVServer.setProvStatus("PREPROV");
+ aaiNqVServer.setVserverSelflink("dhv-test-vserver-selflink");
+ aaiNqVServer.setInMaint(false);
+ aaiNqVServer.setIsClosedLoopDisabled(false);
+ aaiNqVServer.setResourceVersion("1485366417");
+ assertNotNull(aaiNqVServer);
+ assertEquals("dhv-test-vserver", aaiNqVServer.getVserverId());
+ assertEquals("dhv-test-vserver-name", aaiNqVServer.getVserverName());
+ assertEquals("dhv-test-vserver-name2", aaiNqVServer.getVserverName2());
+ assertEquals("PREPROV", aaiNqVServer.getProvStatus());
+ assertEquals("dhv-test-vserver-selflink", aaiNqVServer.getVserverSelflink());
+ assertEquals(false, aaiNqVServer.getInMaint());
+ assertEquals(false, aaiNqVServer.getIsClosedLoopDisabled());
+ assertEquals("1485366417", aaiNqVServer.getResourceVersion());
+ logger.info(Serialization.gsonPretty.toJson(aaiNqVServer));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java
new file mode 100644
index 000000000..1bbb711a5
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AaiNqVfModuleTest {
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqVfModuleTest.class);
+
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ AaiNqVfModule aaiNqVfModule = new AaiNqVfModule();
+ aaiNqVfModule.setVfModuleId("example-vf-module-id-val-49261");
+ aaiNqVfModule.setVfModuleName("example-vf-module-name-val-73074");
+ aaiNqVfModule.setHeatStackId("example-heat-stack-id-val-86300");
+ aaiNqVfModule.setOrchestrationStatus("example-orchestration-status-val-56523");
+ aaiNqVfModule.setIsBaseVfModule(true);
+ aaiNqVfModule.setResourceVersion("1485366450");
+ aaiNqVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5");
+ aaiNqVfModule.setPersonaModelVersion("1.0");
+ aaiNqVfModule.setWidgetModelId("example-widget-model-id-val-92571");
+ aaiNqVfModule.setWidgetModelVersion("example-widget-model-version-val-83317");
+ aaiNqVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796");
+ aaiNqVfModule.setModelInvariantId("SomeId");
+ aaiNqVfModule.setModelVersionId("SomeVersion");
+ assertNotNull(aaiNqVfModule);
+ assertEquals("example-vf-module-id-val-49261", aaiNqVfModule.getVfModuleId());
+ assertEquals("example-vf-module-name-val-73074", aaiNqVfModule.getVfModuleName());
+ assertEquals("example-heat-stack-id-val-86300", aaiNqVfModule.getHeatStackId());
+ assertEquals("example-orchestration-status-val-56523", aaiNqVfModule.getOrchestrationStatus());
+ assertEquals(true, aaiNqVfModule.getIsBaseVfModule());
+ assertEquals("1485366450", aaiNqVfModule.getResourceVersion());
+ assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNqVfModule.getPersonaModelId());
+ assertEquals("1.0", aaiNqVfModule.getPersonaModelVersion());
+ assertEquals("example-widget-model-id-val-92571", aaiNqVfModule.getWidgetModelId());
+ assertEquals("example-widget-model-version-val-83317", aaiNqVfModule.getWidgetModelVersion());
+ assertEquals("example-contrail-service-instance-fqdn-val-86796",
+ aaiNqVfModule.getContrailServiceInstanceFqdn());
+ assertEquals("SomeId", aaiNqVfModule.getModelInvariantId());
+ assertEquals("SomeVersion", aaiNqVfModule.getModelVersionId());
+ logger.info(Serialization.gsonPretty.toJson(aaiNqVfModule));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java
deleted file mode 100644
index b4a8a51eb..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PNFInstanceTest {
- private static final Logger logger = LoggerFactory.getLogger(PNFInstanceTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- PNFInstance pnfInstance = new PNFInstance();
- pnfInstance.setPNFInstanceName("pnf-instance-name-test");
- pnfInstance.setPNFName("pnf-name-test");
- pnfInstance.setPNFType(PNFType.ENODEB);
- pnfInstance.setPNFSerial("pnf-serial-test");
- assertNotNull(pnfInstance);
- assertEquals("pnf-instance-name-test", pnfInstance.getPNFInstanceName());
-
- PNFInstance pnfInstanceNull = new PNFInstance(null);
- assertNotNull(pnfInstanceNull);
-
- PNFInstance pnfInstanceClone = new PNFInstance(pnfInstance);
- assertNotNull(pnfInstanceClone);
-
- assertEquals("pnf-name-test", pnfInstanceClone.getPNFName());
- assertEquals(PNFType.ENODEB, pnfInstanceClone.getPNFType());
- assertEquals("pnf-serial-test", pnfInstanceClone.getPNFSerial());
-
- assertEquals("PNFInstance [PNFName=pnf-name-test, PNFInstanceName=pnf-instance-name-test, PNFType=eNodeB, PNFSerial=pnf-serial-test]", pnfInstanceClone.toString());
- assertNotEquals(0, pnfInstanceClone.hashCode());
- assertNotEquals(0, new PNF().hashCode());
-
- PNFInstance pnfInstanceOther0 = new PNFInstance();
- pnfInstanceOther0.setPNFName("pnf-name-test");
-
- PNFInstance pnfInstanceOther1 = new PNFInstance(pnfInstance);
- pnfInstanceOther1.setPNFName("pnf-name-test-diff");
-
- PNFInstance pnfInstanceOther2 = new PNFInstance(pnfInstance);
- pnfInstanceOther2.setPNFInstanceName("pnf-instance-name-test-diff");
-
- PNFInstance pnfInstanceOther3 = new PNFInstance(pnfInstance);
- pnfInstanceOther3.setPNFName(null);
-
- PNFInstance pnfInstanceOther4 = new PNFInstance(pnfInstance);
- pnfInstanceOther4.setPNFSerial(null);
-
- PNFInstance pnfInstanceOther5 = new PNFInstance(pnfInstance);
- pnfInstanceOther5.setPNFSerial("pnf-serial-test-diff");
-
- assertTrue(pnfInstance.equals(pnfInstance));
- assertFalse(pnfInstance.equals(null));
- assertFalse(pnfInstance.equals("hello"));
- assertTrue(pnfInstance.equals(pnfInstanceClone));
- assertFalse(pnfInstance.equals(new PNF()));
- assertFalse(new PNF().equals(pnfInstance));
- assertFalse(new PNF().equals(pnfInstanceOther0));
- assertFalse(pnfInstanceOther0.equals(pnfInstance));
- assertFalse(pnfInstanceOther1.equals(pnfInstance));
- assertFalse(pnfInstanceOther2.equals(pnfInstance));
- assertFalse(pnfInstanceOther3.equals(pnfInstance));
- assertFalse(pnfInstanceOther4.equals(pnfInstance));
- assertFalse(pnfInstanceOther5.equals(pnfInstance));
-
- logger.info(Serialization.gsonPretty.toJson(pnfInstance));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java
deleted file mode 100644
index 86a037892..000000000
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.aai;
-
-import static org.junit.Assert.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.aai.util.Serialization;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PNFTest {
- private static final Logger logger = LoggerFactory.getLogger(PNFTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- PNF pnf = new PNF();
- pnf.setPNFName("pnf-name-test");
- pnf.setPNFType(PNFType.ENODEB);
- assertNotNull(pnf);
-
- PNF pnfClone = new PNF(pnf);
- assertNotNull(pnfClone);
-
- assertEquals("pnf-name-test", pnfClone.getPNFName());
- assertEquals(PNFType.ENODEB, pnfClone.getPNFType());
-
- assertEquals("PNF [PNFName=pnf-name-test, PNFType=eNodeB]", pnfClone.toString());
- assertNotEquals(0, pnfClone.hashCode());
- assertNotEquals(0, new PNF().hashCode());
-
- PNF pnfOther = new PNF();
- pnfOther.setPNFName("pnf-name-test");
-
- assertTrue(pnf.equals(pnf));
- assertFalse(pnf.equals(null));
- assertFalse(pnf.equals("hello"));
- assertTrue(pnf.equals(pnfClone));
- assertFalse(pnf.equals(new PNF()));
- assertFalse(new PNF().equals(pnf));
- assertFalse(new PNF().equals(pnfOther));
- assertFalse(pnfOther.equals(pnf));
-
- logger.info(Serialization.gsonPretty.toJson(pnf));
- }
-
-}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java
new file mode 100644
index 000000000..495d9f134
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PnfInstanceTest {
+ private static final Logger logger = LoggerFactory.getLogger(PnfInstanceTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ PnfInstance pnfInstance = new PnfInstance();
+ pnfInstance.setPnfInstanceName("pnf-instance-name-test");
+ pnfInstance.setPnfName("pnf-name-test");
+ pnfInstance.setPnfType(PnfType.ENODEB);
+ pnfInstance.setPnfSerial("pnf-serial-test");
+ assertNotNull(pnfInstance);
+ assertEquals("pnf-instance-name-test", pnfInstance.getPnfInstanceName());
+
+ PnfInstance pnfInstanceNull = new PnfInstance(null);
+ assertNotNull(pnfInstanceNull);
+
+ PnfInstance pnfInstanceClone = new PnfInstance(pnfInstance);
+ assertNotNull(pnfInstanceClone);
+
+ assertEquals("pnf-name-test", pnfInstanceClone.getPnfName());
+ assertEquals(PnfType.ENODEB, pnfInstanceClone.getPnfType());
+ assertEquals("pnf-serial-test", pnfInstanceClone.getPnfSerial());
+
+ assertEquals("PNFInstance [PNFName=pnf-name-test, PNFInstanceName=pnf-instance-name-test, PNFType=eNodeB, "
+ + "PNFSerial=pnf-serial-test]", pnfInstanceClone.toString());
+ assertNotEquals(0, pnfInstanceClone.hashCode());
+ assertNotEquals(0, new Pnf().hashCode());
+
+ PnfInstance pnfInstanceOther0 = new PnfInstance();
+ pnfInstanceOther0.setPnfName("pnf-name-test");
+
+ PnfInstance pnfInstanceOther1 = new PnfInstance(pnfInstance);
+ pnfInstanceOther1.setPnfName("pnf-name-test-diff");
+
+ PnfInstance pnfInstanceOther2 = new PnfInstance(pnfInstance);
+ pnfInstanceOther2.setPnfInstanceName("pnf-instance-name-test-diff");
+
+ PnfInstance pnfInstanceOther3 = new PnfInstance(pnfInstance);
+ pnfInstanceOther3.setPnfName(null);
+
+ PnfInstance pnfInstanceOther4 = new PnfInstance(pnfInstance);
+ pnfInstanceOther4.setPnfSerial(null);
+
+ PnfInstance pnfInstanceOther5 = new PnfInstance(pnfInstance);
+ pnfInstanceOther5.setPnfSerial("pnf-serial-test-diff");
+
+ assertTrue(pnfInstance.equals(pnfInstance));
+ assertFalse(pnfInstance.equals(null));
+ assertFalse(pnfInstance.equals("hello"));
+ assertTrue(pnfInstance.equals(pnfInstanceClone));
+ assertFalse(pnfInstance.equals(new Pnf()));
+ assertFalse(new Pnf().equals(pnfInstance));
+ assertFalse(new Pnf().equals(pnfInstanceOther0));
+ assertFalse(pnfInstanceOther0.equals(pnfInstance));
+ assertFalse(pnfInstanceOther1.equals(pnfInstance));
+ assertFalse(pnfInstanceOther2.equals(pnfInstance));
+ assertFalse(pnfInstanceOther3.equals(pnfInstance));
+ assertFalse(pnfInstanceOther4.equals(pnfInstance));
+ assertFalse(pnfInstanceOther5.equals(pnfInstance));
+
+ logger.info(Serialization.gsonPretty.toJson(pnfInstance));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java
new file mode 100644
index 000000000..0380c15b0
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.aai;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.aai.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PnfTest {
+ private static final Logger logger = LoggerFactory.getLogger(PnfTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf-name-test");
+ pnf.setPnfType(PnfType.ENODEB);
+ assertNotNull(pnf);
+
+ Pnf pnfClone = new Pnf(pnf);
+ assertNotNull(pnfClone);
+
+ assertEquals("pnf-name-test", pnfClone.getPnfName());
+ assertEquals(PnfType.ENODEB, pnfClone.getPnfType());
+
+ assertEquals("PNF [PNFName=pnf-name-test, PNFType=eNodeB]", pnfClone.toString());
+ assertNotEquals(0, pnfClone.hashCode());
+ assertNotEquals(0, new Pnf().hashCode());
+
+ Pnf pnfOther = new Pnf();
+ pnfOther.setPnfName("pnf-name-test");
+
+ assertTrue(pnf.equals(pnf));
+ assertFalse(pnf.equals(null));
+ assertFalse(pnf.equals("hello"));
+ assertTrue(pnf.equals(pnfClone));
+ assertFalse(pnf.equals(new Pnf()));
+ assertFalse(new Pnf().equals(pnf));
+ assertFalse(new Pnf().equals(pnfOther));
+ assertFalse(pnfOther.equals(pnf));
+
+ logger.info(Serialization.gsonPretty.toJson(pnf));
+ }
+
+}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java
index 7081b0e7e..e62430ade 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -28,24 +29,22 @@ import org.onap.policy.aai.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class PNFTypeTest {
- private static final Logger logger = LoggerFactory.getLogger(PNFTypeTest.class);
+public class PnfTypeTest {
+ private static final Logger logger = LoggerFactory.getLogger(PnfTypeTest.class);
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
- @Test
- public void test() {
- PNFType pnfType = PNFType.ENODEB;
- assertNotNull(pnfType);
- assertNotNull(pnfType.toString());
- logger.info(Serialization.gsonPretty.toJson(pnfType));
- }
+ @Test
+ public void test() {
+ PnfType pnfType = PnfType.ENODEB;
+ assertNotNull(pnfType);
+ assertNotNull(pnfType.toString());
+ logger.info(Serialization.gsonPretty.toJson(pnfType));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java
index a240570d3..57f6c7605 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,23 +30,21 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelatedToPropertyItemTest {
- private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyItemTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
- relatedToPropertyItem.setPropertyKey("model.model-name");
- relatedToPropertyItem.setPropertyValue("service-instance");
- assertNotNull(relatedToPropertyItem);
- logger.info(Serialization.gsonPretty.toJson(relatedToPropertyItem));
- }
+ private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyItemTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
+ relatedToPropertyItem.setPropertyKey("model.model-name");
+ relatedToPropertyItem.setPropertyValue("service-instance");
+ assertNotNull(relatedToPropertyItem);
+ logger.info(Serialization.gsonPretty.toJson(relatedToPropertyItem));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java
index 05b72ed6a..439c11dd2 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,33 +30,31 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelatedToPropertyTest {
- private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
- relatedToPropertyItem.setPropertyKey("model.model-name");
- relatedToPropertyItem.setPropertyValue("service-instance");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
- RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
- relatedToPropertyItem2.setPropertyKey("model.model-name2");
- relatedToPropertyItem2.setPropertyValue("service-instance2");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
- assertNotNull(relatedToProperty);
-
- relatedToProperty.setRelatedTo(relatedToProperty.getRelatedTo());
- assertNotNull(relatedToProperty);
-
- logger.info(Serialization.gsonPretty.toJson(relatedToProperty));
- }
+ private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
+ relatedToPropertyItem.setPropertyKey("model.model-name");
+ relatedToPropertyItem.setPropertyValue("service-instance");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
+ RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
+ relatedToPropertyItem2.setPropertyKey("model.model-name2");
+ relatedToPropertyItem2.setPropertyValue("service-instance2");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
+ assertNotNull(relatedToProperty);
+
+ relatedToProperty.setRelatedTo(relatedToProperty.getRelatedTo());
+ assertNotNull(relatedToProperty);
+
+ logger.info(Serialization.gsonPretty.toJson(relatedToProperty));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java
index 38727b7b5..5ad99f9a7 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -27,20 +28,18 @@ import org.junit.Test;
public class RelationshipDataItemTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.setRelationshipKey("relationship-key");
- relationshipDataItem.setRelationshipValue("relationship-value");
- assertNotNull(relationshipDataItem);
- }
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+ relationshipDataItem.setRelationshipKey("relationship-key");
+ relationshipDataItem.setRelationshipValue("relationship-value");
+ assertNotNull(relationshipDataItem);
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java
index 6b228f7a0..57543711d 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,37 +31,35 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelationshipDataTest {
- private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ @Test
+ public void test() {
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+ relationshipDataItem.setRelationshipKey("relationship-key");
+ relationshipDataItem.setRelationshipValue("relationship-value");
+ assertNotNull(relationshipDataItem);
+ assertEquals("relationship-key", relationshipDataItem.getRelationshipKey());
+ assertEquals("relationship-value", relationshipDataItem.getRelationshipValue());
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+ RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem();
+ relationshipDataItem2.setRelationshipKey("relationship-key2");
+ relationshipDataItem2.setRelationshipValue("relationship-value2");
+ relationshipData.getRelationshipData().add(relationshipDataItem2);
+ assertNotNull(relationshipData);
- @Test
- public void test() {
- RelationshipData relationshipData = new RelationshipData();
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.setRelationshipKey("relationship-key");
- relationshipDataItem.setRelationshipValue("relationship-value");
- assertNotNull(relationshipDataItem);
- assertEquals("relationship-key", relationshipDataItem.getRelationshipKey());
- assertEquals("relationship-value", relationshipDataItem.getRelationshipValue());
+ relationshipData.setRelationshipData(relationshipData.getRelationshipData());
+ assertNotNull(relationshipData);
- relationshipData.getRelationshipData().add(relationshipDataItem);
- RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem();
- relationshipDataItem2.setRelationshipKey("relationship-key2");
- relationshipDataItem2.setRelationshipValue("relationship-value2");
- relationshipData.getRelationshipData().add(relationshipDataItem2);
- assertNotNull(relationshipData);
-
- relationshipData.setRelationshipData(relationshipData.getRelationshipData());
- assertNotNull(relationshipData);
-
- logger.info(Serialization.gsonPretty.toJson(relationshipData));
- }
+ logger.info(Serialization.gsonPretty.toJson(relationshipData));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java
index 625592e76..98445a2de 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,29 +30,27 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelationshipItemTest {
- private static final Logger logger = LoggerFactory.getLogger(RelationshipItemTest.class);
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Test
- public void test() {
- RelationshipItem relationshipItem = new RelationshipItem();
- RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
- relatedToPropertyItem.setPropertyKey("model.model-name");
- relatedToPropertyItem.setPropertyValue("service-instance");
- relationshipItem.getRelatedToProperty().add(relatedToPropertyItem);
- assertNotNull(relationshipItem);
-
- relationshipItem.setRelatedToProperty(relationshipItem.getRelatedToProperty());
- assertNotNull(relationshipItem);
-
- logger.info(Serialization.gsonPretty.toJson(relationshipItem));
- }
+ private static final Logger logger = LoggerFactory.getLogger(RelationshipItemTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ RelationshipItem relationshipItem = new RelationshipItem();
+ RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
+ relatedToPropertyItem.setPropertyKey("model.model-name");
+ relatedToPropertyItem.setPropertyValue("service-instance");
+ relationshipItem.getRelatedToProperty().add(relatedToPropertyItem);
+ assertNotNull(relationshipItem);
+
+ relationshipItem.setRelatedToProperty(relationshipItem.getRelatedToProperty());
+ assertNotNull(relationshipItem);
+
+ logger.info(Serialization.gsonPretty.toJson(relationshipItem));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java
index 7300fb87c..e7f207e6b 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,49 +31,48 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelationshipListTest {
- private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
+
+ @Test
+ public void test() {
+ Relationship relationship = new Relationship();
+ relationship.setRelatedLink("related-link");
+ relationship.setRelatedTo("related-to");
+ assertEquals("related-link", relationship.getRelatedLink());
+ assertEquals("related-to", relationship.getRelatedTo());
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
+ relatedToPropertyItem.setPropertyKey("model.model-name");
+ relatedToPropertyItem.setPropertyValue("service-instance");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
+ RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
+ relatedToPropertyItem2.setPropertyKey("model.model-name2");
+ relatedToPropertyItem2.setPropertyValue("service-instance2");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
+ relationship.setRelatedToProperty(relatedToProperty);
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+ relationshipDataItem.setRelationshipKey("relationship-key");
+ relationshipDataItem.setRelationshipValue("relationship-value");
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+ relationship.setRelationshipData(relationshipData);
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ RelationshipList relationshipList = new RelationshipList();
+ relationshipList.getRelationshipList().add(relationship);
- @Test
- public void test() {
- RelationshipList relationshipList = new RelationshipList();
- Relationship relationship = new Relationship();
- relationship.setRelatedLink("related-link");
- relationship.setRelatedTo("related-to");
- assertEquals("related-link", relationship.getRelatedLink());
- assertEquals("related-to", relationship.getRelatedTo());
+ assertNotNull(relationshipList);
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
- relatedToPropertyItem.setPropertyKey("model.model-name");
- relatedToPropertyItem.setPropertyValue("service-instance");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
- RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
- relatedToPropertyItem2.setPropertyKey("model.model-name2");
- relatedToPropertyItem2.setPropertyValue("service-instance2");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
- relationship.setRelatedToProperty(relatedToProperty);
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.setRelationshipKey("relationship-key");
- relationshipDataItem.setRelationshipValue("relationship-value");
- RelationshipData relationshipData = new RelationshipData();
- relationshipData.getRelationshipData().add(relationshipDataItem);
- relationship.setRelationshipData(relationshipData);
- relationshipList.getRelationshipList().add(relationship);
-
- assertNotNull(relationshipList);
-
- relationshipList.setRelationshipList(relationshipList.getRelationshipList());
- assertNotNull(relationshipList);
+ relationshipList.setRelationshipList(relationshipList.getRelationshipList());
+ assertNotNull(relationshipList);
- logger.info(Serialization.gsonPretty.toJson(relationshipList));
- }
+ logger.info(Serialization.gsonPretty.toJson(relationshipList));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java
index 81ba0885c..526ff8a1f 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
@@ -17,9 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -29,44 +31,42 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RelationshipTest {
- private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class);
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {}
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
+ @Test
+ public void test() {
+ Relationship relationship = new Relationship();
+ relationship.setRelatedLink("related-link");
+ relationship.setRelatedTo("related-to");
+ assertEquals("related-link", relationship.getRelatedLink());
+ assertEquals("related-to", relationship.getRelatedTo());
- @Test
- public void test() {
- Relationship relationship = new Relationship();
- relationship.setRelatedLink("related-link");
- relationship.setRelatedTo("related-to");
- assertEquals("related-link", relationship.getRelatedLink());
- assertEquals("related-to", relationship.getRelatedTo());
-
- RelatedToProperty relatedToProperty = new RelatedToProperty();
- RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
- relatedToPropertyItem.setPropertyKey("model.model-name");
- relatedToPropertyItem.setPropertyValue("service-instance");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
- RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
- relatedToPropertyItem2.setPropertyKey("model.model-name2");
- relatedToPropertyItem2.setPropertyValue("service-instance2");
- relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
- relationship.setRelatedToProperty(relatedToProperty);
- assertEquals(relationship.getRelatedToProperty(), relatedToProperty);
- RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.setRelationshipKey("relationship-key");
- relationshipDataItem.setRelationshipValue("relationship-value");
- RelationshipData relationshipData = new RelationshipData();
- relationshipData.getRelationshipData().add(relationshipDataItem);
- relationship.setRelationshipData(relationshipData);
- assertEquals(relationship.getRelationshipData(), relationshipData);
- assertNotNull(relationship);
- logger.info(Serialization.gsonPretty.toJson(relationship));
- }
+ RelatedToProperty relatedToProperty = new RelatedToProperty();
+ RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem();
+ relatedToPropertyItem.setPropertyKey("model.model-name");
+ relatedToPropertyItem.setPropertyValue("service-instance");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem);
+ RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem();
+ relatedToPropertyItem2.setPropertyKey("model.model-name2");
+ relatedToPropertyItem2.setPropertyValue("service-instance2");
+ relatedToProperty.getRelatedTo().add(relatedToPropertyItem2);
+ relationship.setRelatedToProperty(relatedToProperty);
+ assertEquals(relationship.getRelatedToProperty(), relatedToProperty);
+ RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
+ relationshipDataItem.setRelationshipKey("relationship-key");
+ relationshipDataItem.setRelationshipValue("relationship-value");
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.getRelationshipData().add(relationshipDataItem);
+ relationship.setRelationshipData(relationshipData);
+ assertEquals(relationship.getRelationshipData(), relationshipData);
+ assertNotNull(relationship);
+ logger.info(Serialization.gsonPretty.toJson(relationship));
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java
index 2a7beb499..69004e7f3 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java
@@ -17,23 +17,24 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.aai.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.junit.Test;
-public class AAIExceptionTest {
+public class AaiExceptionTest {
- @Test
- public void test() {
- assertNotNull(new AAIException());
- assertNotNull(new AAIException("message"));
- assertNotNull(new AAIException("message", new IOException()));
- assertNotNull(new AAIException("message", new IOException(), true, false));
- assertNotNull(new AAIException(new IOException()));
- }
+ @Test
+ public void test() {
+ assertNotNull(new AaiException());
+ assertNotNull(new AaiException("message"));
+ assertNotNull(new AaiException("message", new IOException()));
+ assertNotNull(new AaiException("message", new IOException(), true, false));
+ assertNotNull(new AaiException(new IOException()));
+ }
}
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java
index ad6a58b74..fc835dd51 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/ControlLoop.java
@@ -23,31 +23,31 @@ package org.onap.policy.controlloop.policy;
import java.util.LinkedList;
import java.util.List;
-import org.onap.policy.aai.PNF;
+import org.onap.policy.aai.Pnf;
import org.onap.policy.sdc.Resource;
import org.onap.policy.sdc.Service;
public class ControlLoop {
-
+
private static final String COMPILER_VERSION = "2.0.0";
private String controlLoopName;
private String version = COMPILER_VERSION;
private List<Service> services;
private List<Resource> resources;
- private PNF pnf;
+ private Pnf pnf;
private String triggerPolicy = FinalResult.FINAL_OPENLOOP.toString();
private Integer timeout;
private Boolean abatement = false;
-
+
public ControlLoop() {
// Empty Constructor.
}
-
- public static String getVERSION(){
+
+ public static String getVERSION() {
return ControlLoop.COMPILER_VERSION;
}
-
+
public String getControlLoopName() {
return controlLoopName;
}
@@ -99,16 +99,16 @@ public class ControlLoop {
public String getVersion() {
return version;
}
-
- public void setVersion(String version){
+
+ public void setVersion(String version) {
this.version = version;
}
- public PNF getPnf() {
+ public Pnf getPnf() {
return pnf;
}
- public void setPnf(PNF pnf) {
+ public void setPnf(Pnf pnf) {
this.pnf = pnf;
}
@@ -122,7 +122,7 @@ public class ControlLoop {
}
this.resources = new LinkedList<>();
if (controlLoop.resources != null) {
- for (Resource resource: controlLoop.resources) {
+ for (Resource resource : controlLoop.resources) {
this.resources.add(resource);
}
}
@@ -130,12 +130,14 @@ public class ControlLoop {
this.timeout = controlLoop.timeout;
this.abatement = controlLoop.abatement;
}
+
@Override
public String toString() {
return "ControlLoop [controlLoopName=" + controlLoopName + ", version=" + version + ", services=" + services
- + ", resources=" + resources + ", trigger_policy=" + triggerPolicy + ", timeout="
- + timeout + ", abatement=" + abatement + "]";
+ + ", resources=" + resources + ", trigger_policy=" + triggerPolicy + ", timeout=" + timeout
+ + ", abatement=" + abatement + "]";
}
+
@Override
public int hashCode() {
final int prime = 31;
@@ -149,29 +151,30 @@ public class ControlLoop {
result = prime * result + ((abatement == null) ? 0 : abatement.hashCode());
return result;
}
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ControlLoop other = (ControlLoop) obj;
- return equalsMayBeNull(controlLoopName, other.controlLoopName)
- && equalsMayBeNull(resources, other.resources)
- && equalsMayBeNull(services, other.services)
- && equalsMayBeNull(timeout, other.timeout)
- && equalsMayBeNull(triggerPolicy, other.triggerPolicy)
- && equalsMayBeNull(version, other.version)
- && equalsMayBeNull(abatement, other.abatement);
- }
-
- private boolean equalsMayBeNull(final Object obj1, final Object obj2){
- if ( obj1 == null ) {
+ return equalsMayBeNull(controlLoopName, other.controlLoopName) && equalsMayBeNull(resources, other.resources)
+ && equalsMayBeNull(services, other.services) && equalsMayBeNull(timeout, other.timeout)
+ && equalsMayBeNull(triggerPolicy, other.triggerPolicy) && equalsMayBeNull(version, other.version)
+ && equalsMayBeNull(abatement, other.abatement);
+ }
+
+ private boolean equalsMayBeNull(final Object obj1, final Object obj2) {
+ if (obj1 == null) {
return obj2 == null;
}
- return obj1.equals(obj2);
+ return obj1.equals(obj2);
}
-
+
}
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
index d1212194d..4e034cb0e 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java
@@ -22,7 +22,7 @@ package org.onap.policy.controlloop.policy.builder;
import java.util.Map;
-import org.onap.policy.aai.PNF;
+import org.onap.policy.aai.Pnf;
import org.onap.policy.controlloop.policy.ControlLoop;
import org.onap.policy.controlloop.policy.OperationsAccumulateParams;
import org.onap.policy.controlloop.policy.Policy;
@@ -33,7 +33,7 @@ import org.onap.policy.sdc.Resource;
import org.onap.policy.sdc.Service;
public interface ControlLoopPolicyBuilder {
-
+
/**
* Adds one or more services to the ControlLoop
*
@@ -43,20 +43,20 @@ public interface ControlLoopPolicyBuilder {
* @throws BuilderException
*/
public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException;
-
+
/**
* @param services
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException;
-
+
/**
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder removeAllServices() throws BuilderException;
-
+
/**
* Adds one or more resources to the ControlLoop
*
@@ -66,51 +66,51 @@ public interface ControlLoopPolicyBuilder {
* @throws BuilderException
*/
public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException;
-
+
/**
* @param resources
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException;
-
+
/**
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder removeAllResources() throws BuilderException;
-
+
/**
* @param pnf
* @return
* @throws BuilderException
*/
- public ControlLoopPolicyBuilder setPNF(PNF pnf) throws BuilderException;
-
+ public ControlLoopPolicyBuilder setPNF(Pnf pnf) throws BuilderException;
+
/**
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder removePNF() throws BuilderException;
-
+
/**
- * @param abatement
- * @return
- * @throws BuilderException
+ * @param abatement
+ * @return
+ * @throws BuilderException
*/
public ControlLoopPolicyBuilder setAbatement(Boolean abatement) throws BuilderException;
-
-
+
+
/**
- * Sets the overall timeout value for the Control Loop. If any operational policies have retries and timeouts,
- * then this overall timeout value should exceed all those values.
+ * Sets the overall timeout value for the Control Loop. If any operational policies have retries
+ * and timeouts, then this overall timeout value should exceed all those values.
*
* @param timeout
* @return
* @throws BuilderException
*/
public ControlLoopPolicyBuilder setTimeout(Integer timeout) throws BuilderException;
-
+
/**
* Scans the operational policies and calculate an minimum overall timeout for the Control Loop.
*
@@ -118,9 +118,10 @@ public interface ControlLoopPolicyBuilder {
* @return Integer
*/
public Integer calculateTimeout();
-
+
/**
- * Sets the initial trigger policy when a DCAE Closed Loop Event arrives in the ONAP Policy Platform.
+ * Sets the initial trigger policy when a DCAE Closed Loop Event arrives in the ONAP Policy
+ * Platform.
*
*
* @param name
@@ -133,8 +134,9 @@ public interface ControlLoopPolicyBuilder {
* @return Policy
* @throws BuilderException
*/
- public Policy setTriggerPolicy(String name, String description, String actor, Target target, String recipe, Map<String, String> payload, Integer retries, Integer timeout) throws BuilderException;
-
+ public Policy setTriggerPolicy(String name, String description, String actor, Target target, String recipe,
+ Map<String, String> payload, Integer retries, Integer timeout) throws BuilderException;
+
/**
*
* Changes the trigger policy to point to another existing Policy.
@@ -144,27 +146,27 @@ public interface ControlLoopPolicyBuilder {
* @return ControlLoop
* @throws BuilderException
*/
- public ControlLoop setTriggerPolicy(String id) throws BuilderException;
-
+ public ControlLoop setTriggerPolicy(String id) throws BuilderException;
+
/**
* @return
*/
- public boolean isOpenLoop();
-
+ public boolean isOpenLoop();
+
/**
* @return
* @throws BuilderException
*/
- public Policy getTriggerPolicy() throws BuilderException;
-
+ public Policy getTriggerPolicy() throws BuilderException;
+
/**
* Simply returns a copy of the ControlLoop information.
*
*
* @return ControlLoop
*/
- public ControlLoop getControlLoop();
-
+ public ControlLoop getControlLoop();
+
/**
* Creates a policy that is chained to the result of another Policy.
*
@@ -181,10 +183,11 @@ public interface ControlLoopPolicyBuilder {
* @return
* @throws BuilderException
*/
- public Policy setPolicyForPolicyResult(String name, String description, String actor,
- Target target, String recipe, Map<String, String> payload, Integer retries, Integer timeout, String policyID, PolicyResult... results) throws BuilderException;
-
-
+ public Policy setPolicyForPolicyResult(String name, String description, String actor, Target target, String recipe,
+ Map<String, String> payload, Integer retries, Integer timeout, String policyID, PolicyResult... results)
+ throws BuilderException;
+
+
/**
* Sets the policy result(s) to an existing Operational Policy.
*
@@ -195,11 +198,13 @@ public interface ControlLoopPolicyBuilder {
* @return
* @throws BuilderException
*/
- public Policy setPolicyForPolicyResult(String policyResultID, String policyID, PolicyResult... results) throws BuilderException;
-
+ public Policy setPolicyForPolicyResult(String policyResultID, String policyID, PolicyResult... results)
+ throws BuilderException;
+
/**
- * Removes an Operational Policy. Be mindful that if any other Operational Policies have results that point to this policy, any
- * policies that have results pointing to this policy will have their result reset to the appropriate default FINAL_* result.
+ * Removes an Operational Policy. Be mindful that if any other Operational Policies have results
+ * that point to this policy, any policies that have results pointing to this policy will have
+ * their result reset to the appropriate default FINAL_* result.
*
*
* @param policyID
@@ -207,7 +212,7 @@ public interface ControlLoopPolicyBuilder {
* @throws BuilderException
*/
public boolean removePolicy(String policyID) throws BuilderException;
-
+
/**
* Resets a policy's results to defualt FINAL_* codes.
*
@@ -215,32 +220,33 @@ public interface ControlLoopPolicyBuilder {
* @return Policy
* @throws BuilderException - Policy does not exist
*/
- public Policy resetPolicyResults(String policyID) throws BuilderException;
-
+ public Policy resetPolicyResults(String policyID) throws BuilderException;
+
/**
* Removes all existing Operational Policies and reverts back to an Open Loop.
*
* @return
*/
public ControlLoopPolicyBuilder removeAllPolicies();
-
+
/**
* Adds an operationsAccumulateParams to an existing operational policy
*
* @return Policy
* @throws BuilderException - Policy does not exist
*/
- public Policy addOperationsAccumulateParams(String policyID, OperationsAccumulateParams operationsAccumulateParams) throws BuilderException;
-
+ public Policy addOperationsAccumulateParams(String policyID, OperationsAccumulateParams operationsAccumulateParams)
+ throws BuilderException;
+
/**
- * This will compile and build the YAML specification for the Control Loop Policy. Please iterate the Results object for details.
- * The Results object will contains warnings and errors. If the specification compiled successfully, you will be able to retrieve the
- * YAML.
+ * This will compile and build the YAML specification for the Control Loop Policy. Please
+ * iterate the Results object for details. The Results object will contains warnings and errors.
+ * If the specification compiled successfully, you will be able to retrieve the YAML.
*
* @return Results
*/
- public Results buildSpecification();
-
+ public Results buildSpecification();
+
/**
* The Factory is used to build a ControlLoopPolicyBuilder implementation.
*
@@ -248,36 +254,39 @@ public interface ControlLoopPolicyBuilder {
*
*/
public static class Factory {
- private Factory(){
+ private Factory() {
// Private Constructor.
}
-
+
/**
- * Builds a basic Control Loop with an overall timeout. Use this method if you wish to create an OpenLoop, or if you
- * want to interactively build a Closed Loop.
+ * Builds a basic Control Loop with an overall timeout. Use this method if you wish to
+ * create an OpenLoop, or if you want to interactively build a Closed Loop.
*
* @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
* @param timeout - Overall timeout for the Closed Loop to execute.
* @return ControlLoopPolicyBuilder object
*/
- public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout) {
+ public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout) {
return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout);
}
-
+
/**
* Build a Control Loop for a resource and services associated with the resource.
*
* @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
* @param timeout - Overall timeout for the Closed Loop to execute.
- * @param resource - Resource this closed loop is for. Should come from ASDC, but if not available use resourceName to distinguish.
- * @param services - Zero or more services associated with this resource. Should come from ASDC, but if not available use serviceName to distinguish.
+ * @param resource - Resource this closed loop is for. Should come from ASDC, but if not
+ * available use resourceName to distinguish.
+ * @param services - Zero or more services associated with this resource. Should come from
+ * ASDC, but if not available use serviceName to distinguish.
* @return ControlLoopPolicyBuilder object
* @throws BuilderException
*/
- public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Resource resource, Service... services) throws BuilderException {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, resource, services);
+ public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout,
+ Resource resource, Service... services) throws BuilderException {
+ return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, resource, services);
}
-
+
/**
* @param controlLoopName
* @param timeout
@@ -286,18 +295,21 @@ public interface ControlLoopPolicyBuilder {
* @return
* @throws BuilderException
*/
- public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Service service, Resource... resources) throws BuilderException {
- return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, service, resources);
+ public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout,
+ Service service, Resource... resources) throws BuilderException {
+ return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, service, resources);
}
-
+
/**
* @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop.
* @param timeout - Overall timeout for the Closed Loop to execute.
- * @param pnf - Physical Network Function. Should come from AIC, but if not available use well-known name to distinguish. Eg. eNodeB
+ * @param pnf - Physical Network Function. Should come from AIC, but if not available use
+ * well-known name to distinguish. Eg. eNodeB
* @return ControlLoopPolicyBuilder object
* @throws BuilderException
*/
- public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, PNF pnf) throws BuilderException {
+ public static ControlLoopPolicyBuilder buildControlLoop(String controlLoopName, Integer timeout, Pnf pnf)
+ throws BuilderException {
return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, pnf);
}
}
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
index 45315b077..adbf12748 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
@@ -20,11 +20,13 @@
package org.onap.policy.controlloop.policy.builder.impl;
+import com.google.common.base.Strings;
+
import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.aai.PNF;
+import org.onap.policy.aai.Pnf;
import org.onap.policy.controlloop.compiler.CompilerException;
import org.onap.policy.controlloop.compiler.ControlLoopCompiler;
import org.onap.policy.controlloop.compiler.ControlLoopCompilerCallback;
@@ -47,464 +49,466 @@ import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
import org.yaml.snakeyaml.Yaml;
-import com.google.common.base.Strings;
-
public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
- private static final String UNKNOWN_POLICY = "Unknown policy ";
- private static Logger logger = LoggerFactory.getLogger(ControlLoopPolicyBuilderImpl.class.getName());
- private ControlLoopPolicy controlLoopPolicy;
-
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout) {
- controlLoopPolicy = new ControlLoopPolicy();
- ControlLoop controlLoop = new ControlLoop();
- controlLoop.setControlLoopName(controlLoopName);
- controlLoop.setTimeout(timeout);
- controlLoopPolicy.setControlLoop(controlLoop);
- }
-
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource, Service... services) throws BuilderException {
- this(controlLoopName, timeout);
- this.addResource(resource);
- this.addService(services);
- }
-
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, PNF pnf) throws BuilderException {
- this(controlLoopName, timeout);
- this.setPNF(pnf);
- }
-
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service, Resource[] resources) throws BuilderException {
- this(controlLoopName, timeout);
- this.addService(service);
- this.addResource(resources);
- }
-
- @Override
- public ControlLoopPolicyBuilder removePNF() throws BuilderException {
- controlLoopPolicy.getControlLoop().setPnf(null);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException {
- for (Service service : services) {
- if (service == null) {
- throw new BuilderException("Service must not be null");
- }
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
- throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
- }
- if(controlLoopPolicy.getControlLoop().getServices()==null){
- controlLoopPolicy.getControlLoop().setServices(new LinkedList<>());
- }
- controlLoopPolicy.getControlLoop().getServices().add(service);
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException {
- if (controlLoopPolicy.getControlLoop().getServices() == null) {
- throw new BuilderException("No existing services to remove");
- }
- for (Service service : services) {
- if (service == null) {
- throw new BuilderException("Service must not be null");
- }
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
- throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
- }
- boolean removed = controlLoopPolicy.getControlLoop().getServices().remove(service);
- if (!removed) {
- throw new BuilderException("Unknown service " + service.getServiceName());
- }
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllServices() throws BuilderException {
- controlLoopPolicy.getControlLoop().getServices().clear();
- return this;
- }
-
-
- @Override
- public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException {
- for (Resource resource : resources) {
- if (resource == null) {
- throw new BuilderException("Resource must not be null");
- }
- if (resource.getResourceUUID() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
- throw new BuilderException("Invalid resource - need either resourceUUID or resourceName");
- }
- if(controlLoopPolicy.getControlLoop().getResources()==null){
- controlLoopPolicy.getControlLoop().setResources(new LinkedList<>());
- }
- controlLoopPolicy.getControlLoop().getResources().add(resource);
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setPNF(PNF pnf) throws BuilderException {
- if (pnf == null) {
- throw new BuilderException("PNF must not be null");
- }
- if (pnf.getPNFName() == null && pnf.getPNFType() == null) {
- throw new BuilderException("Invalid PNF - need either pnfName or pnfType");
- }
- controlLoopPolicy.getControlLoop().setPnf(pnf);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setAbatement(Boolean abatement) throws BuilderException{
- if (abatement == null) {
- throw new BuilderException("abatement must not be null");
- }
- controlLoopPolicy.getControlLoop().setAbatement(abatement);
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder setTimeout(Integer timeout) {
- controlLoopPolicy.getControlLoop().setTimeout(timeout);
- return this;
- }
-
- @Override
- public Policy setTriggerPolicy(String name, String description, String actor, Target target, String recipe,
- Map<String, String> payload, Integer retries, Integer timeout) throws BuilderException {
-
- Policy trigger = new Policy(UUID.randomUUID().toString(), name, description, actor, payload, target, recipe, retries, timeout);
-
- controlLoopPolicy.getControlLoop().setTrigger_policy(trigger.getId());
-
- this.addNewPolicy(trigger);
- //
- // Return a copy of the policy
- //
- return new Policy(trigger);
- }
-
- @Override
- public Policy setPolicyForPolicyResult(String name, String description, String actor,
- Target target, String recipe, Map<String, String> payload, Integer retries, Integer timeout, String policyID, PolicyResult... results) throws BuilderException {
- //
- // Find the existing policy
- //
- Policy existingPolicy = this.findPolicy(policyID);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyID);
- }
- //
- // Create the new Policy
- //
- Policy newPolicy = new Policy(UUID.randomUUID().toString(), name, description, actor, payload, target, recipe, retries, timeout);
- //
- // Connect the results
- //
- for (PolicyResult result : results) {
- switch (result) {
- case FAILURE:
- existingPolicy.setFailure(newPolicy.getId());
- break;
- case FAILURE_EXCEPTION:
- existingPolicy.setFailure_exception(newPolicy.getId());
- break;
- case FAILURE_RETRIES:
- existingPolicy.setFailure_retries(newPolicy.getId());
- break;
- case FAILURE_TIMEOUT:
- existingPolicy.setFailure_timeout(newPolicy.getId());
- break;
- case FAILURE_GUARD:
- existingPolicy.setFailure_guard(newPolicy.getId());
- break;
- case SUCCESS:
- existingPolicy.setSuccess(newPolicy.getId());
- break;
- default:
- throw new BuilderException("Invalid PolicyResult " + result);
- }
- }
- //
- // Add it to our list
- //
- this.controlLoopPolicy.getPolicies().add(newPolicy);
- //
- // Return a policy to them
- //
- return new Policy(newPolicy);
- }
-
- private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
-
- private ResultsImpl results = new ResultsImpl();
-
- @Override
- public boolean onWarning(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.WARNING));
- return false;
- }
-
- @Override
- public boolean onError(String message) {
- results.addMessage(new MessageImpl(message, MessageLevel.ERROR));
- return false;
- }
- }
-
- @Override
- public Results buildSpecification() {
- //
- // Dump the specification
- //
- DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle(FlowStyle.BLOCK);
- options.setPrettyFlow(true);
- Yaml yaml = new Yaml(options);
- String dumpedYaml = yaml.dump(controlLoopPolicy);
- //
- // This is our callback class for our compiler
- //
- BuilderCompilerCallback callback = new BuilderCompilerCallback();
- //
- // Compile it
- //
- try {
- ControlLoopCompiler.compile(controlLoopPolicy, callback);
- } catch (CompilerException e) {
- logger.error(e.getMessage() + e);
- callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
- }
- //
- // Save the spec
- //
- callback.results.setSpecification(dumpedYaml);
- return callback.results;
- }
-
- private void addNewPolicy(Policy policy) {
- if (this.controlLoopPolicy.getPolicies() == null) {
- this.controlLoopPolicy.setPolicies(new LinkedList<>());
- }
- this.controlLoopPolicy.getPolicies().add(policy);
- }
-
- private Policy findPolicy(String id) {
- if (this.controlLoopPolicy.getPolicies() != null){
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- if (policy.getId().equals(id)) {
- return policy;
- }
- }
- }
- return null;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException {
- if (controlLoopPolicy.getControlLoop().getResources() == null) {
- throw new BuilderException("No existing resources to remove");
- }
- for (Resource resource : resources) {
- if (resource == null) {
- throw new BuilderException("Resource must not be null");
- }
- if (resource.getResourceUUID() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
- throw new BuilderException("Invalid resource - need either a resourceUUID or resourceName");
- }
- boolean removed = controlLoopPolicy.getControlLoop().getResources().remove(resource);
- if (!removed) {
- throw new BuilderException("Unknown resource " + resource.getResourceName());
- }
- }
- return this;
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllResources() throws BuilderException {
- controlLoopPolicy.getControlLoop().getResources().clear();
- return this;
- }
-
- @Override
- public Integer calculateTimeout() {
- int sum = 0;
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- sum += policy.getTimeout().intValue();
- }
- return Integer.valueOf(sum);
- }
-
- @Override
- public ControlLoop setTriggerPolicy(String id) throws BuilderException {
- if (id == null) {
- throw new BuilderException("Id must not be null");
- }
- Policy trigger = this.findPolicy(id);
- if (trigger == null) {
- throw new BuilderException(UNKNOWN_POLICY + id);
- }
- else {
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(id);
- }
- return new ControlLoop(this.controlLoopPolicy.getControlLoop());
- }
-
- @Override
- public boolean isOpenLoop() {
- return this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString());
- }
-
- @Override
- public Policy getTriggerPolicy() throws BuilderException {
- if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString())) {
- return null;
- }
- else {
- return new Policy(this.findPolicy(this.controlLoopPolicy.getControlLoop().getTrigger_policy()));
- }
- }
-
- @Override
- public ControlLoop getControlLoop() {
- return new ControlLoop(this.controlLoopPolicy.getControlLoop());
- }
-
- @Override
- public Policy setPolicyForPolicyResult(String policyResultID, String policyID, PolicyResult... results)
- throws BuilderException {
- //
- // Find the existing policy
- //
- Policy existingPolicy = this.findPolicy(policyID);
- if (existingPolicy == null) {
- throw new BuilderException(policyID + " does not exist");
- }
- if (this.findPolicy(policyResultID) == null) {
- throw new BuilderException("Operational policy " + policyResultID + " does not exist");
- }
- //
- // Connect the results
- //
- for (PolicyResult result : results) {
- switch (result) {
- case FAILURE:
- existingPolicy.setFailure(policyResultID);
- break;
- case FAILURE_EXCEPTION:
- existingPolicy.setFailure_exception(policyResultID);
- break;
- case FAILURE_RETRIES:
- existingPolicy.setFailure_retries(policyResultID);
- break;
- case FAILURE_TIMEOUT:
- existingPolicy.setFailure_timeout(policyResultID);
- break;
- case FAILURE_GUARD:
- existingPolicy.setFailure_guard(policyResultID);
- break;
- case SUCCESS:
- existingPolicy.setSuccess(policyResultID);
- break;
- default:
- throw new BuilderException("Invalid PolicyResult " + result);
- }
- }
- return new Policy(this.findPolicy(policyResultID));
- }
-
- @Override
- public boolean removePolicy(String policyID) throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyID);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyID);
- }
- //
- // Check if the policy to remove is trigger_policy
- //
- if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(policyID)) {
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
- }
- else {
- updateChainedPoliciesForPolicyRemoval(policyID);
- }
- //
- // remove the policy
- //
- return this.controlLoopPolicy.getPolicies().remove(existingPolicy);
- }
-
- private void updateChainedPoliciesForPolicyRemoval(String idOfPolicyBeingRemoved){
- for (Policy policy : this.controlLoopPolicy.getPolicies()) {
- int index = this.controlLoopPolicy.getPolicies().indexOf(policy);
- if (policy.getSuccess().equals(idOfPolicyBeingRemoved)) {
- policy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
- }
- if (policy.getFailure().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure(FinalResult.FINAL_FAILURE.toString());
- }
- if (policy.getFailure_retries().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
- }
- if (policy.getFailure_timeout().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
- }
- if (policy.getFailure_exception().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
- }
- if (policy.getFailure_guard().equals(idOfPolicyBeingRemoved)) {
- policy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
- }
- this.controlLoopPolicy.getPolicies().set(index, policy);
- }
- }
-
- @Override
- public Policy resetPolicyResults(String policyID) throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyID);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyID);
- }
- //
- // reset policy results
- //
- existingPolicy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
- existingPolicy.setFailure(FinalResult.FINAL_FAILURE.toString());
- existingPolicy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
- existingPolicy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
- existingPolicy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
- existingPolicy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
- return new Policy(existingPolicy);
- }
-
- @Override
- public ControlLoopPolicyBuilder removeAllPolicies() {
- //
- // Remove all existing operational policies
- //
- this.controlLoopPolicy.getPolicies().clear();
- //
- // Revert controlLoop back to an open loop
- //
- this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
- return this;
- }
-
- @Override
- public Policy addOperationsAccumulateParams(String policyID, OperationsAccumulateParams operationsAccumulateParams) throws BuilderException {
- Policy existingPolicy = this.findPolicy(policyID);
- if (existingPolicy == null) {
- throw new BuilderException(UNKNOWN_POLICY + policyID);
- }
- //
- // Add operationsAccumulateParams to existingPolicy
- //
- existingPolicy.setOperationsAccumulateParams(operationsAccumulateParams);
- return new Policy(existingPolicy);
- }
+ private static final String UNKNOWN_POLICY = "Unknown policy ";
+ private static Logger logger = LoggerFactory.getLogger(ControlLoopPolicyBuilderImpl.class.getName());
+ private ControlLoopPolicy controlLoopPolicy;
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout) {
+ controlLoopPolicy = new ControlLoopPolicy();
+ ControlLoop controlLoop = new ControlLoop();
+ controlLoop.setControlLoopName(controlLoopName);
+ controlLoop.setTimeout(timeout);
+ controlLoopPolicy.setControlLoop(controlLoop);
+ }
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource, Service... services)
+ throws BuilderException {
+ this(controlLoopName, timeout);
+ this.addResource(resource);
+ this.addService(services);
+ }
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Pnf pnf) throws BuilderException {
+ this(controlLoopName, timeout);
+ this.setPNF(pnf);
+ }
+
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service, Resource[] resources)
+ throws BuilderException {
+ this(controlLoopName, timeout);
+ this.addService(service);
+ this.addResource(resources);
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removePNF() throws BuilderException {
+ controlLoopPolicy.getControlLoop().setPnf(null);
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException {
+ for (Service service : services) {
+ if (service == null) {
+ throw new BuilderException("Service must not be null");
+ }
+ if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
+ throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
+ }
+ if (controlLoopPolicy.getControlLoop().getServices() == null) {
+ controlLoopPolicy.getControlLoop().setServices(new LinkedList<>());
+ }
+ controlLoopPolicy.getControlLoop().getServices().add(service);
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException {
+ if (controlLoopPolicy.getControlLoop().getServices() == null) {
+ throw new BuilderException("No existing services to remove");
+ }
+ for (Service service : services) {
+ if (service == null) {
+ throw new BuilderException("Service must not be null");
+ }
+ if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
+ throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
+ }
+ boolean removed = controlLoopPolicy.getControlLoop().getServices().remove(service);
+ if (!removed) {
+ throw new BuilderException("Unknown service " + service.getServiceName());
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeAllServices() throws BuilderException {
+ controlLoopPolicy.getControlLoop().getServices().clear();
+ return this;
+ }
+
+
+ @Override
+ public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException {
+ for (Resource resource : resources) {
+ if (resource == null) {
+ throw new BuilderException("Resource must not be null");
+ }
+ if (resource.getResourceUUID() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
+ throw new BuilderException("Invalid resource - need either resourceUUID or resourceName");
+ }
+ if (controlLoopPolicy.getControlLoop().getResources() == null) {
+ controlLoopPolicy.getControlLoop().setResources(new LinkedList<>());
+ }
+ controlLoopPolicy.getControlLoop().getResources().add(resource);
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder setPNF(Pnf pnf) throws BuilderException {
+ if (pnf == null) {
+ throw new BuilderException("PNF must not be null");
+ }
+ if (pnf.getPnfName() == null && pnf.getPnfType() == null) {
+ throw new BuilderException("Invalid PNF - need either pnfName or pnfType");
+ }
+ controlLoopPolicy.getControlLoop().setPnf(pnf);
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder setAbatement(Boolean abatement) throws BuilderException {
+ if (abatement == null) {
+ throw new BuilderException("abatement must not be null");
+ }
+ controlLoopPolicy.getControlLoop().setAbatement(abatement);
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder setTimeout(Integer timeout) {
+ controlLoopPolicy.getControlLoop().setTimeout(timeout);
+ return this;
+ }
+
+ @Override
+ public Policy setTriggerPolicy(String name, String description, String actor, Target target, String recipe,
+ Map<String, String> payload, Integer retries, Integer timeout) throws BuilderException {
+
+ Policy trigger = new Policy(UUID.randomUUID().toString(), name, description, actor, payload, target, recipe,
+ retries, timeout);
+
+ controlLoopPolicy.getControlLoop().setTrigger_policy(trigger.getId());
+
+ this.addNewPolicy(trigger);
+ //
+ // Return a copy of the policy
+ //
+ return new Policy(trigger);
+ }
+
+ @Override
+ public Policy setPolicyForPolicyResult(String name, String description, String actor, Target target, String recipe,
+ Map<String, String> payload, Integer retries, Integer timeout, String policyID, PolicyResult... results)
+ throws BuilderException {
+ //
+ // Find the existing policy
+ //
+ Policy existingPolicy = this.findPolicy(policyID);
+ if (existingPolicy == null) {
+ throw new BuilderException(UNKNOWN_POLICY + policyID);
+ }
+ //
+ // Create the new Policy
+ //
+ Policy newPolicy = new Policy(UUID.randomUUID().toString(), name, description, actor, payload, target, recipe,
+ retries, timeout);
+ //
+ // Connect the results
+ //
+ for (PolicyResult result : results) {
+ switch (result) {
+ case FAILURE:
+ existingPolicy.setFailure(newPolicy.getId());
+ break;
+ case FAILURE_EXCEPTION:
+ existingPolicy.setFailure_exception(newPolicy.getId());
+ break;
+ case FAILURE_RETRIES:
+ existingPolicy.setFailure_retries(newPolicy.getId());
+ break;
+ case FAILURE_TIMEOUT:
+ existingPolicy.setFailure_timeout(newPolicy.getId());
+ break;
+ case FAILURE_GUARD:
+ existingPolicy.setFailure_guard(newPolicy.getId());
+ break;
+ case SUCCESS:
+ existingPolicy.setSuccess(newPolicy.getId());
+ break;
+ default:
+ throw new BuilderException("Invalid PolicyResult " + result);
+ }
+ }
+ //
+ // Add it to our list
+ //
+ this.controlLoopPolicy.getPolicies().add(newPolicy);
+ //
+ // Return a policy to them
+ //
+ return new Policy(newPolicy);
+ }
+
+ private class BuilderCompilerCallback implements ControlLoopCompilerCallback {
+
+ private ResultsImpl results = new ResultsImpl();
+
+ @Override
+ public boolean onWarning(String message) {
+ results.addMessage(new MessageImpl(message, MessageLevel.WARNING));
+ return false;
+ }
+
+ @Override
+ public boolean onError(String message) {
+ results.addMessage(new MessageImpl(message, MessageLevel.ERROR));
+ return false;
+ }
+ }
+
+ @Override
+ public Results buildSpecification() {
+ //
+ // Dump the specification
+ //
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(FlowStyle.BLOCK);
+ options.setPrettyFlow(true);
+ Yaml yaml = new Yaml(options);
+ String dumpedYaml = yaml.dump(controlLoopPolicy);
+ //
+ // This is our callback class for our compiler
+ //
+ BuilderCompilerCallback callback = new BuilderCompilerCallback();
+ //
+ // Compile it
+ //
+ try {
+ ControlLoopCompiler.compile(controlLoopPolicy, callback);
+ } catch (CompilerException e) {
+ logger.error(e.getMessage() + e);
+ callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
+ }
+ //
+ // Save the spec
+ //
+ callback.results.setSpecification(dumpedYaml);
+ return callback.results;
+ }
+
+ private void addNewPolicy(Policy policy) {
+ if (this.controlLoopPolicy.getPolicies() == null) {
+ this.controlLoopPolicy.setPolicies(new LinkedList<>());
+ }
+ this.controlLoopPolicy.getPolicies().add(policy);
+ }
+
+ private Policy findPolicy(String id) {
+ if (this.controlLoopPolicy.getPolicies() != null) {
+ for (Policy policy : this.controlLoopPolicy.getPolicies()) {
+ if (policy.getId().equals(id)) {
+ return policy;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException {
+ if (controlLoopPolicy.getControlLoop().getResources() == null) {
+ throw new BuilderException("No existing resources to remove");
+ }
+ for (Resource resource : resources) {
+ if (resource == null) {
+ throw new BuilderException("Resource must not be null");
+ }
+ if (resource.getResourceUUID() == null && Strings.isNullOrEmpty(resource.getResourceName())) {
+ throw new BuilderException("Invalid resource - need either a resourceUUID or resourceName");
+ }
+ boolean removed = controlLoopPolicy.getControlLoop().getResources().remove(resource);
+ if (!removed) {
+ throw new BuilderException("Unknown resource " + resource.getResourceName());
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeAllResources() throws BuilderException {
+ controlLoopPolicy.getControlLoop().getResources().clear();
+ return this;
+ }
+
+ @Override
+ public Integer calculateTimeout() {
+ int sum = 0;
+ for (Policy policy : this.controlLoopPolicy.getPolicies()) {
+ sum += policy.getTimeout().intValue();
+ }
+ return Integer.valueOf(sum);
+ }
+
+ @Override
+ public ControlLoop setTriggerPolicy(String id) throws BuilderException {
+ if (id == null) {
+ throw new BuilderException("Id must not be null");
+ }
+ Policy trigger = this.findPolicy(id);
+ if (trigger == null) {
+ throw new BuilderException(UNKNOWN_POLICY + id);
+ } else {
+ this.controlLoopPolicy.getControlLoop().setTrigger_policy(id);
+ }
+ return new ControlLoop(this.controlLoopPolicy.getControlLoop());
+ }
+
+ @Override
+ public boolean isOpenLoop() {
+ return this.controlLoopPolicy.getControlLoop().getTrigger_policy()
+ .equals(FinalResult.FINAL_OPENLOOP.toString());
+ }
+
+ @Override
+ public Policy getTriggerPolicy() throws BuilderException {
+ if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(FinalResult.FINAL_OPENLOOP.toString())) {
+ return null;
+ } else {
+ return new Policy(this.findPolicy(this.controlLoopPolicy.getControlLoop().getTrigger_policy()));
+ }
+ }
+
+ @Override
+ public ControlLoop getControlLoop() {
+ return new ControlLoop(this.controlLoopPolicy.getControlLoop());
+ }
+
+ @Override
+ public Policy setPolicyForPolicyResult(String policyResultID, String policyID, PolicyResult... results)
+ throws BuilderException {
+ //
+ // Find the existing policy
+ //
+ Policy existingPolicy = this.findPolicy(policyID);
+ if (existingPolicy == null) {
+ throw new BuilderException(policyID + " does not exist");
+ }
+ if (this.findPolicy(policyResultID) == null) {
+ throw new BuilderException("Operational policy " + policyResultID + " does not exist");
+ }
+ //
+ // Connect the results
+ //
+ for (PolicyResult result : results) {
+ switch (result) {
+ case FAILURE:
+ existingPolicy.setFailure(policyResultID);
+ break;
+ case FAILURE_EXCEPTION:
+ existingPolicy.setFailure_exception(policyResultID);
+ break;
+ case FAILURE_RETRIES:
+ existingPolicy.setFailure_retries(policyResultID);
+ break;
+ case FAILURE_TIMEOUT:
+ existingPolicy.setFailure_timeout(policyResultID);
+ break;
+ case FAILURE_GUARD:
+ existingPolicy.setFailure_guard(policyResultID);
+ break;
+ case SUCCESS:
+ existingPolicy.setSuccess(policyResultID);
+ break;
+ default:
+ throw new BuilderException("Invalid PolicyResult " + result);
+ }
+ }
+ return new Policy(this.findPolicy(policyResultID));
+ }
+
+ @Override
+ public boolean removePolicy(String policyID) throws BuilderException {
+ Policy existingPolicy = this.findPolicy(policyID);
+ if (existingPolicy == null) {
+ throw new BuilderException(UNKNOWN_POLICY + policyID);
+ }
+ //
+ // Check if the policy to remove is trigger_policy
+ //
+ if (this.controlLoopPolicy.getControlLoop().getTrigger_policy().equals(policyID)) {
+ this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
+ } else {
+ updateChainedPoliciesForPolicyRemoval(policyID);
+ }
+ //
+ // remove the policy
+ //
+ return this.controlLoopPolicy.getPolicies().remove(existingPolicy);
+ }
+
+ private void updateChainedPoliciesForPolicyRemoval(String idOfPolicyBeingRemoved) {
+ for (Policy policy : this.controlLoopPolicy.getPolicies()) {
+ int index = this.controlLoopPolicy.getPolicies().indexOf(policy);
+ if (policy.getSuccess().equals(idOfPolicyBeingRemoved)) {
+ policy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
+ }
+ if (policy.getFailure().equals(idOfPolicyBeingRemoved)) {
+ policy.setFailure(FinalResult.FINAL_FAILURE.toString());
+ }
+ if (policy.getFailure_retries().equals(idOfPolicyBeingRemoved)) {
+ policy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
+ }
+ if (policy.getFailure_timeout().equals(idOfPolicyBeingRemoved)) {
+ policy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
+ }
+ if (policy.getFailure_exception().equals(idOfPolicyBeingRemoved)) {
+ policy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
+ }
+ if (policy.getFailure_guard().equals(idOfPolicyBeingRemoved)) {
+ policy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
+ }
+ this.controlLoopPolicy.getPolicies().set(index, policy);
+ }
+ }
+
+ @Override
+ public Policy resetPolicyResults(String policyID) throws BuilderException {
+ Policy existingPolicy = this.findPolicy(policyID);
+ if (existingPolicy == null) {
+ throw new BuilderException(UNKNOWN_POLICY + policyID);
+ }
+ //
+ // reset policy results
+ //
+ existingPolicy.setSuccess(FinalResult.FINAL_SUCCESS.toString());
+ existingPolicy.setFailure(FinalResult.FINAL_FAILURE.toString());
+ existingPolicy.setFailure_retries(FinalResult.FINAL_FAILURE_RETRIES.toString());
+ existingPolicy.setFailure_timeout(FinalResult.FINAL_FAILURE_TIMEOUT.toString());
+ existingPolicy.setFailure_exception(FinalResult.FINAL_FAILURE_EXCEPTION.toString());
+ existingPolicy.setFailure_guard(FinalResult.FINAL_FAILURE_GUARD.toString());
+ return new Policy(existingPolicy);
+ }
+
+ @Override
+ public ControlLoopPolicyBuilder removeAllPolicies() {
+ //
+ // Remove all existing operational policies
+ //
+ this.controlLoopPolicy.getPolicies().clear();
+ //
+ // Revert controlLoop back to an open loop
+ //
+ this.controlLoopPolicy.getControlLoop().setTrigger_policy(FinalResult.FINAL_OPENLOOP.toString());
+ return this;
+ }
+
+ @Override
+ public Policy addOperationsAccumulateParams(String policyID, OperationsAccumulateParams operationsAccumulateParams)
+ throws BuilderException {
+ Policy existingPolicy = this.findPolicy(policyID);
+ if (existingPolicy == null) {
+ throw new BuilderException(UNKNOWN_POLICY + policyID);
+ }
+ //
+ // Add operationsAccumulateParams to existingPolicy
+ //
+ existingPolicy.setOperationsAccumulateParams(operationsAccumulateParams);
+ return new Policy(existingPolicy);
+ }
}
diff --git a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
index 05d4e469d..3133273f9 100644
--- a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
+++ b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
@@ -33,12 +33,13 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
+
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.policy.aai.PNF;
-import org.onap.policy.aai.PNFType;
+import org.onap.policy.aai.Pnf;
+import org.onap.policy.aai.PnfType;
import org.onap.policy.controlloop.policy.builder.BuilderException;
import org.onap.policy.controlloop.policy.builder.ControlLoopPolicyBuilder;
import org.onap.policy.controlloop.policy.builder.Message;
@@ -53,17 +54,18 @@ import org.yaml.snakeyaml.error.YAMLException;
public class ControlLoopPolicyBuilderTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Test
public void testControlLoop() {
try {
//
// Create a builder for our policy
//
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test add services
//
@@ -98,92 +100,102 @@ public class ControlLoopPolicyBuilderTest {
fail(e.getMessage());
}
}
-
+
@Test
public void testAddNullService() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Service must not be null");
- builder.addService((Service)null);
+ builder.addService((Service) null);
}
-
+
@Test
public void testAddInvalidService() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Invalid service - need either a serviceUUID or serviceName");
builder.addService(new Service());
}
-
+
@Test
public void testAddServiceWithUUID() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
UUID uuid = UUID.randomUUID();
Service serviceWithUUID = new Service(uuid);
builder.addService(serviceWithUUID);
assertTrue(builder.getControlLoop().getServices().size() == 1);
}
-
+
@Test
public void testAddNullResource() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Resource must not be null");
- builder.addResource((Resource)null);
+ builder.addResource((Resource) null);
}
-
-
+
+
@Test
public void testAddInvalidResource() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Invalid resource - need either resourceUUID or resourceName");
builder.addResource(new Resource());
}
-
+
@Test
public void testAddAndRemoveResourceWithUUID() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
UUID uuid = UUID.randomUUID();
Resource resourceWithUUID = new Resource(uuid);
builder.addResource(resourceWithUUID);
assertTrue(builder.getControlLoop().getResources().size() == 1);
-
+
builder.removeResource(resourceWithUUID);
assertTrue(builder.getControlLoop().getResources().size() == 0);
}
-
+
@Test
public void testRemoveNullResource() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource("resource1", ResourceType.VF);
builder.addResource(resource);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Resource must not be null");
- builder.removeResource((Resource)null);
+ builder.removeResource((Resource) null);
}
-
+
@Test
public void testRemoveResourceNoExistingResources() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("No existing resources to remove");
builder.removeResource(new Resource("resource1", ResourceType.VF));
}
-
+
@Test
public void testRemoveInvalidResource() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource("resource1", ResourceType.VF);
builder.addResource(resource);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Invalid resource - need either a resourceUUID or resourceName");
builder.removeResource(new Resource());
}
-
+
@Test
public void testRemoveUnknownResource() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource("resource1", ResourceType.VF);
builder.addResource(resource);
final String unknownResourceName = "reource2";
@@ -191,155 +203,150 @@ public class ControlLoopPolicyBuilderTest {
expectedException.expectMessage("Unknown resource " + unknownResourceName);
builder.removeResource(new Resource(unknownResourceName, ResourceType.VF));
}
-
+
@Test
public void testControlLoopWithInitialResourceAndServices() {
try {
Resource vCTS = new Resource("vCTS", ResourceType.VF);
Service vSCP = new Service("vSCP");
Service vUSP = new Service("vUSP");
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, vCTS, vSCP, vUSP);
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
+ .buildControlLoop(UUID.randomUUID().toString(), 2400, vCTS, vSCP, vUSP);
assertTrue(builder.getControlLoop().getResources().size() == 1);
assertTrue(builder.getControlLoop().getServices().size() == 2);
} catch (BuilderException e) {
fail(e.getMessage());
}
}
-
+
@Test
public void testControlLoopWithInitialResourcesAndService() {
try {
Resource vCTS = new Resource("vCTS", ResourceType.VF);
Resource vCOM = new Resource("vCTS", ResourceType.VF);
Service vSCP = new Service("vSCP");
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, vSCP, vCTS, vCOM);
+ ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
+ .buildControlLoop(UUID.randomUUID().toString(), 2400, vSCP, vCTS, vCOM);
assertTrue(builder.getControlLoop().getServices().size() == 1);
assertTrue(builder.getControlLoop().getResources().size() == 2);
} catch (BuilderException e) {
fail(e.getMessage());
}
}
-
+
@Test
@Ignore
// I'VE MARKED THIS TEST CASE AS IGNORE BECAUSE THE TEST CASE FAILS
- // This test case fails because builder.getControlLoop() returns an instance of ControlLoop copied using
- // the ControlLoop(ControlLoop controlLoop) constructor.
+ // This test case fails because builder.getControlLoop() returns an instance of ControlLoop
+ // copied using
+ // the ControlLoop(ControlLoop controlLoop) constructor.
// This constructor does not copy the value of pnf into the newly created object
// On the face of it, this looks like a bug, but perhaps there is a reason for this
// PLEASE ADVISE IF THE BEHAVIOUR IS INCORRECT OR THE TEST CASE IS INVALID
public void testControlLoopForPnf() {
try {
- PNF pnf = new PNF();
- pnf.setPNFType(PNFType.ENODEB);
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
+ Pnf pnf = new Pnf();
+ pnf.setPnfType(PnfType.ENODEB);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
-
+
builder.removePNF();
assertNull(builder.getControlLoop().getPnf());
} catch (BuilderException e) {
fail(e.getMessage());
}
}
-
+
@Test
@Ignore
// Fails for the same reason as the above test case
public void testSetAndRemovePnf() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
assertNull(builder.getControlLoop().getPnf());
-
- PNF pnf = new PNF();
- pnf.setPNFType(PNFType.ENODEB);
+
+ Pnf pnf = new Pnf();
+ pnf.setPnfType(PnfType.ENODEB);
builder.setPNF(pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
-
+
builder.removePNF();
assertNull(builder.getControlLoop().getPnf());
}
-
+
@Test
public void testSetNullPnf() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("PNF must not be null");
builder.setPNF(null);
}
-
+
@Test
public void testSetInvalidPnf() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Invalid PNF - need either pnfName or pnfType");
- builder.setPNF(new PNF());
+ builder.setPNF(new Pnf());
}
-
+
@Test
public void testSetAbatement() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
assertFalse(builder.getControlLoop().getAbatement());
builder = builder.setAbatement(true);
assertTrue(builder.getControlLoop().getAbatement());
}
-
+
@Test
public void testSetNullAbatement() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("abatement must not be null");
builder = builder.setAbatement(null);
}
-
+
@Test
public void testTimeout() {
try {
//
// Create a builder for our policy
//
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test setTimeout
//
assertTrue(builder.getControlLoop().getTimeout() == 2400);
builder = builder.setTimeout(800);
assertTrue(builder.getControlLoop().getTimeout() == 800);
- //
+ //
// Test calculateTimeout
//
- Policy trigger = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
+ Policy trigger =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
@SuppressWarnings("unused")
- Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600,
- trigger.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult("Rebuild VM",
+ "If the restart fails, rebuild it", "APPC", new Target(TargetType.VM), "Rebuild", null, 1, 600,
+ trigger.getId(), PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
assertTrue(builder.calculateTimeout().equals(new Integer(300 + 600)));
//
} catch (BuilderException e) {
fail(e.getMessage());
}
}
-
+
@Test
public void testTriggerPolicyMethods() {
try {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test isOpenLoop
//
@@ -347,31 +354,19 @@ public class ControlLoopPolicyBuilderTest {
//
// Test set initial trigger policy
//
- Policy triggerPolicy1 = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
+ Policy triggerPolicy1 =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
assertTrue(builder.isOpenLoop() == false);
assertTrue(builder.getControlLoop().getTrigger_policy().equals(triggerPolicy1.getId()));
//
- // Set trigger policy to a new policy
+ // Set trigger policy to a new policy
//
@SuppressWarnings("unused")
- Policy triggerPolicy2 = builder.setTriggerPolicy(
- "Rebuild the VM",
- "Upon getting the trigger event, rebuild the VM",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 2,
- 300);
- //
+ Policy triggerPolicy2 =
+ builder.setTriggerPolicy("Rebuild the VM", "Upon getting the trigger event, rebuild the VM", "APPC",
+ new Target(TargetType.VM), "Rebuild", null, 2, 300);
+ //
// Test set trigger policy to another existing policy
//
@SuppressWarnings("unused")
@@ -386,160 +381,120 @@ public class ControlLoopPolicyBuilderTest {
fail(e.getMessage());
}
}
-
+
@Test
public void testSetTriggerPolicyNullPolicyId() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Id must not be null");
builder.setTriggerPolicy(null);
}
-
+
@Test
public void testSetTriggerPolicyNoPoliciesExist() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
final String unknownPolicyId = "100";
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Unknown policy " + unknownPolicyId);
builder.setTriggerPolicy(unknownPolicyId);
}
-
+
@Test
public void testSetTriggerPolicyUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
final String unknownPolicyId = "100";
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Unknown policy " + unknownPolicyId);
builder.setTriggerPolicy(unknownPolicyId);
}
-
+
@Test
public void testAddRemovePolicies() {
try {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
//
// Test create a policy and chain it to the results of trigger policy
//
- Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600,
- triggerPolicy.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_EXCEPTION,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
- PolicyResult.FAILURE_GUARD);
+ Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult("Rebuild VM",
+ "If the restart fails, rebuild it.", "APPC", new Target(TargetType.VM), "Rebuild", null, 1, 600,
+ triggerPolicy.getId(), PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.FAILURE_GUARD);
//
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy1.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy1.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy1.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy1.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy1.getId()));
-
+
//
// Test create a policy and chain it to the results of trigger policy success
//
- Policy onSuccessPolicy1 = builder.setPolicyForPolicyResult(
- "Do something",
- "If the restart succeeds, do something else.",
- "APPC",
- new Target(TargetType.VM),
- "SomethingElse",
- null,
- 1,
- 600,
- triggerPolicy.getId(),
- PolicyResult.SUCCESS);
+ Policy onSuccessPolicy1 = builder.setPolicyForPolicyResult("Do something",
+ "If the restart succeeds, do something else.", "APPC", new Target(TargetType.VM), "SomethingElse",
+ null, 1, 600, triggerPolicy.getId(), PolicyResult.SUCCESS);
//
assertTrue(builder.getTriggerPolicy().getSuccess().equals(onSuccessPolicy1.getId()));
-
+
//
// Test remove policy
//
boolean removed = builder.removePolicy(onRestartFailurePolicy1.getId());
assertTrue(removed);
assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_retries()
+ .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout()
+ .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ assertTrue(
+ builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
//
// Create another policy and chain it to the results of trigger policy
//
- Policy onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 2,
- 600,
- triggerPolicy.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ Policy onRestartFailurePolicy2 =
+ builder.setPolicyForPolicyResult("Rebuild VM", "If the restart fails, rebuild it.", "APPC",
+ new Target(TargetType.VM), "Rebuild", null, 2, 600, triggerPolicy.getId(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
//
// Test reset policy results
//
triggerPolicy = builder.resetPolicyResults(triggerPolicy.getId());
assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
- //
+ assertTrue(builder.getTriggerPolicy().getFailure_retries()
+ .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_timeout()
+ .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ //
// Test set the policy results to an existing operational policy
//
- onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
- onRestartFailurePolicy2.getId(),
- triggerPolicy.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ onRestartFailurePolicy2 =
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy2.getId()));
- //
+ //
// Test set the policy result for success to an existing operational policy
//
- onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
- onRestartFailurePolicy2.getId(),
- triggerPolicy.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_EXCEPTION,
- PolicyResult.FAILURE_GUARD,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
- PolicyResult.SUCCESS);
+ onRestartFailurePolicy2 =
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION, PolicyResult.FAILURE_GUARD,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.SUCCESS);
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy2.getId()));
assertTrue(builder.getTriggerPolicy().getSuccess().equals(onRestartFailurePolicy2.getId()));
-
+
//
// Test remove all existing operational policies
//
@@ -550,106 +505,68 @@ public class ControlLoopPolicyBuilderTest {
fail(e.getMessage());
}
}
-
+
@Test
public void testAddToUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
final String policyId = "100";
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Unknown policy " + policyId);
-
- builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600,
- policyId,
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
- PolicyResult.FAILURE_GUARD);
- }
-
+
+ builder.setPolicyForPolicyResult("Rebuild VM", "If the restart fails, rebuild it.", "APPC",
+ new Target(TargetType.VM), "Rebuild", null, 1, 600, policyId, PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.FAILURE_GUARD);
+ }
+
@Test
public void testAddExistingPolicyToUnknownPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
-
-
- Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600,
- triggerPolicy.getId(),
- PolicyResult.FAILURE);
-
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
+
+
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult("Rebuild VM",
+ "If the restart fails, rebuild it.", "APPC", new Target(TargetType.VM), "Rebuild", null, 1, 600,
+ triggerPolicy.getId(), PolicyResult.FAILURE);
+
final String unknownPolicyId = "100";
expectedException.expect(BuilderException.class);
expectedException.expectMessage(unknownPolicyId + " does not exist");
-
- builder.setPolicyForPolicyResult(
- onRestartFailurePolicy.getId(),
- unknownPolicyId,
- PolicyResult.FAILURE);
+
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy.getId(), unknownPolicyId, PolicyResult.FAILURE);
}
-
+
@Test
public void testAddUnknownExistingPolicyToPolicy() throws BuilderException {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
-
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
+
final String unknownPolicyId = "100";
expectedException.expect(BuilderException.class);
expectedException.expectMessage("Operational policy " + unknownPolicyId + " does not exist");
-
- builder.setPolicyForPolicyResult(
- unknownPolicyId,
- triggerPolicy.getId(),
- PolicyResult.FAILURE);
+
+ builder.setPolicyForPolicyResult(unknownPolicyId, triggerPolicy.getId(), PolicyResult.FAILURE);
}
@Test
public void testAddOperationsAccumulateParams() {
try {
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy = builder.setTriggerPolicy(
- "Restart the eNodeB",
- "Upon getting the trigger event, restart the eNodeB",
- "RANController",
- new Target(TargetType.PNF),
- "Restart",
- null,
- 2,
- 300);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ Policy triggerPolicy =
+ builder.setTriggerPolicy("Restart the eNodeB", "Upon getting the trigger event, restart the eNodeB",
+ "RANController", new Target(TargetType.PNF), "Restart", null, 2, 300);
//
// Add the operationsAccumulateParams
//
- triggerPolicy = builder.addOperationsAccumulateParams(triggerPolicy.getId(), new OperationsAccumulateParams("15m", 5));
+ triggerPolicy = builder.addOperationsAccumulateParams(triggerPolicy.getId(),
+ new OperationsAccumulateParams("15m", 5));
assertNotNull(builder.getTriggerPolicy().getOperationsAccumulateParams());
assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getPeriod().equals("15m"));
assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getLimit() == 5);
@@ -658,27 +575,21 @@ public class ControlLoopPolicyBuilderTest {
fail(e.getMessage());
}
}
-
-
+
+
@Test
public void testBuildSpecification() {
try {
//
// Create the builder
//
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
//
// Set the first invalid trigger policy
//
- Policy policy1 = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- null,
- null,
- "Instantiate",
- null,
- 2,
- 300);
+ Policy policy1 = builder.setTriggerPolicy("Restart the VM",
+ "Upon getting the trigger event, restart the VM", null, null, "Instantiate", null, 2, 300);
Results results = builder.buildSpecification();
//
// Check that ERRORs are in results for invalid policy arguments
@@ -704,41 +615,29 @@ public class ControlLoopPolicyBuilderTest {
//
// Remove the invalid policy
//
- //@SuppressWarnings("unused")
+ // @SuppressWarnings("unused")
boolean removed = builder.removePolicy(policy1.getId());
assertTrue(removed);
assertTrue(builder.getTriggerPolicy() == null);
//
// Set a valid trigger policy
//
- policy1 = builder.setTriggerPolicy(
- "Rebuild VM",
- "If the restart fails, rebuild it.",
- "APPC",
- new Target(TargetType.VM),
- "Rebuild",
- null,
- 1,
- 600);
+ policy1 = builder.setTriggerPolicy("Rebuild VM", "If the restart fails, rebuild it.", "APPC",
+ new Target(TargetType.VM), "Rebuild", null, 1, 600);
//
// Set a second valid trigger policy
//
- Policy policy2 = builder.setTriggerPolicy(
- "Restart the VM",
- "Upon getting the trigger event, restart the VM",
- "APPC",
- new Target(TargetType.VM),
- "Restart",
- null,
- 2,
- 300);
+ Policy policy2 =
+ builder.setTriggerPolicy("Restart the VM", "Upon getting the trigger event, restart the VM", "APPC",
+ new Target(TargetType.VM), "Restart", null, 2, 300);
//
// Now, we have policy1 unreachable
//
results = builder.buildSpecification();
boolean unreachable = false;
for (Message m : results.getMessages()) {
- if (m.getMessage().equals("Policy " + policy1.getId() + " is not reachable.") && m.getLevel() == MessageLevel.WARNING) {
+ if (m.getMessage().equals("Policy " + policy1.getId() + " is not reachable.")
+ && m.getLevel() == MessageLevel.WARNING) {
unreachable = true;
break;
}
@@ -747,23 +646,21 @@ public class ControlLoopPolicyBuilderTest {
//
// Set policy1 for the failure results of policy2
//
- policy1 = builder.setPolicyForPolicyResult(
- policy1.getId(),
- policy2.getId(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ policy1 = builder.setPolicyForPolicyResult(policy1.getId(), policy2.getId(), PolicyResult.FAILURE,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
results = builder.buildSpecification();
boolean invalid_timeout = false;
for (Message m : results.getMessages()) {
- if (m.getMessage().equals("controlLoop overall timeout is less than the sum of operational policy timeouts.") && m.getLevel() == MessageLevel.ERROR) {
+ if (m.getMessage()
+ .equals("controlLoop overall timeout is less than the sum of operational policy timeouts.")
+ && m.getLevel() == MessageLevel.ERROR) {
invalid_timeout = true;
break;
}
}
assertTrue(invalid_timeout);
//
- // Remove policy2 (revert controlLoop back to open loop)
+ // Remove policy2 (revert controlLoop back to open loop)
//
removed = builder.removePolicy(policy2.getId());
//
@@ -772,7 +669,8 @@ public class ControlLoopPolicyBuilderTest {
results = builder.buildSpecification();
unreachable = false;
for (Message m : results.getMessages()) {
- if (m.getMessage().equals("Open Loop policy contains policies. The policies will never be invoked.") && m.getLevel() == MessageLevel.WARNING) {
+ if (m.getMessage().equals("Open Loop policy contains policies. The policies will never be invoked.")
+ && m.getLevel() == MessageLevel.WARNING) {
unreachable = true;
break;
}
@@ -783,13 +681,13 @@ public class ControlLoopPolicyBuilderTest {
fail(e.getMessage());
}
}
-
-
+
+
@Test
public void test() {
this.test("src/test/resources/v1.0.0/policy_Test.yaml");
}
-
+
@Test
public void testEvilYaml() {
try (InputStream is = new FileInputStream(new File("src/test/resources/v1.0.0/test_evil.yaml"))) {
@@ -808,7 +706,7 @@ public class ControlLoopPolicyBuilderTest {
//
}
}
-
+
public void test(String testFile) {
try (InputStream is = new FileInputStream(new File(testFile))) {
//
@@ -823,19 +721,20 @@ public class ControlLoopPolicyBuilderTest {
// Now we're going to try to use the builder to build this.
//
ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
- policyTobuild.getControlLoop().getControlLoopName(),
- policyTobuild.getControlLoop().getTimeout());
+ policyTobuild.getControlLoop().getControlLoopName(), policyTobuild.getControlLoop().getTimeout());
//
// Add services
//
if (policyTobuild.getControlLoop().getServices() != null) {
- builder = builder.addService(policyTobuild.getControlLoop().getServices().toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
+ builder = builder.addService(policyTobuild.getControlLoop().getServices()
+ .toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
}
//
// Add resources
//
if (policyTobuild.getControlLoop().getResources() != null) {
- builder = builder.addResource(policyTobuild.getControlLoop().getResources().toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
+ builder = builder.addResource(policyTobuild.getControlLoop().getResources()
+ .toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
}
//
// Set pnf
@@ -849,16 +748,17 @@ public class ControlLoopPolicyBuilderTest {
if (policyTobuild.getPolicies() != null) {
for (Policy policy : policyTobuild.getPolicies()) {
if (policy.getId() == policyTobuild.getControlLoop().getTrigger_policy()) {
- builder.setTriggerPolicy(policy.getName(), policy.getDescription(), policy.getActor(), policy.getTarget(), policy.getRecipe(), null, policy.getRetry(), policy.getTimeout());
+ builder.setTriggerPolicy(policy.getName(), policy.getDescription(), policy.getActor(),
+ policy.getTarget(), policy.getRecipe(), null, policy.getRetry(), policy.getTimeout());
}
}
}
-
+
// Question : how to change policy ID and results by using builder ??
-
+
@SuppressWarnings("unused")
Results results = builder.buildSpecification();
-
+
} catch (FileNotFoundException e) {
fail(e.getLocalizedMessage());
} catch (IOException e) {
@@ -866,7 +766,7 @@ public class ControlLoopPolicyBuilderTest {
} catch (BuilderException e) {
fail(e.getLocalizedMessage());
}
-
+
}
}
diff --git a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
index 0b2f62def..cc5a903ad 100644
--- a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
+++ b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopTest.java
@@ -15,6 +15,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.controlloop.policy;
import static org.junit.Assert.assertEquals;
@@ -23,122 +24,124 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Ignore;
import org.junit.Test;
-import org.onap.policy.aai.PNF;
+import org.onap.policy.aai.Pnf;
import org.onap.policy.sdc.Resource;
import org.onap.policy.sdc.ResourceType;
import org.onap.policy.sdc.Service;
public class ControlLoopTest {
-
+
private String controlLoopName = "control loop 1";
private String version = "1.0.1";
private String triggerPolicy = FinalResult.FINAL_OPENLOOP.toString();
private Integer timeout = 100;
private Boolean abatement = false;
-
- @Test
- public void testEqualsSameInstance() {
- ControlLoop controlLoop1 = new ControlLoop();
- assertTrue(controlLoop1.equals(controlLoop1));
- }
-
- @Test
- public void testEqualsNull() {
- ControlLoop controlLoop1 = new ControlLoop();
- assertFalse(controlLoop1.equals(null));
- }
- @Test
- public void testEqualsInstanceOfDiffClass() {
- ControlLoop controlLoop1 = new ControlLoop();
- assertFalse(controlLoop1.equals(""));
- }
-
- @Test
- public void testEqualsNoServicesAndResourcesOrTimeout() {
- final PNF pnf = new PNF();
- pnf.setPNFName("pnf 1");
-
- ControlLoop controlLoop1 = new ControlLoop();
- controlLoop1.setControlLoopName(controlLoopName);
- controlLoop1.setVersion(version);
- controlLoop1.setPnf(pnf);
- controlLoop1.setTrigger_policy(triggerPolicy);
- controlLoop1.setAbatement(abatement);
-
- ControlLoop controlLoop2 = new ControlLoop();
- controlLoop2.setControlLoopName(controlLoopName);
- controlLoop2.setVersion(version);
- controlLoop2.setPnf(pnf);
- controlLoop2.setTrigger_policy(triggerPolicy);
- controlLoop2.setAbatement(abatement);
-
- assertTrue(controlLoop1.equals(controlLoop2));
- }
-
- @Test
- public void testEquals() {
- final PNF pnf = new PNF();
- pnf.setPNFName("pnf 1");
-
- ControlLoop controlLoop1 = new ControlLoop();
- controlLoop1.setControlLoopName(controlLoopName);
- controlLoop1.setVersion(version);
- Service service1 = new Service("service1");
- Service service2 = new Service("service2");
- List<Service> services = new ArrayList<>();
- services.add(service1);
- services.add(service2);
- controlLoop1.setServices(services);
- Resource resource1 = new Resource("resource1", ResourceType.VF);
- Resource resource2 = new Resource("resource2", ResourceType.VFC);
- List<Resource> resources = new ArrayList<>();
- resources.add(resource1);
- resources.add(resource2);
- controlLoop1.setResources(resources);
- controlLoop1.setPnf(pnf);
- controlLoop1.setTrigger_policy(triggerPolicy);
- controlLoop1.setTimeout(timeout);
- controlLoop1.setAbatement(abatement);
-
- ControlLoop controlLoop2 = new ControlLoop();
- controlLoop2.setControlLoopName(controlLoopName);
- controlLoop2.setVersion(version);
- Service controlLoop2_service1 = new Service("service1");
- Service controlLoop2_service2 = new Service("service2");
- List<Service> controlLoop2_services = new ArrayList<>();
- controlLoop2_services.add(controlLoop2_service1);
- controlLoop2_services.add(controlLoop2_service2);
- controlLoop2.setServices(controlLoop2_services);
- Resource controlLoop2_resource1 = new Resource("resource1", ResourceType.VF);
- Resource controlLoop2_resource2 = new Resource("resource2", ResourceType.VFC);
- List<Resource> controlLoop2_resources = new ArrayList<>();
- controlLoop2_resources.add(controlLoop2_resource1);
- controlLoop2_resources.add(controlLoop2_resource2);
- controlLoop2.setResources(controlLoop2_resources);
- controlLoop2.setPnf(pnf);
- controlLoop2.setTrigger_policy(triggerPolicy);
- controlLoop2.setTimeout(timeout);
- controlLoop1.setAbatement(abatement);
-
- assertTrue(controlLoop1.equals(controlLoop2));
- assertEquals(controlLoop1.hashCode(), controlLoop2.hashCode());
- }
-
- @Test
+
+ @Test
+ public void testEqualsSameInstance() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertTrue(controlLoop1.equals(controlLoop1));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertFalse(controlLoop1.equals(null));
+ }
+
+ @Test
+ public void testEqualsInstanceOfDiffClass() {
+ ControlLoop controlLoop1 = new ControlLoop();
+ assertFalse(controlLoop1.equals(""));
+ }
+
+ @Test
+ public void testEqualsNoServicesAndResourcesOrTimeout() {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
+ controlLoop1.setPnf(pnf);
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop();
+ controlLoop2.setControlLoopName(controlLoopName);
+ controlLoop2.setVersion(version);
+ controlLoop2.setPnf(pnf);
+ controlLoop2.setTrigger_policy(triggerPolicy);
+ controlLoop2.setAbatement(abatement);
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ }
+
+ @Test
+ public void testEquals() {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
+ Service service1 = new Service("service1");
+ Service service2 = new Service("service2");
+ List<Service> services = new ArrayList<>();
+ services.add(service1);
+ services.add(service2);
+ controlLoop1.setServices(services);
+ Resource resource1 = new Resource("resource1", ResourceType.VF);
+ Resource resource2 = new Resource("resource2", ResourceType.VFC);
+ List<Resource> resources = new ArrayList<>();
+ resources.add(resource1);
+ resources.add(resource2);
+ controlLoop1.setResources(resources);
+ controlLoop1.setPnf(pnf);
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setTimeout(timeout);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop();
+ controlLoop2.setControlLoopName(controlLoopName);
+ controlLoop2.setVersion(version);
+ Service controlLoop2_service1 = new Service("service1");
+ Service controlLoop2_service2 = new Service("service2");
+ List<Service> controlLoop2_services = new ArrayList<>();
+ controlLoop2_services.add(controlLoop2_service1);
+ controlLoop2_services.add(controlLoop2_service2);
+ controlLoop2.setServices(controlLoop2_services);
+ Resource controlLoop2_resource1 = new Resource("resource1", ResourceType.VF);
+ Resource controlLoop2_resource2 = new Resource("resource2", ResourceType.VFC);
+ List<Resource> controlLoop2_resources = new ArrayList<>();
+ controlLoop2_resources.add(controlLoop2_resource1);
+ controlLoop2_resources.add(controlLoop2_resource2);
+ controlLoop2.setResources(controlLoop2_resources);
+ controlLoop2.setPnf(pnf);
+ controlLoop2.setTrigger_policy(triggerPolicy);
+ controlLoop2.setTimeout(timeout);
+ controlLoop1.setAbatement(abatement);
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ assertEquals(controlLoop1.hashCode(), controlLoop2.hashCode());
+ }
+
+ @Test
@Ignore
// I'VE MARKED THIS TEST CASE AS IGNORE BECAUSE THE TEST CASE FAILS
- // This test case fails because the ControlLoop(ControlLoop controlLoop) constructor.
+ // This test case fails because the ControlLoop(ControlLoop controlLoop) constructor.
// does not copy the value of pnf and version into the newly created object
// PLEASE ADVISE IF THE EXISTING BEHAVIOUR IS CORRECT
- public void testControlLoop() {
- final PNF pnf = new PNF();
- pnf.setPNFName("pnf 1");
-
- ControlLoop controlLoop1 = new ControlLoop();
- controlLoop1.setControlLoopName(controlLoopName);
- controlLoop1.setVersion(version);
+ public void testControlLoop() {
+ final Pnf pnf = new Pnf();
+ pnf.setPnfName("pnf 1");
+
+ ControlLoop controlLoop1 = new ControlLoop();
+ controlLoop1.setControlLoopName(controlLoopName);
+ controlLoop1.setVersion(version);
Service service1 = new Service("service1");
Service service2 = new Service("service2");
List<Service> services = new ArrayList<>();
@@ -152,20 +155,20 @@ public class ControlLoopTest {
resources.add(resource2);
controlLoop1.setResources(resources);
controlLoop1.setPnf(pnf);
- controlLoop1.setTrigger_policy(triggerPolicy);
- controlLoop1.setAbatement(abatement);
-
- ControlLoop controlLoop2 = new ControlLoop(controlLoop1);
-
- assertEquals(controlLoop1.getControlLoopName(), controlLoop2.getControlLoopName());
- assertEquals(controlLoop1.getVersion(), controlLoop2.getVersion());
- assertEquals(controlLoop1.getServices(), controlLoop2.getServices());
- assertEquals(controlLoop1.getResources(), controlLoop2.getResources());
- assertEquals(controlLoop1.getPnf(), controlLoop2.getPnf());
- assertEquals(controlLoop1.getTrigger_policy(), controlLoop2.getTrigger_policy());
- assertEquals(controlLoop1.getAbatement(), controlLoop2.getAbatement());
-
- assertTrue(controlLoop1.equals(controlLoop2));
- }
+ controlLoop1.setTrigger_policy(triggerPolicy);
+ controlLoop1.setAbatement(abatement);
+
+ ControlLoop controlLoop2 = new ControlLoop(controlLoop1);
+
+ assertEquals(controlLoop1.getControlLoopName(), controlLoop2.getControlLoopName());
+ assertEquals(controlLoop1.getVersion(), controlLoop2.getVersion());
+ assertEquals(controlLoop1.getServices(), controlLoop2.getServices());
+ assertEquals(controlLoop1.getResources(), controlLoop2.getResources());
+ assertEquals(controlLoop1.getPnf(), controlLoop2.getPnf());
+ assertEquals(controlLoop1.getTrigger_policy(), controlLoop2.getTrigger_policy());
+ assertEquals(controlLoop1.getAbatement(), controlLoop2.getAbatement());
+
+ assertTrue(controlLoop1.equals(controlLoop2));
+ }
}
diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
index 627e9311e..411a0caed 100644
--- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
+++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java
@@ -29,7 +29,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.onap.policy.aai.AAINQRequest;
+import org.onap.policy.aai.AaiNqRequest;
import org.onap.policy.aai.util.Serialization;
@Path("/aai")
@@ -62,7 +62,7 @@ public class AaiSimulatorJaxRs {
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
public String aaiPostQuery(String req) {
- AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class);
+ AaiNqRequest request = Serialization.gsonPretty.fromJson(req, AaiNqRequest.class);
if (request.getInstanceFilters().getInstanceFilter().get(0).containsKey("vserver")) {
String vserverName =
diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
index 89208d2c6..e42d5574c 100644
--- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
+++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java
@@ -32,13 +32,13 @@ import java.util.UUID;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.AAINQInstanceFilters;
-import org.onap.policy.aai.AAINQNamedQuery;
-import org.onap.policy.aai.AAINQQueryParameters;
-import org.onap.policy.aai.AAINQRequest;
-import org.onap.policy.aai.AAINQResponse;
+import org.onap.policy.aai.AaiGetVnfResponse;
+import org.onap.policy.aai.AaiManager;
+import org.onap.policy.aai.AaiNqInstanceFilters;
+import org.onap.policy.aai.AaiNqNamedQuery;
+import org.onap.policy.aai.AaiNqQueryParameters;
+import org.onap.policy.aai.AaiNqRequest;
+import org.onap.policy.aai.AaiNqResponse;
import org.onap.policy.drools.http.server.HttpServletServer;
import org.onap.policy.drools.utils.LoggerUtil;
import org.onap.policy.rest.RESTManager;
@@ -66,7 +66,7 @@ public class AaiSimulatorTest {
@Test
public void testGet() {
- final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID(
+ final AaiGetVnfResponse response = new AaiManager(new RESTManager()).getQueryByVnfId(
"http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass",
UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792");
assertNotNull(response);
@@ -75,10 +75,10 @@ public class AaiSimulatorTest {
@Test
public void testPost() {
- final AAINQRequest request = new AAINQRequest();
- final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters();
- final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery();
- tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
+ final AaiNqRequest request = new AaiNqRequest();
+ final AaiNqQueryParameters tempQueryParameters = new AaiNqQueryParameters();
+ final AaiNqNamedQuery tempNamedQuery = new AaiNqNamedQuery();
+ tempNamedQuery.setNamedQueryUuid(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
tempQueryParameters.setNamedQuery(tempNamedQuery);
request.setQueryParameters(tempQueryParameters);
Map<String, String> tempInnerMap = new HashMap<>();
@@ -87,16 +87,16 @@ public class AaiSimulatorTest {
tempOuterMap.put("vserver", tempInnerMap);
List<Map<String, Map<String, String>>> tempInstanceFilter = new LinkedList<>();
tempInstanceFilter.add(tempOuterMap);
- AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters();
+ AaiNqInstanceFilters tempInstanceFilters = new AaiNqInstanceFilters();
tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
request.setInstanceFilters(tempInstanceFilters);
- AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser",
+ AaiNqResponse response = new AaiManager(new RESTManager()).postQuery("http://localhost:6666", "testUser",
"testPass", request, UUID.randomUUID());
assertNotNull(response);
assertNotNull(response.getInventoryResponseItems());
- tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"));
+ tempNamedQuery.setNamedQueryUuid(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"));
tempQueryParameters.setNamedQuery(tempNamedQuery);
request.setQueryParameters(tempQueryParameters);
tempInnerMap = new HashMap<>();
@@ -105,11 +105,11 @@ public class AaiSimulatorTest {
tempOuterMap.put("generic-vnf", tempInnerMap);
tempInstanceFilter = new LinkedList<>();
tempInstanceFilter.add(tempOuterMap);
- tempInstanceFilters = new AAINQInstanceFilters();
+ tempInstanceFilters = new AaiNqInstanceFilters();
tempInstanceFilters.setInstanceFilter(tempInstanceFilter);
request.setInstanceFilters(tempInstanceFilters);
- response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request,
+ response = new AaiManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request,
UUID.randomUUID());
assertNotNull(response);
assertNotNull(response.getInventoryResponseItems());
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
index 520425746..f5f82e02a 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -32,7 +32,6 @@ import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS;
import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager;
import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
-import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.CommonHeader;
diff --git a/controlloop/templates/archetype-cl-beijing/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-beijing/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
index cb0a716aa..62bfb3ea5 100644
--- a/controlloop/templates/archetype-cl-beijing/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/archetype-cl-beijing/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
@@ -33,7 +33,6 @@ import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager;
import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS;
import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager;
import org.onap.policy.controlloop.actor.so.SOActorServiceProvider;
-import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.CommonHeader;
@@ -1236,4 +1235,4 @@ rule "EVENT.CLEANUP"
$clName, drools.getRule().getName(), $event);
retract($event);
-end \ No newline at end of file
+end