From e55d256a9eeb411bb485919eb4c1d449cbae5d46 Mon Sep 17 00:00:00 2001 From: shaoqiu Date: Tue, 2 Apr 2019 12:33:04 +0000 Subject: update dependency to policy/models Update the dependency of model-impl from drools-applications to policy/models. Issue-ID: POLICY-1264 Change-Id: I07fcb29501499a97689d2d27c845bf8e411e7825 Signed-off-by: shaoqiu Signed-off-by: Pamela Dragosh --- controlloop/common/controller-usecases/pom.xml | 75 +++++++++++----------- controlloop/common/eventmanager/pom.xml | 73 ++++++++++----------- .../eventmanager/ControlLoopOperationManager.java | 49 +++++++------- .../common/feature-controlloop-management/pom.xml | 75 +++++++++++----------- .../src/test/resources/op.pom | 9 +-- .../common/feature-controlloop-trans/pom.xml | 5 +- .../common/feature-controlloop-utils/pom.xml | 21 +++--- controlloop/common/guard/pom.xml | 10 +-- controlloop/common/policy-yaml/pom.xml | 9 +-- controlloop/common/pom.xml | 4 -- controlloop/common/simulators/pom.xml | 17 ++--- .../main/resources/__closedLoopControlName__.drl | 41 ++++++++++-- .../main/resources/__closedLoopControlName__.drl | 40 ++++++++++-- .../main/resources/__closedLoopControlName__.drl | 27 ++++++-- controlloop/templates/template.demo/pom.xml | 7 +- .../org/onap/policy/template/demo/SupportUtil.java | 2 +- 16 files changed, 275 insertions(+), 189 deletions(-) diff --git a/controlloop/common/controller-usecases/pom.xml b/controlloop/common/controller-usecases/pom.xml index 29fd55572..918f350b7 100644 --- a/controlloop/common/controller-usecases/pom.xml +++ b/controlloop/common/controller-usecases/pom.xml @@ -4,6 +4,7 @@ ONAP ================================================================================ Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -73,63 +74,63 @@ - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl events - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appclcm - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnr - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl vfc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl so - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl trafficgenerator - ${project.version} + ${policy.models.version} provided @@ -145,51 +146,51 @@ provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actorServiceProvider - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appclcm - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnr - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.so - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.vfc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common - policy-yaml - ${project.version} + org.onap.policy.models.policy-models-interactions + model-yaml + ${policy.models.version} provided diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml index 32cda44d4..55a6e4007 100644 --- a/controlloop/common/eventmanager/pom.xml +++ b/controlloop/common/eventmanager/pom.xml @@ -3,6 +3,7 @@ eventmanager ================================================================================ Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -42,45 +43,45 @@ provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actorServiceProvider - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnr - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.so - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.vfc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appclcm - ${project.version} + ${policy.models.version} provided @@ -90,45 +91,45 @@ provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl events - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnr - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl vfc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appclcm - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl trafficgenerator - ${project.version} + ${policy.models.version} provided @@ -147,21 +148,21 @@ provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl so - ${project.version} + ${policy.models.version} provided @@ -188,9 +189,9 @@ test - org.onap.policy.drools-applications.controlloop.common + org.onap.policy.models.policy-models-interactions simulators - ${project.version} + ${policy.models.version} test 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 9d60e2d86..1234a8ae1 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 @@ -29,10 +29,8 @@ import java.util.LinkedList; import java.util.List; import java.util.NoSuchElementException; import java.util.Properties; - 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.appc.Response; @@ -88,7 +86,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Construct an instance. - * + * * @param onset the onset event * @param policy the policy * @param em the event manager @@ -114,7 +112,9 @@ public class ControlLoopOperationManager implements Serializable { * yaml, the target vnf-id is retrieved by a named query to A&AI. */ String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery(policy.getTarget().getResourceID(), - this.targetEntity); + this.targetEntity, PolicyEngine.manager.getEnvironmentProperty("aai.url"), + PolicyEngine.manager.getEnvironmentProperty("aai.username"), + PolicyEngine.manager.getEnvironmentProperty("aai.password")); this.targetEntity = targetVnf; } break; @@ -156,7 +156,7 @@ public class ControlLoopOperationManager implements Serializable { // private class Operation implements Serializable { private static final long serialVersionUID = 1L; - + private ControlLoopOperation clOperation = new ControlLoopOperation(); private PolicyResult policyResult = null; private int attempt = 0; @@ -182,7 +182,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the target for a policy. - * + * * @param policy the policy * @return the target * @throws ControlLoopException if an error occurs @@ -233,7 +233,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Start an operation. - * + * * @param onset the onset event * @return the operation request * @throws ControlLoopException if an error occurs @@ -288,7 +288,10 @@ public class ControlLoopOperationManager implements Serializable { return operationRequest; case "VFC": this.operationRequest = VfcActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, - operation.clOperation, this.policy, this.eventManager.getVnfResponse()); + operation.clOperation, this.policy, this.eventManager.getVnfResponse(), + PolicyEngine.manager.getEnvironmentProperty("vfc.url"), + PolicyEngine.manager.getEnvironmentProperty("vfc.username"), + PolicyEngine.manager.getEnvironmentProperty("vfc.password")); this.currentOperation = operation; if (this.operationRequest == null) { this.policyResult = PolicyResult.FAILURE; @@ -325,7 +328,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Handle a response. - * + * * @param response the response * @return a PolicyResult */ @@ -370,7 +373,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method handles operation responses from APPC. - * + * * @param appcResponse the APPC response * @return The result of the response handling */ @@ -463,7 +466,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method handles operation responses from LCM. - * + * * @param dmaapResponse the LCM response * @return The result of the response handling */ @@ -496,7 +499,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method handles operation responses from SDNR. - * + * * @param dmaapResponse the SDNR response * @return the result of the response handling */ @@ -529,7 +532,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method handles operation responses from SO. - * + * * @param msoResponse the SO response * @return The result of the response handling */ @@ -561,7 +564,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method handles operation responses from VFC. - * + * * @param vfcResponse the VFC response * @return The result of the response handling */ @@ -621,7 +624,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the operation timeout. - * + * * @return the timeout */ public Integer getOperationTimeout() { @@ -638,7 +641,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the operation timeout as a String. - * + * * @param defaultTimeout the default timeout * @return the timeout as a String */ @@ -656,7 +659,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the operation as a message. - * + * * @return the operation as a message */ public String getOperationMessage() { @@ -672,7 +675,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the operation as a message including the guard result. - * + * * @param guardResult the guard result * @return the operation as a message including the guard result */ @@ -689,7 +692,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the operation history. - * + * * @return the operation history */ public String getOperationHistory() { @@ -705,7 +708,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Get the history. - * + * * @return the list of control loop operations */ public List getHistory() { @@ -743,7 +746,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Is the operation complete. - * + * * @return true if the operation is complete, false otherwise */ public boolean isOperationComplete() { @@ -800,7 +803,7 @@ public class ControlLoopOperationManager implements Serializable { /** * This method verifies that the operation manager may run an operation. - * + * * @return True if the operation can run, false otherwise * @throws ControlLoopException if the operation cannot run */ @@ -961,7 +964,7 @@ public class ControlLoopOperationManager implements Serializable { */ public void commitAbatement(String message, String outcome) { logger.info("commitAbatement: {}. {}", message, outcome); - + if (this.currentOperation == null) { try { this.currentOperation = this.operationHistory.getLast(); diff --git a/controlloop/common/feature-controlloop-management/pom.xml b/controlloop/common/feature-controlloop-management/pom.xml index e4c2d3504..40e37beff 100644 --- a/controlloop/common/feature-controlloop-management/pom.xml +++ b/controlloop/common/feature-controlloop-management/pom.xml @@ -3,6 +3,7 @@ ONAP ================================================================================ Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -96,54 +97,54 @@ - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl events - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appc - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl appclcm - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnc - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnr - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl vfc - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl so - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdc - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl trafficgenerator - ${project.version} + ${policy.models.version} org.onap.policy.drools-applications.controlloop.common @@ -156,9 +157,9 @@ ${project.version} - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actorServiceProvider - ${project.version} + ${policy.models.version} guava @@ -167,9 +168,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appc - ${project.version} + ${policy.models.version} guava @@ -178,9 +179,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.appclcm - ${project.version} + ${policy.models.version} guava @@ -189,9 +190,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnr - ${project.version} + ${policy.models.version} guava @@ -200,9 +201,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.so - ${project.version} + ${policy.models.version} guava @@ -211,9 +212,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.vfc - ${project.version} + ${policy.models.version} guava @@ -222,9 +223,9 @@ - org.onap.policy.drools-applications.controlloop.common.actors + org.onap.policy.models.policy-models-interactions.model-actors actor.sdnc - ${project.version} + ${policy.models.version} guava @@ -233,9 +234,9 @@ - org.onap.policy.drools-applications.controlloop.common - policy-yaml - ${project.version} + org.onap.policy.models.policy-models-interactions + model-yaml + ${policy.models.version} guava diff --git a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom index 133387217..4285acda6 100644 --- a/controlloop/common/feature-controlloop-management/src/test/resources/op.pom +++ b/controlloop/common/feature-controlloop-management/src/test/resources/op.pom @@ -4,6 +4,7 @@ ONAP ================================================================================ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,9 +26,9 @@ 4.0.0 - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl model-impl - 1.4.0-SNAPSHOT + 2.0.0-SNAPSHOT org.onap.policy.drools.apps.test @@ -36,9 +37,9 @@ - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl events - 1.4.0-SNAPSHOT + 2.0.0-SNAPSHOT provided diff --git a/controlloop/common/feature-controlloop-trans/pom.xml b/controlloop/common/feature-controlloop-trans/pom.xml index 0aa320ad3..4d9080616 100644 --- a/controlloop/common/feature-controlloop-trans/pom.xml +++ b/controlloop/common/feature-controlloop-trans/pom.xml @@ -3,6 +3,7 @@ ONAP ================================================================================ Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -124,9 +125,9 @@ - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl events - ${project.version} + ${policy.models.version} org.onap.policy.common diff --git a/controlloop/common/feature-controlloop-utils/pom.xml b/controlloop/common/feature-controlloop-utils/pom.xml index 92b783885..a96d62e07 100644 --- a/controlloop/common/feature-controlloop-utils/pom.xml +++ b/controlloop/common/feature-controlloop-utils/pom.xml @@ -3,6 +3,7 @@ ONAP ================================================================================ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -105,29 +106,29 @@ provided - org.onap.policy.drools-applications.controlloop.common + org.onap.policy.models.policy-models-interactions simulators - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl so - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnc - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl rest - ${project.version} + ${policy.models.version} junit diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml index d1beed58d..07aa304b7 100644 --- a/controlloop/common/guard/pom.xml +++ b/controlloop/common/guard/pom.xml @@ -30,9 +30,9 @@ - org.onap.policy.drools-applications.controlloop.common - policy-yaml - ${project.version} + org.onap.policy.models.policy-models-interactions + model-yaml + ${policy.models.version} provided @@ -113,9 +113,9 @@ provided - org.onap.policy.drools-applications.controlloop.common + org.onap.policy.models.policy-models-interactions simulators - ${project.version} + ${policy.models.version} test diff --git a/controlloop/common/policy-yaml/pom.xml b/controlloop/common/policy-yaml/pom.xml index 526945bbf..548c92896 100644 --- a/controlloop/common/policy-yaml/pom.xml +++ b/controlloop/common/policy-yaml/pom.xml @@ -3,6 +3,7 @@ drools-pdp-apps ================================================================================ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,15 +52,15 @@ 0.9.2 - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdc - ${project.version} + ${policy.models.version} provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} provided diff --git a/controlloop/common/pom.xml b/controlloop/common/pom.xml index 020a1efbc..d9165ae3c 100644 --- a/controlloop/common/pom.xml +++ b/controlloop/common/pom.xml @@ -32,13 +32,9 @@ common - actors guard coordination eventmanager - model-impl - policy-yaml - simulators controller-usecases feature-controlloop-utils feature-controlloop-trans diff --git a/controlloop/common/simulators/pom.xml b/controlloop/common/simulators/pom.xml index a837ce311..0bbb24b6e 100644 --- a/controlloop/common/simulators/pom.xml +++ b/controlloop/common/simulators/pom.xml @@ -3,6 +3,7 @@ simulators ================================================================================ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -41,19 +42,19 @@ test - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl aai - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl so - ${project.version} + ${policy.models.version} - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl vfc - ${project.version} + ${policy.models.version} test @@ -68,9 +69,9 @@ provided - org.onap.policy.drools-applications.controlloop.common.model-impl + org.onap.policy.models.policy-models-interactions.model-impl sdnc - ${project.version} + ${policy.models.version} 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 5b012d3b5..6a73f8e8f 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 @@ -48,6 +48,7 @@ import org.onap.policy.sdnr.PciResponse; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; +import org.onap.policy.so.SoManager; import org.onap.policy.so.SoRequest; import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.sdnc.SdncRequest; @@ -579,14 +580,34 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received - SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), - request); + class mySoCallback implements SoManager.SoCallback { + public void onSoResponseWrapper(SoResponseWrapper wrapper) { + drools.getWorkingMemory().insert(wrapper); + } + } + SoActorServiceProvider.sendRequest($event.getRequestId().toString(), + new mySoCallback(), + request, + PolicyEngine.manager.getEnvironmentProperty("so.url"), + PolicyEngine.manager.getEnvironmentProperty("so.username"), + PolicyEngine.manager.getEnvironmentProperty("so.password")); } break; case "VFC": if (request instanceof VfcRequest) { // Start VFC thread - Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); + class myVfcCallback implements VfcManager.VfcCallback { + + public void onResponse(VfcResponse responseError) { + drools.getWorkingMemory().insert(responseError); + } + }; + // Start VFC thread + Thread t = new Thread(new VfcManager(new myVfcCallback(), + (VfcRequest)request, + PolicyEngine.manager.getEnvironmentProperty("vfc.url"), + PolicyEngine.manager.getEnvironmentProperty("vfc.username"), + PolicyEngine.manager.getEnvironmentProperty("vfc.password"))); t.start(); } break; @@ -594,8 +615,18 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" case "SDNC": if (request instanceof SdncRequest) { // Start SDNC thread - Thread t = new Thread(new SdncManager(drools.getWorkingMemory(), (SdncRequest)request)); - t.start(); + class mySdncCallback implements SdncManager.SdncCallback { + public void onCallback(SdncResponse response) { + drools.getWorkingMemory().insert(response); + } + } + // Start SDNC thread + Thread t = new Thread(new SdncManager(new mySdncCallback(), + (SdncRequest)request, + PolicyEngine.manager.getEnvironmentProperty("sdnc.url"), + PolicyEngine.manager.getEnvironmentProperty("sdnc.username"), + PolicyEngine.manager.getEnvironmentProperty("sdnc.password"))); + t.start(); } break; case "SDNR": diff --git a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index b0262f989..93bc63ea7 100644 --- a/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-usecases/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -49,6 +49,7 @@ import org.onap.policy.sdnr.PciResponse; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; +import org.onap.policy.so.SoManager; import org.onap.policy.so.SoRequest; import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.sdnc.SdncRequest; @@ -529,13 +530,33 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received - SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); + class mySoCallback implements SoManager.SoCallback { + public void onSoResponseWrapper(SoResponseWrapper wrapper) { + drools.getWorkingMemory().insert(wrapper); + } + } + SoActorServiceProvider.sendRequest($event.getRequestId().toString(), + new mySoCallback(), + request, + PolicyEngine.manager.getEnvironmentProperty("so.url"), + PolicyEngine.manager.getEnvironmentProperty("so.username"), + PolicyEngine.manager.getEnvironmentProperty("so.password")); } break; case "VFC": if (request instanceof VfcRequest) { + class myVfcCallback implements VfcManager.VfcCallback { + + public void onResponse(VfcResponse responseError) { + drools.getWorkingMemory().insert(responseError); + } + }; // Start VFC thread - Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); + Thread t = new Thread(new VfcManager(new myVfcCallback(), + (VfcRequest)request, + PolicyEngine.manager.getEnvironmentProperty("vfc.url"), + PolicyEngine.manager.getEnvironmentProperty("vfc.username"), + PolicyEngine.manager.getEnvironmentProperty("vfc.password"))); t.start(); } break; @@ -547,9 +568,18 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" case "SDNC": if (request instanceof SdncRequest) { - // Start SDNC thread - Thread t = new Thread(new SdncManager(drools.getWorkingMemory(), (SdncRequest)request)); - t.start(); + class mySdncCallback implements SdncManager.SdncCallback { + public void onCallback(SdncResponse response) { + drools.getWorkingMemory().insert(response); + } + } + // Start SDNC thread + Thread t = new Thread(new SdncManager(new mySdncCallback(), + (SdncRequest)request, + PolicyEngine.manager.getEnvironmentProperty("sdnc.url"), + PolicyEngine.manager.getEnvironmentProperty("sdnc.username"), + PolicyEngine.manager.getEnvironmentProperty("sdnc.password"))); + t.start(); } break; } diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl index f2584c063..1d8e6c511 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -45,6 +45,7 @@ import org.onap.policy.appclcm.LcmCommonHeader; import org.onap.policy.vfc.VfcRequest; import org.onap.policy.vfc.VfcResponse; import org.onap.policy.vfc.VfcManager; +import org.onap.policy.so.SoManager; import org.onap.policy.so.SoRequest; import org.onap.policy.so.SoResponseWrapper; import org.onap.policy.guard.PolicyGuard; @@ -584,14 +585,32 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" if(request instanceof SoRequest) { // Call SO. The response will be inserted into memory once it's received - SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), - request); - } + class mySoCallback implements SoManager.SoCallback { + public void onSoResponseWrapper(SoResponseWrapper wrapper) { + drools.getWorkingMemory().insert(wrapper); + } + } + SoActorServiceProvider.sendRequest($event.getRequestId().toString(), + new mySoCallback(), + request, + PolicyEngine.manager.getEnvironmentProperty("so.url"), + PolicyEngine.manager.getEnvironmentProperty("so.username"), + PolicyEngine.manager.getEnvironmentProperty("so.password")); } break; case "VFC": if (request instanceof VfcRequest) { // Start VFC thread - Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request)); + class myVfcCallback implements VfcManager.VfcCallback { + public void onResponse(VfcResponse responseError) { + drools.getWorkingMemory().insert(responseError); + } + }; + // Start VFC thread + Thread t = new Thread(new VfcManager(new myVfcCallback(), + (VfcRequest)request, + PolicyEngine.manager.getEnvironmentProperty("vfc.url"), + PolicyEngine.manager.getEnvironmentProperty("vfc.username"), + PolicyEngine.manager.getEnvironmentProperty("vfc.password"))); t.start(); } break; diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml index 446117e1f..2471f9200 100644 --- a/controlloop/templates/template.demo/pom.xml +++ b/controlloop/templates/template.demo/pom.xml @@ -126,10 +126,9 @@ provided - org.onap.policy.drools-applications.controlloop.common - - policy-yaml - ${project.version} + org.onap.policy.models.policy-models-interactions + model-yaml + ${policy.models.version} provided diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java index 00949599e..d5eb28e23 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/SupportUtil.java @@ -332,7 +332,7 @@ public final class SupportUtil { * Set the VFC properties. */ public static void setVfcProps() { - PolicyEngine.manager.setEnvironmentProperty("vfc.url", "http://localhost:6668"); + PolicyEngine.manager.setEnvironmentProperty("vfc.url", "http://localhost:6668/api/nslcm/v1"); PolicyEngine.manager.setEnvironmentProperty("vfc.username", "VFC"); PolicyEngine.manager.setEnvironmentProperty("vfc.password", "VFC"); } -- cgit 1.2.3-korg