07b55984f139bd289951c8ab21834f0eb3590038
[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 *csit* directory of the *policy/docker* repo
18 - Start *xacml-pdp* by running the *start-containter.sh* script
19
20     start-container.sh xacml-pdp
21
22 - Ensure that DMaaP is up
23
24     > curl -X POST http://0.0.0.0:30227/events/POLICY-PDP-PAP
25     Should return JSON similar to this:
26     {"serverTimeMs":0,"count":0}
27
28 - Run the xacml-pdp health check
29
30     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30441/policy/pdpx/v1/healthcheck'
31     Should return JSON similar to this:
32     {"name":"Policy Xacml PDP","url":"self","healthy":true,"code":200,"message":"alive"}
33
34 - Run the api health check
35
36     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30440/policy/api/v1/healthcheck'
37     Should return JSON similar to this:
38     {
39         "name": "Policy API",
40         "url": "policy-api",
41         "healthy": true,
42         "code": 200,
43         "message": "alive"
44     }
45
46 - Run the pap health check
47
48     curl -u 'policyadmin:zb!XztG34' 'http://0.0.0.0:30442/policy/pap/v1/healthcheck'
49     Should return JSON similar to this:
50     {
51         "name": "Policy PAP",
52         "url": "policy-pap",
53         "healthy": true,
54         "code": 200,
55         "message": "alive"
56     }
57
58 # Run the Tutorial
59
60 You can run the application via code by running the *App.main* method with command line argument with IP then Port
61 of the XACML PDP, followed by the IP then Port of Dmaap.
62
63     App.main(new String[] {"0.0.0.0", "6969", "0.0.0.0", "3904"});
64
65 or from Eclipse by right-clicking App.java and selecting *Run As* and select *Java Application*. Edit the
66 configuration by adding these command line arguments: "0.0.0.0" "6969" "0.0.0.0" "3904"
67
68 Quit the application by typing 'q' into stdin.