TOSCA Policy Testing Upgrade
Automation Composition
Istanbul
Step 1: Clone Policy Clamp
git clone "https://gerrit.onap.org/r/policy/clamp"
Step 2: Change Master Branch to Istanbul
git checkout -b origin/istanbul
Step 3: Run Maven Clean Install
mvn clean install
Step 3: Create the Database by going to /clamp/runtime/extra/bin-for-dev
./start-db.sh test
Step 4: Start Clamp Runtime by going to /clamp/runtime/extra/bin-for-dev
./start-backend.sh
Step 5: Start Control Loop Runtime by going to /clamp/runtime-controlloop
java -jar target/policy-clamp-runtime-controlloop-6.1.5-SNAPSHOT
Step 6: Open up Postman and import the following collections
Step 7: Open up the folder Control Loop Istanbul/Commissioning
Select POST Commission Tosca Service Template and run it.
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedInstanceProperties": [
4 {
5 "name": "PMSH_Instance1",
6 "version": "1.2.3"
7 },
8 {
9 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
10 "version": "1.2.3"
11 },
12 {
13 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
14 "version": "1.2.3"
15 },
16 {
17 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement_Instance1",
18 "version": "1.2.3"
19 },
20 {
21 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement_Instance1",
22 "version": "1.2.3"
23 },
24 {
25 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
26 "version": "2.3.1"
27 },
28 {
29 "name": "org.onap.controlloop.HttpControlLoopParticipant",
30 "version": "2.3.4"
31 },
32 {
33 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
34 "version": "1.2.3"
35 },
36 {
37 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
38 "version": "1.2.3"
39 },
40 {
41 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
42 "version": "1.2.3"
43 },
44 {
45 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement_Instance1",
46 "version": "1.2.3"
47 },
48 {
49 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement_Instance1",
50 "version": "1.2.3"
51 },
52 {
53 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
54 "version": "2.3.4"
55 },
56 {
57 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
58 "version": "1.2.3"
59 },
60 {
61 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement_Instance1",
62 "version": "1.2.3"
63 },
64 {
65 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition_Instance1",
66 "version": "1.2.3"
67 },
68 {
69 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant_Instance1",
70 "version": "2.3.1"
71 },
72 {
73 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant_Instance1",
74 "version": "2.3.4"
75 },
76 {
77 "name": "org.onap.controlloop.HttpControlLoopParticipant_Instance1",
78 "version": "2.3.4"
79 },
80 {
81 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement_Instance1",
82 "version": "1.2.3"
83 },
84 {
85 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement_Instance1",
86 "version": "1.2.3"
87 },
88 {
89 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
90 "version": "1.2.3"
91 },
92 {
93 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
94 "version": "1.2.3"
95 }
96 ]
97}
Step 8: To try out other endpoints try out the other postman collections inside commission folder
Step 9: To decommission the Tosca Service Template Select DELETE Tosca Service Template
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedControlLoopDefinitions": [
4 {
5 "name": "ToscaServiceTemplateSimple",
6 "version": "1.0.0"
7 }
8 ]
9}
Step 10: For Instance Properties select the following folder in postman Control Loop Istanbul/Instantiation
Select POST Instance Properties
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedInstanceProperties": [
4 {
5 "name": "PMSH_Instance1",
6 "version": "1.2.3"
7 },
8 {
9 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
10 "version": "1.2.3"
11 },
12 {
13 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
14 "version": "1.2.3"
15 },
16 {
17 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement_Instance1",
18 "version": "1.2.3"
19 },
20 {
21 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement_Instance1",
22 "version": "1.2.3"
23 },
24 {
25 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
26 "version": "2.3.1"
27 },
28 {
29 "name": "org.onap.controlloop.HttpControlLoopParticipant",
30 "version": "2.3.4"
31 },
32 {
33 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
34 "version": "1.2.3"
35 },
36 {
37 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
38 "version": "1.2.3"
39 },
40 {
41 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
42 "version": "1.2.3"
43 },
44 {
45 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement_Instance1",
46 "version": "1.2.3"
47 },
48 {
49 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement_Instance1",
50 "version": "1.2.3"
51 },
52 {
53 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
54 "version": "2.3.4"
55 },
56 {
57 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
58 "version": "1.2.3"
59 },
60 {
61 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement_Instance1",
62 "version": "1.2.3"
63 },
64 {
65 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition_Instance1",
66 "version": "1.2.3"
67 },
68 {
69 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant_Instance1",
70 "version": "2.3.1"
71 },
72 {
73 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant_Instance1",
74 "version": "2.3.4"
75 },
76 {
77 "name": "org.onap.controlloop.HttpControlLoopParticipant_Instance1",
78 "version": "2.3.4"
79 },
80 {
81 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement_Instance1",
82 "version": "1.2.3"
83 },
84 {
85 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement_Instance1",
86 "version": "1.2.3"
87 },
88 {
89 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
90 "version": "1.2.3"
91 },
92 {
93 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
94 "version": "1.2.3"
95 }
96 ]
97}
Step 11: To try out other endpoints try out the other postman collections inside Instantiation folder
Step 12: To delete Instance properties select DELETE Instance Properties
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedControlLoops": [
4 {
5 "name": "PMSH_Instance1",
6 "version": "1.2.3"
7 }
8 ]
9}
Step 13: For monitoring endpoints go to Control Loop Istanbul/Monitoring folder
Jakarta
Step 1: Clone Policy Clamp
git clone "https://gerrit.onap.org/r/policy/clamp"
Step 2: Change Master Branch to Jakarta
git checkout -b origin/jakarta
Step 3: Run Maven Clean Install
mvn clean install
Step 3: Create the Database by going to /clamp/runtime/extra/bin-for-dev
./start-db.sh test
Step 4: Start Clamp Runtime by going to /clamp/runtime/extra/bin-for-dev
./start-backend.sh
Step 5: Start Automation Composition Runtime by going to /clamp/runtime-acm
java -jar target/policy-clamp-runtime-acm-6.3.0-SNAPSHOT.jar
Step 6: Open up Postman and import the following collections
Step 7: Open up the folder Automation Composition Jakarta/Commissioning
Select POST Commission Tosca Service Template and run it.
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedAutomationCompositionDefinitions": [
4 {
5 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
6 "version": "1.2.3"
7 },
8 {
9 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
10 "version": "1.2.3"
11 },
12 {
13 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
14 "version": "1.2.3"
15 },
16 {
17 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
18 "version": "1.2.3"
19 },
20 {
21 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition",
22 "version": "1.2.3"
23 },
24 {
25 "name": "org.onap.policy.clamp.acm.HttpParticipant",
26 "version": "2.3.4"
27 },
28 {
29 "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
30 "version": "2.3.4"
31 },
32 {
33 "name": "org.onap.policy.clamp.acm.PolicyParticipant",
34 "version": "2.3.1"
35 }
36 ]
37}
Step 8: To try out other endpoints try out the other postman collections inside commission folder
Step 9: To decommission the Tosca Service Template Select DELETE Tosca Service Template
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedAutomationCompositionDefinitions": [
4 {
5 "name": "ToscaServiceTemplateSimple",
6 "version": "1.0.0"
7 }
8 ]
9}
Step 10: For Instance Properties select the following folder in postman Automation Composition Jakarta/Instantiation
Select POST Instance Properties
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedInstanceProperties": [
4 {
5 "name": "ATT",
6 "version": "2.3.4"
7 },
8 {
9 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition",
10 "version": "1.2.3"
11 },
12 {
13 "name": "org.onap.policy.clamp.acm.PolicyParticipant",
14 "version": "2.3.1"
15 },
16 {
17 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
18 "version": "1.2.3"
19 },
20 {
21 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
22 "version": "1.2.3"
23 },
24 {
25 "name": "org.onap.policy.clamp.acm.HttpParticipant",
26 "version": "2.3.4"
27 },
28 {
29 "name": "org.onap.policy.clamp.acm.KubernetesParticipant-ATT",
30 "version": "2.3.4"
31 },
32 {
33 "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
34 "version": "2.3.4"
35 },
36 {
37 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement-ATT",
38 "version": "1.2.3"
39 },
40 {
41 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement-ATT",
42 "version": "1.2.3"
43 },
44 {
45 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
46 "version": "1.2.3"
47 },
48 {
49 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement-ATT",
50 "version": "1.2.3"
51 },
52 {
53 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement-ATT",
54 "version": "1.2.3"
55 },
56 {
57 "name": "org.onap.policy.clamp.acm.PolicyParticipant-ATT",
58 "version": "2.3.1"
59 },
60 {
61 "name": "org.onap.policy.clamp.acm.HttpParticipant-ATT",
62 "version": "2.3.4"
63 },
64 {
65 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
66 "version": "1.2.3"
67 },
68 {
69 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition-ATT",
70 "version": "1.2.3"
71 }
72 ]
73}
Step 11: To try out other endpoints try out the other postman collections inside Instantiation folder
Step 12: To delete Instance properties select DELETE Instance Properties
- Should receive the following result
1{
2 "errorDetails": null,
3 "affectedAutomationCompositionDefinitions": [
4 {
5 "name": "ToscaServiceTemplateSimple",
6 "version": "1.0.0"
7 }
8 ]
9}
Step 13: For monitoring endpoints go to Automation Composition Jakarta/Monitoring folder
PAP & API
Istanbul
Step 1: Clone Policy Docker
git clone "https://gerrit.onap.org/r/policy/docker"
Step 2: Go to the CSIT directory
cd docker/csit
Step 3: Run prepare csit script
./prepare-csit.sh
Step 4: Modify the compose-grafana.yml file
remove everything from xacml-pdp downwards to grafana
add the following in api after the keyword expose
ports:
- "6970:6969"
add the following in pap after the keyword expose
ports:
- "6971:6969"
Step 5: Run start grafana script
./start-grafana.sh
Step 6: Once api and pap has started check run the postman script Policy Framework Lifecycle API/Lifecycle Api Healthcheck at port 6970

