Support for kafka within xacml tutorial 29/137029/1
authoradheli.tavares <adheli.tavares@est.tech>
Wed, 3 Jan 2024 15:00:40 +0000 (15:00 +0000)
committeradheli.tavares <adheli.tavares@est.tech>
Thu, 18 Jan 2024 10:42:28 +0000 (10:42 +0000)
Issue-ID: POLICY-4202
Change-Id: I7bb47dce25d7613221a13f8437030f02a978770d
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
.gitignore
applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java
tutorials/tutorial-enforcement/README.md
tutorials/tutorial-enforcement/src/main/java/org/onap/policy/tutorial/policyenforcement/App.java
tutorials/tutorial-enforcement/src/test/resources/postman/Policy_Enforcement_Tutorial.postman_collection.json
tutorials/tutorial-enforcement/src/test/resources/postman/policy_update_notification.json [new file with mode: 0644]
tutorials/tutorial-xacml-application/postman/PolicyApplicationTutorial.postman_collection.json
tutorials/tutorial-xacml-application/src/main/docker/README.md
tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml
tutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh
tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java

index 8d4df19..680691e 100644 (file)
@@ -8,6 +8,7 @@
 target
 .metadata/
 /bin/
+**/*.log
 
 # IntelliJ files
 .idea/
index 95150c3..626c916 100644 (file)
@@ -3,7 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 2024 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,6 +25,7 @@ package org.onap.policy.xacml.pdp.application.monitoring;
 
 import com.att.research.xacml.api.Response;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import org.apache.commons.lang3.tuple.Pair;
@@ -54,7 +55,7 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider
 
     public static final String VERSION_100 = "1.0.0";
 
-    private StdCombinedPolicyResultsTranslator translator = new StdCombinedPolicyResultsTranslator();
+    private final StdCombinedPolicyResultsTranslator translator = new StdCombinedPolicyResultsTranslator();
 
     /**
      * Constructor.
@@ -63,9 +64,9 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider
         super();
 
         applicationName = "monitoring";
-        actions = Arrays.asList("configure");
+        actions = List.of("configure");
         //
-        // By default this supports just Monitoring policy types
+        // By default, this supports just Monitoring policy types
         //
         supportedPolicyTypes.add(new ToscaConceptIdentifier(ONAP_MONITORING_BASE_POLICY_TYPE, VERSION_100));
     }
index 07b5598..d65ca3b 100644 (file)
@@ -14,16 +14,14 @@ The Policy Enforcement Tutorial can be built:
 Be sure to start the Policy Framework application components in *docker* if you are not testing this in a lab.
 - Ensure you have docker and docker-compose installed
 - Check out the *policy/docker* repo from the ONAP gerrit or from github: https://github.com/onap/policy-docker
-- In a console, change directory into the *csit* directory of the *policy/docker* repo
-- Start *xacml-pdp* by running the *start-containter.sh* script
+- In a console, change directory into the *compose* directory of the *policy/docker* repo
+- Start *xacml-pdp* by running the *start-compose.sh* script
 
-    start-container.sh xacml-pdp
+    start-compose.sh xacml-pdp
 
-- Ensure that DMaaP is up
-
-    > curl -X POST http://0.0.0.0:30227/events/POLICY-PDP-PAP
-    Should return JSON similar to this:
-    {"serverTimeMs":0,"count":0}
+- Run python script ```kafka_producer.py``` under docker repository with topic name and message as parameters.
+  i.e. ```python3 /docker/csit/resources/tests/kafka_producer.py POLICY-PDP-PAP "message"```
+  (update "message" to the usual json body)
 
 - Run the xacml-pdp health check
 
@@ -58,11 +56,11 @@ Be sure to start the Policy Framework application components in *docker* if you
 # Run the Tutorial
 
 You can run the application via code by running the *App.main* method with command line argument with IP then Port
-of the XACML PDP, followed by the IP then Port of Dmaap.
+of the XACML PDP, followed by the IP then Port of kafka.
 
-    App.main(new String[] {"0.0.0.0", "6969", "0.0.0.0", "3904"});
+    App.main(new String[] {"0.0.0.0", "6969", "0.0.0.0", "9092"});
 
 or from Eclipse by right-clicking App.java and selecting *Run As* and select *Java Application*. Edit the
-configuration by adding these command line arguments: "0.0.0.0" "6969" "0.0.0.0" "3904"
+configuration by adding these command line arguments: "0.0.0.0" "6969" "0.0.0.0" "9092"
 
 Quit the application by typing 'q' into stdin.
index 78d0684..0697e82 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@ package org.onap.policy.tutorial.policyenforcement;
 
 import jakarta.ws.rs.client.Entity;
 import jakarta.ws.rs.core.MediaType;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Scanner;
@@ -46,11 +46,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class App extends Thread implements TopicListener {
-    private static Logger logger                           = LoggerFactory.getLogger(App.class);
-    private static final String MY_POLICYTYPEID = "onap.policies.monitoring.MyAnalytic";
-    private String xacmlPdpHost;
-    private String xacmlPdpPort;
-    private DecisionRequest decisionRequest = new DecisionRequest();
+    private static final Logger logger = LoggerFactory.getLogger(App.class);
+    private static final String MY_POLICY_TYPE_ID = "onap.policies.monitoring.MyAnalytic";
+    private final String xacmlPdpHost;
+    private final String xacmlPdpPort;
+    private final DecisionRequest decisionRequest = new DecisionRequest();
     private Integer requestId = 1;
     private HttpClient client = null;
 
@@ -64,23 +64,23 @@ public class App extends Thread implements TopicListener {
         xacmlPdpPort = args[1];
 
         var params = new TopicParameters();
-        params.setTopicCommInfrastructure("dmaap");
+        params.setTopicCommInfrastructure("kafka");
         params.setFetchLimit(1);
         params.setFetchTimeout(5000);
-        params.setTopic("POLICY-NOTIFICATION");
-        params.setServers(Arrays.asList(args[2] + ":" + args[3]));
+        params.setTopic("policy-notification");
+        params.setServers(List.of(args[2] + ":" + args[3]));
         var topicParams = new TopicParameterGroup();
-        topicParams.setTopicSources(Arrays.asList(params));
+        topicParams.setTopicSources(List.of(params));
 
         TopicEndpointManager.getManager().addTopics(topicParams);
-        TopicEndpointManager.getManager().getDmaapTopicSource("POLICY-NOTIFICATION").register(this);
+        TopicEndpointManager.getManager().getKafkaTopicSource("policy-notification").register(this);
 
         decisionRequest.setOnapComponent("myComponent");
         decisionRequest.setOnapName("myName");
         decisionRequest.setOnapInstance("myInstanceId");
         decisionRequest.setAction("configure");
         Map<String, Object> resources = new HashMap<>();
-        resources.put("policy-type", MY_POLICYTYPEID);
+        resources.put("policy-type", MY_POLICY_TYPE_ID);
         decisionRequest.setResource(resources);
     }
 
@@ -88,19 +88,19 @@ public class App extends Thread implements TopicListener {
      * Thread run method that creates a connection and gets an initial Decision on which policy(s)
      * we should be enforcing.
      * Then sits waiting for the user to enter q or Q from the keyboard to quit. While waiting,
-     * listen on Dmaap topic for notification that the policy has changed.
+     * listen on a topic for notification that the policy has changed.
      */
     @Override
     public void run() {
         logger.info("running - type q to stdin to quit");
         try {
             client = HttpClientFactoryInstance.getClientFactory().build(BusTopicParams.builder()
-                    .clientName("myClientName").useHttps(true).allowSelfSignedCerts(true)
-                    .hostname(xacmlPdpHost).port(Integer.parseInt(xacmlPdpPort))
-                    .userName("healthcheck").password("zb!XztG34").basePath("policy/pdpx/v1")
-                    .managed(true)
-                    .serializationProvider("org.onap.policy.common.gson.GsonMessageBodyHandler")
-                    .build());
+                .clientName("myClientName").useHttps(true).allowSelfSignedCerts(true)
+                .hostname(xacmlPdpHost).port(Integer.parseInt(xacmlPdpPort))
+                .userName("healthcheck").password("zb!XztG34").basePath("policy/pdpx/v1")
+                .managed(true)
+                .serializationProvider("org.onap.policy.common.gson.GsonMessageBodyHandler")
+                .build());
         } catch (NumberFormatException | HttpClientConfigException e) {
             logger.error("Could not create Http client", e);
             return;
@@ -116,7 +116,7 @@ public class App extends Thread implements TopicListener {
 
         TopicEndpointManager.getManager().start();
 
-        @SuppressWarnings("resource") // never close System.in
+        // never close System.in
         var input = new Scanner(System.in);
         while (!Thread.currentThread().isInterrupted()) {
             String quit = input.nextLine();
@@ -148,23 +148,23 @@ public class App extends Thread implements TopicListener {
     }
 
     /**
-     * Helper method that parses a DMaap message event for POLICY-NOTIFICATION
+     * Helper method that parses a message event for policy-notification
      * looking for our supported policy type to enforce.
      *
-     * @param msg Dmaap Message
-     * @return true if MY_POLICYTYPEID is in the message
+     * @param msg topic message
+     * @return true if MY_POLICY_TYPE_ID is in the message
      */
     private boolean scanForPolicyType(String msg) {
         var gson = new StandardCoder();
         try {
             PolicyNotification notification = gson.decode(msg, PolicyNotification.class);
             for (PolicyStatus added : notification.getAdded()) {
-                if (MY_POLICYTYPEID.equals(added.getPolicyTypeId())) {
+                if (MY_POLICY_TYPE_ID.equals(added.getPolicyTypeId())) {
                     return true;
                 }
             }
             for (PolicyStatus deleted : notification.getDeleted()) {
-                if (MY_POLICYTYPEID.equals(deleted.getPolicyTypeId())) {
+                if (MY_POLICY_TYPE_ID.equals(deleted.getPolicyTypeId())) {
                     return true;
                 }
             }
@@ -179,7 +179,7 @@ public class App extends Thread implements TopicListener {
      * Helper method that calls the XACML PDP Decision API to get a Decision
      * as to which policy we should be enforcing.
      *
-     * @param client HttpClient to use to make REST call
+     * @param client          HttpClient to use to make REST call
      * @param decisionRequest DecisionRequest object to send
      * @return The Map of policies that was in the DecisionResponse object
      */
@@ -188,12 +188,12 @@ public class App extends Thread implements TopicListener {
         requestId++;
 
         Entity<DecisionRequest> entityRequest =
-                Entity.entity(decisionRequest, MediaType.APPLICATION_JSON);
+            Entity.entity(decisionRequest, MediaType.APPLICATION_JSON);
         var response = client.post("/decision", entityRequest, Collections.emptyMap());
 
         if (response.getStatus() != 200) {
             logger.error(
-                    "Decision API failed - is the IP/port correct? {}", response.getStatus());
+                "Decision API failed - is the IP/port correct? {}", response.getStatus());
             return Collections.emptyMap();
         }
 
index 85de39b..8d89d76 100644 (file)
@@ -19,7 +19,7 @@
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
@@ -70,7 +70,7 @@
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                        },
                        "response": []
                },
-               {
-                       "name": "Dmaap Simulator - Policy Update Notification",
-                       "request": {
-                               "auth": {
-                                       "type": "noauth"
-                               },
-                               "method": "POST",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "type": "text",
-                                               "value": "application/json"
-                                       },
-                                       {
-                                               "key": "Accept",
-                                               "type": "text",
-                                               "value": "application/json"
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n  \"messageName\": \"PDP_STATE_CHANGE\",\n  \"requestId\": \"05d08a05-e182-46fa-a6d1-5500e52cd3e5\",\n  \"timestampMs\": \"1576598570797\", \n  \"name\": \"PamelaDragosh.local\",\n  \"pdpGroup\": \"defaultGroup\",\n  \"pdpSubgroup\":\"XacmlPdpGroup\",\n  \"state\":\"ACTIVE\"\n}"
-                               },
-                               "url": {
-                                       "raw": "http://localhost:3904/events/POLICY-PDP-PAP",
-                                       "protocol": "http",
-                                       "host": [
-                                               "localhost"
-                                       ],
-                                       "port": "3904",
-                                       "path": [
-                                               "events",
-                                               "POLICY-PDP-PAP"
-                                       ]
-                               }
-                       },
-                       "response": []
-               },
                {
                        "name": "Simple Undeploy Policy Copy",
                        "request": {
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
diff --git a/tutorials/tutorial-enforcement/src/test/resources/postman/policy_update_notification.json b/tutorials/tutorial-enforcement/src/test/resources/postman/policy_update_notification.json
new file mode 100644 (file)
index 0000000..e462a8e
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "messageName": "PDP_STATE_CHANGE",
+  "requestId": "05d08a05-e182-46fa-a6d1-5500e52cd3e5",
+  "timestampMs": "1576598570797",
+  "name": "PamelaDragosh.local",
+  "pdpGroup": "defaultGroup",
+  "pdpSubgroup":"XacmlPdpGroup",
+  "state":"ACTIVE"
+}
index dbb1e0d..3f94ac6 100644 (file)
@@ -19,7 +19,7 @@
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
@@ -66,7 +66,7 @@
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                        "response": [
                        ]
                },
-               {
-                       "name": "Dmaap Simulator - Policy Update Notification",
-                       "protocolProfileBehavior": {
-                               "disableBodyPruning": true
-                       },
-                       "request": {
-                               "auth": {
-                                       "type": "noauth"
-                               },
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "type": "text",
-                                               "value": "application/json"
-                                       },
-                                       {
-                                               "key": "Accept",
-                                               "type": "text",
-                                               "value": "application/json"
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
-                               },
-                               "url": {
-                                       "raw": "{{DMAAP-URL}}/events/POLICY-NOTIFICATION/group/id?timeout=5000",
-                                       "host": [
-                                               "{{DMAAP-URL}}"
-                                       ],
-                                       "path": [
-                                               "events",
-                                               "POLICY-NOTIFICATION",
-                                               "group",
-                                               "id"
-                                       ],
-                                       "query": [
-                                               {
-                                                       "key": "timeout",
-                                                       "value": "5000"
-                                               }
-                                       ]
-                               }
-                       },
-                       "response": [
-                       ]
-               },
                {
                        "name": "Xacml Healthcheck",
                        "request": {
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
                                                },
                                                {
                                                        "key": "username",
-                                                       "value": "healthcheck",
+                                                       "value": "policyadmin",
                                                        "type": "string"
                                                }
                                        ]
index 05a8746..33c9166 100644 (file)
@@ -12,7 +12,7 @@
 ### Setting Up and Starting from policy/docker components
 
  1. Clone ```https://git.onap.org/policy/docker/```
- 2. ```cd /docker/csit```
+ 2. ```cd /docker```
  3. Run the following to set the containers location, project, branch, and version:
        - ```export CONTAINER_LOCATION=nexus3.onap.org:10001/```
        - ```export PROJECT=pap```
        - ```get-versions.sh```
  4. Run ```docker image ls```
        - Take note of the REPOSITORY ```onap/policy/xacml-tutorial``` and its ```TAG```
-       - This refers to the image from our mvn clean install from above
+       - This refers to the image from our `mvn clean install` from above
  5. Edit ```docker-compose-all.sh```
        - Replace xacml-pdp image with the format "REPOSITORY:TAG" as noted in Step 4
-               - ex. image: ```onap/policy-xacml-tutorial:2.7.1-SNAPSHOT```
+               - ex. image: ```onap/policy-xacml-tutorial:3.1.1-SNAPSHOT```
 
 ### Running the Containers and Testing
 
-Run ```docker-compose -f docker-compose-all.yml up xacml-pdp```
+Run ```./compose/start-compose.sh xacml-pdp```
 
+### Triggering policy notification update
+
+Run python script ```kafka_producer.py``` under docker repository with topic name and message as parameters.
+i.e. ```python3 /docker/csit/resources/tests/kafka_producer.py POLICY-PDP-PAP "message"```
+(update "message" to the usual json body)
 
 ## Verification Example Calls
 
 Verify that the components are accessible:
 
- 1. ```curl -X POST http://0.0.0.0:3904/events/POLICY-PDP-PAP```
-       - Should return JSON similar to this: ```{"serverTimeMs":0,"count":0}```
-
- 2. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6969/policy/pdpx/v1/healthcheck'```
-       - Should return JSON similar to this: ```{"name":"Policy Xacml PDP","url":"self","healthy":true,"code":200,"message":"alive"}```
+ 1. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6969/policy/pdpx/v1/healthcheck'```
+    - Should return JSON similar to this: ```{"name":"Policy Xacml PDP","url":"self","healthy":true,"code":200,"message":"alive"}```
 
3. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6767/policy/api/v1/healthcheck'```
-       - Should return JSON similar to this: ```{"name": "Policy API","url": "policy-api","healthy": true,"code": 200,"message": "alive"}```
2. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6767/policy/api/v1/healthcheck'```
+    - Should return JSON similar to this: ```{"name": "Policy API","url": "policy-api","healthy": true,"code": 200,"message": "alive"}```
 
4. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6868/policy/pap/v1/healthcheck'```
-       - Should return JSON similar to this: ```{"name": "Policy PAP","url": "policy-pap","healthy": true,"code": 200,"message": "alive"}```
3. ```curl -k -u 'healthcheck:zb!XztG34' 'https://0.0.0.0:6868/policy/pap/v1/healthcheck'```
+    - Should return JSON similar to this: ```{"name": "Policy PAP","url": "policy-pap","healthy": true,"code": 200,"message": "alive"}```
 
 ## POSTMAN Collection
 
-You can find the collection under ```/policy-xacml-pdp/tutorials-tutorial-xacml-application/postman/```
+You can find the collection under ```/policy-xacml-pdp/tutorials/tutorial-xacml-application/postman/```
index 48d246b..296f115 100644 (file)
@@ -1,6 +1,6 @@
 # ============LICENSE_START=======================================================
 #  Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
-#  Modifications Copyright (C) 2022 Nordix Foundation.
+#  Modifications Copyright (C) 2022, 2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@
 version: '3'
 services:
   mariadb:
-    image: ${CONTAINER_LOCATION}mariadb:${POLICY_MARIADB_VER}
+    image: nexus3.onap.org:10001/mariadb:${POLICY_MARIADB_VER}
     container_name: mariadb
     hostname: mariadb
     command: [ '--lower-case-table-names=1', '--wait_timeout=28800' ]
index 82750c4..7b2f31e 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/bash
 
 # ============LICENSE_START====================================================
-#  Copyright 2022 Nordix Foundation.
+#  Copyright 2022, 2024 Nordix Foundation.
 # =============================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ fi
 
 echo "Looking up latest versions of Policy Framework images . . ."
 GETVERS_SCRIPT=$(mktemp)
-curl -qL --silent "https://raw.githubusercontent.com/onap/policy-docker/master/csit/get-versions.sh" > "$GETVERS_SCRIPT"
+curl -qL --silent "https://raw.githubusercontent.com/onap/policy-docker/master/compose/get-versions.sh" > "$GETVERS_SCRIPT"
 export GERRIT_BRANCH="master"
 chmod +x "$GETVERS_SCRIPT"
 source "$GETVERS_SCRIPT"
@@ -57,4 +57,4 @@ echo "Tutorial run completed"
 
 echo "Cleaning up . . ."
 rm "$GETVERS_SCRIPT"
-echo "Cleanup competed"
+echo "Cleanup completed"
index b30dd94..2f8fb85 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,7 +56,7 @@ public class TutorialTranslator extends StdBaseTranslator {
             new IdentifierImpl(ToscaDictionary.ID_URN_ONAP, "tutorial-permission");
 
     /**
-     * Constructor will setup some defaults.
+     * Constructor will set up some defaults.
      */
     public TutorialTranslator() {
         //
@@ -71,7 +72,7 @@ public class TutorialTranslator extends StdBaseTranslator {
      */
     @SuppressWarnings("unchecked")
     @Override
-    public PolicyType convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException {
+    public PolicyType convertPolicy(ToscaPolicy toscaPolicy) {
         //
         // Here is our policy with a version and default combining algo
         //
@@ -102,7 +103,7 @@ public class TutorialTranslator extends StdBaseTranslator {
                 XACML3.ID_DATATYPE_STRING, ID_TUTORIAL_USER, XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE);
         var anyOf = new AnyOfType();
         //
-        // Create AllOf (AND) of just Policy Id
+        // Create AllOf (AND) of just Policy ID
         //
         anyOf.getAllOf().add(ToscaPolicyTranslatorUtils.buildAllOf(matchAction, matchUser));
         var target = new TargetType();