Below is code snippet to retrieve all the network connections.
public class BulkUplaodService extends Service {
/***
* retrieveDataForConnection
* */
public List<String> retrieveDataForConnection (OMSRestTemplate restTemplate, String urlSuffix) {
List<String> retData = new ArrayList <String>();
/** Url to retrieve networkconnections json file*/
String custUrl = restTemplate.getUrlPrefix() + urlSuffix; //"//data/otn/networkinventory/connections";
//?userid=ECmdKGhCKVqxOwMqdli62w==&password=zGwL2f+0s44QqnRUAhJSKQ==";
/**retrieve json file path*/
JsonNode response = restTemplate.getForObject(custUrl, JsonNode.class);
System.out.println( response );
String statusUrl = restTemplate.getUrlPrefix() + "/data/otn/networkinventory/connectionstatus";
JsonNode filePaths = null;
for (int i = 0 ; i < 5 ; i++ ){
response = restTemplate.getForObject(statusUrl, JsonNode.class);
if (response.get("responseHeader").get ("responseStatus").textValue().equalsIgnoreCase("success")) {
filePaths = response.get("responseFiles");
break;
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//JsonNode respFiles = response.get("responseFiles");
if (filePaths != null) downloadFilesForConnection(restTemplate, retData, filePaths, "");
return retData;
}
JSON Request to get the network connections
/data/otn/networkinventory/connections
JSON Response
{
"responseHeader": {
"originatorApp": "NPT",
"objectType": "connections",
"objectScope": "connections",
"responseStatus": "IN_PROGRESS",
"fileGenerationTime": null,
"errorCode": null,
"errorReason": null,
"errorParams": null
},
"responseFiles": null
}
JSON Request to get the network connection status
//data/otn/networkinventory/connectionstatus
JSON Response
/OTN_2-13/data_extraction/npt/inventory/connection/connections.tar.gz