NG-UI Added the validation for the topology connection.
* New error validation is added for the VNF Topology connections.
Change-Id: I1b68695718410435cc064bd32ce1da007f6fa6ee
Signed-off-by: Barath Kumar R <barath.r@tataelxsi.co.in>
diff --git a/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts b/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts
index 21aad71..bf78d7f 100644
--- a/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts
+++ b/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts
@@ -706,90 +706,140 @@
if (!this.mousedownNode) { return; }
this.dragLine.classed('hidden', true);
this.mouseupNode = d;
- if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'intcp') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVDUANDINTCP'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'vdu') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVDUANDVDU'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'vdu') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDVDU'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'intvl') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKCPANDVNFVL'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'intvl' && this.mouseupNode.nodeTypeRef === 'cp') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVNFVLANDCP'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'cp') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDCP'));
- this.deselectPath();
- }
- else if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'intcp') {
- this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKCPANDINTCP'));
- this.deselectPath();
- } else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'cp') {
- this.vnfdPackageDetails.vdu.forEach((vduDetails: VDU) => {
- if (vduDetails.id === this.mousedownNode.id) {
- if (vduDetails.interface === undefined) { vduDetails.interface = []; }
- vduDetails.interface.push({
- 'external-connection-point-ref': this.mouseupNode.id, 'mgmt-interface': true,
- name: 'eth_' + this.sharedService.randomString(),
- 'virtual-interface': { type: 'VIRTIO' },
- type: 'EXTERNAL'
- });
- if (vduDetails['internal-connection-point'] === undefined) {
- vduDetails['internal-connection-point'] = [];
- }
- if (vduDetails['monitoring-param'] === undefined) {
- vduDetails['monitoring-param'] = [];
- }
- if (vduDetails['vm-flavor'] === undefined) {
- vduDetails['vm-flavor'] = {};
- }
- }
- });
- this.addNodes(environment.VNFPACKAGES_URL, this.identifier, this.vnfdPackageDetails);
- this.deselectPath();
- } else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'intvl') {
- const setIntCP: string = 'intcp_' + this.sharedService.randomString();
- this.vnfdPackageDetails['internal-vld'].forEach((vldInternal: InternalVLD) => {
- if (vldInternal.id === this.mouseupNode.id) {
- if (vldInternal['internal-connection-point'] === undefined) { vldInternal['internal-connection-point'] = []; }
- vldInternal['internal-connection-point'].push({ 'id-ref': setIntCP });
- }
- });
- this.vnfdPackageDetails.vdu.forEach((vduDetails: VDU) => {
- if (vduDetails.id === this.mousedownNode.id) {
- if (vduDetails.interface === undefined) {
- vduDetails.interface = [];
- }
- vduDetails.interface.push({
- 'internal-connection-point-ref': setIntCP, name: 'int_' + setIntCP, type: 'INTERNAL', 'virtual-interface': { type: 'VIRTIO' }
- });
- if (vduDetails['internal-connection-point'] === undefined) {
- vduDetails['internal-connection-point'] = [];
- }
- vduDetails['internal-connection-point'].push({
- id: setIntCP, name: setIntCP, 'short-name': setIntCP, type: 'VPORT'
- });
- }
- });
- this.addNodes(environment.VNFPACKAGES_URL, this.identifier, this.vnfdPackageDetails);
- this.deselectPath();
- }
- else {
+ if (this.mousedownNode.nodeTypeRef === 'vdu') {
+ this.vduMouseDownNode();
+ } else if (this.mousedownNode.nodeTypeRef === 'cp') {
+ this.cpMouseDownNode();
+ } else if (this.mousedownNode.nodeTypeRef === 'intvl') {
+ this.intVLMouseDownNode();
+ } else if (this.mousedownNode.nodeTypeRef === 'intcp') {
+ this.intCPMouseDownNode();
+ } else {
this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.INVALIDSELECTION'));
this.deselectPath();
}
this.resetMouseActions();
this.currentSelectedNode = null;
}
+ /** Establish a connection point between vdu and other nodes @private */
+ private vduMouseDownNode(): void {
+ if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'cp') {
+ this.vduCPConnection(this.mousedownNode.id, this.mouseupNode.id);
+ } else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'intcp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVDUANDINTCP'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'vdu') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVDUANDVDU'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'vdu' && this.mouseupNode.nodeTypeRef === 'intvl') {
+ this.vduIntvlConnection(this.mousedownNode.id, this.mouseupNode.id);
+ }
+ }
+
+ /** Establish a connection point between cp and other nodes @private */
+ private cpMouseDownNode(): void {
+ if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'vdu') {
+ this.vduCPConnection(this.mouseupNode.id, this.mousedownNode.id);
+ } else if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'intvl') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKCPANDVNFVL'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'intcp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKCPANDINTCP'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'cp' && this.mouseupNode.nodeTypeRef === 'cp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKCPANDCP'));
+ this.deselectPath();
+ }
+ }
+
+ /** Establish a connection piont between intvl and other nodes @private */
+ private intVLMouseDownNode(): void {
+ if (this.mousedownNode.nodeTypeRef === 'intvl' && this.mouseupNode.nodeTypeRef === 'cp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVNFVLANDCP'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'intvl' && this.mouseupNode.nodeTypeRef === 'vdu') {
+ this.vduIntvlConnection(this.mouseupNode.id, this.mousedownNode.id);
+ } else if (this.mousedownNode.nodeTypeRef === 'intvl' && this.mouseupNode.nodeTypeRef === 'intvl') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVNFVLANDVNFVL'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'intvl' && this.mouseupNode.nodeTypeRef === 'intcp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKVNFVLANDONTCP'));
+ this.deselectPath();
+ }
+ }
+
+ /** Establish a connection point between intcp and other nodes @private */
+ private intCPMouseDownNode(): void {
+ if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'vdu') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDVDU'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'cp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDCP'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'intvl') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDVNFVL'));
+ this.deselectPath();
+ } else if (this.mousedownNode.nodeTypeRef === 'intcp' && this.mouseupNode.nodeTypeRef === 'intcp') {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.CANNOTLINKINTCPANDINTCP'));
+ this.deselectPath();
+ }
+ }
+
+ /** Establish a connection between VDU & CP vice versa @private */
+ private vduCPConnection(nodeA: string, nodeB: string): void {
+ this.vnfdPackageDetails.vdu.forEach((vduDetails: VDU) => {
+ if (vduDetails.id === nodeA) {
+ if (vduDetails.interface === undefined) { vduDetails.interface = []; }
+ vduDetails.interface.push({
+ 'external-connection-point-ref': nodeB, 'mgmt-interface': true,
+ name: 'eth_' + this.sharedService.randomString(),
+ 'virtual-interface': { type: 'VIRTIO' },
+ type: 'EXTERNAL'
+ });
+ if (vduDetails['internal-connection-point'] === undefined) {
+ vduDetails['internal-connection-point'] = [];
+ }
+ if (vduDetails['monitoring-param'] === undefined) {
+ vduDetails['monitoring-param'] = [];
+ }
+ if (vduDetails['vm-flavor'] === undefined) {
+ vduDetails['vm-flavor'] = {};
+ }
+ }
+ });
+ this.addNodes(environment.VNFPACKAGES_URL, this.identifier, this.vnfdPackageDetails);
+ this.deselectPath();
+ }
+
+ /** Establish a connection between vdu & intvl and vice versa @private */
+ private vduIntvlConnection(nodeA: string, nodeB: string): void {
+ const setIntCP: string = 'intcp_' + this.sharedService.randomString();
+ this.vnfdPackageDetails['internal-vld'].forEach((vldInternal: InternalVLD) => {
+ if (vldInternal.id === nodeB) {
+ if (vldInternal['internal-connection-point'] === undefined) { vldInternal['internal-connection-point'] = []; }
+ vldInternal['internal-connection-point'].push({ 'id-ref': setIntCP });
+ }
+ });
+ this.vnfdPackageDetails.vdu.forEach((vduDetails: VDU) => {
+ if (vduDetails.id === nodeA) {
+ if (vduDetails.interface === undefined) {
+ vduDetails.interface = [];
+ }
+ vduDetails.interface.push({
+ 'internal-connection-point-ref': setIntCP, name: 'int_' + setIntCP, type: 'INTERNAL', 'virtual-interface': { type: 'VIRTIO' }
+ });
+ if (vduDetails['internal-connection-point'] === undefined) {
+ vduDetails['internal-connection-point'] = [];
+ }
+ vduDetails['internal-connection-point'].push({
+ id: setIntCP, name: setIntCP, 'short-name': setIntCP, type: 'VPORT'
+ });
+ }
+ });
+ this.addNodes(environment.VNFPACKAGES_URL, this.identifier, this.vnfdPackageDetails);
+ this.deselectPath();
+ }
+
/** Events handles when mousemove it will capture the selected node data @private */
private mousemove(): void {
if (!this.mousedownNode) { return; }
diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json
index 992d48a..cc22546 100644
--- a/src/assets/i18n/de.json
+++ b/src/assets/i18n/de.json
@@ -349,7 +349,12 @@
"CANNOTLINKVNFVLANDCP": "Sie können vnf_vl nicht mit cp verknüpfen",
"CANNOTLINKINTCPANDCP": "Sie können intcp nicht mit cp verknüpfen",
"CANNOTLINKCPANDINTCP": "Sie können cp nicht mit int_cp verknüpfen",
- "CANNOTLINKVDUANDVDU": "Sie können ein vdu nicht mit einem vdu verknüpfen"
+ "CANNOTLINKVDUANDVDU": "Sie können ein vdu nicht mit einem vdu verknüpfen",
+ "CANNOTLINKCPANDCP": "Sie können ein CP nicht mit einem CP verknüpfen",
+ "CANNOTLINKVNFVLANDVNFVL": "Sie können vnf_vl nicht mit vnf_vl verknüpfen",
+ "CANNOTLINKVNFVLANDONTCP": "Sie können vnf_vl nicht mit int_cp verknüpfen",
+ "CANNOTLINKINTCPANDVNFVL": "Sie können intcp nicht mit vnf_vl verknüpfen",
+ "CANNOTLINKINTCPANDINTCP": "Sie können intcp nicht mit intcp verknüpfen"
}
},
"NETSLICE": {
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 44d452a..4bcf7a8 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -349,7 +349,12 @@
"CANNOTLINKVNFVLANDCP": "You cant link vnf_vl with cp",
"CANNOTLINKINTCPANDCP": "You cant link intcp with cp",
"CANNOTLINKCPANDINTCP": "You cant link cp with int_cp",
- "CANNOTLINKVDUANDVDU": "You can't link a vdu with a vdu"
+ "CANNOTLINKVDUANDVDU": "You can't link a vdu with a vdu",
+ "CANNOTLINKCPANDCP": "You can't link a cp with a cp",
+ "CANNOTLINKVNFVLANDVNFVL": "You cant link vnf_vl with vnf_vl",
+ "CANNOTLINKVNFVLANDONTCP": "You cant link vnf_vl with int_cp",
+ "CANNOTLINKINTCPANDVNFVL": "You cant link intcp with vnf_vl",
+ "CANNOTLINKINTCPANDINTCP": "You cant link intcp with intcp"
}
},
"NETSLICE": {
diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json
index 6b8fc76..f80d529 100644
--- a/src/assets/i18n/es.json
+++ b/src/assets/i18n/es.json
@@ -349,7 +349,12 @@
"CANNOTLINKVNFVLANDCP": "No puedes vincular vnf_vl con cp",
"CANNOTLINKINTCPANDCP": "No puedes vincular intcp con cp",
"CANNOTLINKCPANDINTCP": "No puedes vincular cp con int_cp",
- "CANNOTLINKVDUANDVDU": "No puedes vincular un vdu con un vdu"
+ "CANNOTLINKVDUANDVDU": "No puedes vincular un vdu con un vdu",
+ "CANNOTLINKCPANDCP": "No puedes vincular una cp con una cp",
+ "CANNOTLINKVNFVLANDVNFVL": "No puede vincular vnf_vl con vnf_vl",
+ "CANNOTLINKVNFVLANDONTCP": "No puede vincular vnf_vl con int_cp",
+ "CANNOTLINKINTCPANDVNFVL": "No puedes vincular intcp con vnf_vl",
+ "CANNOTLINKINTCPANDINTCP": "No puede vincular intcp con intcp"
}
},
"NETSLICE": {
diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json
index ded0191..b2e995f 100644
--- a/src/assets/i18n/pt.json
+++ b/src/assets/i18n/pt.json
@@ -349,7 +349,12 @@
"CANNOTLINKVNFVLANDCP": "Você não pode vincular vnf_vl ao cp",
"CANNOTLINKINTCPANDCP": "Você não pode vincular o intcp ao cp",
"CANNOTLINKCPANDINTCP": "Você não pode vincular o cp ao int_cp",
- "CANNOTLINKVDUANDVDU": "Você não pode vincular um vdu a um vdu"
+ "CANNOTLINKVDUANDVDU": "Você não pode vincular um vdu a um vdu",
+ "CANNOTLINKCPANDCP": "Você não pode vincular um cp a um cp",
+ "CANNOTLINKVNFVLANDVNFVL": "Você não pode vincular vnf_vl a vnf_vl",
+ "CANNOTLINKVNFVLANDONTCP": "Você não pode vincular vnf_vl com int_cp",
+ "CANNOTLINKINTCPANDVNFVL": "Você não pode vincular intcp a vnf_vl",
+ "CANNOTLINKINTCPANDINTCP": "Você não pode vincular intcp a intcp"
}
},
"NETSLICE": {