Add Cloud, business customer, zone, service and tenant in A&AI

---------------------------------
CHECK IF COMPLEX OBJECT EXISTS: 
---------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/complexes/complex/clli1?depth=3 | jq .

---------------------------------
INSERT COMPLEX OBJECT: 
---------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/complexes/complex/clli1 -X PUT -d /
'{
  "physical-location-id": "clli1",
  "data-center-code": "example-data-center-code-val-5556",
  "complex-name": "clli1",
  "identity-url": "example-identity-url-val-56898",
  "physical-location-type": "example-physical-location-type-val-7608",
  "street1": "example-street1-val-34205",
  "street2": "example-street2-val-99210",
  "city": "example-city-val-27150",
  "state": "example-state-val-59487",
  "postal-code": "68871",
  "country": "example-country-val-94173",
  "region": "example-region-val-13893",
  "latitude": "example-latitude-val-89101",
  "longitude": "32.89948",
  "elevation": "97.045443",
  "lata": "example-lata-val-46073"
}'
---------------------------------
CHECK IF COMPLEX OBJECT EXISTS: 
---------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/complexes/complex/clli1?depth=3 | jq .


----------------------------------------------------
CHECK IF CLOUD OWNER AND CLOUD REGION OBJECT EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud?depth=3 | jq .


----------------------------------------------------
INSERT CLOUD OWNER AND CLOUD REGION OBJECT: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud -X PUT -d \
'{
  "cloud-owner": "CloudOwner",
  "cloud-region-id": "ericssoncloud",
  "cloud-type": "OPENSTACK",
  "owner-defined-type": "OwnerType",
  "cloud-region-version": "v1",
  "cloud-zone": "CloudZone",
  "availability-zones": {
    "availability-zone": [
      {
        "availability-zone-name": "nova",
        "hypervisor-type": "kvm",
        "operational-status": "available"
      }
    ]
  }
}
' | jq .
----------------------------------------------------
CHECK IF CLOUD OWNER AND CLOUD REGION OBJECT EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud?depth=3 | jq .


----------------------------------------------------
CHECK IF BUSINESS CUSTOMER EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer?depth=3 | jq .

----------------------------------------------------
INSERT BUSINESS CUSTOMER: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer -X PUT -d \
'{
  "global-customer-id": "EricssonDemoCustomer",
  "subscriber-name": "EricssonDemoCustomer",
  "subscriber-type": "INFRA",
  "service-subscriptions": {
    "service-subscription": [
      {
        "service-type": "vLB",
        "relationship-list": {
          "relationship": [
            {
              "related-to": "tenant",
              "relationship-label": "org.onap.relationships.inventory.Uses",
              "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d",
              "relationship-data": [
                {
                  "relationship-key": "cloud-region.cloud-owner",
                  "relationship-value": "CloudOwner"
                },
                {
                  "relationship-key": "cloud-region.cloud-region-id",
                  "relationship-value": "ericssoncloud"
                },
                {
                  "relationship-key": "tenant.tenant-id",
                  "relationship-value": "693c7729b2364a26a3ca602e6f66187d"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "tenant.tenant-name",
                  "property-value": "admin"
                }
              ]
            }
          ]
        }
      },
      {
        "service-type": "vCPE",
        "relationship-list": {
          "relationship": [
            {
              "related-to": "tenant",
              "relationship-label": "org.onap.relationships.inventory.Uses",
              "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d",
              "relationship-data": [
                {
                  "relationship-key": "cloud-region.cloud-owner",
                  "relationship-value": "CloudOwner"
                },
                {
                  "relationship-key": "cloud-region.cloud-region-id",
                  "relationship-value": "ericssoncloud"
                },
                {
                  "relationship-key": "tenant.tenant-id",
                  "relationship-value": "693c7729b2364a26a3ca602e6f66187d"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "tenant.tenant-name",
                  "property-value": "admin"
                }
              ]
            }
          ]
        }
      }
    ]
  }
}
' | jq .

----------------------------------------------------
CHECK IF BUSINESS CUSTOMER EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer?depth=3 | jq .


