Automate Reference Artifacts via getdesign:dbservice
There is an alternative where you would not use CDT self service GUI, when repopulating vnf and template artifact to APPC DB. There is a RESTful API call between CDT GUI and APPC's Proxy service could be used for this need. Here are the steps that could be used by curling POST request to populate vnf/template artifact to APPC DB.
This could be useful if you have an artifact that you will be inputting to CDT on a regular basis, since this method will be much faster than going through the CDT GUI every time you want to add the artifact.
In ONAP OOM environment, access to CDT GUI: https://XYZ:30289/index.html#/home
Turn on debugger mode: For Firefox, click the right top hamburger menu, click "Web Developer", then click "Debugger"
debugger console shows on the browser bottom:
click "network" on the debugger console in Firefox browser
Follow CDT guide for VNF self service
When clicking "SAVE ALL TO APPC" button, VNF Reference artifact would save to APPC DB. Look at the debugger console, a new POST request shows in debugger console. click "Params" on the right panel in the debugger console. The payload for the VNF Reference artifact should show.
copy & pastes the "request payload" and save to a json file:uploadArtifact-test.json (for example)
write a shell script for curl command:
curl -k -X POST -H "Content-Type: application/json" -d @./uploadArtifact-test.json https://XYZ:30211/cdtService/getDesigns
when you run the curl command in the command terminal. the output shows:
{"output":{"status":{"code":"400","message":"success"},"data":{"requestId":"816017286421"}}}
check APPC DB:
ubuntu@k8s-master:~/getdesign$ kubectl -n onap exec -it dev-appc-appc-db-0 bash bash-4.2$ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 117266 Server version: 10.1.24-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use sdnctl; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [sdnctl]> select * from ASDC_ARTIFACTS ; | 5158 | TLSUUID816017286421 | TLDID53249 | TLServiceName | Template Loader Test | TLRUID53249 | TLRIName | null | TLResourceVersion | TLResourceType | TLAUUID53249 | APPC-CONFIG | 0.1 | SdcTestDescription | 8 | 2020-01-31 10:56:08 | reference_AllAction_taka_vnf_0.0.1V.json | {"reference_data":[{"action":"ConfigScaleOut","action-level":"vnf","scope":{"vnf-type":"taka_vnf","vnfc-type-list":[],"vnfc-type":""},"template":"Y","vm":[],"device-protocol":"ANSIBLE","user-name":"","port-number":"","artifact-list":[{"artifact-name":"template_ConfigScaleOut_taka_vnf_0.0.1V_aaa.json","artifact-type":"config_template"},{"artifact-name":"pd_ConfigScaleOut_taka_vnf_0.0.1V_aaa.yaml","artifact-type":"parameter_definitions"},{"artifact-name":"param_ConfigScaleOut_taka_vnf_0.0.1V_aaa.json","artifact-type":"param_values"}],"template-id-list":["aaa"],"scopeType":"vnf-type"},{"action":"AllAction","action-level":"vnf","scope":{"vnf-type":"taka_vnf","vnfc-type-list":[],"vnfc-type":""},"artifact-list":[{"artifact-name":"reference_AllAction_taka_vnf_0.0.1V.json","artifact-type":"reference_template"}]}]} | | 5161 | TLSUUID816017286421 | TLDID53249 | TLServiceName | Template Loader Test | TLRUID53249 | TLRIName | null | TLResourceVersion | TLResourceType | TLAUUID53249 | null | 0.1 | SdcTestDescription | 8 | 2020-01-31 10:56:08 | capability_AllAction_taka_vnf_0.0.1V.json | {"capabilities":{"vnfc":[],"vm":[],"vf-module":[],"vnf":["ConfigScaleOut","AllAction"]}} ....
follow the same method above for template artifact.