Description

This article talks about using the REST API to modify the serial number for node0 (primary node) and node1 (secondary node) of an SRX Dual CPE device in Contrail Service Orchestration (CSO) UI for which RMA has been performed.

Note: This article applies to CSO 5.1.2.

 

Solution

If RMA has been performed on both primary node 0 and secondary node1 of the SRX Dual CPE device that is being managed in the CSO UI, the following steps can be performed to change the serial numbers for both node0 and node1 in the UI.

  1. Generate an auth-token for the cspadmin user. 

POST :   ​http://CSO_IP : 5000/v3/auth/tokens

Body:  ​

{
"auth": {
"scope": {
"project": {
"domain": {
"id": "default"
},
"name": "admin"
}
},
"identity": {
"password": {
"user": {
"domain": {
"id": "default"
},
"password": "PASSWORD",
"name": "cspadmin"
}
},
"methods": [
"password"
]
}
}
}
  1. Generate an auth-token for the tenant (customer).

POST :   http://CSO_IP : 5000/v3/auth/tokens

BODY:    {"auth":{"identity":{"methods":["token"],"token":{"id":"{{auth-token}}"}},"scope":{"project":{"domain":{"id":"default"},"name":"TENANT NAME"}}}}
  1. Fetch the UUIDs for the SRX Dual CPE site ( SITENAME , SITENAME_cpe0 , and SITENAME_cpe1 ).

GET:  https://CSO_IP/ems-regional/device/

BODY:  
{
"fq_name": [
"default-domain",
"NewIPVPNpki",
"SITENAME"
],
"uuid": "42f091b6-0f4d-491a-9bfe-83aa580247f7",
"uri": "/ems-regional/device/42f091b6-0f4d-491a-9bfe-83aa580247f7"
},
{
"fq_name": [
"default-domain",
"NewIPVPNpki",
"SITENAME_cpe0"
],
"uuid": "b25291fa-542a-4f11-9de2-4eefd8dba4d7",
"uri": "/ems-regional/device/b25291fa-542a-4f11-9de2-4eefd8dba4d7"
},
{
"fq_name": [
"default-domain",
"NewIPVPNpki",
"SITENAME_cpe1"
],
"uuid": "4642159a-b3db-44c3-885d-0d61d7340b6b",
"uri": "/ems-regional/device/4642159a-b3db-44c3-885d-0d61d7340b6b"
}
  1. Fetch the serial number for SITENAME uuid of the new device under ems-central and ems-regional.

GET: ​https://CSO_IP/ems-regional/device/<SITENAME uuid>

"system_info": {
"hardware_model": "srx4100",
"os_version": "19.3R2-S4.5",
"os_name": "junos-es",
"host_name": "S7GW2.S7GW2.NewIPVPNpki",
"serial_number": "DJ2418AR0171.DJ3618AR0009"
},
},
"parent_uri": "/ems-regional/project/dd80ff89-d391-4508-8a08-8de42dd5958c",
"unique_id": "DJ2418AR0171.DJ3618AR0009"

GET: ​https://{{CSO_IP.EN_US}}/ems-central/device/<SITENAME uuid>
"parent_uri": "/ems-central/project/dd80ff89-d391-4508-8a08-8de42dd5958c",
"unique_id": "DJ2418AR0171.DJ3618AR0009"
"os_name": "junos-es",
"host_name": "S7GW2.S7GW2.NewIPVPNpki",
"serial_number": "DJ2418AR0171.DJ3618AR0009"
  1. Change the serial numbers for SITENAME uuid by using the PUT method [take the complete response from the above GET operation, modify the existing serial number of the device to the new serial number, and create it as a payload (BODY) for the PUT operation].

PUT: https://CSO_IP/ems-regional/device/<SITENAME uuid>
PUT: https://CSO_IP/ems-central/device/<SITENAME uuid>
  1. Fetch the serial number for   SITENAME_cpe0 uuid of the new device under ems-central and ems-regional.

GET: ​https://CSO_IP/ems-regional/device/<SITENAME_cpe0 uuid>

"system_info": {
"hardware_model": null,
"os_version": "19.3R2-S4.5",
"os_name": null,
"host_name": "default_host",
"serial_number": "DJ2418AR0171"
},
...

"parent_uri": "/ems-central/project/dd80ff89-d391-4508-8a08-8de42dd5958c",
"unique_id": "DJ2418AR0171"

GET: ​https://CSO_IP/ems-centrall/device/<SITENAME_cpe0 uuid>

"os_name": null,
"host_name": "default_host",
"serial_number": "DJ2418AR0171"
},
...

"parent_uri": "/ems-regional/project/dd80ff89-d391-4508-8a08-8de42dd5958c",
"unique_id": "DJ2418AR0171"
  1. Change the serial numbers for SITENAME_cpe0 uuid of the new device by using the PUT method [take the complete response from the above GET operation, modify the existing serial number of the device to the new serial number, and create it as a payload (BODY) for the PUT operation].

PUT: https://CSO_IP/ems-regional/device/<SITENAME_cpe0 uuid>
PUT: https://CSO_IP/ems-central/device/<SITENAME_cpe0 uuid>
  1. Fetch the serial number for SITENAME_cpe1 uuid of the new device under ems-central and ems-regional.

GET: ​https://CSO_IP/ems-regional/device/<SITENAME_cpe1 uuid>

"os_name": null, "host_name": "default_host", "serial_number": "DJ3618AR0009"
},
...

}, "parent_uri": "/ems-regional/project/dd80ff89-d391-4508-8a08-8de42dd5958c",
"unique_id": "DJ3618AR0009"
  1. Change the serial numbers for SITENAME_cpe1 uuid of the new device by using the PUT method [take the complete response from the above GET operation, modify the existing serial number of the device to the new serial number, and create it as a payload (BODY) for the PUT operation].

PUT: https://CSO_IP/ems-regional/device/<SITENAME_cpe1 uuid>
PUT: https://CSO_IP/ems-central/device/<SITENAME_cpe1 uuid>

After the above steps have been successfully completed, the serial number change will be reflected in the CSO UI.