----------------------------------------------------
CHECK IF ZONE EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/network/zones/zone/nova?depth=3  | jq .


----------------------------------------------------
INSERT ZONE: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/network/zones/zone/nova -X PUT -d \
'{
"zone-id":"nova",
"zone-name":"nova",
"design-type":"integration",
"zone-context":"labs",
"status": "deployed"
}
' | jq .

----------------------------------------------------
CHECK IF ZONE EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/network/zones/zone/nova?depth=3  | jq .

----------------------------------------------------
CHECK IF SERVICE EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/service-design-and-creation/services/service/f13844f4-dbf8-4d0e-a979-45204f3ddb4e?depth=3


----------------------------------------------------
INSERT SERVICE: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/service-design-and-creation/services/service/f13844f4-dbf8-4d0e-a979-45204f3ddb4e -X PUT -d '{"service-id":"f13844f4-dbf8-4d0e-a979-45204f3ddb4e","service-description":"vCPE"}'

----------------------------------------------------
CHECK IF TENANT EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d?depth=3 | jq .

----------------------------------------------------
INSERT TENANT: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d -X PUT -d \
'{
  "tenant-id": "693c7729b2364a26a3ca602e6f66187d",
  "tenant-name": "admin"
}' | jq .

----------------------------------------------------
CHECK IF TENANT EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d?depth=3 | jq .


----------------------------------------------------
CHECK IF SERVICE SUBSCRIPTION EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer/service-subscriptions/service-subscription/vCPE/relationship-list/relationship?depth=3 | jq .


----------------------------------------------------
INSERT SERVICE SUBSCRIPTION: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer/service-subscriptions/service-subscription/vCPE/relationship-list/relationship -X PUT -d \
'{
        "related-to": "tenant",
        "relationship-label": "org.onap.relationships.inventory.Uses",
        "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/ericssoncloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d",
        "relationship-data": [
          {
            "relationship-key": "cloud-region.cloud-owner",
            "relationship-value": "CloudOwner"
          },
          {
            "relationship-key": "cloud-region.cloud-region-id",
            "relationship-value": "ericssoncloud"
          },
          {
            "relationship-key": "tenant.tenant-id",
            "relationship-value": "693c7729b2364a26a3ca602e6f66187d"
          }
        ],
        "related-to-property": [
          {
            "property-key": "tenant.tenant-name",
            "property-value": "admin"
          }
        ]
      }

' | jq .

----------------------------------------------------
CHECK IF SERVICE SUBSCRIPTION EXISTS: 
----------------------------------------------------
curl  -k --user VID:VID -H "Accept: application/json" -H "Content-Type: application/json" -H "X-TransactionId: AFR" -H "X-FromAppId: AFR" https://aai.onap:8443/aai/v14/business/customers/customer/EricssonDemoCustomer/service-subscriptions/service-subscription/vCPE/relationship-list/relationship?depth=3 | jq .


How to fix missing project and owning entity drop down values in VID "Create Service Instance -- a la carte" window

Add following entries in vid-mariadb-galera database


