feat:optimize topo api & mock json for network service page 60/95560/1
authorcyuamber <xuranyjy@chinamobile.com>
Thu, 12 Sep 2019 08:45:16 +0000 (16:45 +0800)
committercyuamber <xuranyjy@chinamobile.com>
Thu, 12 Sep 2019 08:45:22 +0000 (16:45 +0800)
Change-Id: Icb5cbb83407c1fa8054dea197fd52292747bd821
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json [new file with mode: 0644]
usecaseui-portal/src/app/mock/json/uui-sotn_getNetWorkResources.json [new file with mode: 0644]
usecaseui-portal/src/app/mock/json/uui-sotn_getPinterfaceByPnfName.json [new file with mode: 0644]
usecaseui-portal/src/app/mock/json/uui-sotn_getSpecificLogicalLink.json [new file with mode: 0644]
usecaseui-portal/src/app/views/ccvpn-network/ccvpn-network.component.html
usecaseui-portal/src/app/views/ccvpn-network/ccvpn-network.component.ts

index a3131bb..2b1c38d 100644 (file)
@@ -23,25 +23,24 @@ export class networkHttpservice {
 
     constructor(private http: HttpClient) { }
 
-    baseUrl = baseUrl.baseUrl + "/uui-sotn/";//Online environment
+    baseUrl = baseUrl.baseUrl;//Online environment
     url = {
         // The following APIs are optimizable
-        "getNetworkD3Data": this.baseUrl + "getNetWorkResources",
-        "getLogicalLinksData": this.baseUrl + "getLogicalLinks",
-        "deleteCloud": this.baseUrl + "deleteExtNetWork",
+        "getNetworkD3Data": "/uui-sotn/getNetWorkResources",
+        "getLogicalLinksData": "/uui-sotn/getLogicalLinks",
+        "deleteCloud": "/uui-sotn/deleteExtNetWork",
         // The following APIs are not optimizable
-        "getPInterfacesData1": this.baseUrl + "getPinterfaceByPnfName/",
-        "getPInterfacesData2": this.baseUrl + "getPinterfaceByPnfName/",
-        "createLink": this.baseUrl + "createLink/",
-        "querySpecificLinkInfo": this.baseUrl + "getSpecificLogicalLink/",
-        "queryCloudUrl": this.baseUrl + "getHostUrl/",
-        "queryExtAAIIdVersion": this.baseUrl + "getExtAaiId/",
-        "createNetwrok": this.baseUrl + "createTopoNetwork/",
-        "createPnf": this.baseUrl + "createPnf/",
-        "createTp": this.baseUrl + "pnf/",
-        "createCloudLink": this.baseUrl + "createLink/",
-        "createCloudUrl": this.baseUrl + "createHostUrl/",
-        "deleteLink": this.baseUrl + "deleteLink/",
+        "getPInterfacesData": "/uui-sotn/getPinterfaceByPnfName/",
+        "createLink": "/uui-sotn/createLink/",
+        "querySpecificLinkInfo": "/uui-sotn/getSpecificLogicalLink/",
+        "queryCloudUrl": "/uui-sotn/getHostUrl/",
+        "queryExtAAIIdVersion": "/uui-sotn/getExtAaiId/",
+        "createNetwrok": "/uui-sotn/createTopoNetwork/",
+        "createPnf": "/uui-sotn/createPnf/",
+        "createTp": "/uui-sotn/pnf/",
+        "createCloudLink": "/uui-sotn/createLink/",
+        "createCloudUrl": "/uui-sotn/createHostUrl/",
+        "deleteLink": "/uui-sotn/deleteLink/",
 
     };
 
@@ -55,17 +54,14 @@ export class networkHttpservice {
         return this.http.get<any>(this.url["getLogicalLinksData"]);
     }
     deleteCloudLink(paramsObj) {
-        let str = "?extNetworkId=" + paramsObj["aaiId"] + "&resourceVersion=" + paramsObj["version"];
-        return this.http.delete<any>((this.url["deleteCloud"] + str));
+        let params = new HttpParams({ fromObject: paramsObj });
+        return this.http.delete<any>(this.url["deleteCloud"],{params});
     }
 
     //The following APIs function are not optimizable------------------------
     //Query the tp data corresponding to the specified node
-    getPInterfacesData1(paramsObj) {
-        return this.http.get<any>(this.url['getPInterfacesData1'] + paramsObj["pnfName"]);
-    }
-    getPInterfacesData2(paramsObj) {
-        return this.http.get<any>(this.url["getPInterfacesData2"] + paramsObj["pnfName"]);
+    getPInterfacesData(paramsObj) {
+        return this.http.get<any>(this.url['getPInterfacesData'] + paramsObj["pnfName"]);
     }
     //Create a connection interface
     createLink(paramsObj) {
diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json
new file mode 100644 (file)
index 0000000..1b8ecff
--- /dev/null
@@ -0,0 +1,117 @@
+{
+  "logical-link": [
+    {
+      "link-name": "cross-link-1",
+      "in-maint": false,
+      "link-type": "cross-link",
+      "resource-version": "1536029865021",
+      "operational-status": "up",
+      "relationship-list": {
+        "relationship": [
+          {
+            "related-to": "p-interface",
+            "relationship-label": "tosca.relationships.network.LinksTo",
+            "related-link": "/aai/v13/network/pnfs/pnf/pnf2000/p-interfaces/p-interface/nodeId-78.78.78.78-ltpId-1",
+            "relationship-data": [
+              {
+                "relationship-key": "pnf.pnf-name",
+                "relationship-value": "pnf2000"
+              },
+              {
+                "relationship-key": "p-interface.interface-name",
+                "relationship-value": "nodeId-78.78.78.78-ltpId-1"
+              }
+            ],
+            "related-to-property": [
+              {
+                "property-key": "p-interface.prov-status"
+              }
+            ]
+          },
+          {
+            "related-to": "p-interface",
+            "relationship-label": "tosca.relationships.network.LinksTo",
+            "related-link": "/aai/v13/network/pnfs/pnf/pnf1000/p-interfaces/p-interface/nodeId-79.79.79.79-ltpId-1",
+            "relationship-data": [
+              {
+                "relationship-key": "pnf.pnf-name",
+                "relationship-value": "pnf1000"
+              },
+              {
+                "relationship-key": "p-interface.interface-name",
+                "relationship-value": "nodeId-79.79.79.79-ltpId-1"
+              }
+            ],
+            "related-to-property": [
+              {
+                "property-key": "p-interface.prov-status"
+              }
+            ]
+          }
+        ]
+      }
+    },
+    {
+      "link-name": "cross-link-2",
+      "in-maint": false,
+      "link-type": "cross-link",
+      "resource-version": "1536029865021",
+      "operational-status": "up",
+      "relationship-list": {
+        "relationship": [
+          {
+            "related-to": "p-interface",
+            "relationship-label": "tosca.relationships.network.LinksTo",
+            "related-link": "/aai/v13/network/pnfs/pnf/pnf3000/p-interfaces/p-interface/nodeId-80.80.80.80-ltpId-2",
+            "relationship-data": [
+              {
+                "relationship-key": "pnf.pnf-name",
+                "relationship-value": "pnf3000"
+              },
+              {
+                "relationship-key": "p-interface.interface-name",
+                "relationship-value": "nodeId-80.80.80.80-ltpId-2"
+              }
+            ],
+            "related-to-property": [
+              {
+                "property-key": "p-interface.prov-status"
+              }
+            ]
+          },
+          {
+            "related-to": "p-interface",
+            "relationship-label": "tosca.relationships.network.LinksTo",
+            "related-link": "/aai/v13/network/pnfs/pnf/pnf-cloud/p-interfaces/p-interface/cloud-tp",
+            "relationship-data": [
+              {
+                "relationship-key": "pnf.pnf-name",
+                "relationship-value": "pnf-cloud"
+              },
+              {
+                "relationship-key": "p-interface.interface-name",
+                "relationship-value": "cloud-tp"
+              }
+            ],
+            "related-to-property": [
+              {
+                "property-key": "p-interface.prov-status"
+              }
+            ]
+          },
+          {
+            "related-to": "ext-aai-network",
+            "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+            "related-link": "/aai/v13/network/ext-aai-networks/ext-aai-network/gongjie666",
+            "relationship-data": [
+              {
+                "relationship-key": "ext-aai-network.aai-id",
+                "relationship-value": "gongjie666"
+              }
+            ]
+          }
+        ]
+      }
+    }
+  ]
+}
diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getNetWorkResources.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getNetWorkResources.json
new file mode 100644 (file)
index 0000000..faacef8
--- /dev/null
@@ -0,0 +1,198 @@
+[
+  {
+    "networkId": "1000",
+    "pnfs": [
+      {
+        "pnfName": "pnf1000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-78.78.78.78-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-78.78.78.78-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-78.78.78.78-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-78.78.78.78-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-78.78.78.78-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "2000",
+    "pnfs": [
+      {
+        "pnfName": "pnf2000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-79.79.79.79-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-79.79.79.79-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-79.79.79.79-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-79.79.79.79-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-79.79.79.79-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "3000",
+    "pnfs": [
+      {
+        "pnfName": "pnf3000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-80.80.80.80-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-80.80.80.80-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-80.80.80.80-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-80.80.80.80-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-80.80.80.80-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "4000",
+    "pnfs": [
+      {
+        "pnfName": "pnf4000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-81.81.81.81-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-81.81.81.81-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-81.81.81.81-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-81.81.81.81-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-81.81.81.81-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "5000",
+    "pnfs": [
+      {
+        "pnfName": "pnf5000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "5000",
+    "pnfs": [
+      {
+        "pnfName": "pnf5000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "5000",
+    "pnfs": [
+      {
+        "pnfName": "pnf5000"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-5"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-4"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-1"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-3"
+      },
+      {
+        "interface-name": "nodeId-82.82.82.82-ltpId-2"
+      }
+    ],
+    "aaiId":""
+  },
+  {
+    "networkId": "cloud-network",
+    "pnfs": [
+      {
+        "pnfName": "pnf-cloud"
+      }
+    ],
+    "tps": [
+      {
+        "interface-name": "cloud-tp"
+      }
+    ],
+    "aaiId":"gongjie666"
+  }
+]
diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getPinterfaceByPnfName.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getPinterfaceByPnfName.json
new file mode 100644 (file)
index 0000000..399c21b
--- /dev/null
@@ -0,0 +1,17 @@
+[
+  {
+    "interface-name": "nodeId-78.78.78.78-ltpId-5"
+  },
+  {
+    "interface-name": "nodeId-78.78.78.78-ltpId-4"
+  },
+  {
+    "interface-name": "nodeId-78.78.78.78-ltpId-3"
+  },
+  {
+    "interface-name": "nodeId-78.78.78.78-ltpId-2"
+  },
+  {
+    "interface-name": "nodeId-78.78.78.78-ltpId-1"
+  }
+]
diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getSpecificLogicalLink.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getSpecificLogicalLink.json
new file mode 100644 (file)
index 0000000..e991140
--- /dev/null
@@ -0,0 +1,52 @@
+{
+  "link-name": "nodeId-79.79.79.79-ltpId-4_nodeId-78.78.78.78-ltpId-4",
+  "in-maint": false,
+  "link-type": "some type",
+  "speed-value": "some speed",
+  "resource-version": "1536212883031",
+  "operational-status": "up",
+  "relationship-list": {
+    "relationship": [
+      {
+        "related-to": "p-interface",
+        "relationship-label": "tosca.relationships.network.LinksTo",
+        "related-link": "/aai/v13/network/pnfs/pnf/pnf1000/p-interfaces/p-interface/nodeId-79.79.79.79-ltpId-4",
+        "relationship-data": [
+          {
+            "relationship-key": "pnf.pnf-name",
+            "relationship-value": "pnf1000"
+          },
+          {
+            "relationship-key": "p-interface.interface-name",
+            "relationship-value": "nodeId-79.79.79.79-ltpId-4"
+          }
+        ],
+        "related-to-property": [
+          {
+            "property-key": "p-interface.prov-status"
+          }
+        ]
+      },
+      {
+        "related-to": "p-interface",
+        "relationship-label": "tosca.relationships.network.LinksTo",
+        "related-link": "/aai/v13/network/pnfs/pnf/pnf2000/p-interfaces/p-interface/nodeId-78.78.78.78-ltpId-4",
+        "relationship-data": [
+          {
+            "relationship-key": "pnf.pnf-name",
+            "relationship-value": "pnf2000"
+          },
+          {
+            "relationship-key": "p-interface.interface-name",
+            "relationship-value": "nodeId-78.78.78.78-ltpId-4"
+          }
+        ],
+        "related-to-property": [
+          {
+            "property-key": "p-interface.prov-status"
+          }
+        ]
+      }
+    ]
+  }
+}
index 25687f6..fb025d9 100644 (file)
       </li>
     </ul>
     <button nz-button nzType="primary" nzSize="small" class="del-button" style="width: 90px;" (click)="delLink()" *ngIf="!delcloud"> {{"i18nTextDefine_DeleteLink" | translate}} </button>
-    <button nz-button nzType="primary" nzSize="small" class="del-button" style="width: 90px;" (click)="delCloudLink()" *ngIf="delcloud"> {{"i18nTextDefine_deleteLink" | translate}} </button>
+    <button nz-button nzType="primary" nzSize="small" class="del-button" style="width: 90px;" (click)="delCloudLink()" *ngIf="delcloud"> {{"i18nTextDefine_DeleteLink" | translate}} </button>
     <button nz-button nzType="default" nzSize="small" class="del-button" style="width: 60px;" (click)="hideForm()"> {{"i18nTextDefine_Cancel" | translate}} </button>
   </div>
 </div>
index d02149d..a2f9561 100644 (file)
@@ -688,7 +688,7 @@ export class CcvpnNetworkComponent implements OnInit {
         let params = {
             pnfName: this.selectedNode1,
         };
-        this.myhttp.getPInterfacesData1(params)
+        this.myhttp.getPInterfacesData(params)
             .subscribe((data) => {
                 this.tpOption1 = [];
                 for (let i = 0; i < data.length; i++) {
@@ -716,7 +716,7 @@ export class CcvpnNetworkComponent implements OnInit {
         let params = {
             pnfName: this.selectedNode2,
         };
-        this.myhttp.getPInterfacesData2(params)
+        this.myhttp.getPInterfacesData(params)
             .subscribe((data) => {
                 this.tpOption2 = [];
                 for (let i = 0; i < data.length; i++) {