From 9b444bdfc55deee39bbbd33b32dff7e59e549b17 Mon Sep 17 00:00:00 2001 From: d00565011 Date: Tue, 17 Aug 2021 09:55:00 -0400 Subject: CCVPN-usecase(REQ-719) requirements: update and revise CCVPN-NETWORK module to support latest ccvpn profile. Also, correct the line separator to linux format, to resolve the docker compiling issue. Issue-ID: USECASEUI-606 Signed-off-by: decheng zhang Change-Id: I97c0155fe64072fcd147737e72171b975dc3fa1b --- usecaseui-portal/src/app/app.module.ts | 2 + usecaseui-portal/src/app/core/services/appEvent.ts | 23 + .../src/app/core/services/appEventType.ts | 4 + .../src/app/core/services/eventQueue.service.ts | 36 + .../core/services/networkHttpservice.service.ts | 11 + .../mock/json/uui-sotn_getConnectivityInfo.json | 267 ++- .../app/mock/json/uui-sotn_getLogicalLinks.json | 743 +++++++- .../ccvpn-network/ccvpn-network.component.css | 2 +- .../ccvpn-network/ccvpn-network.component.html | 35 +- .../ccvpn-network/ccvpn-network.component.ts | 1977 +++++++++----------- usecaseui-portal/src/assets/i18n/cn.json | 1 + usecaseui-portal/src/assets/i18n/en.json | 1 + 12 files changed, 1949 insertions(+), 1153 deletions(-) create mode 100644 usecaseui-portal/src/app/core/services/appEvent.ts create mode 100644 usecaseui-portal/src/app/core/services/appEventType.ts create mode 100644 usecaseui-portal/src/app/core/services/eventQueue.service.ts (limited to 'usecaseui-portal/src') diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index 57c188ff..e4b3568d 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -105,6 +105,7 @@ import { ManageServiceComponent } from "./views/services/sotn-management/manage- import { MonitorServiceComponent } from "./views/services/sotn-management/monitor-service/monitor-service.component"; import { OrderServiceComponent } from "./views/services/sotn-management/order-service/order-service.component"; import { SotnManagementComponent } from "./views/services/sotn-management/sotn-management.component"; +import { EventQueueService } from "@src/app/core/services/eventQueue.service"; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, "./assets/i18n/", ".json"); @@ -133,6 +134,7 @@ registerLocaleData(en); ManagemencsService, TextService, SlicingTaskServices, + EventQueueService, // fakeBackendProvider ], declarations: [ diff --git a/usecaseui-portal/src/app/core/services/appEvent.ts b/usecaseui-portal/src/app/core/services/appEvent.ts new file mode 100644 index 00000000..775eced9 --- /dev/null +++ b/usecaseui-portal/src/app/core/services/appEvent.ts @@ -0,0 +1,23 @@ +/* + Copyright (C) 2021 Huawei Canada, Inc. and others. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +import {AppEventType} from "@src/app/core/services/appEventType"; + +export class AppEvent { + constructor( + public type: AppEventType, + public payload: T, + ) {} +} \ No newline at end of file diff --git a/usecaseui-portal/src/app/core/services/appEventType.ts b/usecaseui-portal/src/app/core/services/appEventType.ts new file mode 100644 index 00000000..e5369a8c --- /dev/null +++ b/usecaseui-portal/src/app/core/services/appEventType.ts @@ -0,0 +1,4 @@ +export enum AppEventType { + GenericEvent = 'GENERIC_EVENT', + UserNodeDrag = 'USER_NODE_DRAG' +} \ No newline at end of file diff --git a/usecaseui-portal/src/app/core/services/eventQueue.service.ts b/usecaseui-portal/src/app/core/services/eventQueue.service.ts new file mode 100644 index 00000000..e4c32c38 --- /dev/null +++ b/usecaseui-portal/src/app/core/services/eventQueue.service.ts @@ -0,0 +1,36 @@ +/* + Copyright (C) 2021 Huawei Canada, Inc. and others. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +import { Injectable } from '@angular/core'; +import {Observable, Subject} from "rxjs/Rx"; +import {AppEvent} from "@src/app/core/services/appEvent"; +import {AppEventType} from "@src/app/core/services/appEventType"; +import {filter} from "rxjs/operators"; + +@Injectable() +export class EventQueueService { + + private eventBroker = new Subject>(); + + on(eventType: AppEventType): Observable> { + return this.eventBroker.pipe(filter(event => event.type === eventType)); + } + + dispatch(event: AppEvent): void { + this.eventBroker.next(event); + } + +} \ No newline at end of file diff --git a/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts index 20b79a77..0959f564 100644 --- a/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts +++ b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts @@ -27,6 +27,7 @@ export class networkHttpservice { url = { "getNetworkD3Data": this.baseUrl+"/uui-sotn/getNetWorkResources", "getLogicalLinksData": this.baseUrl+"/uui-sotn/getLogicalLinks", + "getPnfsData": this.baseUrl+"/uui-sotn/getPnfs", "deleteCloud": this.baseUrl+"/uui-sotn/deleteExtNetWork", "getPInterfacesData": this.baseUrl+"/uui-sotn/getPinterfaceByPnfName/", "createLink": this.baseUrl+"/uui-sotn/createLink/", @@ -39,6 +40,7 @@ export class networkHttpservice { "createCloudLink": this.baseUrl+"/uui-sotn/createLink/", "createCloudUrl": this.baseUrl+"/uui-sotn/createHostUrl/", "deleteLink": this.baseUrl+"/uui-sotn/deleteLink/", + "getConnectivities": this.baseUrl+"/uui-sotn/getConnectivityInfo", }; @@ -47,6 +49,10 @@ export class networkHttpservice { getNetworkD3Data() { return this.http.get(this.url["getNetworkD3Data"]); } + // GET AAI PNF(s) data + getPnfsData() { + return this.http.get(this.url["getPnfsData"]); + } //Initialize the connection logical-links getLogicalLinksData() { return this.http.get(this.url["getLogicalLinksData"]); @@ -76,6 +82,11 @@ export class networkHttpservice { queryExtAAIIdVersion(aaiId) { return this.http.get(this.url["queryExtAAIIdVersion"] + aaiId); } + + getConnectivities(){ + return this.http.get(this.url["getConnectivities"]); + } + //Create an external cloud newwork interface createNetwrok(paramsObj) { return this.http.put(this.url["createNetwrok"] + paramsObj["network-id"], paramsObj); diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getConnectivityInfo.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getConnectivityInfo.json index 967ec98b..a43c8c45 100644 --- a/usecaseui-portal/src/app/mock/json/uui-sotn_getConnectivityInfo.json +++ b/usecaseui-portal/src/app/mock/json/uui-sotn_getConnectivityInfo.json @@ -1,89 +1,288 @@ { "connectivity": [ { - "connectivity-id": "4424ea5a-3603-4040-baa9-4046ed533fe5", - "bandwidth-profile-name": "vpn1", - "vpn-type": "ethernet", - "color-aware": "true", - "coupling-flag": "true", - "etht-svc-name": "vpn1", - "access-provider-id": "", - "access-client-id": "", - "access-topology-id": "", - "access-node-id": "", - "access-ltp-id": "", - "connectivity-selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/32cd906f-ee7a-4ecf-b1c3-2fce4d59f8c0/service-data/networks/network/4424ea5a-3603-4040-baa9-4046ed533fe5/network-data/", - "operational-status": "Active", - "model-customization-id": "2bafc8aa-c60c-4a17-a658-db4cbca07fac", - "model-invariant-id": "5d0ada6b-de04-4624-9410-3baab839cd6f", - "model-version-id": "15e21930-3248-4148-b071-a2a9be1f9889", - "resource-version": "1537623789475", + "connectivity-id": "0cdb3c80-e319-4690-bed9-ae081e69542c", + "bandwidth-profile-name": "3", + "vpn-type": "leaf", + "cir": "3000000", + "eir": "3000000", + "coupling-flag": "-,OA==", + "etht-svc-name": "cll-link-1", + "access-provider-id": "10", + "access-client-id": "0", + "access-topology-id": "2", + "access-node-id": "10.1.1.3", + "access-ltp-id": "1000001", + "connectivity-selflink": "restconf/config/GENERIC-RESOURCE-API:services/service//service-data/networks/network//network-data/", + "cvlan": "47", + "operational-status": "Activated", + "resource-version": "1632433788978", "relationship-list": { "relationship": [ { "related-to": "vpn-binding", - "relationship-label": "org.onap.relationships.inventory.PartOf", - "related-link": "/aai/v13/network/vpn-bindings/vpn-binding/11.11.11.11-vpn1", + "relationship-label": "tosca.relationships.network.BindsTo", + "related-link": "/aai/v24/network/vpn-bindings/vpn-binding/7bdc2f8c-2d3f-4a9f-91c9-e13e105b3f85", "relationship-data": [ { "relationship-key": "vpn-binding.vpn-id", - "relationship-value": "11.11.11.11-vpn1" + "relationship-value": "7bdc2f8c-2d3f-4a9f-91c9-e13e105b3f85" } ], "related-to-property": [ { "property-key": "vpn-binding.vpn-name", - "property-value": "11.11.11.11-vpn1" + "property-value": "32edeb0d-1036-4f16-9c11-c5257d81ae0e" }, { - "property-key": "vpn-binding.vpn-type", - "property-value": "ethernet" + "property-key": "vpn-binding.vpn-type" } ] }, { "related-to": "service-instance", "relationship-label": "org.onap.relationships.inventory.PartOf", - "related-link": "/aai/v13/business/customers/customer/demo/service-subscriptions/service-subscription/ccvpn/service-instances/service-instance/32cd906f-ee7a-4ecf-b1c3-2fce4d59f8c0", + "related-link": "/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/cll-101", "relationship-data": [ { "relationship-key": "customer.global-customer-id", - "relationship-value": "demo" + "relationship-value": "IBNCustomer" }, { "relationship-key": "service-subscription.service-type", - "relationship-value": "ccvpn" + "relationship-value": "IBN" }, { "relationship-key": "service-instance.service-instance-id", - "relationship-value": "32cd906f-ee7a-4ecf-b1c3-2fce4d59f8c0" + "relationship-value": "cll-101" } ], "related-to-property": [ { "property-key": "service-instance.service-instance-name", - "property-value": "SOTNVPNInfra" + "property-value": "cloud-leased-line-101" } ] }, { - "related-to": "vpn-binding", + "related-to": "uni", + "relationship-label": "org.onap.relationships.inventory.PartOf", + "related-link": "/aai/v24/network/unis/uni/networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.3-ltpId-1000001", + "relationship-data": [ + { + "relationship-key": "uni.id", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.3-ltpId-1000001" + } + ] + }, + { + "related-to": "connectivity", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/connectivities/connectivity/c648ddff-7abe-44ba-946f-8d7a4fa2691b", + "relationship-data": [ + { + "relationship-key": "connectivity.connectivity-id", + "relationship-value": "c648ddff-7abe-44ba-946f-8d7a4fa2691b" + } + ], + "related-to-property": [ + { + "property-key": "connectivity.etht-svc-name", + "property-value": "cll-link-1" + } + ] + } + ] + } + }, + { + "connectivity-id": "c648ddff-7abe-44ba-946f-8d7a4fa2691b", + "bandwidth-profile-name": "3", + "vpn-type": "mdsc", + "cir": "3000000", + "eir": "3000000", + "color-aware": "networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512", + "etht-svc-name": "cll-link-1", + "connectivity-selflink": "restconf/config/GENERIC-RESOURCE-API:services/service//service-data/networks/network//network-data/", + "cvlan": "47", + "operational-status": "Created", + "resource-version": "1632433782443", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.PartOf", + "related-link": "/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/cll-101", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "IBNCustomer" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "IBN" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cll-101" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "cloud-leased-line-101" + } + ] + }, + { + "related-to": "uni", + "relationship-label": "org.onap.relationships.inventory.PartOf", + "related-link": "/aai/v24/network/unis/uni/networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.3-ltpId-1000001", + "relationship-data": [ + { + "relationship-key": "uni.id", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.3-ltpId-1000001" + } + ] + }, + { + "related-to": "uni", "relationship-label": "org.onap.relationships.inventory.PartOf", - "related-link": "/aai/v13/network/vpn-bindings/vpn-binding/12.12.12.12-vpn1", + "related-link": "/aai/v24/network/unis/uni/networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512", + "relationship-data": [ + { + "relationship-key": "uni.id", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512" + } + ] + }, + { + "related-to": "connectivity", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/connectivities/connectivity/0cdb3c80-e319-4690-bed9-ae081e69542c", + "relationship-data": [ + { + "relationship-key": "connectivity.connectivity-id", + "relationship-value": "0cdb3c80-e319-4690-bed9-ae081e69542c" + } + ], + "related-to-property": [ + { + "property-key": "connectivity.etht-svc-name", + "property-value": "cll-link-1" + } + ] + }, + { + "related-to": "connectivity", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/connectivities/connectivity/8dfd5f6a-e795-47ff-8d66-ff26e78a7175", + "relationship-data": [ + { + "relationship-key": "connectivity.connectivity-id", + "relationship-value": "8dfd5f6a-e795-47ff-8d66-ff26e78a7175" + } + ], + "related-to-property": [ + { + "property-key": "connectivity.etht-svc-name", + "property-value": "cll-link-1" + } + ] + } + ] + } + }, + { + "connectivity-id": "8dfd5f6a-e795-47ff-8d66-ff26e78a7175", + "bandwidth-profile-name": "3", + "vpn-type": "root", + "cir": "3000000", + "eir": "3000000", + "color-aware": "networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512", + "coupling-flag": "-MTI=,", + "etht-svc-name": "cll-link-1", + "access-provider-id": "20", + "access-client-id": "0", + "access-topology-id": "2", + "access-node-id": "10.2.1.2", + "access-ltp-id": "512", + "connectivity-selflink": "restconf/config/GENERIC-RESOURCE-API:services/service//service-data/networks/network//network-data/", + "cvlan": "47", + "operational-status": "Activated", + "resource-version": "1632433789733", + "relationship-list": { + "relationship": [ + { + "related-to": "vpn-binding", + "relationship-label": "tosca.relationships.network.BindsTo", + "related-link": "/aai/v24/network/vpn-bindings/vpn-binding/c4b924e2-8a39-4f67-b9c1-d04b6c7a6053", "relationship-data": [ { "relationship-key": "vpn-binding.vpn-id", - "relationship-value": "12.12.12.12-vpn1" + "relationship-value": "c4b924e2-8a39-4f67-b9c1-d04b6c7a6053" } ], "related-to-property": [ { "property-key": "vpn-binding.vpn-name", - "property-value": "12.12.12.12-vpn1" + "property-value": "32edeb0d-1036-4f16-9c11-c5257d81ae0e" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + }, + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.PartOf", + "related-link": "/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/cll-101", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "IBNCustomer" }, { - "property-key": "vpn-binding.vpn-type", - "property-value": "ethernet" + "relationship-key": "service-subscription.service-type", + "relationship-value": "IBN" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cll-101" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "cloud-leased-line-101" + } + ] + }, + { + "related-to": "uni", + "relationship-label": "org.onap.relationships.inventory.PartOf", + "related-link": "/aai/v24/network/unis/uni/networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512", + "relationship-data": [ + { + "relationship-key": "uni.id", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512" + } + ] + }, + { + "related-to": "connectivity", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/connectivities/connectivity/c648ddff-7abe-44ba-946f-8d7a4fa2691b", + "relationship-data": [ + { + "relationship-key": "connectivity.connectivity-id", + "relationship-value": "c648ddff-7abe-44ba-946f-8d7a4fa2691b" + } + ], + "related-to-property": [ + { + "property-key": "connectivity.etht-svc-name", + "property-value": "cll-link-1" } ] } diff --git a/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json b/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json index 1b8ecff1..4ee81b6b 100644 --- a/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json +++ b/usecaseui-portal/src/app/mock/json/uui-sotn_getLogicalLinks.json @@ -1,25 +1,25 @@ { "logical-link": [ { - "link-name": "cross-link-1", + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.2-22", "in-maint": false, - "link-type": "cross-link", - "resource-version": "1536029865021", - "operational-status": "up", + "link-type": "point-to-point", + "resource-version": "1632418647894", + "link-id": "10.1.1.2-22", "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", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-22", "relationship-data": [ { "relationship-key": "pnf.pnf-name", - "relationship-value": "pnf2000" + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2" }, { "relationship-key": "p-interface.interface-name", - "relationship-value": "nodeId-78.78.78.78-ltpId-1" + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-22" } ], "related-to-property": [ @@ -31,15 +31,15 @@ { "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", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-12", "relationship-data": [ { "relationship-key": "pnf.pnf-name", - "relationship-value": "pnf1000" + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3" }, { "relationship-key": "p-interface.interface-name", - "relationship-value": "nodeId-79.79.79.79-ltpId-1" + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-12" } ], "related-to-property": [ @@ -52,25 +52,661 @@ } }, { - "link-name": "cross-link-2", + "link-name": "networkId-providerId-10-clientId-0-topologyId-2-linkId-10.1.1.1-1000001", "in-maint": false, - "link-type": "cross-link", - "resource-version": "1536029865021", - "operational-status": "up", + "link-type": "point-to-point", + "resource-version": "1632418637582", + "link-id": "10.1.1.1-1000001" + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-2-linkId-10.1.1.1-2000001", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418638991", + "link-id": "10.1.1.1-2000001" + }, + { + "link-name": "51000", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418711940", + "link-role": "cross-domain", + "link-id": "10.1.1.2-12", + "relationship-list": { + "relationship": [ + { + "related-to": "te-link-attribute", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/te-link-attributes/te-link-attribute/10.1.1.2-12", + "relationship-data": [ + { + "relationship-key": "te-link-attribute.id", + "relationship-value": "10.1.1.2-12" + } + ] + }, + { + "related-to": "te-link-attribute", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/te-link-attributes/te-link-attribute/10.2.1.1-22", + "relationship-data": [ + { + "relationship-key": "te-link-attribute.id", + "relationship-value": "10.2.1.1-22" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.3-12", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418648333", + "link-id": "10.1.1.3-12", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "52000", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418711437", + "link-role": "cross-domain", + "link-id": "10.1.1.3-8", + "relationship-list": { + "relationship": [ + { + "related-to": "te-link-attribute", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/te-link-attributes/te-link-attribute/10.1.1.3-8", + "relationship-data": [ + { + "relationship-key": "te-link-attribute.id", + "relationship-value": "10.1.1.3-8" + } + ] + }, + { + "related-to": "te-link-attribute", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/te-link-attributes/te-link-attribute/10.2.1.3-12", + "relationship-data": [ + { + "relationship-key": "te-link-attribute.id", + "relationship-value": "10.2.1.3-12" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-8", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-8" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.3-22", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418649331", + "link-id": "10.1.1.3-22", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-6", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-6" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.2-2", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418647397", + "link-id": "10.1.1.2-2", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-2", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-2" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "tranportEp_src_ID_111_2", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418767038", + "link-name2": "tranportEp_dst_ID_212_1", + "link-id": "111-2-212-1" + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.2-22", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418710116", + "link-id": "10.2.1.2-22", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.1-12", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418648797", + "link-id": "10.1.1.1-12", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-2", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.2-ltpId-2" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-1-linkId-10.1.1.1-6", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418650687", + "link-id": "10.1.1.1-6", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-6", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.1-ltpId-6" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3/p-interfaces/p-interface/networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-10-clientId-0-topologyId-1-nodeId-10.1.1.3-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-2-linkId-10.2.1.2-512", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418701065", + "link-id": "10.2.1.2-512" + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.1-12", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418710752", + "link-id": "10.2.1.1-12", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-12", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-12" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-22", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-22" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.2-5", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418710349", + "link-id": "10.2.1.2-5", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-3", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-3" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-5", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-5" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.3-3", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418710549", + "link-id": "10.2.1.3-3", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-3", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-3" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + }, + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-5", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.2-ltpId-5" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.3-22", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418710961", + "link-id": "10.2.1.3-22", "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", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-22", "relationship-data": [ { "relationship-key": "pnf.pnf-name", - "relationship-value": "pnf3000" + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3" }, { "relationship-key": "p-interface.interface-name", - "relationship-value": "nodeId-80.80.80.80-ltpId-2" + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-22" } ], "related-to-property": [ @@ -82,15 +718,53 @@ { "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", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-9", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-9" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" + } + ] + } + ] + } + }, + { + "link-name": "networkId-providerId-10-clientId-0-topologyId-2-linkId-10.1.1.3-1000001", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418639304", + "link-id": "10.1.1.3-1000001" + }, + { + "link-name": "networkId-providerId-20-clientId-0-topologyId-1-linkId-10.2.1.1-9", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418709796", + "link-id": "10.2.1.1-9", + "relationship-list": { + "relationship": [ + { + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-22", "relationship-data": [ { "relationship-key": "pnf.pnf-name", - "relationship-value": "pnf-cloud" + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3" }, { "relationship-key": "p-interface.interface-name", - "relationship-value": "cloud-tp" + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.3-ltpId-22" } ], "related-to-property": [ @@ -100,18 +774,35 @@ ] }, { - "related-to": "ext-aai-network", - "relationship-label": "org.onap.relationships.inventory.BelongsTo", - "related-link": "/aai/v13/network/ext-aai-networks/ext-aai-network/gongjie666", + "related-to": "p-interface", + "relationship-label": "tosca.relationships.network.LinksTo", + "related-link": "/aai/v24/network/pnfs/pnf/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1/p-interfaces/p-interface/networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-9", "relationship-data": [ { - "relationship-key": "ext-aai-network.aai-id", - "relationship-value": "gongjie666" + "relationship-key": "pnf.pnf-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1" + }, + { + "relationship-key": "p-interface.interface-name", + "relationship-value": "networkId-providerId-20-clientId-0-topologyId-1-nodeId-10.2.1.1-ltpId-9" + } + ], + "related-to-property": [ + { + "property-key": "p-interface.prov-status" } ] } ] } + }, + { + "link-name": "tranportEp_src_ID_113_1", + "in-maint": false, + "link-type": "point-to-point", + "resource-version": "1632418777509", + "link-name2": "tranportEp_dst_ID_212_1", + "link-id": "113-1-212-1" } ] -} +} \ No newline at end of file diff --git a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.css b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.css index 53cf02b4..e1a1d6e4 100644 --- a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.css +++ b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.css @@ -71,7 +71,6 @@ margin: 0; color: #3C4F8C; margin-left: 10px; - display: inline-block; } .model .title-modelshow{ color: #A0AACD; @@ -115,3 +114,4 @@ + diff --git a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.html b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.html index fb025d96..48d01d36 100644 --- a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.html +++ b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.html @@ -16,13 +16,40 @@
- +
+ + + + + {{"i18nTextDefine_Connectivity" | translate}} : + + + + + + + +
+