Steps:


  1. Login to vid-mariadb-galera database

    kubectl -n onap exec -it devonap-vid-vid-mariadb-galera-0 bash


  2. Run following command to find database password

    bash-4.2$ env | grep -i password
    
    MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
    MYSQL_ROOT_PASSWORD=secretpassword


  3. Login to MariaDB and connect to vid_openecomp_epsdk database

    bash-4.2$ mysql -uroot -psecretpassword
    
    MariaDB [(none)]>  show databases;
    +---------------------+
    | Database            |
    +---------------------+
    | information_schema  |
    | mysql               |
    | performance_schema  |
    | vid_openecomp_epsdk |
    +---------------------+
    4 rows in set (0.02 sec)
    
    MariaDB [(none)]> connect vid_openecomp_epsdk
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Connection id:    83013
    Current database: vid_openecomp_epsdk
    
    MariaDB [vid_openecomp_epsdk]> 


  4. Insert following entries in vid_category_parameter_option table

    MariaDB [vid_openecomp_epsdk]> select * from vid_category_parameter;
    +-------------+------------------------------+--------------+---------------------------+---------------------+---------------------+
    | CATEGORY_ID | NAME                         | ID_SUPPORTED | FAMILY                    | CREATED_DATE        | MODIFIED_DATE       |
    +-------------+------------------------------+--------------+---------------------------+---------------------+---------------------+
    |           1 | platform                     |            0 | PARAMETER_STANDARDIZATION | 2017-09-12 17:01:13 | 2017-09-12 17:01:13 |
    |           2 | project                      |            0 | PARAMETER_STANDARDIZATION | 2017-09-12 18:23:54 | 2017-09-13 15:05:25 |
    |           3 | lineOfBusiness               |            0 | PARAMETER_STANDARDIZATION | 2017-09-12 18:24:14 | 2017-09-12 18:24:15 |
    |           4 | owningEntity                 |            1 | PARAMETER_STANDARDIZATION | 2017-09-12 18:24:26 | 2017-09-12 18:24:28 |
    |           5 | operational-environment-type |            0 | TENANT_ISOLATION          | 2017-11-12 18:24:26 | 2017-11-12 18:24:28 |
    |           6 | workload-context             |            0 | TENANT_ISOLATION          | 2017-11-12 18:24:26 | 2017-11-12 18:24:28 |
    +-------------+------------------------------+--------------+---------------------------+---------------------+---------------------+
    6 rows in set (0.01 sec)
    
    
    MariaDB [vid_openecomp_epsdk]> select * from vid_category_parameter_option;
    +--------------------+---------------------+-------+-------------+---------------------+---------------------+
    | CATEGORY_OPT_DB_ID | CATEGORY_OPT_APP_ID | NAME  | CATEGORY_ID | CREATED_DATE        | MODIFIED_DATE       |
    +--------------------+---------------------+-------+-------------+---------------------+---------------------+
    |                 25 | ECOMP               | ECOMP |           6 | 2018-12-06 14:55:12 | 2018-12-06 14:55:12 |
    |                 26 | DEV                 | DEV   |           6 | 2018-12-06 14:55:12 | 2018-12-06 14:55:12 |
    |                 27 | TEST                | TEST  |           6 | 2018-12-06 14:55:12 | 2018-12-06 14:55:12 |
    |                 28 | VNF                 | VNF   |           5 | 2018-12-06 14:55:12 | 2018-12-06 14:55:12 |
    +--------------------+---------------------+-------+-------------+---------------------+---------------------+
    
    
    MariaDB [vid_openecomp_epsdk]> SHOW COLUMNS FROM vid_category_parameter_option;
    +---------------------+-------------+------+-----+-------------------+----------------+
    | Field               | Type        | Null | Key | Default           | Extra          |
    +---------------------+-------------+------+-----+-------------------+----------------+
    | CATEGORY_OPT_DB_ID  | int(11)     | NO   | PRI | NULL              | auto_increment |
    | CATEGORY_OPT_APP_ID | varchar(50) | NO   |     | NULL              |                |
    | NAME                | varchar(50) | YES  |     | NULL              |                |
    | CATEGORY_ID         | int(11)     | NO   | MUL | 0                 |                |
    | CREATED_DATE        | timestamp   | NO   |     | CURRENT_TIMESTAMP |                |
    | MODIFIED_DATE       | timestamp   | NO   |     | CURRENT_TIMESTAMP |                |
    +---------------------+-------------+------+-----+-------------------+----------------+
    
    
    INSERT INTO vid_category_parameter_option (CATEGORY_OPT_APP_ID, NAME, CATEGORY_ID) VALUES ('oe_1', 'oe_2', 4);
    INSERT INTO vid_category_parameter_option (CATEGORY_OPT_APP_ID, NAME, CATEGORY_ID) VALUES ('PLATFORM_APP_ID_1', 'PLATFORM_NAME_1', 1);
    


