Merge "Fix all bugs reported by Sonar in policy/engine"
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 21 Mar 2018 13:20:54 +0000 (13:20 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 21 Mar 2018 13:20:54 +0000 (13:20 +0000)
27 files changed:
ONAP-PDP-REST/pom.xml
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/BRMSParamPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopFaultPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/ClosedLoopPMPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/FirewallPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/MicroServicesPolicyServiceTest.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java
POLICY-SDK-APP/pom.xml
POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java
POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java
POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java [new file with mode: 0644]
docker_build.sh
docker_merge.sh
docker_verify.sh
docs/platform/PolicyArchitectureDetails.png
docs/platform/PolicyArchitectureDetailsKey.png [new file with mode: 0755]
docs/platform/PolicySummary.png [new file with mode: 0755]
docs/platform/architecture.rst
docs/platform/cookbook.gif [new file with mode: 0755]
docs/platform/cookbook.rst [new file with mode: 0644]
docs/platform/index.rst
docs/release-notes.rst
packages/base/src/files/install/servers/brmsgw/dependency.json
pom.xml

index ad7c70c..b559269 100644 (file)
                                </exclusion>
                        </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>
index 70b717d..8867a78 100644 (file)
@@ -79,6 +79,8 @@ public class BRMSParamPolicyServiceTest {
 
        @After
        public void tearDown() throws Exception {
+               PAPServices.setPaps(null);
+               PAPServices.junit = false;
        }
 
        @Test
index 458cfc6..de884b3 100644 (file)
@@ -68,6 +68,8 @@ public class ClosedLoopFaultPolicyServiceTest {
 
                @After
                public void tearDown() throws Exception {
+                       PAPServices.setPaps(null);
+                       PAPServices.junit = false;
                }
 
                @Test
index e00c71d..19bb279 100644 (file)
@@ -68,6 +68,8 @@ public class ClosedLoopPMPolicyServiceTest {
 
        @After
        public void tearDown() throws Exception {
+               PAPServices.setPaps(null);
+               PAPServices.junit = false;
        }
 
        @Test
index 5236b28..0fcb002 100644 (file)
@@ -93,6 +93,8 @@ public class DecisionPolicyServiceTest {
 
        @After
        public void tearDown() throws Exception {
+               PAPServices.setPaps(null);
+               PAPServices.junit = false;
        }
 
        @Test
index 111a39f..4343a50 100644 (file)
@@ -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);
        }
-
 }
index 6830fcc..a9301e7 100644 (file)
@@ -68,6 +68,8 @@ public class MicroServicesPolicyServiceTest {
 
        @After
        public void tearDown() throws Exception {
+               PAPServices.setPaps(null);
+               PAPServices.junit = false;
        }
 
        @Test
index 13f7287..9d1d139 100644 (file)
@@ -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;
        }
 
index 153299e..3a8eaa4 100644 (file)
                                        <groupId>commons-logging</groupId>
                                        <artifactId>commons-logging</artifactId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>org.apache.httpcomponents</groupId>
+                                       <artifactId>httpclient</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
index ab4ea6d..422c18a 100644 (file)
@@ -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);
index 0835655..c751c47 100644 (file)
@@ -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();
-        }
-       }
 }
index 1013664..cfc9bec 100644 (file)
@@ -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]));
index 0c85e71..95fa962 100644 (file)
@@ -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 (file)
index 0000000..920cc97
--- /dev/null
@@ -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);
+       }
+}
index d7794bf..55ee964 100644 (file)
@@ -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
index c8bde37..085a1ce 100644 (file)
@@ -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
index dc40513..b5ac2aa 100644 (file)
@@ -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
 
index 3970546..e179cdb 100755 (executable)
Binary files a/docs/platform/PolicyArchitectureDetails.png and b/docs/platform/PolicyArchitectureDetails.png differ
diff --git a/docs/platform/PolicyArchitectureDetailsKey.png b/docs/platform/PolicyArchitectureDetailsKey.png
new file mode 100755 (executable)
index 0000000..e6e7a46
Binary files /dev/null and b/docs/platform/PolicyArchitectureDetailsKey.png differ
diff --git a/docs/platform/PolicySummary.png b/docs/platform/PolicySummary.png
new file mode 100755 (executable)
index 0000000..b2f84dc
Binary files /dev/null and b/docs/platform/PolicySummary.png differ
index 28215de..91679ea 100644 (file)
@@ -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
new file mode 100755 (executable)
index 0000000..10d25ea
Binary files /dev/null and b/docs/platform/cookbook.gif differ
diff --git a/docs/platform/cookbook.rst b/docs/platform/cookbook.rst
new file mode 100644 (file)
index 0000000..a93f66b
--- /dev/null
@@ -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
+
+
+
index f8fccd8..1bedf09 100644 (file)
@@ -35,6 +35,7 @@ Policy Platform Tutorials
 .. toctree::
    :maxdepth: 1
 
+   cookbook.rst
    deployPDPPAP.rst
    guardpolicy.rst
    guardpdp.rst
index bd68868..bf142ef 100644 (file)
@@ -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
 
 
index c225542..1339076 100644 (file)
@@ -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}}"
         }, {
diff --git a/pom.xml b/pom.xml
index b370e2b..660e87e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -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>