Step 7: Log into mariadb container
docker exec -it mariadb sh
Step 8: Log into mariadb container
docker exec -it mariadb sh
Step 9: Connect to mariadb
mysql -u policy_user -p
Step 10: Enter mariadb password

password: policy_user
Step 11: View all schemas
show schemas;

Step 12: Select policyadmin schema
use policyadmin;
Step 13: View all tables
show tables;

Step 14: Change schema to migration
use migration;
Step 15: View migration tables
show tables;

Step 16: Select tables from schema_versions
select * from schema_versions;

‘*’ Notice the version 1000 is the latest
Step 17: Go inside the db-migrator container
docker exec -it policy-db-migrator sh
Step 18: See what environment variables is set on the container
printenv
Step 19: If SQL_HOST, SQL_DB, SQL_USER, SQL_PASSWORD & SCRIPT_DIRECTORY is not set do the following
1export SQL_HOST=mariadb
2export SQL_DB=policyadmin
3export SQL_USER=policy_user
4export SQL_PASSWORD=policy_user
5export SCRIPT_DIRECTORY=sql
Step 20: To downgrade to Istanbul go to the following directory /opt/app/policy/bin and use the following script
./prepare_downgrade policyadmin
Step 21: To downgrade to Istanbul go to the following directory /opt/app/policy/bin and use the following script
./db-migrator -s policyadmin -o downgrade -f 1000 -t 0800
Step 22: Go back to the mariaddb container
docker exec -it mariadb sh
Step 23: Log back into mariadb
mysql -u policy_user -p
Step 24: See if the downgrade has been successfully
1use migration;
2select * from policyadmin_schema_changelog;
3select * from schema_versions;



Step 25: To upgrade to Jakarta repeat steps 17, 18 & 19
Step 26: Got to the following directory /opt/app/policy/bin and use the following script
./prepare_upgrade.sh policyadmin
Step 27: Got to the following directory /opt/app/policy/bin and use the following script
./db-migrator -s policyadmin -o upgrade -f 0800 -t 0900
Step 28: Repeat steps 22, 23 & 24