How to fix "ALaCarte Service createInstance is not supported by GR_API."  error in bpmn-infra while instantiating VNF

  1. Login into SO Mariadb

    root@esy22-rancher:~# kubectl -n onap get pods | grep mariadb-galera
    dev-mariadb-galera-mariadb-galera-0                         1/1     Running            0          10d
    dev-mariadb-galera-mariadb-galera-1                         1/1     Running            0          10d
    dev-mariadb-galera-mariadb-galera-2                         1/1     Running            0          10d
    dev-vid-vid-mariadb-galera-0                                1/1     Running            0          2d22h
    root@esy22-rancher:~# kubectl -n onap exec -it  dev-mariadb-galera-mariadb-galera-0 bash
    bash-4.2$ 


  2. login to database and connect to catalogdb

    bash-4.2$ env | grep -i password  
    MYSQL_PASSWORD=my-password
    MYSQL_ROOT_PASSWORD=secretpassword
    bash-4.2$ mysql -uroot -psecretpassword
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 188369
    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)]> connect catalogdb;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Connection id:    188371
    Current database: catalogdb
    
    MariaDB [catalogdb]> 
    
    


  3. Change SERVICE_TYPE Null value to *

    MariaDB [catalogdb]> select * from northbound_request_ref_lookup; 
    +-----+-------------------+-----------------------------------+--------------------------+-------------+-----------------+-----------------+-----------------+-------------+--------------+
    | id  | REQUEST_SCOPE     | MACRO_ACTION                      | ACTION                   | IS_ALACARTE | MIN_API_VERSION | MAX_API_VERSION | IS_TOPLEVELFLOW | CLOUD_OWNER | SERVICE_TYPE |
    +-----+-------------------+-----------------------------------+--------------------------+-------------+-----------------+-----------------+-----------------+-------------+--------------+
    |  86 | Service           | Service-Create                    | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    |  89 | Service           | Service-Delete                    | deleteInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    |  92 | Service           | Service-Macro-Assign              | assignInstance           |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    |  95 | Service           | Service-Macro-Activate            | activateInstance         |           0 |               5 |               7 |               1 | CloudOwner  | NULL         |
    |  98 | Service           | Service-Macro-Unassign            | unassignInstance         |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 101 | Service           | Service-Macro-Create              | createInstance           |           0 |               5 |               7 |               1 | CloudOwner  | NULL         |
    | 104 | Service           | Service-Macro-Delete              | deleteInstance           |           0 |               5 |               7 |               1 | CloudOwner  | NULL         |
    | 107 | Network           | Network-Create                    | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 110 | Network           | Network-Delete                    | deleteInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 113 | Vnf               | VNF-Macro-Recreate                | recreateInstance         |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 116 | Vnf               | VNF-Macro-Replace                 | replaceInstance          |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 119 | Vnf               | VNF-Create                        | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 122 | Vnf               | VNF-Delete                        | deleteInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 125 | VolumeGroup       | VolumeGroup-Create                | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 128 | VolumeGroup       | VolumeGroup-Delete                | deleteInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 131 | VfModule          | VFModule-Create                   | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 134 | VfModule          | VFModule-Delete                   | deleteInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 137 | NetworkCollection | NetworkCollection-Macro-Create    | createInstance           |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 140 | NetworkCollection | NetworkCollection-Macro-Delete    | deleteInstance           |           0 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 143 | VfModule          | VFModule-ScaleOut                 | createInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 146 | VfModule          | VFModule-DeactivateAndCloudDelete | deactivateAndCloudDelete |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    | 149 | Service           | Service-Macro-Deactivate          | deactivateInstance       |           0 |               5 |               7 |               1 | CloudOwner  | NULL         |
    | 152 | Network           | Network-Update                    | updateInstance           |           1 |               7 |               7 |               1 | CloudOwner  | NULL         |
    +-----+-------------------+-----------------------------------+--------------------------+-------------+-----------------+-----------------+-----------------+-------------+--------------+
    23 rows in set (0.00 sec)
    
    MariaDB [catalogdb]> UPDATE northbound_request_ref_lookup set SERVICE_TYPE='*';  
    Query OK, 0 rows affected (0.00 sec)
    Rows matched: 23  Changed: 0  Warnings: 0


Command to remove old images from docker

docker images | grep " [1 days ago|months|weeks]* ago" | awk '{print $3,$4,$5}' | xargs docker rmi --force $3