1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. _clamp-policy-upgrade-label:
5 TOSCA Policy Testing Upgrade
6 ############################
11 Automation Composition
12 **********************
18 **Step 1:** Clone Policy Clamp
22 git clone "https://gerrit.onap.org/r/policy/clamp"
24 **Step 2:** Change Master Branch to Istanbul
28 git checkout -b origin/istanbul
30 **Step 3:** Run Maven Clean Install
36 **Step 3:** Create the Database by going to /clamp/runtime/extra/bin-for-dev
42 **Step 4:** Start Clamp Runtime by going to /clamp/runtime/extra/bin-for-dev
48 **Step 5:** Start Control Loop Runtime by going to /clamp/runtime-controlloop
52 java -jar target/policy-clamp-runtime-controlloop-6.1.5-SNAPSHOT
54 **Step 6:** Open up Postman and import the following collections
56 `Download Istanbul Postman Collections <https://github.com/onap/policy-parent/blob/master/docs/clamp/acm/policy-upgrade/collections/Control%20Loop%20Istanbul.postman_collection.json>`_
58 **Step 7:** Open up the folder Control Loop Istanbul/Commissioning
60 Select POST Commission Tosca Service Template and run it.
62 *- Should receive the following result*
69 "affectedInstanceProperties": [
71 "name": "PMSH_Instance1",
75 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
79 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
83 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement_Instance1",
87 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement_Instance1",
91 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
95 "name": "org.onap.controlloop.HttpControlLoopParticipant",
99 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
103 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
107 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
111 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement_Instance1",
115 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement_Instance1",
119 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
123 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
127 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement_Instance1",
131 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition_Instance1",
135 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant_Instance1",
139 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant_Instance1",
143 "name": "org.onap.controlloop.HttpControlLoopParticipant_Instance1",
147 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement_Instance1",
151 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement_Instance1",
155 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
159 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
165 **Step 8:** To try out other endpoints try out the other postman collections inside commission folder
167 **Step 9:** To decommission the Tosca Service Template Select DELETE Tosca Service Template
169 *- Should receive the following result*
175 "errorDetails": null,
176 "affectedControlLoopDefinitions": [
178 "name": "ToscaServiceTemplateSimple",
184 **Step 10:** For Instance Properties select the following folder in postman Control Loop Istanbul/Instantiation
186 Select POST Instance Properties
188 *- Should receive the following result*
194 "errorDetails": null,
195 "affectedInstanceProperties": [
197 "name": "PMSH_Instance1",
201 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement",
205 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition",
209 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement_Instance1",
213 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement_Instance1",
217 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant",
221 "name": "org.onap.controlloop.HttpControlLoopParticipant",
225 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement",
229 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement",
233 "name": "org.onap.domain.database.Local_K8SMicroserviceControlLoopElement",
237 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement_Instance1",
241 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement_Instance1",
245 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant",
249 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement",
253 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement_Instance1",
257 "name": "org.onap.domain.sample.GenericK8s_ControlLoopDefinition_Instance1",
261 "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant_Instance1",
265 "name": "org.onap.k8s.controlloop.K8SControlLoopParticipant_Instance1",
269 "name": "org.onap.controlloop.HttpControlLoopParticipant_Instance1",
273 "name": "org.onap.domain.pmsh.DerivedDerivedPolicyControlLoopElement_Instance1",
277 "name": "org.onap.domain.database.Http_PMSHMicroserviceControlLoopElement_Instance1",
281 "name": "org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement",
285 "name": "org.onap.domain.pmsh.DerivedPolicyControlLoopElement",
291 **Step 11:** To try out other endpoints try out the other postman collections inside Instantiation folder
293 **Step 12:** To delete Instance properties select DELETE Instance Properties
295 *- Should receive the following result*
301 "errorDetails": null,
302 "affectedControlLoops": [
304 "name": "PMSH_Instance1",
310 **Step 13:** For monitoring endpoints go to Control Loop Istanbul/Monitoring folder
316 **Step 1:** Clone Policy Clamp
320 git clone "https://gerrit.onap.org/r/policy/clamp"
322 **Step 2:** Change Master Branch to Jakarta
326 git checkout -b origin/jakarta
328 **Step 3:** Run Maven Clean Install
334 **Step 3:** Create the Database by going to /clamp/runtime/extra/bin-for-dev
340 **Step 4:** Start Clamp Runtime by going to /clamp/runtime/extra/bin-for-dev
346 **Step 5:** Start Automation Composition Runtime by going to /clamp/runtime-acm
350 java -jar target/policy-clamp-runtime-acm-6.3.0-SNAPSHOT.jar
352 **Step 6:** Open up Postman and import the following collections
354 `Download Jakarta Postman Collections <https://github.com/onap/policy-parent/blob/master/docs/clamp/acm/policy-upgrade/collections/Automation%20Composition%20Jackarta.postman_collection.json>`_
356 **Step 7:** Open up the folder Automation Composition Jakarta/Commissioning
358 Select POST Commission Tosca Service Template and run it.
360 *- Should receive the following result*
366 "errorDetails": null,
367 "affectedAutomationCompositionDefinitions": [
369 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
373 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
377 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
381 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
385 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition",
389 "name": "org.onap.policy.clamp.acm.HttpParticipant",
393 "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
397 "name": "org.onap.policy.clamp.acm.PolicyParticipant",
403 **Step 8:** To try out other endpoints try out the other postman collections inside commission folder
405 **Step 9:** To decommission the Tosca Service Template Select DELETE Tosca Service Template
407 *- Should receive the following result*
413 "errorDetails": null,
414 "affectedAutomationCompositionDefinitions": [
416 "name": "ToscaServiceTemplateSimple",
422 **Step 10:** For Instance Properties select the following folder in postman Automation Composition Jakarta/Instantiation
424 Select POST Instance Properties
426 *- Should receive the following result*
432 "errorDetails": null,
433 "affectedInstanceProperties": [
439 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition",
443 "name": "org.onap.policy.clamp.acm.PolicyParticipant",
447 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
451 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
455 "name": "org.onap.policy.clamp.acm.HttpParticipant",
459 "name": "org.onap.policy.clamp.acm.KubernetesParticipant-ATT",
463 "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
467 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement-ATT",
471 "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement-ATT",
475 "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
479 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement-ATT",
483 "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement-ATT",
487 "name": "org.onap.policy.clamp.acm.PolicyParticipant-ATT",
491 "name": "org.onap.policy.clamp.acm.HttpParticipant-ATT",
495 "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
499 "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition-ATT",
505 **Step 11:** To try out other endpoints try out the other postman collections inside Instantiation folder
507 **Step 12:** To delete Instance properties select DELETE Instance Properties
509 *- Should receive the following result*
515 "errorDetails": null,
516 "affectedAutomationCompositionDefinitions": [
518 "name": "ToscaServiceTemplateSimple",
524 **Step 13:** For monitoring endpoints go to Automation Composition Jakarta/Monitoring folder
532 **Step 1:** Clone Policy Docker
536 git clone "https://gerrit.onap.org/r/policy/docker"
538 **Step 2:** Go to the CSIT directory
544 **Step 3:** Run prepare csit script
550 **Step 4:** Modify the compose-grafana.yml file
552 remove everything from xacml-pdp downwards to grafana
554 add the following in api after the keyword expose
561 add the following in pap after the keyword expose
568 **Step 5:** Run start grafana script
574 **Step 6:** Once api and pap has started check run the postman script Policy Framework Lifecycle API/Lifecycle Api Healthcheck at port 6970
576 .. image:: images/01-api-pap-upgrade.png
578 **Step 7:** Log into mariadb container
582 docker exec -it mariadb sh
584 **Step 8:** Log into mariadb container
588 docker exec -it mariadb sh
591 **Step 9:** Connect to mariadb
595 mysql -u policy_user -p
597 **Step 10:** Enter mariadb password
599 .. image:: images/02-api-pap-upgrade.png
601 **password:** policy_user
603 **Step 11:** View all schemas
609 .. image:: images/03-api-pap-upgrade.png
611 **Step 12:** Select policyadmin schema
617 **Step 13:** View all tables
623 .. image:: images/04-api-pap-upgrade.png
625 **Step 14:** Change schema to migration
631 **Step 15:** View migration tables
637 .. image:: images/05-api-pap-upgrade.png
639 **Step 16:** Select tables from schema_versions
643 select * from schema_versions;
645 .. image:: images/06-api-pap-upgrade.png
647 '*' Notice the version 1000 is the latest
649 **Step 17:** Go inside the db-migrator container
653 docker exec -it policy-db-migrator sh
655 **Step 18:** See what environment variables is set on the container
661 **Step 19:** If SQL_HOST, SQL_DB, SQL_USER, SQL_PASSWORD & SCRIPT_DIRECTORY is not set do the following
666 export SQL_HOST=mariadb
667 export SQL_DB=policyadmin
668 export SQL_USER=policy_user
669 export SQL_PASSWORD=policy_user
670 export SCRIPT_DIRECTORY=sql
672 **Step 20:** To downgrade to Istanbul go to the following directory /opt/app/policy/bin and use the following script
676 ./prepare_downgrade policyadmin
678 **Step 21:** To downgrade to Istanbul go to the following directory /opt/app/policy/bin and use the following script
682 ./db-migrator -s policyadmin -o downgrade -f 1000 -t 0800
684 **Step 22:** Go back to the mariaddb container
688 docker exec -it mariadb sh
690 **Step 23:** Log back into mariadb
694 mysql -u policy_user -p
696 **Step 24:** See if the downgrade has been successfully
702 select * from policyadmin_schema_changelog;
703 select * from schema_versions;
705 .. image:: images/07-api-pap-upgrade.png
709 .. image:: images/08-api-pap-upgrade.png
713 .. image:: images/01-api-pap-upgrade.png
715 **Step 25:** To upgrade to Jakarta repeat steps 17, 18 & 19
717 **Step 26:** Got to the following directory /opt/app/policy/bin and use the following script
721 ./prepare_upgrade.sh policyadmin
723 **Step 27:** Got to the following directory /opt/app/policy/bin and use the following script
727 ./db-migrator -s policyadmin -o upgrade -f 0800 -t 0900
729 **Step 28:** Repeat steps 22, 23 & 24
731 .. image:: images/09-api-pap-upgrade.png
735 .. image:: images/10-api-pap-upgrade.png
739 .. image:: images/01-api-pap-upgrade.png