import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider;
+import org.onap.policy.aai.AAIGETVnfResponse;
import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Request;
* @return an APPC request conforming to the legacy API
* @throws AAIException
*/
- public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) throws AAIException {
+ public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
+ Policy policy, AAIGETVnfResponse vnfResponse) throws AAIException {
/*
* Construct an APPC request
*/
* specified in the yaml, the target vnf-id is retrieved by
* a named query to A&AI.
*/
- String vnfId;
- if (onset.AAI.get("generic-vnf.vnf-id").equalsIgnoreCase(policy.getTarget().getResourceID())) {
- vnfId = onset.AAI.get("generic-vnf.vnf-id");
+ String sourceVnf = onset.AAI.get("generic-vnf.vnf-id");
+ if (sourceVnf == null) {
+ /*
+ * Lets see if the vnf-name is provided
+ */
+ sourceVnf = vnfResponse.vnfID;
+ if (sourceVnf == null) {
+ throw new AAIException("No vnf-id found");
+ }
}
- else {
- vnfId = AppcLcmActorServiceProvider.vnfNamedQuery(
- policy.getTarget().getResourceID(), onset.AAI.get("generic-vnf.vnf-id"));
- }
-
- if (vnfId == null) {
- throw new AAIException("No vnf id found");
- }
-
+ String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery(
+ policy.getTarget().getResourceID(), sourceVnf);
+
/*
* For now Policy generates the PG Streams as a demo, in the
* future the payload can be provided by CLAMP
*/
- request.Payload.put("generic-vnf.vnf-id", vnfId);
+ request.Payload.put("generic-vnf.vnf-id", targetVnf);
PGRequest pgRequest = new PGRequest();
pgRequest.pgStreams = new PGStreams();
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.policy.aai.AAIGETVnfResponse;
import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
private static VirtualControlLoopEvent onsetEvent;
private static ControlLoopOperation operation;
private static Policy policy;
+ private static AAIGETVnfResponse aaiResponse;
static {
/*
onsetEvent.requestID = UUID.randomUUID();
onsetEvent.closedLoopEventClient = "tca.instance00001";
onsetEvent.target_type = ControlLoopTargetType.VNF;
- onsetEvent.target = "generic-vnf.vnf-id";
+ onsetEvent.target = "generic-vnf.vnf-name";
onsetEvent.from = "DCAE";
onsetEvent.closedLoopAlarmStart = Instant.now();
onsetEvent.AAI = new HashMap<>();
- onsetEvent.AAI.put("generic-vnf.vnf-id", "fw0001vm001fw001");
+ onsetEvent.AAI.put("generic-vnf.vnf-name", "fw0001vm001fw001");
onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
/* Construct an operation with an APPC actor and ModifyConfig operation. */
policy.setRetry(2);
policy.setTimeout(300);
+ /* Construct a mock A&AI response */
+ aaiResponse = new AAIGETVnfResponse();
+ aaiResponse.vnfID = "vnf01";
+
/* Set environment properties */
PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
Request appcRequest = null;
try {
- appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy);
+ appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy, aaiResponse);
} catch (AAIException e) {
logger.warn(e.toString());
fail("no vnfid found");
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>simulators</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
import org.onap.policy.aai.AAINQInstanceFilters;
import org.onap.policy.aai.AAINQInventoryResponseItem;
+import org.onap.policy.aai.AAIGETVnfResponse;
import org.onap.policy.aai.AAIManager;
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;
* the vnf id of the source entity reporting the alert
*
* @return the target entities vnf id to act upon
+ * @throws AAIException
*/
- public static String vnfNamedQuery(String resourceId, String sourceVnfId) {
+ 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");
aaiUrl,
aaiUsername, aaiPassword,
aaiRequest, requestId);
+
+ if (aaiResponse == null) {
+ throw new AAIException("The named query response was null");
+ }
- //TODO: What if the resourceId never matches?
String targetVnfId = parseAAIResponse(aaiResponse.inventoryResponseItems, resourceId);
+ if (targetVnfId == null) {
+ throw new AAIException("Target vnf-id could not be found");
+ }
return targetVnfId;
}
* the policy the was specified from the yaml generated
* by CLAMP or through the Policy GUI/API
* @return an APPC request conforming to the lcm API using the DMAAP wrapper
+ * @throws AAIException
*/
- public static LCMRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
- Policy policy) {
+ public static LCMRequestWrapper constructRequest(VirtualControlLoopEvent onset,
+ ControlLoopOperation operation, Policy policy, AAIGETVnfResponse vnfResponse) throws AAIException {
/* Construct an APPC request using LCM Model */
* a vnf-id.
*/
HashMap<String, String> requestActionIdentifiers = new HashMap<>();
- requestActionIdentifiers.put("vnf-id", onset.AAI.get(DCAE_VNF_ID));
+ String vnfId = onset.AAI.get(DCAE_VNF_ID);
+ if (vnfId == null) {
+ vnfId = vnfResponse.vnfID;
+ if (vnfId == null) {
+ throw new AAIException("No vnf-id found");
+ }
+ }
+ requestActionIdentifiers.put("vnf-id", vnfId);
+
appcRequest.setActionIdentifiers(requestActionIdentifiers);
/*
import java.util.HashMap;
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.util.AAIException;
import org.onap.policy.appclcm.LCMCommonHeader;
import org.onap.policy.appclcm.LCMRequest;
import org.onap.policy.appclcm.LCMRequestWrapper;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.policy.Target;
import org.onap.policy.controlloop.policy.TargetType;
+import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.simulators.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static VirtualControlLoopEvent onsetEvent;
private static ControlLoopOperation operation;
private static Policy policy;
+ private static AAIGETVnfResponse aaiResponse;
private static LCMRequestWrapper dmaapRequest;
private static LCMResponseWrapper dmaapResponse;
onsetEvent.requestID = UUID.randomUUID();
onsetEvent.closedLoopEventClient = "tca.instance00001";
onsetEvent.target_type = ControlLoopTargetType.VM;
- onsetEvent.target = "generic-vnf.vnf-id";
+ onsetEvent.target = "generic-vnf.vnf-name";
onsetEvent.from = "DCAE";
onsetEvent.closedLoopAlarmStart = Instant.now();
onsetEvent.AAI = new HashMap<>();
- onsetEvent.AAI.put("generic-vnf.vnf-id", "fw0001vm001fw001");
+ onsetEvent.AAI.put("generic-vnf.vnf-name", "fw0001vm001fw001");
onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
/* Construct an operation with an APPC actor and restart operation. */
policy.setName("Restart the VM");
policy.setDescription("Upon getting the trigger event, restart the VM");
policy.setActor("APPC");
- policy.setTarget(new Target(TargetType.VM));
+ policy.setTarget(new Target(TargetType.VNF));
policy.setRecipe("Restart");
policy.setPayload(null);
policy.setRetry(2);
policy.setTimeout(300);
+
+ /* Construct a mock A&AI response */
+ aaiResponse = new AAIGETVnfResponse();
+ aaiResponse.vnfID = "vnf01";
/* A sample DMAAP request wrapper. */
dmaapRequest = new LCMRequestWrapper();
dmaapResponse.setCorrelationId(onsetEvent.requestID.toString() + "-" + "1");
dmaapResponse.setRpcName(policy.getRecipe().toLowerCase());
dmaapResponse.setType("response");
-
+
+ /* Set environment properties */
+ PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
+ PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
+ PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+
/* A sample APPC LCM request. */
LCMRequest appcRequest = new LCMRequest();
dmaapResponse.setBody(appcResponse);
}
+ @BeforeClass
+ public static void setUpSimulator() {
+ try {
+ Util.buildAaiSim();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
/**
* A test to construct an APPC LCM restart request.
*/
@Test
public void constructRestartRequestTest() {
- LCMRequestWrapper dmaapRequest = AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, policy);
+ LCMRequestWrapper dmaapRequest = null;
+ try {
+ dmaapRequest = AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, policy, aaiResponse);
+ } catch (AAIException e) {
+ logger.warn(e.toString());
+ fail("no vnfid found");
+ }
/* The service provider must return a non null DMAAP request wrapper */
assertNotNull(dmaapRequest);
/* Action Identifiers are required and cannot be null */
assertNotNull(appcRequest.getActionIdentifiers());
assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id"));
+ assertEquals(appcRequest.getActionIdentifiers().get("vnf-id"), "vnf01");
logger.debug("APPC Request: \n" + appcRequest.toString());
}
assertEquals(result.getKey(), PolicyResult.FAILURE_EXCEPTION);
}
-
+ /**
+ * This test ensures that that if the the source entity
+ * is also the target entity, the source will be used for
+ * the APPC request
+ */
+ @Test
+ public void sourceIsTargetTest() {
+ String resourceId = "82194af1-3c2c-485a-8f44-420e22a9eaa4";
+ String targetVnfId = null;
+ try {
+ targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, aaiResponse.vnfID);
+ } catch (AAIException e) {
+ logger.warn(e.toString());
+ fail("no vnf-id found");
+ }
+ assertNotNull(targetVnfId);
+ assertEquals(targetVnfId, aaiResponse.vnfID);
+ }
}
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>simulators</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
this.currentOperation = operation;
if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
- this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
+ this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+ operation.operation, this.policy, eventManager.getVnfResponse());
}
else {
- this.operationRequest = AppcLcmActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy);
+ this.operationRequest = AppcLcmActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset,
+ operation.operation, this.policy, eventManager.getVnfResponse());
}
//
// Save the operation
import java.util.HashMap;
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.appclcm.LCMRequest;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
+import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
static {
onset = new VirtualControlLoopEvent();
onset.requestID = UUID.randomUUID();
- onset.target = "vserver.selflink";
+ onset.target = "generic-vnf.vnf-name";
onset.closedLoopAlarmStart = Instant.now();
onset.AAI = new HashMap<>();
- onset.AAI.put("cloud-region.identity-url", "foo");
- onset.AAI.put("vserver.selflink", "bar");
- onset.AAI.put("vserver.is-closed-loop-disabled", "false");
onset.AAI.put("generic-vnf.vnf-name", "testTriggerSource");
onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+
+ /* Set environment properties */
+ PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
+ PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
+ PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
}
+ @BeforeClass
+ public static void setUpSimulator() {
+ try {
+ org.onap.policy.simulators.Util.buildAaiSim();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
@Test
public void testRetriesFail() {
//
// create the manager
//
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
-
+ try {
+ eventManager.checkEventSyntax(onset);
+ }
+ catch (ControlLoopException e) {
+ logger.warn(e.toString());
+ fail("The onset failed the syntax check");
+ }
+
ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager);
logger.debug("{}",manager);
//
// create the manager
//
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
+ try {
+ eventManager.checkEventSyntax(onset);
+ }
+ catch (ControlLoopException e) {
+ logger.warn(e.toString());
+ fail("The onset failed the syntax check");
+ }
ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager);
//
@Path("/v11/network/generic-vnfs/generic-vnf")
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/json")
- public String getByVnfName (@QueryParam("vnfName") String vnfName)
+ public String getByVnfName (@QueryParam("vnf-name") String vnfName)
{
if ("getFail".equals(vnfName)) {
return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"GET\",\"network/generic-vnfs/generic-vnf\",\"Node Not Found:No Node of type generic-vnf found at network/generic-vnfs/generic-vnf\",\"ERR.5.4.6114\"]}}}";
}
boolean isDisabled = "disableClosedLoop".equals(vnfName);
+ if ("error".equals(vnfName)) {
+ return "{ \"vnf-id\": \"error\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
+
+ }
return "{ \"vnf-id\": \"5e49ca06-2972-4532-9ed4-6d071588d792\", \"vnf-name\": \"" + vnfName + "\", \"vnf-type\": \"RT\", \"service-id\": \"d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4\", \"equipment-role\": \"UCPE\", \"orchestration-status\": \"created\", \"management-option\": \"ATT\", \"ipv4-oam-address\": \"32.40.68.35\", \"ipv4-loopback0-address\": \"32.40.64.57\", \"nm-lan-v6-address\": \"2001:1890:e00e:fffe::1345\", \"management-v6-address\": \"2001:1890:e00e:fffd::36\", \"in-maint\": false, \"is-closed-loop-disabled\": " + isDisabled + ", \"resource-version\": \"1493389458092\", \"relationship-list\": {\"relationship\":[{ \"related-to\": \"service-instance\", \"related-link\": \"/aai/v11/business/customers/customer/1610_Func_Global_20160817084727/service-subscriptions/service-subscription/uCPE-VMS/service-instances/service-instance/USUCP0PCOIL0110UJZZ01\", \"relationship-data\":[{ \"relationship-key\": \"customer.global-customer-id\", \"relationship-value\": \"1610_Func_Global_20160817084727\"},{ \"relationship-key\": \"service-subscription.service-type\", \"relationship-value\": \"uCPE-VMS\"},{ \"relationship-key\": \"service-instance.service-instance-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01\"} ], \"related-to-property\": [{\"property-key\": \"service-instance.service-instance-name\"}]},{ \"related-to\": \"vserver\", \"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USUCP0PCOIL0110UJZZ01%3A%3AuCPE-VMS/vservers/vserver/3b2558f4-39d8-40e7-bfc7-30660fb52c45\", \"relationship-data\":[{ \"relationship-key\": \"cloud-region.cloud-owner\", \"relationship-value\": \"att-aic\"},{ \"relationship-key\": \"cloud-region.cloud-region-id\", \"relationship-value\": \"AAIAIC25\"},{ \"relationship-key\": \"tenant.tenant-id\", \"relationship-value\": \"USUCP0PCOIL0110UJZZ01::uCPE-VMS\"},{ \"relationship-key\": \"vserver.vserver-id\", \"relationship-value\": \"3b2558f4-39d8-40e7-bfc7-30660fb52c45\"} ], \"related-to-property\": [ {\"property-key\": \"vserver.vserver-name\",\"property-value\": \"USUCP0PCOIL0110UJZZ01-vsrx\" }]} ]}}";
}
String policyName = notification.policyName;
if (policyName.endsWith("EVENT")) {
logger.debug("Rule Fired: " + notification.policyName);
- if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-id"))) {
+ if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
assertEquals(ControlLoopNotificationType.REJECTED, notification.notification);
kieSession.halt();
}
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
- event.target = "generic-vnf.vnf-id";
+ event.target = "generic-vnf.vnf-name";
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-id", "testGenericVnfID");
+ event.AAI.put("generic-vnf.vnf-name", "testGenericVnfName");
event.closedLoopEventStatus = status;
kieSession.insert(event);
}
- protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vnfId) {
+ protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vnfName) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
- event.target = "generic-vnf.vnf-id";
+ event.target = "generic-vnf.vnf-name";
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-id", vnfId);
+ event.AAI.put("generic-vnf.vnf-name", vnfName);
event.closedLoopEventStatus = status;
kieSession.insert(event);
}
String policyName = notification.policyName;
if (policyName.endsWith("EVENT")) {
logger.debug("Rule Fired: " + notification.policyName);
- if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-id"))) {
+ if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
assertEquals(ControlLoopNotificationType.REJECTED, notification.notification);
kieSession.halt();
}
}
else if (policyName.endsWith("EVENT.MANAGER")) {
logger.debug("Rule Fired: " + notification.policyName);
- if ("error".equals(notification.AAI.get("generic-vnf.vnf-id"))) {
- assertTrue(ControlLoopNotificationType.FINAL_FAILURE.equals(notification.notification));
+ if ("error".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
assertEquals("Exception in processing closed loop", notification.message);
}
else {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
- event.target = "generic-vnf.vnf-id";
+ event.target = "generic-vnf.vnf-name";
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-id", "testGenericVnfID");
+ event.AAI.put("generic-vnf.vnf-name", "testGenericVnfID");
event.closedLoopEventStatus = status;
kieSession.insert(event);
}
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
event.requestID = requestID;
- event.target = "generic-vnf.vnf-id";
+ event.target = "generic-vnf.vnf-name";
event.closedLoopAlarmStart = Instant.now();
event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-id", vnfId);
+ event.AAI.put("generic-vnf.vnf-name", vnfId);
event.closedLoopEventStatus = status;
kieSession.insert(event);
}