...
Example curl command you can use to retrieve inventory from anywhere any pod within the cluster in which AAI is deployed to.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class InventoryRetriever { public void getXnfsFromAai(){ String nfData; try{ HttpClient client = HttpClient.newHttpClient(); String aaiNetworkEndPoint = getAaiServiceUrl(); var request = HttpRequest.newBuilder(URI.create(aaiNetworkEndPoint)) .headers("Authorization", "Basic QUFJOkFBSQ==", "accept", "application/json", "content-type", "application/json", "x-fromappid", "cps-ncmp", "X-TransactionId", "get_aai_subscr") .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); if (response.statusCode() == 200){ nfData = response.body(); System.out.println(nfData); } } catch (IOException | InterruptedException e) { e.printStackTrace(); } } private String getAaiServiceUrl(){ String version = "v23"; return "http://aai:8443/aai/"+ version + "/network/pnfs"; } } |
...