aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java21
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java2
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java128
3 files changed, 76 insertions, 75 deletions
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 4adcff048..559eab9d9 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
@@ -46,6 +46,7 @@ import org.onap.policy.guard.LockCallback;
import org.onap.policy.guard.PolicyGuard;
import org.onap.policy.guard.PolicyGuard.LockResult;
import org.onap.policy.guard.TargetLock;
+import org.onap.policy.rest.RESTManager;
import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -568,7 +569,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-id)");
}
- if (vnfResponse.requestError != null) {
+ if (vnfResponse.getRequestError() != null) {
throw new AAIException("AAI Responded with a request error (query by vnf-id)");
}
if (isClosedLoopDisabled(vnfResponse) == true) {
@@ -579,7 +580,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-name)");
}
- if (vnfResponse.requestError != null) {
+ if (vnfResponse.getRequestError() != null) {
throw new AAIException("AAI Responded with a request error (query by vnf-name)");
}
if (isClosedLoopDisabled(vnfResponse) == true) {
@@ -590,7 +591,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vserverResponse == null) {
throw new AAIException("AAI Response is null (query by vserver-name)");
}
- if (vserverResponse.requestError != null) {
+ if (vserverResponse.getRequestError() != null) {
throw new AAIException("AAI responded with a request error (query by vserver-name)");
}
if (isClosedLoopDisabled(vserverResponse) == true) {
@@ -607,8 +608,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) {
- if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
- String value = aaiResponse.isClosedLoopDisabled;
+ if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) {
+ String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
"yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) {
return true;
@@ -619,8 +620,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVserverResponse aaiResponse) {
- if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
- String value = aaiResponse.isClosedLoopDisabled;
+ if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) {
+ String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
"yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) {
return true;
@@ -659,7 +660,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
String url = aaiHostURL + aaiGetQueryByVserver;
logger.info("url: " + url);
- response = AAIManager.getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName);
+ response = new AAIManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName);
}
} catch (Exception e) {
logger.error("getAAIVserverInfo exception: ", e);
@@ -684,12 +685,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
String url = aaiHostURL + aaiGetQueryByVnfName;
logger.info("url: " + url);
- response = AAIManager.getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName);
+ 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("url: " + url);
- response = AAIManager.getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID);
+ response = 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 d52f7fd47..5084d4cbc 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
@@ -157,7 +157,7 @@ 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().vnfID;
+ String vnfId = this.eventManager.getVnfResponse().getVnfID();
if (vnfId == null) {
throw new AAIException("No vnf-id found");
}
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 99a4c926d..bc832a907 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
@@ -271,46 +271,46 @@ public class ControlLoopEventManagerTest {
public static AAIGETVnfResponse getQueryByVnfID2(String urlGet, String username, String password, UUID requestID, String key) {
AAIGETVnfResponse response = new AAIGETVnfResponse();
- response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491";
- response.vnfName = "lll_vnf_010317";
- response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1";
- response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
- response.orchestrationStatus = "Created";
- response.inMaint = "false";
- response.isClosedLoopDisabled = "false";
- response.resourceVersion = "1494001988835";
- response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa";
+ 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");
RelationshipList relationshipList = new RelationshipList();
Relationship relationship = new Relationship();
RelationshipData relationshipData = new RelationshipData();
RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.relationshipKey = "customer.global-customer-id";
- relationshipDataItem.relationshipValue = "MSO_1610_ST";
+ relationshipDataItem.setRelationshipKey ("customer.global-customer-id");
+ relationshipDataItem.setRelationshipValue("MSO_1610_ST");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-subscription.service-type";
- relationshipDataItem.relationshipValue = "MSO-dev-service-type";
+ relationshipDataItem.setRelationshipKey ("service-subscription.service-type");
+ relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-instance.service-instance-id";
- relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970";
+ 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.propertyKey = "service-instance.service-instance-name";
- item.propertyValue = "lll_svc_010317";
+ item.setPropertyKey("service-instance.service-instance-name");
+ item.setPropertyValue("lll_svc_010317");
relatedToProperty.getRelatedTo().add(item);
- relationship.relatedTo = "service-instance";
- relationship.relatedLink = "/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.relationshipData = relationshipData;
- relationship.relatedToProperty = relatedToProperty;
+ 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.relationshipList = relationshipList;
+ response.setRelationshipList(relationshipList);
return response;
}
@@ -318,46 +318,46 @@ public class ControlLoopEventManagerTest {
public static AAIGETVnfResponse getQueryByVnfName2(String urlGet, String username, String password, UUID requestID, String key) {
AAIGETVnfResponse response = new AAIGETVnfResponse();
- response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491";
- response.vnfName = "lll_vnf_010317";
- response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1";
- response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
- response.orchestrationStatus = "Created";
- response.inMaint = "false";
- response.isClosedLoopDisabled = "false";
- response.resourceVersion = "1494001988835";
- response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa";
+ 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");
RelationshipList relationshipList = new RelationshipList();
Relationship relationship = new Relationship();
RelationshipData relationshipData = new RelationshipData();
RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.relationshipKey = "customer.global-customer-id";
- relationshipDataItem.relationshipValue = "MSO_1610_ST";
+ relationshipDataItem.setRelationshipKey("customer.global-customer-id");
+ relationshipDataItem.setRelationshipValue("MSO_1610_ST");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-subscription.service-type";
- relationshipDataItem.relationshipValue = "MSO-dev-service-type";
+ relationshipDataItem.setRelationshipKey("service-subscription.service-type");
+ relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-instance.service-instance-id";
- relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970";
+ 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.propertyKey = "service-instance.service-instance-name";
- item.propertyValue = "lll_svc_010317";
+ item.setPropertyKey("service-instance.service-instance-name");
+ item.setPropertyValue("lll_svc_010317");
relatedToProperty.getRelatedTo().add(item);
- relationship.relatedTo = "service-instance";
- relationship.relatedLink = "/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.relationshipData = relationshipData;
- relationship.relatedToProperty = relatedToProperty;
+ 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.relationshipList = relationshipList;
+ response.setRelationshipList(relationshipList);
return response;
}
@@ -365,44 +365,44 @@ public class ControlLoopEventManagerTest {
public static AAIGETVserverResponse getQueryByVserverName2(String urlGet, String username, String password, UUID requestID, String key) {
AAIGETVserverResponse response = new AAIGETVserverResponse();
- response.vserverID = "d0668d4f-c25e-4a1b-87c4-83845c01efd8";
- response.vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0";
- response.vserverName2 = "vjunos0";
- response.vserverSelflink = "https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8";
- response.inMaint = "false";
- response.isClosedLoopDisabled = "false";
- response.resourceVersion = "1494001931513";
+ response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8");
+ response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0");
+ response.setVserverName2("vjunos0");
+ response.setVserverSelflink("https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8");
+ response.setInMaint("false");
+ response.setIsClosedLoopDisabled("false");
+ response.setResourceVersion("1494001931513");
RelationshipList relationshipList = new RelationshipList();
Relationship relationship = new Relationship();
RelationshipData relationshipData = new RelationshipData();
RelationshipDataItem relationshipDataItem = new RelationshipDataItem();
- relationshipDataItem.relationshipKey = "customer.global-customer-id";
- relationshipDataItem.relationshipValue = "MSO_1610_ST";
+ relationshipDataItem.setRelationshipKey("customer.global-customer-id");
+ relationshipDataItem.setRelationshipValue("MSO_1610_ST");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-subscription.service-type";
- relationshipDataItem.relationshipValue = "MSO-dev-service-type";
+ relationshipDataItem.setRelationshipKey("service-subscription.service-type");
+ relationshipDataItem.setRelationshipValue("MSO-dev-service-type");
relationshipData.getRelationshipData().add(relationshipDataItem);
- relationshipDataItem.relationshipKey = "service-instance.service-instance-id";
- relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970";
+ 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.propertyKey = "service-instance.service-instance-name";
- item.propertyValue = "lll_svc_010317";
+ item.setPropertyKey("service-instance.service-instance-name");
+ item.setPropertyValue("lll_svc_010317");
relatedToProperty.getRelatedTo().add(item);
- relationship.relatedTo = "service-instance";
- relationship.relatedLink = "/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.relationshipData = relationshipData;
- relationship.relatedToProperty = relatedToProperty;
+ 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.relationshipList = relationshipList;
+ response.setRelationshipList(relationshipList);
return response;
}