Please configure network links for registered devices and partner system.

+

+ Service Instances: +

+
+
+

+ Network Topology: +

diff --git a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.ts b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.ts index 56009546..d1e40672 100644 --- a/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.ts +++ b/usecaseui-portal/src/app/views/network/ccvpn-network/ccvpn-network.component.ts @@ -13,10 +13,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { Component, EventEmitter, OnInit, Output } from '@angular/core'; -import * as d3 from 'd3'; +import {Component, OnInit} from '@angular/core'; +import * as d3 from 'd3' import * as $ from 'jquery'; -import { networkHttpservice } from '../../../core/services/networkHttpservice.service'; +import {networkHttpservice} from '../../../core/services/networkHttpservice.service'; +import {EventQueueService} from "../../../core/services/eventQueue.service"; +import {AppEvent} from "@src/app/core/services/appEvent"; +import {AppEventType} from "@src/app/core/services/appEventType"; @Component({ selector: 'app-ccvpn-network', @@ -25,62 +28,64 @@ import { networkHttpservice } from '../../../core/services/networkHttpservice.se }) export class CcvpnNetworkComponent implements OnInit { - constructor(private myhttp: networkHttpservice) { + constructor(private myhttp: networkHttpservice, + private eventDispatcher: EventQueueService) { } ngOnInit() { let thisNg = this; - thisNg.getD3Data(); - - - //Local cloud TP port connection, click on the right to expand the details - $('#tpContainer').on('click', '.line-port', function () { - thisNg.isVisible = false; - thisNg.delBoxisVisible = true; - thisNg.delcloud = false; - - thisNg.delTp1 = $(this).attr('data-tp1'); - thisNg.delTp2 = $(this).attr('data-tp2'); - thisNg.delNode1 = $(this).attr('data-node1'); - thisNg.delNode2 = $(this).attr('data-node2'); - thisNg.delVersion = $(this).attr('data-version'); - thisNg.delLinkname = $(this).attr('data-link'); - thisNg.delcloudUrl = null; - thisNg.delLinkIndex = $(this); - - let dataD3 = thisNg.d3Data; - for (let p = 0; p < dataD3.length; p++) {//Determine which Domain network the two tp ports belong to - if (dataD3[p]['name'] == thisNg.delTp1) { - thisNg.network.push(dataD3[p]['source']['name']); - } - if (dataD3[p]['name'] == thisNg.delTp2) { - thisNg.network.push(dataD3[p]['source']['name']); + this.isSpinning = true; + this.myhttp.getConnectivities() + .subscribe((data) => { + if(data){ + for (let conn of data["connectivity"]) { + if (conn["vpn-type"] === "mdsc"){ + this.connectivityList.push({ "name": conn["connectivity-id"], + "id": conn["connectivity-id"], + "relationship-list" : conn["relationship-list"] + }); + } + } + if (this.connectivityList.length !== 0) { + this.connectivitySelected = this.connectivityList[0]; + this.choseConnectivity(this.connectivitySelected); + + }; } - } - thisNg.delNetwork1 = thisNg.network[0]; - thisNg.delNetwork2 = thisNg.network[1]; - }); + }, + (err) => { + console.log(err); + }); + this.myhttp.getLogicalLinksData() + .subscribe((data) => { + if (data) { + for (let ll of data["logical-link"]){ + // Filter layer1 logical link + //if (ll["relationship-list"] !== undefined && + // ll["relationship-list"]["relationship"].length) { + thisNg.logicalLinks.push(ll); + //} + } + let tpMapping = thisNg.getPnfTpMapping(thisNg.logicalLinks); - //External cloud connection, click on the right to expand the details - $('#tpContainer').on('click', '.cloudline', function () { - thisNg.isVisible = false; - thisNg.delBoxisVisible = true; - thisNg.delcloud = true; - - thisNg.delTp1 = $(this).attr('data-tp1'); - thisNg.delTp2 = $(this).attr('data-tp2'); - thisNg.delNode1 = $(this).attr('data-node1'); - thisNg.delNode2 = $(this).attr('data-node2'); - thisNg.delVersion = $(this).attr('data-version'); - thisNg.delNetwork1 = $(this).attr('data-network'); - thisNg.delNetwork2 = $(this).attr('data-cloudnetwork'); - thisNg.delcloudUrl = $(this).attr('data-url'); - thisNg.delLinkname = $(this).attr('data-link'); - thisNg.aaiId = $(this).attr('data-aaiid'); - thisNg.getCloudUrl(thisNg.aaiId); - }); + let links = thisNg.getLinks( thisNg.logicalLinks, tpMapping); + let tps = thisNg.getNodes(tpMapping); + console.log(links); + console.log(tps); + + thisNg.drawTopo(tps, links); + + } + this.isSpinning = false; + }, + (err) => { + console.log(err); + }) } + connectivityList = []; + connectivitySelected = { name: null, id: null }; + addLinkDisabled = true; nonetwork = false; isVisible = false; @@ -89,6 +94,9 @@ export class CcvpnNetworkComponent implements OnInit { delBoxisVisible = false; isSpinning = true; + pnfs = []; + layer1Tps = []; + d3Data = [];//D3Render the required data logicalLinks = [];//logicalLinks Existing connection data returned by the interface linkName = null;//Linked name link-name @@ -129,12 +137,25 @@ export class CcvpnNetworkComponent implements OnInit { winWidth = $('#tpContainer').width(); winHeight = $('#tpContainer').height(); charge = -300; + SEPERATOR = '-'; - imgmap = { - '1': 'assets/images/cloud-county1.png', - '2': 'assets/images/tp.png', - '3': 'assets/images/cloud-out.png', + + imgMap = { + 'pnf': 'assets/images/site.png', + 'tp': 'assets/images/tp.png' }; + + //### SELECTION - store the selected node ### + //### EDITING - store the drag mode (either 'drag' or 'add_link') ### + svcEditorGlobal = { + selection: null + } + svcContainerOpt = { + containerId : "svcContainer", + width: 1000, + height: this.winHeight + }; + tpoption = { container: '#tpContainer', data: '', @@ -142,1127 +163,907 @@ export class CcvpnNetworkComponent implements OnInit { height: this.winHeight }; - showForm(): void { - if (this.addLinkDisabled == false) { - this.isVisible = true; - this.delBoxisVisible = false; - } - } - - hideForm(): void { - this.isVisible = false; - this.delBoxisVisible = false; - this.linkName = null; - this.networkVal1 = null;//Initialize the default data of the network1 drop-down box - this.networkVal2 = null;//Initialize the network2 drop-down box default data - this.selectedNode1 = null;//Initialize the default data of the node1 drop-down box - this.selectedNode2 = null;//Initialize the default data of the node2 drop-down box - this.selecteTpName1 = null;//Initialize the default data of the TP1 drop-down box - this.selecteTpName2 = null;//Initialize the default data of the TP2 drop-down box - this.cloudUrl = null;//External cloud URL address - this.cloudNetwork = null;//External cloud network name - this.cloudNode = null;//External cloud Node name - this.cloudTp = null;//External cloud Tp name - } - - //Get cloud image data - getD3Data() { - this.isSpinning = true; - this.myhttp.getNetworkD3Data() - .subscribe((data) => { - this.isSpinning = false; - if (data.length == 0) { - this.addLinkDisabled = false; - this.nonetwork = true; - return; - } - this.nonetwork = false; - for (let ii = 0; ii < data.length; ii++) {//Determine if there is external cloud information in the data, and kick it out. - if (data[ii]['aaiId'] != null) { - this.dataCloud = data.splice(ii, 1); - } - } - - for (let i = 0; i < data.length; i++) { - let name1 = {}, name2 = {}; - let nodess = []; - name1['name'] = name2['network'] = data[i]['networkId']; - name1['type'] = '1'; - name1['source'] = i; - this.d3Data.push(name1); - for (let c = 0; c < data[i]["pnfs"].length; c++) { - nodess.push(data[i]['pnfs'][c]['pnfName']); - this.nodeOption1[name2['network']] = nodess; - } - this.networkOption.push(name2); + /** + * Redraw the selected L2 ethernet service. + * @param {Array} treeData parsed from AAI connectivity. + */ + drawService(treeData) { + //Model of service graph + let graph = { + nodes: [ + ], + links: [ + ], + objectify: (function() { + /* resolve node IDs (not optimized at all!) + */ + var l, n, _i, _len, _ref, _results; + _ref = graph.links; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + l = _ref[_i]; + _results.push((function() { + var _j, _len2, _ref2, _results2; + _ref2 = graph.nodes; + _results2 = []; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + n = _ref2[_j]; + if (l.source === n.id) { + l.source = n; + continue; + } + if (l.target === n.id) { + l.target = n; + continue; + } else { + _results2.push(void 0); + } + } + return _results2; + })()); } - for (let i = 0; i < data.length; i++) { - let tp_length = data[i]['tps'].length; - for (let h = 0; h < tp_length; h++) { - let name2 = {}; - let interface_name = data[i]['tps'][h]['interface-name']; - name2['name'] = interface_name; - name2['type'] = '2'; - name2['source'] = i; - this.d3Data.push(name2); - } + return _results; + }), + remove: (function(condemned) { + /* remove the given node or link from the graph, also deleting dangling links if a node is removed + */ if (Array.prototype.indexOf.call(this.nodes, condemned) >= 0) { + this.nodes = this.nodes.filter(function(n) { + return n !== condemned; + }); + return this.links = this.links.filter(function(l) { + return l.source.id !== condemned.id && l.target.id !== condemned.id; + }); + } else if (Array.prototype.indexOf.call(this.links, condemned) >= 0) { + return this.links = this.links.filter(function(l) { + return l !== condemned; + }); } - for (let b = 0; b < this.d3Data.length; b++) { - this.d3Data[b]['target'] = b; + }), + last_index: 0, + add_node: (function(type) { + var n; + n = { + id: this.last_index++, + x: 960 / 2, + y: 500 / 2, + type: type + }; + this.nodes.push(n); + return n; + }), + add_link: (function(source, target) { + /* avoid links to self + */ + var l, link, _i, _len, _ref; + if (source === target) return null; + /* avoid link duplicates + */ + _ref = this.links; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + link = _ref[_i]; + if (link.source === source && link.target === target) return null; } - this.initPosition(this.d3Data); - setTimeout(this.render(this.d3Data, this.imgmap, this.dataCloud, this.charge, data), 0); - }, (err) => { - console.log(err); - }); + l = { + source: source, + target: target + }; + this.links.push(l); + return l; + }) + }; - } + var nodeList = treeData.map(obj => { + let rObj = {}; + rObj["id"] = obj["id"]; + rObj["x"] = 500; + rObj["y"] = 500; + rObj["type"] = obj["type"]; + return rObj; + }) - //Get the initial connection status of the cloud image getlogicalLinksData - getLinksData() { - this.myhttp.getLogicalLinksData() - .subscribe((data) => { - if (data["status"] == "FAILED") { - return; + var linkList = [] ; + for (var i = 0, e = treeData.length; i < e; i++){ + for (var j = i+1, k = e; j < k; j++){ + linkList.push({ + source: treeData[i].id, + target: treeData[j].id + }); } - for (let i = 0; i < data["logical-link"].length; i++) {//Determine whether there is an external cloud connection in the obtained connection, and kick it out. - if (data['logical-link'][i]['relationship-list']['relationship'].length > 2) { - this.dataCloudLink = data['logical-link'].splice(i, 1); + } + graph.nodes = nodeList; + graph.links = linkList; + graph.objectify(); + var _this = this; + var margin = {top: 20, right: 120, bottom: 20, left: 120}, + width = 1000 - margin.right - margin.left, + height = 350 - margin.top - margin.bottom; + //clean existing element + d3.select("div#" + this.svcContainerOpt.containerId).selectAll("*").remove(); + + let svg = d3.select("div#" + this.svcContainerOpt.containerId).append("svg") + .attr("width", width + margin.right + margin.left) + .attr("height", height + margin.top + margin.bottom); + let container = svg.append("g").style("fill", "transparent"); + + let vis = container.append('g'); + container.call(d3.behavior.zoom().scaleExtent([0.5, 8]) + .on('zoom', function(){ + vis.attr('transform', "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); + })); + + vis.append('rect') + .attr('class', 'overlay') + .attr('x', -500000) + .attr('y', -500000) + .attr('width', 1000000) + .attr('height', 1000000) + .on('click', function(d) { + _this.svcEditorGlobal.selection = null; + d3.selectAll('.node').classed('selected', false); + return d3.selectAll('.link').classed('selected', false); + }); + let colorify = d3.scale.category10(); + /* initialize the force layout + */ + let force = d3.layout.force().size([width, height]).charge(-400).linkDistance(160) + .on('tick', (function(e) { + /* update nodes and links + */ + let k = 16 * e.alpha; + graph.nodes.forEach(function(o, i) { + if (o["type"] === "root"){ + o["x"] += k + //o["x"] += i & 2 ? k : -k; + + } else if (o["type"] === "leaf") { + o["x"] += -k; + //o["x"] += i & 2 ? k : -k; } - } + }); + vis.selectAll('.node').attr('transform', function(d) { + return "translate(" + d.x + "," + d.y + ")"; + }); - for (let i = 0; i < data["logical-link"].length; i++) { - let textval = []; - textval[0] = data['logical-link'][i]['relationship-list']['relationship'][0]['relationship-data'][1]['relationship-value'];//tp1 - textval[1] = data['logical-link'][i]['relationship-list']['relationship'][1]['relationship-data'][1]['relationship-value'];//tp2 - textval[2] = data['logical-link'][i]['resource-version'];//version - textval[3] = data['logical-link'][i]['relationship-list']['relationship'][0]['relationship-data'][0]['relationship-value'];//node1 - textval[4] = data['logical-link'][i]['relationship-list']['relationship'][1]['relationship-data'][0]['relationship-value'];//node2 - textval[5] = data['logical-link'][i]['operational-status']; - textval[6] = data['logical-link'][i]['link-name']; - this.logicalLinks.push(textval); - this.chose(textval); - } - if (this.dataCloudLink.length > 0) { - this.getcloudLine(this.dataCloudLink); - } - }, (err) => { - console.log(err); - }); - } - //D3Cloud rendering - render(nodes, imgmap, dataCloud, charge, dataD3) { - let thiss = this; - let _this = this.tpoption, - width = null, - height = _this.height; - if (_this.width > 800) { - width = _this.width; - } else { - width = 800; - } - if (dataD3.length <= 4) { - charge = -300; - } else if (dataD3.length > 4 && dataD3.length <= 6) { - charge = -160; - } else if (dataD3.length > 6 && dataD3.length <= 10) { - charge = -110; - } else { - charge = -100; - } - let svg = d3.select(_this.container).append('svg') - .attr('width', width) - .attr('height', height) - .attr('id', 'content-svg') - .style('pointer-events', 'all') - .style('position', 'absolute') - .style('top', '1%') - .style('right', '2%'), - graph = svg.append('g').attr('class', 'graph').attr('id', 'graph'), - - _g_nodes = graph.selectAll('g.node') - .data(nodes) - .enter() - .append('g') - .style('display', function (d) { - let display = 'block'; - switch (d.type) { - case '1': - display = 'none'; - break; - case '2': - display = 'none'; - break; - default: - break; + //#svcContainer > svg > g > g > g:nth-child(3) > text + //_this.svcEditorGlobal.selection + return vis.selectAll('.link').attr('x1', function(d) { + return d.source.x; + }).attr('y1', function(d) { + return d.source.y; + }).attr('x2', function(d) { + return d.target.x; + }).attr('y2', function(d) { + return d.target.y; + }); + })); + let nodeDragging = force.drag().on('dragstart', function (d){ + d3.event.sourceEvent.stopPropagation(); + d.fixed = true; + }) + + let topoNodeSync = _this.eventDispatcher.on(AppEventType.UserNodeDrag) + .subscribe(event => { + //console.log(event); + let pnfId: string = event.payload.id; + let pnfId_short: string = pnfId.substr(pnfId.lastIndexOf('-')+1); + vis.selectAll('.node > circle').attr('stroke-width', function(d) { + if (d.id.startsWith(pnfId_short)){ + return "4px"; } - return display; - }) - .style('cursor', 'pointer') - .attr('class', 'node'), - - _g_lines = graph.selectAll('line.line') - .data(nodes) - .enter() - .append('g') - .style('display', 'none') - .attr('class', 'line'); - - - _g_lines.append('line') - .style('stroke', '#93c62d' - ) - .style('stroke-width', 2); - - _g_nodes.append('image') - .attr('width', function (d) { - let width = 40; - switch (d.type) { - case '1': - width = 4.4 * width; - break; - case '2': - width = 0.12 * width; - break; - default: - break; - } - return width; - }) - .attr('height', function (d) { - let height = 20; - switch (d.type) { - case '1': - height = 3.5 * height; - break; - case '2': - height = 0.2 * height; - break; - default: - break; - } - return height; - }) - .attr('xlink:href', function (d) { - return imgmap[d.type]; + return "1px"; + }); }); - _g_nodes.append('text') - .text(function (d) { - return d.name; - }) - .style('transform', function (d) { - let x = null; - let y = null; - switch (d.type) { - case '1': - x = 7; - y = -7; - break; - case '2': - x = 1; - y = -2; - break; - default: - break; - } - return 'translate(' + x + '%,' + y + '%)'; - }) - .style('font-size', function (d) { - let size = 14; - switch (d.type) { - case '1': - size = 14; - break; - case '2': - size = 12; - break; - default: - break; - } - return size; - }) - .style('fill', function (d) { - let color = '#666'; - switch (d.type) { - case '1': - color = '#666'; - break; - case '2': - color = '#666'; - break; - default: - break; - } - return color; - }) - .style('font-weight', '500'); - + // DELETION - pressing DEL deletes the selection + // CREATION - pressing N creates a new node + // d3.select(window).on('keydown', function() { + // if (d3.event.keyCode === 46) { + // if (global.selection != null) { + // graph.remove(global.selection); + // global.selection = null; + // return update(); + // } + // } else if (d3.event.keyCode === 78) { + // graph.add_node(); + // return update(); + // } + // }); + + //Parameter for Editing tools + let toolbar = $("
"); + $("div#" + this.svcContainerOpt.containerId).append(toolbar); + toolbar.append($("\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "")); + toolbar.append($("\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "")); + toolbar.append($("\n" + + "\n" + + " \n" + + " \n \n" + + " \n" + + " \n" + + "")); + let library = $("
"); + toolbar.append(library); + + ['PON', 'ETH'].forEach(function(type) { + var new_btn; + new_btn = $("\n" + + " \n" + + " \n" + + " " + (type) + " UNI \n" + + " " + + " \n" + + ""); + new_btn.bind('click', function() { + graph.add_node(type); + return update(); + }); + library.append(new_btn); + return library.hide(); + }); - //Add custom attributes online - _g_lines.each(function (d, i) { - let _this = d3.select(this); - if (d.name) { - _this.attr('data-text', d.name); + let tool = 'pointer'; + let new_link_source = null; + let drag_link; + vis.on('mousemove.add_link', (function(d) { + /* check if there is a new link in creation + */ + var p; + if (new_link_source != null) { + /* update the draggable link representation + */ + p = d3.mouse(vis.node()); + return drag_link.attr('x1', new_link_source.x).attr('y1', new_link_source.y).attr('x2', p[0]).attr('y2', p[1]); + } + })).on('mouseup.add_link', (function(d) { + new_link_source = null; + /* remove the draggable link representation, if exists + */ + if (drag_link != null) return drag_link.remove(); + })); + d3.selectAll('.tool').on('click', function() { + var new_tool, nodes; + d3.selectAll('.tool').classed('active', false).style("fill", "#a3a4c3"); + d3.select(this).classed('active', true).style("fill", "#b52d0c"); + new_tool = $(this).data('tool'); + nodes = vis.selectAll('.node'); + + //mode change to add_link + if (new_tool === 'add_link' && tool !== 'add_link') { + /* remove drag handlers from nodes + */ + nodes.on('mousedown.drag', null).on('touchstart.drag', null); + /* add drag handlers for the add_link tool + */ + nodes.call(drag_add_link); + } else if (new_tool !== 'add_link' && tool === 'add_link') { + /* remove drag handlers for the add_link tool + */ + nodes.on('mousedown.add_link', null).on('mouseup.add_link', null); + /* add drag behavior to nodes + */ + nodes.call(nodeDragging); + } + if (new_tool === 'add_node') { + library.show(); + } else { + library.hide(); } + return tool = new_tool; }); - - let force = d3.layout.force() - .size([1000, this.winHeight]) - .linkDistance(5) - // .theta(0.6) - .charge(charge) - .nodes(nodes) - .links(nodes) - .start(); - - force.on('tick', function () { - if (force.alpha() <= 0.04) { - - _g_nodes.style('display', function (d) { - let display = 'block'; - switch (d.type) { - case '1': - display = 'block'; - break; - case '2': - display = 'none'; - break; - default: - break; - } - return display; + update(); + function update() { + /* update the layout + */ + var links, new_nodes, nodes; + force.nodes(graph.nodes).links(graph.links).start(); + /* create nodes and links + */ + /* (links are drawn with insert to make them appear under the nodes) + */ + /* also define a drag behavior to drag nodes + */ + /* dragged nodes become fixed + */ + nodes = vis.selectAll('.node').data(graph.nodes, function(d) { + return d.id; + }); + new_nodes = nodes.enter().append('g').attr('class', 'node'); +/* .on('click', (function(d) { + /!* SELECTION + *!/ + _this.svcEditorGlobal.selection = d; + d3.selectAll('.node').classed('selected', function(d2) { + return d2 === d; }); + return d3.selectAll('.link').classed('selected', false); + }));*/ + links = vis.selectAll('.link').data(graph.links, function(d) { + return "" + d.source.id + "->" + d.target.id; + }); - nodes.forEach(function (d, i) { - d.x = d.x - 25 < 0 ? 25 : d.x; - d.x = d.x + 25 > width ? width - 25 : d.x; - d.y = d.y - 15 < 0 ? 15 : d.y; - d.y = d.y + 15 > height ? height - 15 : d.y; + links.enter().insert('line', '.node').attr('class', 'link').on('click', (function(d) { + /* SELECTION + */ + _this.svcEditorGlobal.selection = d; + d3.selectAll('.link').classed('selected', function(d2) { + return d2 === d; }); + return d3.selectAll('.node').classed('selected', false); + })); + links + .style("stroke-width", "6px") + .style("stroke", "gray") + .style("opacity", "0.5"); + + links.exit().remove(); + /* TOOLBAR - add link tool initialization for new nodes + */ + if (tool === 'add_link') { + new_nodes.call(drag_add_link); + } else { + new_nodes.call(nodeDragging); + } + new_nodes.append('circle').attr('r', 18).attr('stroke', function(d) { + return colorify(d.type); + }).attr('fill', function(d) { + return d3.hcl(colorify(d.type)).brighter(3); + }); + /* draw the label + */ + new_nodes.append('text').text(function(d) { + return d.id; + }).attr('dy', '0.35em').attr('fill', function(d) { + return colorify(d.type); + }); + return nodes.exit().remove(); + }; + function drag_add_link (selection) { + return selection.on('mousedown.add_link', (function(d) { + var p; + new_link_source = d; + /* create the draggable link representation + */ + p = d3.mouse(vis.node()); + drag_link = vis.insert('line', '.node').attr('class', 'drag_link').attr('x1', d.x).attr('y1', d.y).attr('x2', p[0]).attr('y2', p[1]); + drag_link + .style("stroke-width", "6px") + .style("stroke", "gray") + .style("opacity", "0.5"); + /* prevent pan activation + */ + d3.event.stopPropagation(); + /* prevent text selection + */ + return d3.event.preventDefault(); + })).on('mouseup.add_link', (function(d) { + /* add link and update, but only if a link is actually added + */ if (graph.add_link(new_link_source, d) != null) return update(); + })); + }; - _g_nodes.attr('transform', function (d) { - let image = d3.select(this).select('image')[0][0], - halfWidth = parseFloat(image.attributes[0]['value']) / 2, - halfHeight = parseFloat(image.attributes[1]['value']) / 2; - let xx = d.x - halfWidth, - yy = d.y - halfHeight; - return 'translate(' + xx + ',' + yy + ')'; - }); + } - _g_lines.select('line') - .attr('x1', function (d) { - return d.source.x; - }) - .attr('y1', function (d) { - return d.source.y; - }) - .attr('x2', function (d) { - return d.target.x; - }) - .attr('y2', function (d) { - return d.target.y; - }); + /** + * Redraw the underlay network topology. + * @param {Array} nodes parsed from AAI logicalLinks. + * @param {Array} lines parsed from AAI logicalLinks. + */ + drawTopo(nodes: Array, lines: Array){ + let margin = {top: 20, right: 120, bottom: 20, left: 120}, + width = 1000 - margin.right - margin.left, + height = 350 - margin.top - margin.bottom; - _g_nodes.select('text').attr('dy', function (d) { - let image = this.previousSibling, - height = parseFloat(image.attributes[1]['value']), - fontSize = 12; - return height + 1.5 * fontSize; - }); - } + let thisNg = this; + + let nodeById = d3.map(); + + nodes.forEach(function(node) { + nodeById.set(node["id"], node); }); - force.on('end', function () { - force.stop(); - if (dataCloud.length > 0) { - thiss.getoutCloud(dataCloud, imgmap); - } - thiss.getLinksData(); - thiss.addLinkDisabled = false; + lines.forEach(function(link) { + link["source"] = nodeById.get(link["source"]); + link["target"] = nodeById.get(link["target"]); }); - }; + let svg = d3.select("div#tpContainer").append("svg") + .attr("width", width + margin.right + margin.left) + .attr("height", height + margin.top + margin.bottom) + .style("pointer-events", "all"); - //Topology drag and drop effect - getDragBehavior(force) { + let graph = svg.append("g").attr("class", "graph"); - return d3.behavior.drag() - .origin(function (d) { - return d; + let force = d3.layout.force() + .nodes(nodes) + .links(lines) + .size([width, height]) + /* .linkStrength(function(d){ + switch(d.type){ + case 1: + return 0.15; + case 2: + default: + return 0.1; + } + })*/ + //.gravity(0) + //.gravity(0) + .linkDistance(function (d) { + return 150; }) - .on('dragstart', dragstart) - .on('drag', dragging) - .on('dragend', dragend); + .charge(function(d) { + return -600; + }) + .start(); - function dragstart(d) { - d3.event.sourceEvent.stopPropagation(); - d3.select(this).classed('dragging', true); - force.start(); - } + let drag = force.drag() + .on("dragstart", dragstart) + .on("dragend", dragend); - function dragging(d) { - d.x = d3.event.x; - d.y = d3.event.y; - } + let _g_lines = graph.selectAll("line.line") + .data(lines) + .enter() + .append("g") + .attr("class", "line"); - function dragend(d) { - d3.select(this).classed('dragging', false); - } + let _g_nodes = graph.selectAll("g.node") + .data(nodes) + .enter() + .append("g") + .attr("class", "node") + .call(drag); + _g_lines.append("line") + .style('stroke', function (d) { + if(d.type === 2){ + return "#000000"; + } else { + return '#93c62d'; + } - } + }) + .style("stroke-width", 4); - //Initialize node location - initPosition(datas) { - let origin = [this.tpoption.width / 2, this.tpoption.height / 2]; - let points = this.getVertices(origin, Math.min(this.tpoption.width / 2, this.tpoption.height / 2), datas.length); - datas.forEach((item, i) => { - item.x = points[i].x; - item.y = points[i].y; - }); - } - //Get anchor points based on polygons - getVertices(origin, r, n) { - if (typeof n !== 'number') return; - let ox = origin[0]; - let oy = origin[1]; - let angle = 30 * n / n; - let i = 0; - let points = []; - let tempAngle = 0; - while (i < n) { - tempAngle = (i * angle * Math.PI) / 180; - points.push({ - x: ox - r * Math.sin(tempAngle), - y: oy - r * Math.cos(tempAngle), + _g_nodes.append("image") + .attr("width", function (d) { + switch (d.group) { + case 'pnf': + return 70; + case 'tp': + default: + return 10; + } + }) + .attr("height", function (d) { + switch (d.group) { + case 'pnf': + return 70; + case 'tp': + default: + return 10; + } + }) + .attr("xlink:href", function (d) { + return thisNg.imgMap[d.group]; }); - i++; - } - return points; - } - //Rendering an external cloud - getoutCloud(dataCloud, imgmap) { - let _this = this, - width; - let networkId = dataCloud[0]['networkId']; - if (_this.tpoption.width > 800) { - width = _this.tpoption.width; - } else { - width = 800; - } - let svg = d3.select('#content-svg'); - svg.append('g').attr('class', 'out').attr('id', 'out').style({ 'display': 'block' }).attr('transform', 'translate(' + (width - 200) + ',0)'); - let out = d3.select('#out'); - out.append('image').style('width', '200').style('height', '118').attr('xlink:href', imgmap['3']); - out.append('text').text(networkId) - .style('transform', 'translate(0,0)') - .style('font-size', '16') - .style('font-weight', '400') - .attr('dx', '40') - .attr('dy', '70') - .style('fill', '#666'); - } + _g_nodes.append("text") + .text(function (d) { + return d.id.substr( d.id.lastIndexOf('-')+1); + }) + .style('font-size', '12') + .style('fill', '#333'); + + //_g_nodes.each(function (d, i) { + var selection = d3.select(this); +/* if (d.status == '0') { + selection.append("g").attr("class", "error-tip") + .append("image").attr("xlink:href", function (d) { + return imgMap['error-tip']; + }); + }*/ + // }); - //External cloud connection - getcloudLine(dataCloudLink) { - let textval = []; - textval[0] = dataCloudLink[0]['relationship-list']['relationship'][0]['relationship-data'][1]['relationship-value'];//tp1 - textval[1] = dataCloudLink[0]['relationship-list']['relationship'][1]['relationship-data'][1]['relationship-value'];//tp2 - textval[2] = dataCloudLink[0]['resource-version'];//version - textval[3] = dataCloudLink[0]['relationship-list']['relationship'][0]['relationship-data'][0]['relationship-value'];//node1 - textval[4] = dataCloudLink[0]['relationship-list']['relationship'][1]['relationship-data'][0]['relationship-value'];//node2 - textval[5] = dataCloudLink[0]['operational-status'];//status - textval[6] = dataCloudLink[0]['relationship-list']['relationship'][2]['relationship-data'][0]['relationship-value'];//aaiId - textval[7] = this.dataCloud[0]['networkId']; - let dataD3 = this.d3Data; - let arr = [ - textval[0], - textval[1] - ]; - for (let p = 0; p < dataD3.length; p++) {//Determine which Domain network the two tp ports belong to - for (let pp = 0; pp < arr.length; pp++) {//Determine which Domain network the two tp ports belong to - if (dataD3[p]['name'] == arr[pp]) { - textval[8] = dataD3[p]['source']['name'];//network1 - } - } - } - textval[9] = dataCloudLink[0]['link-name']; - let lines_json = {}; - let _this = this, - width; - if (_this.tpoption.width > 800) { - width = _this.tpoption.width; - } else { - width = 800; - } - for (let i = 0; i < $(".node").length; i++) { - if ($('.node').eq(i).find('text').html() == textval[8]) { - //Get the x, y coordinates of the second level - let translates = $('.node').eq(i).css('transform'); - lines_json['x1'] = parseFloat(translates.substring(7).split(',')[4]); - lines_json['y1'] = parseFloat(translates.substring(7).split(',')[5]); - lines_json['x2'] = width - 100; - lines_json['y2'] = 100; + _g_lines.each(function (d, i) { + var _this = d3.select(this); + if (d.type === 1) { + _this.append("text") + .text("100GB") + .style('fill', 'rgb(255,198,22)') + .style('font-size', '11'); + + _this.append("rect") + .attr("fill", function (d) { + return '#555'; + }) + .attr("width", function (d) { + return 4; + }) + .attr("height", function (d) { + return 4; + }) + .append("animate"); + + _this.select("rect").append("animate"); + } else { + _this.append("image") + .attr("xlink:href", function () { + return thisNg.imgMap['link-cut']; + }); } - } - let x1 = lines_json['x1']; - let y1 = lines_json['y1']; - let x2 = lines_json['x2']; - let y2 = lines_json['y2']; - let color = '#14bb58'; - if (textval[5] == 'up') { - color = '#14bb58'; - } else { - color = 'red'; - } - let line = ''; - let svg = d3.select('#graph'); - $('.cloudline').remove(); - $('#graph').prepend(line); - $('.cloudline').attr({ - x1: x1 + 100, - y1: y1 + 10, - x2: x2, - y2: y2, - 'data-tp1': textval[0], - 'data-tp2': textval[1], - 'data-version': textval[2], - 'data-node1': textval[3], - 'data-node2': textval[4], - 'data-network': textval[8], - 'data-cloudnetwork': textval[7], - 'data-url': '', - 'data-aaiid': textval[6], - 'data-link': textval[9], }); - svg.html(svg.html()); - this.getCloudUrl(textval[6]); - this.getExtAAIIdVersion(textval[6]); - } - //Query external cloud host url address - getCloudUrl(aaiId) { - this.myhttp.queryCloudUrl(aaiId) - .subscribe((data) => { - this.delcloudUrl = data['service-url']; - $('.cloudline').attr({ - 'data-url': data['service-url'] + force.on("tick", function (e) { + + _g_lines.select("line").attr("x1", function (d) { + return d.source.x; + }) + .attr("y1", function (d) { + return d.source.y; + }) + .attr("x2", function (d) { + return d.target.x; + }) + .attr("y2", function (d) { + return d.target.y; + }); + _g_lines.select("image").attr("x", function (d) { + var x1 = d.source.x, + x2 = d.target.x, + x = x1 - (x1 - x2) / 2; + return x - 8; + }) + .attr("y", function (d) { + var y1 = d.source.y, + y2 = d.target.y, + y = y1 - (y1 - y2) / 2; + return y - 15; }); - }, (err) => { - console.log(err); - }); - } - //Query external cloud ext-aai-id resource-version - getExtAAIIdVersion(aaiId) { - this.myhttp.queryExtAAIIdVersion(aaiId) - .subscribe((data) => { - this.delVersion = data["resource-version"]; - $('.cloudline').attr({ - 'data-version': data["resource-version"], + _g_lines.select("text") + .attr('x', function (d) { + var x1 = d.source.x, + x2 = d.target.x, + halfX = x1 - (x1 - x2) / 2, + x3 = x1 - (x1 - halfX) / 2; + return x3; + }) + .attr('y', function (d) { + var y1 = d.source.y, + y2 = d.target.y, + halfY = y1 - (y1 - y2) / 2, + y3 = y1 - (y1 - halfY) / 2; + y3 = y3 - 5; + return y3; + }) + .attr("transform", function (d) { + var x1 = d.source.x, + x2 = d.target.x, + y1 = d.source.y, + y2 = d.target.y, + x = x1 - (x1 - x2) / 2, + y = y1 - (y1 - y2) / 2, + rightAngleSide1 = Math.abs(y2 - y1), + rightAngleSide2 = Math.abs(x2 - x1), + _asin = 0, + _rotateAngle = 0, + x3 = x1 - (x1 - x) / 2, + y3 = y1 - (y1 - y) / 2; + + if (x1 < x2) { + _asin = (y2 - y1) / Math.sqrt(Math.pow(rightAngleSide1, 2) + Math.pow( + rightAngleSide2, 2)); + _rotateAngle = Math.asin(_asin) * 180 / Math.PI; + } else { + _asin = (y1 - y2) / Math.sqrt(Math.pow(rightAngleSide1, 2) + Math.pow( + rightAngleSide2, 2)); + _rotateAngle = Math.asin(_asin) * 180 / Math.PI; + _rotateAngle = _rotateAngle < 0 ? (180 + _rotateAngle) : -(180 - + _rotateAngle); + } + return 'rotate(' + (_rotateAngle) + ',' + x3 + ' ' + y3 + ')'; }); - }, (err) => { - console.log(err); - }); - } + _g_lines.select("rect") + .attr('x', function (d) { + return d.source.x - 1; + }) + .attr('y', function (d) { + return d.source.y - 1; + }) + .selectAll('animate').each(function (d, i) { + if (i == 0) { + d3.select(this) + .attr("attributeName", function (d) { + return 'x'; + }) + .attr("from", function (d) { + return d.source.x - 1; + }) + .attr("to", function (d) { + return d.target.x; + }); + } else { + d3.select(this) + .attr("attributeName", function (d) { + return 'y'; + }) + .attr("from", function (d) { + return d.source.y - 1; + }) + .attr("to", function (d) { + return d.target.y; + }); + } - //The right form drop-down box data is filled with three levels of linkage - //Left Port - network1Change(value: string): void { - this.selectedNode1 = this.nodeOption1[value][0]; - this.getPInterfaces1(); - } + d3.select(this).attr("attributeType", "XML") + .attr("dur", function (d) { + return '1.5s'; + }) + .attr("repeatCount", "indefinite"); - node1Change(): void { - this.getPInterfaces1(); - } + }) +/* let k = 6 * e.alpha; + nodes.forEach(function(o, i) { + if (o["layer"] === "Otn"){ + o["y"] += k + //o["x"] += i & 2 ? k : -k; + + } else if (o["layer"] === "Eth") { + o["y"] += -k; + //o["x"] += i & 2 ? k : -k; + } + });*/ - //Get the TP data under the specified node - getPInterfaces1() { - let params = { - pnfName: this.selectedNode1, - }; - this.myhttp.getPInterfacesData(params) - .subscribe((data) => { - this.tpOption1 = []; - for (let i = 0; i < data.length; i++) { - let tpName = data[i]['interface-name']; - this.tpOption1.push(tpName); + _g_nodes.attr("transform", function (d) { + if(d.group === 'pnf') { + var image = d3.select(this).select("image")[0][0], + halfWidth = parseFloat("70") / 2, + halfHeight = parseFloat("70") / 2; + + return 'translate(' + (d.x - halfWidth) + ',' + (d.y - halfHeight) + ')'; + } else { + return 'translate(' + (d.x) + ',' + (d.y) + ')'; } - this.selecteTpName1 = this.tpOption1[0]; - }, (err) => { - console.log(err); - }); - } - //Right Port - network2Change(value: string): void { - this.selectedNode2 = this.nodeOption1[value][0]; - this.getPInterfaces2(); - } + }); - node2Change(): void { - this.getPInterfaces2(); - } + _g_nodes.select("text").attr('dy', function (d) { + var image = this.previousSibling, + height = parseFloat("10"), + fontSize = parseFloat(this.style.fontSize); - //Get the TP data under the specified node - getPInterfaces2() { - let params = { - pnfName: this.selectedNode2, - }; - this.myhttp.getPInterfacesData(params) - .subscribe((data) => { - this.tpOption2 = []; - for (let i = 0; i < data.length; i++) { - let tpName = data[i]['interface-name']; - this.tpOption2.push(tpName); - } - this.selecteTpName2 = this.tpOption2[0]; - }, (err) => { - console.log(err); + return height + 1.5 * fontSize; }); - } - //Submit form, connect - submitForm(): void { - //When the page ONAP is not selected, the local cloud TP connection - let _thiss = this; - if (this.inputshow == false) { - if (this.linkName == null || this.networkVal1 == null || this.selectedNode1 == null || this.selecteTpName1 == null || this.networkVal2 == null || this.selectedNode2 == null || this.selecteTpName2 == null) { - alert('The service port cannot be empty. Please select the port information.'); - return; - } else if (this.networkVal1 == this.networkVal2) { - alert('The TP port under the same cloud service cannot be connected!'); - return; - } - let tp_links = [], - tp1 = this.selecteTpName1, - tp2 = this.selecteTpName2; - for (let i = 0; i < $(".line-port").length; i++) { - let data_text1 = $('.line-port').eq(i).attr('data-tp1'); - let data_text2 = $('.line-port').eq(i).attr('data-tp2'); - tp_links.push(data_text1); - tp_links.push(data_text2); - } - if (tp_links.indexOf(tp1) != -1 || tp_links.indexOf(tp2) != -1) { - alert('This port number connection already exists!'); - return; - } - this.createTpLinks(); + _g_nodes.select(".error-tip").attr("transform", function (d) { - } else { - //When the page ONAP is selected, the external cloud is created, and the connection is made. - if (this.linkName == null || this.networkVal1 == null || this.selectedNode1 == null || this.selecteTpName1 == null || this.cloudUrl == null || this.cloudNetwork == null || this.cloudNode == null || this.cloudTp == null) { - alert('The service port cannot be empty. Please fill in the complete port information.'); - return; - } - let tp_links = [], - tp1 = this.selecteTpName1; - for (let i = 0; i < $(".line-port").length; i++) { - let data_text1 = $('.line-port').eq(i).attr('data-tp1'); - tp_links.push(data_text1); - } - if (tp_links.indexOf(tp1) != -1) { - alert('This port number connection already exists!'); - return; - } + var image = this.parentNode.firstChild, + width = parseFloat("70"); - let time = this.cloudNetwork + new Date().getTime();//Create aaiid for the external cloud, this identifier is unique and cannot be repeated - this.createCloudUrls(time) - } - } + return 'translate(' + 0.8 * width + ',0)'; - //Create tp connection call interface createLink - createTpLinks() { - let params = { - 'link-name': this.linkName, - 'link-type': 'cross-link', - 'operational-status': 'up', - 'relationship-list': { - 'relationship': [ - { - 'related-to': 'p-interface', - 'related-link': '/aai/v14/network/pnfs/pnf/' + this.selectedNode1 + '/p-interfaces/p-interface/' + this.selecteTpName1, - 'relationship-data': [ - { - 'relationship-key': 'pnf.pnf-id', - 'relationship-value': this.selectedNode1 - }, - { - 'relationship-key': 'p-interface.p-interface-id', - 'relationship-value': this.selecteTpName1, - } - ] - }, - { - 'related-to': 'p-interface', - 'related-link': '/aai/v14/network/pnfs/pnf/' + this.selectedNode2 + '/p-interfaces/p-interface/' + this.selecteTpName2, - 'relationship-data': [ - { - 'relationship-key': 'pnf.pnf-id', - 'relationship-value': this.selectedNode2 - }, - { - 'relationship-key': 'p-interface.p-interface-id', - 'relationship-value': this.selecteTpName2 - } - ] - } - ] - } - }; - this.myhttp.createLink(params) - .subscribe((data) => { - if (data['status'] == 'SUCCESS') { - this.queryAddLink(); - } - }, (err) => { - console.log(err); - console.log('Create connection interface call failed'); }); - } - //Query the newly added connection immediately after creating the tp cable - queryAddLink() { - let linkName = this.linkName, - selecteTpName1 = this.selecteTpName1, - selecteTpName2 = this.selecteTpName2, - selectedNode1 = this.selectedNode1, - selectedNode2 = this.selectedNode2; - let params = { - 'link-name': linkName, - }; - this.myhttp.querySpecificLinkInfo(params) - .subscribe((data) => { - let version = data['resource-version'], - operational_status = data['operational-status'], - linkname = data['link-name']; - let textval = [selecteTpName1, selecteTpName2, version, selectedNode1, selectedNode2, operational_status, linkname]; - this.hideForm(); - this.chose(textval); - }, (err) => { - console.log(err); - }); - } + }); - //Connection between two TP coordinates - chose(textval) { - let lines_json = {}; - lines_json['tp1'] = textval[0]; - lines_json['tp2'] = textval[1]; - lines_json['version'] = textval[2]; - lines_json['node1'] = textval[3]; - lines_json['node2'] = textval[4]; - lines_json['status'] = textval[5]; - lines_json['linkname'] = textval[6]; - for (let i = 0; i < $(".node").length; i++) { - if ($('.node').eq(i).find('text').html() == textval[0]) { - $('.node').eq(i).show(); - //Get the x, y coordinates of the second level - let translates = $('.node').eq(i).css('transform'); - lines_json['x1'] = parseFloat(translates.substring(7).split(',')[4]); - lines_json['y1'] = parseFloat(translates.substring(7).split(',')[5]); - } - if ($('.node').eq(i).find('text').html() == textval[1]) { - $('.node').eq(i).show(); - let translates = $('.node').eq(i).css('transform'); - lines_json['x2'] = parseFloat(translates.substring(7).split(',')[4]); - lines_json['y2'] = parseFloat(translates.substring(7).split(',')[5]); - } - } - this.addLine(lines_json); - } - //Connection between two TPs - addLine(lines) { - let tp1 = lines.tp1; - let tp2 = lines.tp2; - let version = lines.version; - let node1 = lines.node1; - let node2 = lines.node2; - let status = lines.status; - let linkname = lines.linkname; - let x1 = lines.x1; - let y1 = lines.y1; - let x2 = lines.x2; - let y2 = lines.y2; - let color = '#14bb58'; - if (status == 'up') { - color = '#14bb58'; - } else { - color = 'red'; + function dblclick(d) { + d3.select(this).classed("fixed", d.fixed = false); } - let line = ''; - let svg = d3.select('#graph'); - $('#graph').prepend(line); - $('.line').first().attr({ - x1: x1, - y1: y1, - x2: x2, - y2: y2, - 'data-tp1': tp1, - 'data-tp2': tp2, - 'data-version': version, - 'data-node1': node1, - 'data-node2': node2, - 'data-link': linkname - }); - svg.html(svg.html()); - } - - //After creating an external cloud connection, query the connection immediately - queryOutCloudLink(time) { - let networkVal1 = this.networkVal1, - selectedNode1 = this.selectedNode1, - selecteTpName1 = this.selecteTpName1, - cloudUrl = this.cloudUrl, - cloudNetWork = this.cloudNetwork, - cloudNode = this.cloudNode, - cloudTp = this.cloudTp, - linkname = this.linkName; - let params = { - 'link-name': linkname, - }; - this.myhttp.querySpecificLinkInfo(params) - .subscribe((data) => { - let status = data['operational-status']; - let link_name = data['link-name']; - this.outCloudShow = true; - this.hideForm(); - this.outCloud(this.imgmap); - setTimeout(this.cloudLine(networkVal1, selectedNode1, selecteTpName1, cloudUrl, cloudNetWork, cloudNode, cloudTp, status, link_name, time), 0); - }, (err) => { - console.log(err); - }); - } - //Add external cloud - outCloud(imgmap) { - let _this = this, - width; - if (_this.tpoption.width > 800) { - width = _this.tpoption.width; - } else { - width = 800; + function dragstart(d) { + d3.select(this).classed("fixed", d.fixed = true); + thisNg.eventDispatcher.dispatch(new AppEvent(AppEventType.UserNodeDrag, d)); } - let svg = d3.select('#content-svg'); - svg.append('g').attr('class', 'out').attr('id', 'out').style({ 'display': 'block' }).attr('transform', 'translate(' + (width - 200) + ',0)'); - let out = d3.select('#out'); - out.append('image').style('width', '200').style('height', '118').attr('xlink:href', imgmap['3']); - out.append('text').text('Partner Network') - .style('transform', 'translate(0,0)') - .style('font-size', '16') - .style('font-weight', 'bold') - .attr('dx', '40') - .attr('dy', '70') - .style('fill', '#fff'); - } + function dragend(d) { - //Add external cloud connection - cloudLine(networkVal1, selectedNode1, selecteTpName1, cloudUrl, cloudNetWork, cloudNode, cloudTp, status, link_name, time) { - let lines_json = {}; - let _this = this, - width; - if (_this.tpoption.width > 800) { - width = _this.tpoption.width; - } else { - width = 800; } - for (let i = 0; i < $(".node").length; i++) { - if ($('.node').eq(i).find('text').html() == networkVal1) { - //Get the x, y coordinates of the second level - let translates = $('.node').eq(i).css('transform'); - lines_json['x1'] = parseFloat(translates.substring(7).split(',')[4]); - lines_json['y1'] = parseFloat(translates.substring(7).split(',')[5]); - lines_json['x2'] = width - 100; - lines_json['y2'] = 100; + + function color (d){ + const scale = d3.scaleOrdinal(d3.schemeCategory10); + switch(d.group){ + case "pnf": + return scale(1); + case "tp": + return scale(2); + default: + return scale(9); } } - let x1 = lines_json['x1']; - let y1 = lines_json['y1']; - let x2 = lines_json['x2']; - let y2 = lines_json['y2']; - let color = '#14bb58'; - if (status == 'up') { - color = '#14bb58'; - } else { - color = 'red'; - } - let line = ''; - let svg = d3.select('#graph'); - $('.cloudline').remove(); - $('#graph').prepend(line); - $('.cloudline').attr({ - x1: x1 + 100, - y1: y1 + 10, - x2: x2, - y2: y2, - 'data-tp1': selecteTpName1, - 'data-tp2': cloudTp, - 'data-node1': selectedNode1, - 'data-node2': cloudNode, - 'data-network': networkVal1, - 'data-cloudnetwork': cloudNetWork, - 'data-url': cloudUrl, - 'data-aaiid': time, - 'data-link': link_name - }); - svg.html(svg.html()); - this.getExtAAIIdVersion(time); } - //Create an external cloud, call the following 5 interfaces when connecting:createCloudNetwork,createPnfs,createCloudTp,createCloudLinks,createCloudUrls - createCloudNetwork(time) { - let _thiss = this; - let params = { - '-xmlns': 'http://org.onap.aai.inventory/v14', - 'in-maint': 'false', - "network-id": this.cloudNetwork, - "provider-id": "", - "client-id": "", - "te-topo-id": "", - "relationship-list": { - "relationship": [{ - "related-to": "ext-aai-network", - 'related-link': '/aai/v14/network/ext-aai-networks/ext-aai-network/' + time - }] - } - }; + choseConnectivity(item) { + if (this.connectivitySelected !== item) this.connectivitySelected = item; + this.drawService(this.getSvcTree()); + } - //Do some asynchronous operations - _thiss.myhttp.createNetwrok(params) - .subscribe((data) => { - if (data["status"] == "SUCCESS") { - _thiss.createPnfs(time) - } - }, (err) => { - console.log(err); - }); + getSvcTree(): Array { + let tree = [] + let rel = this.connectivitySelected["relationship-list"]["relationship"] || null; + if (rel){ + tree = rel.filter(rl => rl["related-to"] === "uni") + .map(obj => { + let rObj ={}; + rObj["id"] = obj["relationship-data"][0]["relationship-value"], + rObj["type"] = "leaf"; + return rObj; + }) + } + return tree; + } + getNodes(ptMapping: Array) : Array{ + let nodes = []; + for (let pnf of ptMapping){ + if (pnf["layer"] === 2){ + continue; + } + let name = pnf["pnfName"]; + let newNode = { + "id" : name, + "group": "pnf", + "radius" : 2, + "layer" : pnf["layer"] === 2? "Eth" : "Otn" + } + nodes.push(newNode); + } + return nodes; } - createPnfs(time) { - let _thiss = this; - let params = { - "-xmlns": "http://org.onap.aai.inventory/v14", - "pnf-name": this.cloudNode, - "pnf-id": this.cloudNode, - "in-maint": "true", - "relationship-list": { - "relationship": [ - { - "related-to": "ext-aai-network", - "relationship-label": "org.onap.relationships.inventory.BelongsTo", - "related-link": "/aai/v14/network/ext-aai-networks/ext-aai-network/" + time, - "relationship-data": { - "relationship-key": "ext-aai-network.aai-id", - "relationship-value": time + getLinks(logicalLinks: Array, ptMapping: Array) : Array { + let links = []; + for (let ll of logicalLinks){ + let lkName:string = ll["link-name"]; + let topoIdIdx:number = lkName.lastIndexOf("topologyId-"); + if (topoIdIdx !== -1 && lkName.charAt(topoIdIdx + 11) === '2'){ + //Ignore + continue; + } else if (typeof ll["relationship-list"] === 'undefined' || + typeof ll["relationship-list"]["relationship"] === 'undefined'){ + continue; + } + //pnf to pnf + let endpoints = []; + for (let pi of ll["relationship-list"]["relationship"]) { + if (pi["related-to"] === "p-interface"){ + for (let rd of pi["relationship-data"]){ + if (rd["relationship-key"] === "pnf.pnf-name"){ + endpoints.push(rd["relationship-value"]); } - }, - { - "related-to": "network-resource", - "relationship-label": "tosca.relationships.network.LinksTo", - "related-link": "/aai/v14/network/network-resources/network-resource/" + this.cloudNetwork } - ] - } - }; - - //Do some asynchronous operations - _thiss.myhttp.createPnf(params) - .subscribe((data) => { - if (data["status"] == "SUCCESS") { - _thiss.createCloudTp(time) } - }, (err) => { - console.log(err); - }); - } - - createCloudTp(time) { - let _thiss = this; - let params = { - "-xmlns": "http://org.onap.aai.inventory/v14", - "interface-name": this.cloudTp, - "speed-value": "1000000", - "in-maint": "true", - "network-ref": "", - "transparent": "true", - "operational-status": "up" - }; - - let cloudNodeName = this.cloudNode; - //Do some asynchronous operations - _thiss.myhttp.createTp(params, cloudNodeName) - .subscribe((data) => { - if (data["status"] == "SUCCESS") { - _thiss.createCloudLinks(time) + } + if (endpoints.length === 2){ + let newlk = { + "source": endpoints[0], + "target": endpoints[1], + "type" : 1 } - }, (err) => { - console.log(err); - }); + links.push(newlk); + } + } + return links; } - createCloudLinks(time) { - let _thiss = this; - let params = { - "-xmlns": "http://org.onap.aai.inventory/v14", - "link-name": this.linkName, - "in-maint": "false", - "link-type": "cross-link", - "speed-value": "", - "operational-status": "up", - "relationship-list": { - "relationship": [ - { - "related-to": "p-interface", - "relationship-label": "tosca.relationships.network.LinksTo", - "related-link": "/aai/v14/network/pnfs/pnf/" + this.selectedNode1 + "/p-interfaces/p-interface/" + this.selecteTpName1, - "relationship-data": [ - { - "relationship-key": "pnf.pnf-name", - "relationship-value": this.selectedNode1 - }, - { - "relationship-key": "p-interface.interface-name", - "relationship-value": this.selecteTpName1 - } - ], - "related-to-property": [{ - "property-key": "p-interface.prov-status" - }] - }, - { - "related-to": "p-interface", - "relationship-label": "tosca.relationships.network.LinksTo", - "related-link": "/aai/v14/network/pnfs/pnf/" + this.cloudNode + "/p-interfaces/p-interface/" + this.cloudTp, - "relationship-data": [ - { - "relationship-key": "pnf.pnf-name", - "relationship-value": this.cloudNode - }, - { - "relationship-key": "p-interface.interface-name", - "relationship-value": this.cloudTp - } - ], - "related-to-property": [{ - "property-key": "p-interface.prov-status" - }] - }, - { - "related-to": "ext-aai-network", - "relationship-label": "org.onap.relationships.inventory.BelongsTo", - "related-link": "/aai/v14/network/ext-aai-networks/ext-aai-network/" + time, - "relationship-data": [ - { - "relationship-key": "ext-aai-network.aai-id", - "relationship-value": time - } - ] + getPnfTpMapping(logicalLinks: Array) { + let pnfs = []; + let pnfVisited = {}; + let pnfIndex: number = 0; + for (let ll of logicalLinks){ + let lkName:string = ll["link-name"]; + let topoIdIdx:number = lkName.lastIndexOf("topologyId-"); + if (topoIdIdx !== -1 && lkName.charAt(topoIdIdx + 11) === '2'){ + //Ethernet layer logical-link + let lastDashIdx:number = lkName.lastIndexOf("-"); + let pnfName: string = lkName.replace("linkId", "nodeId").substr(0, lastDashIdx); + let uniName: string = lkName.substr( lastDashIdx+1); + + if (pnfVisited[pnfName]){ + let idx: number = parseInt(pnfVisited[pnfName].substr(1)); + pnfs[idx].tps[uniName] = true; + } else { + pnfVisited[pnfName] = '#' + pnfIndex; + let newPnf = { + "pnfName" : pnfName, + "tps" : { + }, + "layer" :2 } - ] - } - }; + newPnf.tps[uniName] = true; + pnfs.push(newPnf); + pnfIndex++; - //Do some asynchronous operations - _thiss.myhttp.createCloudLink(params) - .subscribe((data) => { - // resolve(data['status']); - if (data["status"] == "SUCCESS") { - _thiss.queryOutCloudLink(time); } - }, (err) => { - console.log(err); - }); - } - - createCloudUrls(time) { - let _thiss = this; - let params = { - '-xmlns': 'http://org.onap.aai.inventory/v14', - 'aai-id': time, - 'esr-system-info': { - 'esr-system-info-id': 'example-esr-system-info-id-val-0', - 'service-url': this.cloudUrl, - 'user-name': 'demo', - 'password': 'demo123456!', - 'system-type': 'ONAP' + continue; + } else if (ll["relationship-list"] === undefined || + ll["relationship-list"]["relationship"].length === 0 ){ + continue; } - }; - _thiss.myhttp.createCloudUrl(params) - .subscribe((data) => { - if (data['status'] == 'SUCCESS') { - _thiss.createCloudNetwork(time); - } - }, (err) => { - console.log(err); - }); - } + for (let pi of ll["relationship-list"]["relationship"]) { + if (pi["related-to"] === "p-interface"){ + let pnfName:string; + let tpName:string; + for (let rd of pi["relationship-data"]){ + if (rd["relationship-key"] === "pnf.pnf-name"){ + pnfName = rd["relationship-value"]; + } else if (rd["relationship-key"] === "p-interface.interface-name"){ + tpName = rd["relationship-value"]; + } + } + if (pnfVisited[pnfName]){ + let idx: number = parseInt(pnfVisited[pnfName].substr(1)); + pnfs[idx].tps[tpName] = true; + } else { + pnfVisited[pnfName] = '#' + pnfIndex; + let newPnf = { + "pnfName" : pnfName, + "tps" : { + }, + "layer" : 1 + } + newPnf.tps[tpName] = true; + pnfs.push(newPnf); + pnfIndex++; - //Local cloud TP port Delete connection Call interface deleteLink - delLink(): void { - let deltp1 = this.delTp1, - deltp2 = this.delTp2, - version = this.delVersion, - dellinkname = this.delLinkname, - delLinkIndex = this.delLinkIndex; - let params = { - 'logical-link': dellinkname, - 'resource-version': version, - }; - this.myhttp.deleteLink(params) - .subscribe((data) => { - if (data['status'] == 'SUCCESS') { - this.delLine(deltp1, deltp2); - delLinkIndex.remove(); + } } - }, (err) => { - console.log(err); - console.log('Deleting a connection interface call failed'); - }); - } - - delLine(val1, val2) { - this.delBoxisVisible = false; - for (let i = 0; i < $(".node").length; i++) { - if ($('.node').eq(i).find('text').html() == val1) { - $('.node').eq(i).hide(); - } - if ($('.node').eq(i).find('text').html() == val2) { - $('.node').eq(i).hide(); } } + return pnfs; } - - - //External cloud Delete connection Call interface deleteCloudLink - delCloudLink(): void { - let deltp1 = this.delTp1, - deltp2 = this.delTp2, - version = this.delVersion, - aaiId = this.aaiId; - let params = { - "aaiId": aaiId, - "version": version, - }; - this.myhttp.deleteCloudLink(params) - .subscribe((data) => { - if (data['status'] == 'SUCCESS') { - this.delLine(deltp1, deltp2); - $('.cloudline').remove(); - $('#out').remove(); - } - }, (err) => { - console.log(err); - console.log('Deleting a connection interface call failed'); - }); - } - } diff --git a/usecaseui-portal/src/assets/i18n/cn.json b/usecaseui-portal/src/assets/i18n/cn.json index fc02bb7b..f4086084 100644 --- a/usecaseui-portal/src/assets/i18n/cn.json +++ b/usecaseui-portal/src/assets/i18n/cn.json @@ -153,6 +153,7 @@ "i18nTextDefine_PartnerNetwork": "伙伴网络", "i18nTextDefine_HostUrl": "主机网址", "i18nTextDefine_deleteLink": "删除链接", + "i18nTextDefine_Connectivty": "L3业务实例", "sotn-component": "--:", "i18nTextDefine_subscriptionType": "订购类型", diff --git a/usecaseui-portal/src/assets/i18n/en.json b/usecaseui-portal/src/assets/i18n/en.json index 10218f47..10fd2140 100644 --- a/usecaseui-portal/src/assets/i18n/en.json +++ b/usecaseui-portal/src/assets/i18n/en.json @@ -147,6 +147,7 @@ "i18nTextDefine_PartnerNetwork": "Partner Network", "i18nTextDefine_HostUrl": "Host Url", "i18nTextDefine_DeleteLink": "Delete Link", + "i18nTextDefine_Connectivity": "Connectivity", "sotn-component": "--:", "i18nTextDefine_subscriptionType": "Service Type", -- cgit 1.2.3-korg