aboutsummaryrefslogtreecommitdiffstats
path: root/tutorials/tutorial-xacml-application/src
diff options
context:
space:
mode:
Diffstat (limited to 'tutorials/tutorial-xacml-application/src')
-rw-r--r--tutorials/tutorial-xacml-application/src/main/docker/README.md30
-rw-r--r--tutorials/tutorial-xacml-application/src/main/docker/docker-compose.yml4
-rwxr-xr-xtutorials/tutorial-xacml-application/src/main/docker/run-tutorial.sh6
-rw-r--r--tutorials/tutorial-xacml-application/src/main/java/org/onap/policy/tutorial/tutorial/TutorialTranslator.java7
4 files changed, 25 insertions, 22 deletions
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();