Support for kafka within xacml tutorial
[policy/xacml-pdp.git] / tutorials / tutorial-enforcement / README.md
1 Copyright 2020 AT&T Intellectual Property. All rights reserved.
2
3 This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
4 Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
5
6 # Build the Tutorial
7
8 The Policy Enforcement Tutorial can be built:
9
10     mvn clean install
11
12 # Start the Policy Framework components
13
14 Be sure to start the Policy Framework application components in *docker* if you are not testing this in a lab.
15 - Ensure you have docker and docker-compose installed
16 - Check out the *policy/docker* repo from the ONAP gerrit or from github: https://github.com/onap/policy-docker
17 - In a console, change directory into the *compose* directory of the *policy/docker* repo
18 - Start *xacml-pdp* by running the *start-compose.sh* script
19
20     start-compose.sh xacml-pdp
21
22 - Run python script ```kafka_producer.py``` under docker repository with topic name and message as parameters.
23   i.e. ```python3 /docker/csit/resources/tests/kafka_producer.py POLICY-PDP-PAP "message"```
24   (update "message" to the usual json body)
25
26 - Run the xacml-pdp health check
27
28     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30441/policy/pdpx/v1/healthcheck'
29     Should return JSON similar to this:
30     {"name":"Policy Xacml PDP","url":"self","healthy":true,"code":200,"message":"alive"}
31
32 - Run the api health check
33
34     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30440/policy/api/v1/healthcheck'
35     Should return JSON similar to this:
36     {
37         "name": "Policy API",
38         "url": "policy-api",
39         "healthy": true,
40         "code": 200,
41         "message": "alive"
42     }
43
44 - Run the pap health check
45
46     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30442/policy/pap/v1/healthcheck'
47     Should return JSON similar to this:
48     {
49         "name": "Policy PAP",
50         "url": "policy-pap",
51         "healthy": true,
52         "code": 200,
53         "message": "alive"
54     }
55
56 # Run the Tutorial
57
58 You can run the application via code by running the *App.main* method with command line argument with IP then Port
59 of the XACML PDP, followed by the IP then Port of kafka.
60
61     App.main(new String[] {"0.0.0.0", "6969", "0.0.0.0", "9092"});
62
63 or from Eclipse by right-clicking App.java and selecting *Run As* and select *Java Application*. Edit the
64 configuration by adding these command line arguments: "0.0.0.0" "6969" "0.0.0.0" "9092"
65
66 Quit the application by typing 'q' into stdin.