Uploading input JSON file

Same NPS toolkit VM can be used for multiple deployments or single deployment of single VIM type by uploading respective input.json files. To achieve the same, perform the following steps to keep a clear segregation on the deployments to be performed.

Procedure
  1. Create a directory with any desired name.
    mkdir <deployment1-dir>
  2. Navigate to the newly created directory and copy the input.json file for the deployment to this directory.
    cd <deployment1-dir>
  3. For ease of use, create a file within the directory and update it with the environment variables to be exported as provided below. Ensure the topology name mentioned in the input.json file and the environment variables match.
    vi <deployment1_env_file>
    export API_IP=<NPS Toolkit VM OAM/Customer Network IP address>
    export NPSADMIN=<user name of admin mentioned in the nps_secret.yaml file>
    export NPSPASSWD=<password of admin user mentioned in the nps_secret.yaml file>
    export TOPOLOGY_NAME=<value of the field "topology_name" in the input.json file>
    export VIM_TYPE=<VIM platform type like RHOCP/RHOCP/VMWARE>
    NOTE:

    The user name and password stored in the nps_secret.yaml file under /root/nps2/install are encoded. When running the export command, enter the decoded user name and password to avoid authentication errors.

  4. To export the environment variables from anywhere within the NPS Toolkit VM, run the following command:

    source /root/<deployment1-dir>/<deployment1_env_file>

  5. Upload the input JSON file using the following command:
    nps upload-json -f <complete directory path and name of your input JSON file>

    After the input JSON file is uploaded successfully, the result is displayed as shown in following example:

    [root@npsvm ~]# source /root/deployment-1/deployment1_env
    [root@npsvm ~]# env | grep TOPOLOGY_NAME
    TOPOLOGY_NAME=edge-topology
    [root@npsvm ~]# nps upload-json -f /root/deployment-1/topology.json
    Input json uploaded successfully with topology name: edge-topology
    +------------+---------------------------------------+
    | operation  | status                                |
    +------------+---------------------------------------+
    | jsonupload | uploaded successfully : edge-topology |
    +------------+---------------------------------------+
    [root@npsvm ~]#
  6. If you are deploying VIM using NPS toolkit, do the following:
    1. Validate the VIM block of the uploaded input JSON file using the following command:
      nps validate-vim-json

      The validation process is displayed as shown in following example:

      [root@npsvm ~]# nps validate-vim-json
      +---------------------+------------------------------+
      |       Process       |            Status            |
      +---------------------+------------------------------+
      | VIM-data-validation | Process successfully started |
      +---------------------+------------------------------+
      Check the status using 'nps show --service validate-vim-json'
      [root@npsvm ~]#
    2. View the status of the VIM block of the input JSON file validation process using the following command:
      nps show --service validate-vim-json

      The status of the input JSON file validation process is displayed as shown in following example:

      [root@npsvm ~]# nps show --service validate-vim-json
      +---------------------+--------------------------------------------------------------+
      |       Process       | Status                                                       |
      +---------------------+--------------------------------------------------------------+
      | VIM-data-validation | [                                                            |
      |                     |     {                                                        |
      |                     |         "POD-Name": "edge-topology-validate-ocponosp",       |
      |                     |         "POD-UUID": "ca0c0139-2a81-4f0c-86d9-cf7792d3bf3e",  |
      |                     |         "Status": "Succeeded"                                |
      |                     |     },                                                       |
      |                     |     {                                                        |
      |                     |         "POD-Name": "edge-topology-validate",                |
      |                     |         "POD-UUID": "a3bb491d-2650-42f8-9c9b-73de77e95e78",  |
      |                     |         "Status": "Succeeded"                                |
      |                     |     }                                                        |
      |                     | ]                                                            |
      +---------------------+--------------------------------------------------------------+
      To check the logs use 'kubectl logs <Name of the pod> -n nps'
      [root@npsvm ~]#
    3. View the logs of the VIM block of the input JSON file validation using the following command:
      kubectl logs <name of the pod> -n nps
      NOTE:

      If the validation fails, delete the previous JSON file and upload the new input JSON file.

  7. Optional: To delete the input JSON data, run the following command:
    nps delete-json
    You are prompted to confirm the deletion:
    [root@npsvm ~]# source /root/deployment-1/deployment1_env
    [root@npsvm ~]# env | grep TOPOLOGY_NAME
    TOPOLOGY_NAME=edge-topology
    [root@npsvm ~]# nps delete-json
    Do you really want to delete the Topology  Y/N : Y
    +---------------+----------------------+
    | Topology-Name |        Status        |
    +---------------+----------------------+
    | edge-topology | Successfully deleted |
    +---------------+----------------------+

    Press Y to delete or N to cancel, and then press Enter.

    NOTE:
    • If multiple topologies/input.json are uploaded to the NPS Toolkit VM, ensure to export the correct environment variable file before deleting the topology.

    • When using NPS toolkit VM as a centralized NPS VM, the following are the limitations:
      • Only deployments of the same VIM type and Infrastructure type are allowed.

      • Deployment must be done sequentially. Parallel execution must be avoided.