From 2e7b3c77cf6f7bf68233368bce17edb598daedc8 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Wed, 3 Jan 2024 15:00:40 +0000 Subject: [PATCH] Support for kafka within xacml tutorial Issue-ID: POLICY-4202 Change-Id: I7bb47dce25d7613221a13f8437030f02a978770d Signed-off-by: adheli.tavares --- .gitignore | 1 + .../monitoring/MonitoringPdpApplication.java | 9 +-- tutorials/tutorial-enforcement/README.md | 20 +++--- .../policy/tutorial/policyenforcement/App.java | 58 ++++++++--------- ...cy_Enforcement_Tutorial.postman_collection.json | 58 +++-------------- .../postman/policy_update_notification.json | 9 +++ ...licyApplicationTutorial.postman_collection.json | 74 ++++------------------ .../src/main/docker/README.md | 30 +++++---- .../src/main/docker/docker-compose.yml | 4 +- .../src/main/docker/run-tutorial.sh | 6 +- .../tutorial/tutorial/TutorialTranslator.java | 7 +- 11 files changed, 101 insertions(+), 175 deletions(-) create mode 100644 tutorials/tutorial-enforcement/src/test/resources/postman/policy_update_notification.json diff --git a/.gitignore b/.gitignore index 8d4df198..680691e5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ target .metadata/ /bin/ +**/*.log # IntelliJ files .idea/ diff --git a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java index 95150c37..626c9163 100644 --- a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java +++ b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java @@ -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)); } diff --git a/tutorials/tutorial-enforcement/README.md b/tutorials/tutorial-enforcement/README.md index 07b55984..d65ca3bb 100644 --- a/tutorials/tutorial-enforcement/README.md +++ b/tutorials/tutorial-enforcement/README.md @@ -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. diff --git a/tutorials/tutorial-enforcement/src/main/java/org/onap/policy/tutorial/policyenforcement/App.java b/tutorials/tutorial-enforcement/src/main/java/org/onap/policy/tutorial/policyenforcement/App.java index 78d06841..0697e822 100644 --- a/tutorials/tutorial-enforcement/src/main/java/org/onap/policy/tutorial/policyenforcement/App.java +++ b/tutorials/tutorial-enforcement/src/main/java/org/onap/policy/tutorial/policyenforcement/App.java @@ -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 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 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(); } diff --git a/tutorials/tutorial-enforcement/src/test/resources/postman/Policy_Enforcement_Tutorial.postman_collection.json b/tutorials/tutorial-enforcement/src/test/resources/postman/Policy_Enforcement_Tutorial.postman_collection.json index 85de39be..8d89d76c 100644 --- a/tutorials/tutorial-enforcement/src/test/resources/postman/Policy_Enforcement_Tutorial.postman_collection.json +++ b/tutorials/tutorial-enforcement/src/test/resources/postman/Policy_Enforcement_Tutorial.postman_collection.json @@ -19,7 +19,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -70,7 +70,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -125,7 +125,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -184,7 +184,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -235,7 +235,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -286,7 +286,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -342,7 +342,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -393,7 +393,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -444,7 +444,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -486,44 +486,6 @@ }, "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": { @@ -537,7 +499,7 @@ }, { "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 index 00000000..e462a8e2 --- /dev/null +++ b/tutorials/tutorial-enforcement/src/test/resources/postman/policy_update_notification.json @@ -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" +} diff --git a/tutorials/tutorial-xacml-application/postman/PolicyApplicationTutorial.postman_collection.json b/tutorials/tutorial-xacml-application/postman/PolicyApplicationTutorial.postman_collection.json index dbb1e0d1..3f94ac6f 100644 --- a/tutorials/tutorial-xacml-application/postman/PolicyApplicationTutorial.postman_collection.json +++ b/tutorials/tutorial-xacml-application/postman/PolicyApplicationTutorial.postman_collection.json @@ -19,7 +19,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -66,7 +66,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -122,7 +122,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -182,7 +182,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -229,7 +229,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -276,7 +276,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -332,7 +332,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -382,7 +382,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -436,7 +436,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -475,54 +475,6 @@ "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": { @@ -536,7 +488,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -583,7 +535,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -630,7 +582,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] @@ -681,7 +633,7 @@ }, { "key": "username", - "value": "healthcheck", + "value": "policyadmin", "type": "string" } ] diff --git a/tutorials/tutorial-xacml-application/src/main/docker/README.md b/tutorials/tutorial-xacml-application/src/main/docker/README.md index 05a87462..33c9166a 100644 --- a/tutorials/tutorial-xacml-application/src/main/docker/README.md +++ b/tutorials/tutorial-xacml-application/src/main/docker/README.md @@ -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``` @@ -21,32 +21,34 @@ - ```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/``` diff --git a/tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml b/tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml index 48d246be..296f115c 100644 --- a/tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml +++ b/tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml @@ -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' ] diff --git a/tutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh b/tutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh index 82750c41..7b2f31e2 100755 --- a/tutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh +++ b/tutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh @@ -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" diff --git a/tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java b/tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java index b30dd943..2f8fb851 100644 --- a/tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java +++ b/tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java @@ -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(); -- 2.16.6