getServiceList,getNetWorkResources do not get data 19/65419/1
authorguochuyicmri <guochuyi@chinamobile.com>
Mon, 10 Sep 2018 02:38:19 +0000 (10:38 +0800)
committerguochuyicmri <guochuyi@chinamobile.com>
Mon, 10 Sep 2018 02:48:16 +0000 (10:48 +0800)
Change-Id: Icef68ca6061896943ceaf22497737346ba24e51e
Issue-ID: USECASEUI-141
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
server/src/main/java/org/onap/usecaseui/server/bean/sotn/NetWorkResource.java
server/src/main/java/org/onap/usecaseui/server/controller/sotn/SotnController.java
server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java

index 0af6640..1acb3b0 100644 (file)
@@ -27,11 +27,14 @@ public class NetWorkResource {
        private List<Pnf> pnfs;
        
        private List<Pinterface> tps;
+       
+       private String aaiId;
 
-       public NetWorkResource(String networkId, List<Pnf> pnfs, List<Pinterface> tps) {
+       public NetWorkResource(String networkId, List<Pnf> pnfs, List<Pinterface> tps,String aaiId) {
                this.networkId = networkId;
                this.pnfs = pnfs;
                this.tps = tps;
+               this.aaiId = aaiId;
        }
 
        public NetWorkResource() {
@@ -60,5 +63,13 @@ public class NetWorkResource {
        public void setTps(List<Pinterface> tps) {
                this.tps = tps;
        }
+
+       public String getAaiId() {
+               return aaiId;
+       }
+
+       public void setAaiId(String aaiId) {
+               this.aaiId = aaiId;
+       }
        
 }
index 9ed5b65..b201f61 100644 (file)
@@ -26,6 +26,7 @@ import org.onap.usecaseui.server.bean.sotn.NetWorkResource;
 import org.onap.usecaseui.server.bean.sotn.Pinterface;
 import org.onap.usecaseui.server.bean.sotn.Pnf;
 import org.onap.usecaseui.server.service.sotn.SOTNService;
+import org.onap.usecaseui.server.util.UuiCommonUtil;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -160,19 +161,25 @@ public class SotnController {
                                List<Pnf> pnfs = new ArrayList<Pnf>();
                                String networkId=netNode.get(i).get("network-id").toString();
                                netResource.setNetworkId(networkId);
-                               String relationJson = netNode.get(i).get("relationship-list").toString();
-                               JsonNode relationNode = mapper.readTree(relationJson);
-                               
-                               JsonNode shipNode = relationNode.get("relationship");
-                               for(int j=0;j<shipNode.size();j++){
-                                       Pnf pnf = new Pnf();
-                                       JsonNode shipDataNode = shipNode.get(j).get("relationship-data");
-                                       String shipDataValue = shipDataNode.get(0).get("relationship-value").toString();
-                                       pnf.setPnfName(shipDataValue);
-                                       pnfs.add(pnf);
+                               if(UuiCommonUtil.isNotNullOrEmpty(netNode.get(i).get("relationship-list"))){
+                                       String relationJson = netNode.get(i).get("relationship-list").toString();
+                                       JsonNode relationNode = mapper.readTree(relationJson);
+                                       
+                                       JsonNode shipNode = relationNode.get("relationship");
+                                       for(int j=0;j<shipNode.size();j++){
+                                               Pnf pnf = new Pnf();
+                                               JsonNode shipDataNode = shipNode.get(j).get("relationship-data");
+                                               String shipDataValue = shipDataNode.get(0).get("relationship-value").toString();
+                                               String shipDataKey = shipDataNode.get(0).get("relationship-key").toString();
+                                               if("ext-aai-network.aai-id".equals(shipDataKey)){
+                                                       netResource.setAaiId(shipDataKey);
+                                               }
+                                               pnf.setPnfName(shipDataValue);
+                                               pnfs.add(pnf);
+                                       }
+                                       netResource.setPnfs(pnfs);
+                                       list.add(netResource);
                                }
-                               netResource.setPnfs(pnfs);
-                               list.add(netResource);
                        }
                } catch (IOException e) {
                        e.printStackTrace();
index ad044b0..157da3b 100644 (file)
@@ -126,8 +126,8 @@ public interface AAIService {
        "Authorization: Basic QUFJOkFBSQ==",
        "Accept: application/json"
     })
-    @GET("/api/aai-network/logical-links")
-    Call<ResponseBody> getSpecificLogicalLink(@Query("link-name") String linkName);
+    @GET("/api/aai-network/logical-links/logical-link/{link-name}")
+    Call<ResponseBody> getSpecificLogicalLink(@Path("link-name") String linkName);
     
     @Headers({
         "X-TransactionId: 7777",
@@ -198,7 +198,7 @@ public interface AAIService {
         "Authorization: Basic QUFJOkFBSQ==",
         "Accept: application/json"
     })
-    @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}")
+    @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances")
     Call<ResponseBody> getServiceInstances(@Path("global-customer-id}") String customerId,@Path("service-type}") String serviceType);
     
     @Headers({