You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

CPS-392 - Getting issue details... STATUS

Investigate A&AI Interface, especially how to retrieve inventory, current list of xNF functions

Consider som PoC Code

Documentation:

AAI REST API Documentation - Honolulu

How to retrieve current list of xNF functions from A&AI:

Send Get request to this endpoint

Example curl command you can use to retrieve inventory from anywhere within the cluster in which AAI is deployed to.

Example curl command
curl 'http://aai:8443/aai/v23/network/pnfs'

PoC code:

Write code to show that it is possible to retrieve the current list of xNF functions.

PoC code
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";
    }

}


  • No labels