diff options
27 files changed, 427 insertions, 119 deletions
diff --git a/ONAP-PDP-REST/pom.xml b/ONAP-PDP-REST/pom.xml index ad7c70c88..b559269b3 100644 --- a/ONAP-PDP-REST/pom.xml +++ b/ONAP-PDP-REST/pom.xml @@ -145,6 +145,12 @@ </exclusions> </dependency> <dependency> + <groupId>com.att.aft</groupId> + <artifactId>dme2</artifactId> + <version>3.1.200-oss</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.9.5</version> diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSParamPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSParamPolicyServiceTest.java index 70b717d9d..8867a7828 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSParamPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSParamPolicyServiceTest.java @@ -79,6 +79,8 @@ public class BRMSParamPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopFaultPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopFaultPolicyServiceTest.java index 458cfc6c6..de884b349 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopFaultPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopFaultPolicyServiceTest.java @@ -68,6 +68,8 @@ public class ClosedLoopFaultPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyServiceTest.java index e00c71d9b..19bb279e6 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyServiceTest.java @@ -68,6 +68,8 @@ public class ClosedLoopPMPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyServiceTest.java index 5236b28c7..0fcb0027c 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyServiceTest.java @@ -93,6 +93,8 @@ public class DecisionPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/FirewallPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/FirewallPolicyServiceTest.java index 111a39f8a..4343a5060 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/FirewallPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/FirewallPolicyServiceTest.java @@ -37,7 +37,8 @@ import org.onap.policy.api.PolicyParameters; public class FirewallPolicyServiceTest { FirewallPolicyService firewallPolicyService = null; - + + @Before public void setUp() throws Exception { Properties prop = new Properties(); @@ -65,6 +66,8 @@ public class FirewallPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test @@ -89,5 +92,4 @@ public class FirewallPolicyServiceTest { String result = firewallPolicyService.getResult(false); assertEquals("success",result); } - } diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/MicroServicesPolicyServiceTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/MicroServicesPolicyServiceTest.java index 6830fccbd..a9301e728 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/MicroServicesPolicyServiceTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/MicroServicesPolicyServiceTest.java @@ -68,6 +68,8 @@ public class MicroServicesPolicyServiceTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.junit = false; } @Test diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java index 13f728790..9d1d13910 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java @@ -31,7 +31,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.api.PolicyException; -import org.onap.policy.rest.XACMLRestProperties; import org.onap.policy.xacml.std.pap.StdPAPPolicy; import org.onap.policy.xacml.std.pap.StdPDPPolicy; @@ -53,6 +52,7 @@ public class PAPServicesTest { @After public void tearDown() throws Exception { + PAPServices.setPaps(null); PAPServices.junit = false; } diff --git a/POLICY-SDK-APP/pom.xml b/POLICY-SDK-APP/pom.xml index 153299eb8..3a8eaa456 100644 --- a/POLICY-SDK-APP/pom.xml +++ b/POLICY-SDK-APP/pom.xml @@ -197,6 +197,10 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </exclusion> </exclusions> </dependency> <dependency> diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index ab4ea6d2d..422c18a31 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -113,7 +113,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; @RequestMapping("/") public class CreateDcaeMicroServiceController extends RestrictedBaseController { private static final Logger LOGGER = FlexLogger.getLogger(CreateDcaeMicroServiceController.class); - + private Map<String, String> matchableValues; private static CommonClassDao commonClassDao; public static CommonClassDao getCommonClassDao() { @@ -151,7 +151,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { public static final String DEFAULT=".default"; public static final String REQUIRED=".required"; public static final String MANYFALSE=":MANY-false"; - + public static final String MATCHABLE=".matchable"; @Autowired private CreateDcaeMicroServiceController(CommonClassDao commonClassDao){ @@ -520,6 +520,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { HashMap<String,String> parseDataNodes(Map<String,String> map){ HashMap<String,String> dataMapForJson=new HashMap <>(); + matchableValues = new HashMap <>(); for(String uniqueDataKey: uniqueDataKeys){ if(uniqueDataKey.contains("%")){ String[] uniqueDataKeySplit= uniqueDataKey.split("%"); @@ -538,6 +539,15 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { String requiredValue= map.get(findRequired); LOGGER.info("requiredValue is:"+ requiredValue); + String matchable =DATATYPE+uniqueDataKeySplit[0]+PROPERTIES+uniqueDataKeySplit[1]+MATCHABLE; + + String matchableValue= map.get(matchable); + + if("true".equalsIgnoreCase(matchableValue)){ + String key=uniqueDataKeySplit[uniqueDataKeySplit.length -1]; + matchableValues.put(key, "matching-true"); + } + StringBuilder attributeIndividualStringBuilder= new StringBuilder(); attributeIndividualStringBuilder.append(typeValue+":defaultValue-"); attributeIndividualStringBuilder.append(defaultValue+":required-"); @@ -545,6 +555,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { dataMapForJson.put(uniqueDataKey, attributeIndividualStringBuilder.toString()); } else if(typeValue != null && typeValue.equalsIgnoreCase(LIST)){ + + String findList= DATATYPE+uniqueDataKeySplit[0]+PROPERTIES+uniqueDataKeySplit[1]+".entry_schema.type"; String listValue=map.get(findList); if(listValue!=null){ @@ -569,6 +581,9 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { break; } else{ + if(constraintsValue.contains("=")){ + constraintsValue = constraintsValue.replace("=", "equal-sign"); + } dataConstraints.add(constraintsValue); dataListBuffer.append(constraintsValue+","); } @@ -588,6 +603,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { dataMapForJson.put(uniqueDataKey, referenceIndividualStringBuilder.toString()); } + }else{ + matchableValues.put(uniqueDataKey, "matching-true"); } } return dataMapForJson; @@ -695,9 +712,15 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { attributeIndividualStringBuilder.append(keyValues.get("default")+":required-"); attributeIndividualStringBuilder.append(keyValues.get("required")+":MANY-false"); attributeStringBuilder.append(attributeIndividualStringBuilder+","); - + if("true".equalsIgnoreCase(keyValues.get("matchable"))){ + matchableValues.put(keySetString, "matching-true"); + } } else if(keyValues.get("type") != null && keyValues.get("type").equalsIgnoreCase(LIST)){ + + if("true".equalsIgnoreCase(keyValues.get("matchable"))){ + matchableValues.put(keySetString, "matching-true"); + } //List Datatype Set<String> keys= keyValues.keySet(); Iterator<String> itr=keys.iterator(); @@ -731,6 +754,9 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } }else{ //User defined Datatype. + if("true".equalsIgnoreCase(keyValues.get("matchable"))){ + matchableValues.put(keySetString, "matching-true"); + } String value=keyValues.get("type"); if(value != null && !value.isEmpty()){ String trimValue=value.substring(value.lastIndexOf('.')+1); @@ -1612,7 +1638,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { msAttributes.setAttribute(returnAttributeList); msAttributes.setSubClass(this.retmap); - + msAttributes.setMatchingSet(matchableValues); HashMap<String, String> returnReferenceList =new HashMap<>(); returnReferenceList.put(className, this.referenceAttributes); msAttributes.setRefAttribute(returnReferenceList); diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java index 083565559..c751c472b 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java @@ -455,63 +455,4 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po } return false; } - - public class PDPGroupItem{ - private final OnapPDPGroup group; - - public PDPGroupItem(OnapPDPGroup itemId) { - this.group = itemId; - } - - public String getId() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getId: " + this.group); - } - return this.group.getId(); - } - - public String getName() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getName: " + this.group); - } - return this.group.getName(); - } - - public String getDescription() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getDescription: " + this.group); - } - return this.group.getDescription(); - } - - public Boolean getDefault() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getDefault: " + this.group); - } - return this.group.isDefaultGroup(); - } - - - public String getStatus() { - return this.group.getStatus().getStatus().toString(); - } - - public Set<PDP> getPDPs() { - return Collections.unmodifiableSet(this.group.getPdps()); - } - - public Set<PDPPolicy> getPolicies() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getPolicies: " + this.group); - } - return this.group.getPolicies(); - } - - public Set<PDPPIPConfig> getPipConfigs() { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("getPIPConfigs: " + this.group); - } - return this.group.getPipConfigs(); - } - } } diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js index 101366400..cfc9bec22 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js @@ -900,6 +900,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind } for (i=0; i < listemunerateValues.length; i += 1) { + + if(listemunerateValues[i].includes("equal-sign")){ + listemunerateValues[i] = listemunerateValues[i].replace('equal-sign','='); + } + option = document.createElement('option'); option.setAttribute('value', listemunerateValues[i]); option.appendChild(document.createTextNode(listemunerateValues[i])); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java index 0c85e7116..95fa962a0 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java @@ -22,43 +22,86 @@ package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.IOException; +import javax.servlet.http.HttpServletResponse; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.web.support.UserUtils; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; +@RunWith(PowerMockRunner.class) public class AutoPushControllerTest { - private PolicyController controller = new PolicyController();; - private AutoPushController apController = new AutoPushController(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void testAutoPushSetGet() throws IOException { - // Get and set tests - apController.setPolicyController(controller); - assertEquals(apController.getPolicyController(), controller); - } - - @Test - public void testNegativeCase1() { - try { - apController.getPolicyGroupContainerData(null, null); - } - catch (Exception ex) { - fail("No exceptions expected, received: " + ex); - } - } - - @Test - public void testNegativeCase2() throws IOException { - thrown.expect(NullPointerException.class); - apController.pushPolicyToPDPGroup(null, null); - } + private PolicyController controller = new PolicyController();; + private AutoPushController apController = new AutoPushController(); - @Test - public void testNegativeCase3() throws IOException { - thrown.expect(NullPointerException.class); - apController.removePDPGroup(null, null); - } + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void testAutoPushSetGet() throws IOException { + // Get and set tests + apController.setPolicyController(controller); + assertEquals(apController.getPolicyController(), controller); + } + + @Test + public void testNegativeCase1() { + try { + apController.getPolicyGroupContainerData(null, null); + } catch (Exception ex) { + fail("No exceptions expected, received: " + ex); + } + } + + @Test + public void testNegativeCase2() throws IOException { + thrown.expect(NullPointerException.class); + apController.pushPolicyToPDPGroup(null, null); + } + + @Test + public void testNegativeCase3() throws IOException { + thrown.expect(NullPointerException.class); + apController.removePDPGroup(null, null); + } + + @Test(expected = NullPointerException.class) + public void testRefresh() throws IOException { + apController.refreshGroups(); + } + + @PrepareForTest({UserUtils.class}) + @Test + public void testRequests() throws Exception { + // Mock user utilities + PowerMockito.mockStatic(UserUtils.class); + User user = new User(); + Mockito.when(UserUtils.getUserSession(Mockito.any())).thenReturn(user); + + // Mock policy controller + PolicyController pController = Mockito.mock(PolicyController.class); + PowerMockito.whenNew(PolicyController.class).withNoArguments().thenReturn(pController); + Mockito.when(pController.getRoles(Mockito.any())).thenReturn(null); + + // Test group container + MockHttpServletRequest request = new MockHttpServletRequest(); + MockHttpServletResponse response = new MockHttpServletResponse(); + apController.getPolicyGroupContainerData(request, response); + assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK); + + // Test push + apController.pushPolicyToPDPGroup(request, response); + assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK); + + // Test remove + apController.removePDPGroup(request, response); + assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK); + } } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java new file mode 100644 index 000000000..920cc97f8 --- /dev/null +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Engine + * ================================================================================ + * Copyright (C) 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.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.policy.rest.util.PolicyContainer.ItemSetChangeListener; +import org.onap.policy.xacml.api.pap.OnapPDP; +import org.onap.policy.xacml.api.pap.OnapPDPGroup; +import org.onap.policy.xacml.api.pap.PAPPolicyEngine; +import com.att.research.xacml.api.pap.PAPException; + +public class PDPGroupContainerTest { + private PAPPolicyEngine engine = Mockito.mock(PAPPolicyEngine.class); + private PDPGroupContainer container = new PDPGroupContainer(engine); + + @Test + public void testContainer() throws PAPException { + Object itemId = new Object(); + assertEquals(container.isSupported(itemId), false); + + container.refreshGroups(); + assertEquals(container.getGroups().size(), 0); + + OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class); + container.makeDefault(group); + OnapPDPGroup newGroup = Mockito.mock(OnapPDPGroup.class); + container.removeGroup(group, newGroup); + OnapPDP pdp = Mockito.mock(OnapPDP.class); + container.updatePDP(pdp); + container.updateGroup(group); + assertNull(container.getContainerPropertyIds()); + assertEquals(container.getItemIds().size(), 0); + assertEquals(container.getType(itemId), null); + assertEquals(container.size(), 0); + assertEquals(container.containsId(itemId), false); + String name = "testName"; + String description = "testDescription"; + container.addNewGroup(name, description); + String id = "testID"; + int jmxport = 0; + container.addNewPDP(id, newGroup, name, description, jmxport); + container.movePDP(pdp, newGroup); + ItemSetChangeListener listener = null; + container.addItemSetChangeListener(listener); + container.nextItemId(itemId); + container.prevItemId(itemId); + container.firstItemId(); + container.lastItemId(); + container.isFirstId(itemId); + container.isLastId(itemId); + container.indexOfId(itemId); + assertEquals(container.getItemIds().size(), 0); + container.removeItem(itemId); + container.removePDP(pdp, newGroup); + } + + @Test(expected=UnsupportedOperationException.class) + public void testAddItem() { + container.addItem(); + } + + @Test(expected=UnsupportedOperationException.class) + public void testAddContainerProperty() { + container.addContainerProperty(null, null, null); + } + + @Test(expected=UnsupportedOperationException.class) + public void testRemoveContainerProperty() { + container.removeContainerProperty(null); + } + + @Test(expected=UnsupportedOperationException.class) + public void testRemoveAllItems() { + container.removeAllItems(); + } + + @Test(expected=UnsupportedOperationException.class) + public void testAddItemAfter() { + container.addItemAfter(null); + } + + @Test(expected=IndexOutOfBoundsException.class) + public void testGetIdByIndex() { + container.getIdByIndex(0); + } + + @Test(expected=UnsupportedOperationException.class) + public void testAddItemAt() { + container.addItemAt(0); + } + + @Test(expected=IllegalArgumentException.class) + public void testGetItemIds() { + container.getItemIds(0, 1); + } +} diff --git a/docker_build.sh b/docker_build.sh index d7794bf90..55ee96457 100644 --- a/docker_build.sh +++ b/docker_build.sh @@ -46,19 +46,19 @@ echo "Building $IMAGE" # # This is the local latest tagged image. The Dockerfile's need this to build images # -TAGS="--tag onap/policy/${IMAGE}:latest" +TAGS="--tag onap/${IMAGE}:latest" # # This is the nexus repo prepended for latest tagged image. # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:latest" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:latest" # # This has the nexus repo prepended and only major/minor version with latest # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" # # This has the nexus repo prepended and major/minor/patch version with timestamp # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}" echo $TAGS @@ -75,7 +75,7 @@ docker images echo "Pushing $IMAGE" -docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:latest +docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:latest if [ $? -ne 0 ] then @@ -84,7 +84,7 @@ then fi -docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest +docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest if [ $? -ne 0 ] then @@ -92,7 +92,7 @@ then exit 1 fi -docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP} +docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP} if [ $? -ne 0 ] then diff --git a/docker_merge.sh b/docker_merge.sh index c8bde37e3..085a1ce0d 100644 --- a/docker_merge.sh +++ b/docker_merge.sh @@ -46,15 +46,15 @@ echo "Building $IMAGE" # # This is the local latest tagged image. The Dockerfile's need this to build images # -TAGS="--tag onap/policy/${IMAGE}:latest" +TAGS="--tag onap/${IMAGE}:latest" # # This has the nexus repo prepended and only major/minor version with latest # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" # # This has the nexus repo prepended and major/minor/patch version with timestamp # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}" echo $TAGS @@ -73,7 +73,7 @@ docker images # Push image # echo "Pushing $IMAGE" -docker push ${DOCKER_REPOSITORY}/onap/policy/$IMAGE:${MVN_MAJMIN_VERSION}-latest +docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_MAJMIN_VERSION}-latest if [ $? -ne 0 ] then @@ -81,7 +81,7 @@ then exit 1 fi -docker push ${DOCKER_REPOSITORY}/onap/policy/$IMAGE:${MVN_VERSION}-${TIMESTAMP} +docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-${TIMESTAMP} if [ $? -ne 0 ] then diff --git a/docker_verify.sh b/docker_verify.sh index dc405138f..b5ac2aa82 100644 --- a/docker_verify.sh +++ b/docker_verify.sh @@ -49,15 +49,15 @@ echo "Building $IMAGE" # # This is the local latest tagged image. The Dockerfile's need this to build images # -TAGS="--tag onap/policy/${IMAGE}:latest" +TAGS="--tag onap/${IMAGE}:latest" # # This has the nexus repo prepended and only major/minor version with latest # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest" # # This has the nexus repo prepended and major/minor/patch version with timestamp # -TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}" +TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}" echo $TAGS diff --git a/docs/platform/PolicyArchitectureDetails.png b/docs/platform/PolicyArchitectureDetails.png Binary files differindex 39705465d..e179cdb8f 100755 --- a/docs/platform/PolicyArchitectureDetails.png +++ b/docs/platform/PolicyArchitectureDetails.png diff --git a/docs/platform/PolicyArchitectureDetailsKey.png b/docs/platform/PolicyArchitectureDetailsKey.png Binary files differnew file mode 100755 index 000000000..e6e7a4696 --- /dev/null +++ b/docs/platform/PolicyArchitectureDetailsKey.png diff --git a/docs/platform/PolicySummary.png b/docs/platform/PolicySummary.png Binary files differnew file mode 100755 index 000000000..b2f84dce7 --- /dev/null +++ b/docs/platform/PolicySummary.png diff --git a/docs/platform/architecture.rst b/docs/platform/architecture.rst index 28215dedc..91679eab1 100644 --- a/docs/platform/architecture.rst +++ b/docs/platform/architecture.rst @@ -35,6 +35,9 @@ As illustrated in the Figure below, the POLICY components are supported by a num .. image:: PolicyArchitectureDetails.png +.. image:: PolicyArchitectureDetailsKey.png + + The PAP provides interfaces for the management of policies. It utilizes the XACML database to store policies, which are then distributed to the PDPs. The XACML and Drools databases are hosted in a MariaDB cluster. The XACML database is used to persist policies and policy dictionaries and provide a point for PDPs to retrieve policies. The XACML database also has tables used for node state management, detection of node failure and failover. As indicated above, the state management tables will only include entries for the PAP and PDP-X as the testing is not yet complete for the PDP-D. @@ -96,5 +99,7 @@ Attributes can be specified for each dimension. In addition to being defined for Policy writers can define attributes so that policy events or requests self-indicate their scope. The scope is then examined by a suitable function and subsequently acted upon accordingly. Policy decisions and enforcement functions can self-indicate their scope of decision-making, enforcement, or other capabilities. Virtual functions can be automatically attached to the appropriate POLICY Framework and distribution mechanisms. +.. image:: PolicySummary.png + End of Document diff --git a/docs/platform/cookbook.gif b/docs/platform/cookbook.gif Binary files differnew file mode 100755 index 000000000..10d25eaca --- /dev/null +++ b/docs/platform/cookbook.gif diff --git a/docs/platform/cookbook.rst b/docs/platform/cookbook.rst new file mode 100644 index 000000000..a93f66be8 --- /dev/null +++ b/docs/platform/cookbook.rst @@ -0,0 +1,128 @@ + +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +******************************* +Policy Cookbook |cookbooklogo| +******************************* + +Policy VM/Docker Recipes +^^^^^^^^^^^^^^^^^^^^^^^^ + + .. code-block:: bash + :caption: Get latest images in an already setup policy VM + :linenos: + + /opt/policy_vm_init.sh + + + .. code-block:: bash + :caption: Install/start docker policy containers with no policies preloaded + :linenos: + + echo "PRELOAD_POLICIES=false" > /opt/policy/.env + /opt/policy_vm_init.sh + + + .. code-block:: bash + :caption: Install/start docker policy containers with policies preloaded + :linenos: + + # This is the current default mode of instantiation. + # These operations are unnecessary unless PRELOAD_POLICIES + # was previously set to true + + echo "PRELOAD_POLICIES=true" > /opt/policy/.env + /opt/policy_vm_init.sh + + + .. code-block:: bash + :caption: Access the PDP-D container as a policy user + :linenos: + + docker exec -it drools bash + + + .. code-block:: bash + :caption: Access the PDP-X container as a policy user + :linenos: + + docker exec -it -u 0 pdp su - policy + + + .. code-block:: bash + :caption: Access the BRMSGW container as a policy user + :linenos: + + docker exec -it -u 0 brmsgw su - policy + + + .. code-block:: bash + :caption: Access PAP container as a policy user + :linenos: + + docker exec -it -u 0 pap su - policy + + + .. code-block:: bash + :caption: Access the CONSOLE container as a policy user + :linenos: + + docker exec -it -u 0 console su - policy + + + .. code-block:: bash + :caption: Manual Healthcheck invokation + :linenos: + + # Assuming the healthcheck service credentials have not been changed + # post-installation within the drools container + + source /opt/app/policy/config/feature-healthcheck.conf.environment + curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" + -X GET http://localhost:6969/healthcheck | python -m json.tool + + +PDP-D Recipes ("drools" container) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + .. code-block:: bash + :caption: Stop the PDP-D + :linenos: + + policy stop + + + .. code-block:: bash + :caption: Start the PDP-D + :linenos: + + policy start + + + .. code-block:: bash + :caption: Manual Healthcheck Invokation + :linenos: + + # Assuming the healthcheck service credentials have not been changed + # post-installation within the drools container + + source ${POLICY_HOME}/config/feature-healthcheck.conf + curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" + -X GET http://localhost:6969/healthcheck | python -m json.tool + + +.. |recipelogo| image:: recipecard.png + :width: 80pt + :height: 80pt + +.. |cookbooklogo| image:: cookbook.gif + :width: 80pt + :height: 80pt + +End of Document + +.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Policy+Cookbook + + + diff --git a/docs/platform/index.rst b/docs/platform/index.rst index f8fccd8dc..1bedf09b0 100644 --- a/docs/platform/index.rst +++ b/docs/platform/index.rst @@ -35,6 +35,7 @@ Policy Platform Tutorials .. toctree:: :maxdepth: 1 + cookbook.rst deployPDPPAP.rst guardpolicy.rst guardpdp.rst diff --git a/docs/release-notes.rst b/docs/release-notes.rst index bd688683c..bf142ef46 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -12,7 +12,20 @@ Policy Release Notes .. * one section describing the purpose of this new release. .. * This note must be removed after content has been added. -Version: 1.2.0 + +Version: 1.1.3 +-------------- + +:Release Date: 2018-01-18 (Amsterdam Maintenance Release) + +**Bug Fixes** + +The following bugs were deployed with the Amsterdam Maintenance Release: + + * `[POLICY-486] <https://jira.onap.org/browse/POLICY-486>`_ - pdp-x api pushPolicy fails to push latest version + + +Version: 1.1.1 -------------- :Release Date: 2017-11-16 (Amsterdam Release) @@ -83,8 +96,8 @@ The Amsterdam release continued evolving the design driven architecture of and f - Create a Service Instance via VID. - Create a VNF Instance via VID. - Preload SDNC with topology data used for the actual VNF instantiation (both base and DNS scaling modules). NOTE: you may want to set “vlb_name_0” in the base VF module data to something unique. This is the vLB server name that DCAE will pass to Policy during closed loop. If the same name is used multiple times, the Policy name-query to AAI will show multiple entries, one for each occurrence of that vLB VM name in the OpenStack zone. Note that this is not a limitation, typically server names in a domain are supposed to be unique. - - Instantiate the base VF module (vLB, vPacketGen, and one vDNS) via VID. NOTE: The name of the VF module MUST start with Vfmodule_. The same name MUST appear in the SDNC preload of the base VF module topology. We’ll relax this naming requirement for Beijing Release. - - Run heatbridge from the Robot VM using Vfmodule_ … as stack name (it is the actual stack name in OpenStack) + - Instantiate the base VF module (vLB, vPacketGen, and one vDNS) via VID. NOTE: The name of the VF module MUST start with ``Vfmodule_``. The same name MUST appear in the SDNC preload of the base VF module topology. We’ll relax this naming requirement for Beijing Release. + - Run heatbridge from the Robot VM using ``Vfmodule_`` … as stack name (it is the actual stack name in OpenStack) - Populate AAI with a dummy VF module for vDNS scaling. **Security Issues** @@ -93,6 +106,13 @@ The Amsterdam release continued evolving the design driven architecture of and f **Other** - None at this time + +.. note +.. CHANGE HISTORY +.. 01/15/2018 - Added change for version 1.1.3 to the Amsterdam branch. Also corrected prior version (1.2.0) to (1.1.1) +.. 11/16/2017 - Initial document for Amsterdam release. + + End of Release Notes diff --git a/packages/base/src/files/install/servers/brmsgw/dependency.json b/packages/base/src/files/install/servers/brmsgw/dependency.json index c22554293..133907699 100644 --- a/packages/base/src/files/install/servers/brmsgw/dependency.json +++ b/packages/base/src/files/install/servers/brmsgw/dependency.json @@ -82,7 +82,7 @@ "artifactId": "actor.appclcm", "version": "${{BRMS_DEPENDENCY_VERSION}}" }, { - "groupId": "org.onap.policy.drools-application.controlloop.common.actorss", + "groupId": "org.onap.policy.drools-applications.controlloop.common.actors", "artifactId": "actor.so", "version": "${{BRMS_DEPENDENCY_VERSION}}" }, { @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>0.1.1</version> + <version>1.1.0</version> <relativePath/> </parent> |