Initial Commit - NG UI
* Roboto and font-awesome fonts are added in package.json
* Replace Nginx alpine varient to stable
* Devops files are added
* Docker file aligned as per community reviews
* Enhancement - NS primitive, Azure inclusion and domain name
* RWD changes
Change-Id: If543efbf127964cbd8f4be4c5a67260c91407fd9
Signed-off-by: kumaran.m <kumaran.m@tataelxsi.co.in>
diff --git a/src/app/instances/InstancesComponent.html b/src/app/instances/InstancesComponent.html
new file mode 100644
index 0000000..06b8876
--- /dev/null
+++ b/src/app/instances/InstancesComponent.html
@@ -0,0 +1,18 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<router-outlet></router-outlet>
diff --git a/src/app/instances/InstancesComponent.scss b/src/app/instances/InstancesComponent.scss
new file mode 100644
index 0000000..021d205
--- /dev/null
+++ b/src/app/instances/InstancesComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/instances/InstancesComponent.ts b/src/app/instances/InstancesComponent.ts
new file mode 100644
index 0000000..fe46d8c
--- /dev/null
+++ b/src/app/instances/InstancesComponent.ts
@@ -0,0 +1,55 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file Instance components
+ */
+import { Component, Injector } from '@angular/core';
+import { Router, RouterEvent } from '@angular/router';
+/**
+ * Creating component
+ * @Component takes InstancesComponent.html as template url
+ */
+@Component({
+ selector: 'app-instances',
+ templateUrl: './InstancesComponent.html',
+ styleUrls: ['./InstancesComponent.scss']
+})
+/** Exporting a class @exports InstancesComponent */
+export class InstancesComponent {
+ /** Invoke service injectors @public */
+ public injector: Injector;
+
+ /** Holds teh instance of AuthService class of type AuthService @private */
+ private router: Router;
+
+ // creates packages component
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.router = this.injector.get(Router);
+ this.router.events.subscribe((event: RouterEvent) => {
+ this.redirectToList(event.url);
+ });
+ }
+
+ /** Return to list NS Package List */
+ public redirectToList(getURL: string): void {
+ if (getURL === '/instances') {
+ this.router.navigate(['/instances/ns']).catch();
+ }
+ }
+}
diff --git a/src/app/instances/InstancesModule.ts b/src/app/instances/InstancesModule.ts
new file mode 100644
index 0000000..7e47d32
--- /dev/null
+++ b/src/app/instances/InstancesModule.ts
@@ -0,0 +1,132 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file Instance module
+ */
+import { CommonModule } from '@angular/common';
+import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
+import { FlexLayoutModule } from '@angular/flex-layout';
+import { FormsModule } from '@angular/forms';
+import { ReactiveFormsModule } from '@angular/forms';
+import { RouterModule, Routes } from '@angular/router';
+import { CodemirrorModule } from '@ctrl/ngx-codemirror';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgSelectModule } from '@ng-select/ng-select';
+import { TranslateModule } from '@ngx-translate/core';
+import { AddPDUInstancesComponent } from 'AddPDUInstancesComponent';
+import { DataService } from 'DataService';
+import { HistoryOperationsComponent } from 'HistoryOperationsComponent';
+import { InstancesComponent } from 'InstancesComponent';
+import { LoaderModule } from 'LoaderModule';
+import { NetsliceInstancesComponent } from 'NetsliceInstancesComponent';
+import { SidebarModule } from 'ng-sidebar';
+import { Ng2SmartTableModule } from 'ng2-smart-table';
+import { NSInstancesComponent } from 'NSInstancesComponent';
+import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
+import { NSTopologyComponent } from 'NSTopologyComponent';
+import { PagePerRowModule } from 'PagePerRowModule';
+import { PageReloadModule } from 'PageReloadModule';
+import { PDUInstancesComponent } from 'PDUInstancesComponent';
+import { VNFInstancesComponent } from 'VNFInstancesComponent';
+
+/** To halndle project information */
+const projectInfo: {} = { title: '{project}', url: '/' };
+
+/** Exporting a function using Routes @exports routes */
+const routes: Routes = [
+ {
+ path: '',
+ component: InstancesComponent,
+ children: [
+ {
+ path: 'ns',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'NSINSTANCES', url: null }]
+ },
+ component: NSInstancesComponent
+ },
+ {
+ path: 'vnf',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'VNFINSTANCES', url: null }]
+ },
+ component: VNFInstancesComponent
+ },
+ {
+ path: 'pdu',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'PDUINSTANCES', url: null }]
+ },
+ component: PDUInstancesComponent
+ },
+ {
+ path: 'netslice',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'PAGE.DASHBOARD.NETSLICEINSTANCE', url: null }]
+ },
+ component: NetsliceInstancesComponent
+ },
+ {
+ path: ':type/history-operations/:id',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: '{type}', url: '/instances/{type}' }, { title: '{id}', url: null }]
+ },
+ component: HistoryOperationsComponent
+ },
+ {
+ path: 'ns/:id',
+ data: {
+ breadcrumb: [{ title: 'PAGE.DASHBOARD.DASHBOARD', url: '/' }, { title: 'PAGE.DASHBOARD.PROJECTS', url: '/projects' },
+ projectInfo, { title: 'NSINSTANCES', url: '/instances/ns' }, { title: '{id}', url: null }]
+ },
+ component: NSTopologyComponent
+ }
+ ]
+ }
+];
+
+/**
+ * An NgModule is a class adorned with the @NgModule decorator function.
+ * @NgModule takes a metadata object that tells Angular how to compile and run module code.
+ */
+@NgModule({
+ imports: [ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), FormsModule, TranslateModule,
+ CodemirrorModule, CommonModule, Ng2SmartTableModule, FlexLayoutModule, RouterModule.forChild(routes), NgbModule,
+ NgSelectModule, PagePerRowModule, LoaderModule, SidebarModule.forRoot(), PageReloadModule],
+ declarations: [InstancesComponent, NSInstancesComponent, VNFInstancesComponent, PDUInstancesComponent, AddPDUInstancesComponent,
+ NetsliceInstancesComponent, HistoryOperationsComponent, NSTopologyComponent, NSPrimitiveComponent],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ providers: [DataService],
+ entryComponents: [NSPrimitiveComponent, AddPDUInstancesComponent]
+})
+/** Exporting a class @exports InstancesModule */
+export class InstancesModule {
+ /** Resolves state-less class */
+ private instancesModule: string;
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ this.instancesModule = '';
+ }
+}
diff --git a/src/app/instances/netslice-instances/NetsliceInstancesComponent.html b/src/app/instances/netslice-instances/NetsliceInstancesComponent.html
new file mode 100644
index 0000000..e8b3c0c
--- /dev/null
+++ b/src/app/instances/netslice-instances/NetsliceInstancesComponent.html
@@ -0,0 +1,44 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'PAGE.DASHBOARD.NETSLICEINSTANCE' | translate}}</div>
+ <span class="button">
+ <button class="btn btn-primary" type="button" placement="top" container="body"
+ ngbTooltip="{{'PAGE.NETSLICEINSTANCE.CREATENETSLICEINSTANCE' | translate}}" (click)="instantiateNetSlice()">
+ <i class="fa fa-paper-plane" aria-hidden="true"></i>
+ {{'PAGE.NETSLICEINSTANCE.CREATENETSLICEINSTANCE' | translate}}
+ </button>
+ </span>
+</div>
+<div class="row mt-2 mb-0 list-utilites-actions">
+ <div class="col-auto mr-auto">
+ <nav class="custom-items-config">
+ <span><i class="fas fa-clock text-warning"></i>{{operationalStateFirstStep}}</span>
+ <span><i class="fas fa-check-circle text-success"></i>{{operationalStateSecondStep}} /
+ {{configStateSecondStep}}</span>
+ <span><i class="fas fa-times-circle text-danger"></i>{{operationalStateThirdStep}}</span>
+ </nav>
+ </div>
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)">
+ </ng2-smart-table>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/netslice-instances/NetsliceInstancesComponent.scss b/src/app/instances/netslice-instances/NetsliceInstancesComponent.scss
new file mode 100644
index 0000000..0ecd95d
--- /dev/null
+++ b/src/app/instances/netslice-instances/NetsliceInstancesComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
\ No newline at end of file
diff --git a/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts b/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts
new file mode 100644
index 0000000..3b9564a
--- /dev/null
+++ b/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts
@@ -0,0 +1,283 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file Netslice Instance Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { CONFIGCONSTANT, ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { InstantiateNetSliceTemplateComponent } from 'InstantiateNetSliceTemplate';
+import { NetsliceInstancesActionComponent } from 'NetsliceInstancesActionComponent';
+import { NSTInstanceData, NSTInstanceDetails } from 'NetworkSliceModel';
+import { LocalDataSource } from 'ng2-smart-table';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+
+/**
+ * Creating component
+ * @Component takes NetsliceInstancesComponent.html as template url
+ */
+@Component({
+ templateUrl: './NetsliceInstancesComponent.html',
+ styleUrls: ['./NetsliceInstancesComponent.scss']
+})
+
+/** Exporting a class @exports NetsliceInstancesComponent */
+export class NetsliceInstancesComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** handle translate @public */
+ public translateService: TranslateService;
+
+ /** Columns list of the smart table @public */
+ public columnLists: object = {};
+
+ /** Settings for smarttable to populate the table with columns @public */
+ public settings: object = {};
+
+ /** Datasource instance inititated @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+
+ /** Datasource table Data for the NST @public */
+ public nstInstanceData: NSTInstanceData[] = [];
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+
+ /** operational State init data @public */
+ public operationalStateFirstStep: string = CONFIGCONSTANT.operationalStateFirstStep;
+
+ /** operational State running data @public */
+ public operationalStateSecondStep: string = CONFIGCONSTANT.operationalStateSecondStep;
+
+ /** operational State failed data @public */
+ public operationalStateThirdStep: string = CONFIGCONSTANT.operationalStateThirdStep;
+
+ /** Config State init data @public */
+ public configStateFirstStep: string = CONFIGCONSTANT.configStateFirstStep;
+
+ /** Config State init data @public */
+ public configStateSecondStep: string = CONFIGCONSTANT.configStateSecondStep;
+
+ /** Config State init data @public */
+ public configStateThirdStep: string = CONFIGCONSTANT.configStateThirdStep;
+
+ /** config status assign @public */
+ public configStatusCheck: string;
+
+ /** To consume REST API calls @private */
+ private dataService: DataService;
+
+ /** Utilizes rest service for any CRUD operations @public */
+ private restService: RestService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Instance of the modal service @private */
+ private modalService: NgbModal;
+
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.translateService = this.injector.get(TranslateService);
+ this.sharedService = this.injector.get(SharedService);
+ this.modalService = this.injector.get(NgbModal);
+ this.dataService = this.injector.get(DataService);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ this.generateTableColumn();
+ this.generateTableSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** smart table listing manipulation @private */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+
+ /** smart table listing manipulation @private */
+ public onUserRowSelect(event: MessageEvent): void {
+ Object.assign(event.data, { page: 'net-slice-instance' });
+ this.dataService.changeMessage(event.data);
+ }
+
+ /** Instantiate Net Slice using modalservice @public */
+ public instantiateNetSlice(): void {
+ const modalRef: NgbModalRef = this.modalService.open(InstantiateNetSliceTemplateComponent, { backdrop: 'static' });
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
+ if (result) {
+ this.generateData();
+ }
+ }).catch();
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableSettings(): void {
+ this.settings = {
+ columns: this.columnLists,
+ actions: { add: false, edit: false, delete: false, position: 'right' },
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableColumn(): void {
+ this.columnLists = {
+ name: { title: this.translateService.instant('NAME'), width: '15%', sortDirection: 'asc' },
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '15%' },
+ NstName: { title: this.translateService.instant('NSTNAME'), width: '15%' },
+ OperationalStatus: {
+ type: 'html',
+ title: this.translateService.instant('OPERATIONALSTATUS'),
+ width: '15%',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
+ { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
+ { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: NSTInstanceData, row: NSTInstanceData): string => {
+ if (row.OperationalStatus === this.operationalStateFirstStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.OperationalStatus === this.operationalStateSecondStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.OperationalStatus === this.operationalStateThirdStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.OperationalStatus}</span>`;
+ }
+ }
+ },
+ ConfigStatus: {
+ type: 'html',
+ title: this.translateService.instant('CONFIGSTATUS'),
+ width: '15%',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.configStateFirstStep, title: this.configStateFirstStep },
+ { value: this.configStateSecondStep, title: this.configStateSecondStep },
+ { value: this.configStateThirdStep, title: this.configStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: NSTInstanceData, row: NSTInstanceData): string => {
+ if (row.ConfigStatus === this.configStateFirstStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.ConfigStatus === this.configStateSecondStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.ConfigStatus === this.configStateThirdStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.ConfigStatus}</span>`;
+ }
+ }
+ },
+ DetailedStatus: { title: this.translateService.instant('DETAILEDSTATUS'), width: '15%' },
+ Actions: {
+ name: 'Action', width: '10%', filter: false, sort: false, title: this.translateService.instant('ACTIONS'), type: 'custom',
+ valuePrepareFunction: (cell: NSTInstanceData, row: NSTInstanceData): NSTInstanceData => row,
+ renderComponent: NetsliceInstancesActionComponent
+ }
+ };
+ }
+
+ /** generateData initiate the net-slice-instance list @public */
+ public generateData(): void {
+ this.isLoadingResults = true;
+ this.restService.getResource(environment.NETWORKSLICEINSTANCESCONTENT_URL)
+ .subscribe((netSliceInstancesData: NSTInstanceDetails[]) => {
+ this.nstInstanceData = [];
+ netSliceInstancesData.forEach((netSliceInstanceData: NSTInstanceDetails) => {
+ if (netSliceInstanceData['config-status'] !== undefined) {
+ this.configStatusCheck = netSliceInstanceData['config-status'];
+ } else {
+ this.configStatusCheck = netSliceInstanceData['operational-status'];
+ }
+ const netSliceDataObj: NSTInstanceData = {
+ name: netSliceInstanceData.name,
+ identifier: netSliceInstanceData.id,
+ NstName: netSliceInstanceData['nst-ref'],
+ OperationalStatus: netSliceInstanceData['operational-status'],
+ ConfigStatus: this.configStatusCheck,
+ DetailedStatus: netSliceInstanceData['detailed-status']
+ };
+ this.nstInstanceData.push(netSliceDataObj);
+ });
+ if (this.nstInstanceData.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(this.nstInstanceData).then((data: {}) => {
+ this.isLoadingResults = false;
+ }).catch();
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+}
diff --git a/src/app/instances/ns-history-operations/HistoryOperationsComponent.html b/src/app/instances/ns-history-operations/HistoryOperationsComponent.html
new file mode 100644
index 0000000..7890a13
--- /dev/null
+++ b/src/app/instances/ns-history-operations/HistoryOperationsComponent.html
@@ -0,0 +1,36 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'HISTORYOFOPERATIONS' | translate}}</div>
+</div>
+<div class="row mt-2 mb-0 list-utilites-actions">
+ <div class="col-auto mr-auto">
+ <nav class="custom-items-config">
+ <span><i class="fas fa-clock text-warning"></i>{{historyStateFirstStep}}</span>
+ <span><i class="fas fa-check-circle text-success"></i>{{historyStateSecondStep}}</span>
+ <span><i class="fas fa-times-circle text-danger"></i>{{historyStateThirdStep}}</span>
+ </nav>
+ </div>
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)" (custom)="showInformation($event)">
+ </ng2-smart-table>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/ns-history-operations/HistoryOperationsComponent.scss b/src/app/instances/ns-history-operations/HistoryOperationsComponent.scss
new file mode 100644
index 0000000..fdec4ed
--- /dev/null
+++ b/src/app/instances/ns-history-operations/HistoryOperationsComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
diff --git a/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts b/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts
new file mode 100644
index 0000000..a0cac86
--- /dev/null
+++ b/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts
@@ -0,0 +1,265 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file NS History Of Operations Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { Router } from '@angular/router';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { CONFIGCONSTANT, ERRORDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import * as HttpStatus from 'http-status-codes';
+import { LocalDataSource } from 'ng2-smart-table';
+import { NSDInstanceData } from 'NSInstanceModel';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+import { ShowInfoComponent } from 'ShowInfoComponent';
+
+/**
+ * Creating component
+ * @Component takes HistoryOperationsComponent.html as template url
+ */
+@Component({
+ templateUrl: './HistoryOperationsComponent.html',
+ styleUrls: ['./HistoryOperationsComponent.scss']
+})
+/** Exporting a class @exports HistoryOperationsComponent */
+export class HistoryOperationsComponent implements OnInit {
+ /** Injector to invoke other services @public */
+ public injector: Injector;
+
+ /** NS Instance array @public */
+ public nsAndnstInstanceData: object[] = [];
+
+ /** Datasource instance @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+
+ /** Instance component are stored in settings @public */
+ public settings: {} = {};
+
+ /** Contains objects for smart table title and filter settings @public */
+ public columnList: {} = {};
+
+ /** Variable handles the page name @public */
+ public page: string;
+
+ /** Variable handles the title name @public */
+ public titleName: string;
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+
+ /** History State init data @public */
+ public historyStateFirstStep: string = CONFIGCONSTANT.historyStateFirstStep;
+
+ /** History State running data @public */
+ public historyStateSecondStep: string = CONFIGCONSTANT.historyStateSecondStep;
+
+ /** History State failed data @public */
+ public historyStateThirdStep: string = CONFIGCONSTANT.historyStateThirdStep;
+
+ /** dataService to pass the data from one component to another @private */
+ private dataService: DataService;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Holds teh instance of AuthService class of type AuthService @private */
+ private activatedRoute: ActivatedRoute;
+
+ /** Instance of the modal service @private */
+ private modalService: NgbModal;
+
+ /** variables contains paramsID @private */
+ private paramsID: string;
+
+ /** variables contains paramsID @private */
+ private paramsType: string;
+
+ /** variables conatins URL of the History operations @public */
+ private historyURL: string;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ /** Service holds the router information @private */
+ private router: Router;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.sharedService = this.injector.get(SharedService);
+ this.activatedRoute = this.injector.get(ActivatedRoute);
+ this.modalService = this.injector.get(NgbModal);
+ this.translateService = this.injector.get(TranslateService);
+ this.router = this.injector.get(Router);
+ }
+
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ this.paramsID = this.activatedRoute.snapshot.paramMap.get('id');
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ this.paramsType = this.activatedRoute.snapshot.paramMap.get('type');
+ if (this.paramsType === 'ns') {
+ this.historyURL = environment.NSHISTORYOPERATIONS_URL + '/?nsInstanceId=' + this.paramsID;
+ this.page = 'ns-history-operation';
+ this.titleName = 'INSTANCEDETAILS';
+ } else if (this.paramsType === 'netslice') {
+ this.historyURL = environment.NSTHISTORYOPERATIONS_URL + '/?netsliceInstanceId=' + this.paramsID;
+ this.page = 'nst-history-operation';
+ this.titleName = 'INSTANCEDETAILS';
+ }
+ this.generateTableColumn();
+ this.generateTableSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableSettings(): void {
+ this.settings = {
+ columns: this.columnList,
+ actions: {
+ add: false, edit: false, delete: false, position: 'right',
+ custom: [{
+ name: 'showInformation', title: '<i class="fas fa-info" title=" ' + this.translateService.instant('INFO') + ' "></i>'}]
+ },
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableColumn(): void {
+ this.columnList = {
+ id: { title: this.translateService.instant('ID'), width: '30%' },
+ type: { title: this.translateService.instant('TYPE'), width: '20%' },
+ state: {
+ type: 'html', title: this.translateService.instant('OPERATIONSTATE'), width: '15%',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.historyStateFirstStep, title: this.historyStateFirstStep },
+ { value: this.historyStateSecondStep, title: this.historyStateSecondStep },
+ { value: this.historyStateThirdStep, title: this.historyStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
+ if (row.state === this.historyStateFirstStep) {
+ return `<span class="icon-label" title="${row.state}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.state === this.historyStateSecondStep) {
+ return `<span class="icon-label" title="${row.state}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.state === this.historyStateThirdStep) {
+ return `<span class="icon-label" title="${row.state}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.state}</span>`;
+ }
+ }
+ },
+ startTime: { title: this.translateService.instant('STARTTIME'), width: '15%' },
+ statusEnteredTime: { title: this.translateService.instant('STATUSENTEREDTIME'), width: '15%' }
+ };
+ }
+
+ /** smart table listing manipulation @public */
+ public onUserRowSelect(event: MessageEvent): void {
+ this.dataService.changeMessage(event.data);
+ }
+ /** smart table listing manipulation @public */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+ /** show information methods modal with ns history info */
+ public showInformation(event: MessageEvent): void {
+ this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = {
+ id: event.data.id,
+ page: this.page,
+ titleName: this.titleName
+ };
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+
+ /** generateData initiate the ns-instance list @private */
+ private generateData(): void {
+ this.isLoadingResults = true;
+ this.restService.getResource(this.historyURL).subscribe((nsdInstancesData: {}[]) => {
+ this.nsAndnstInstanceData = [];
+ nsdInstancesData.forEach((nsdAndnstInstanceData: NSDInstanceData) => {
+ const nsAndnstDataObj: {} = {
+ id: nsdAndnstInstanceData.id,
+ type: nsdAndnstInstanceData.lcmOperationType,
+ state: nsdAndnstInstanceData.operationState,
+ startTime: this.sharedService.convertEpochTime(nsdAndnstInstanceData.startTime),
+ statusEnteredTime: this.sharedService.convertEpochTime(nsdAndnstInstanceData.statusEnteredTime)
+ };
+ this.nsAndnstInstanceData.push(nsAndnstDataObj);
+ });
+
+ if (this.nsAndnstInstanceData.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(this.nsAndnstInstanceData).then((data: {}) => {
+ //empty block
+ }).catch();
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) {
+ this.router.navigateByUrl('404', { skipLocationChange: true }).catch();
+ } else {
+ this.restService.handleError(error, 'get');
+ }
+ });
+ }
+}
diff --git a/src/app/instances/ns-instances/NSInstancesComponent.html b/src/app/instances/ns-instances/NSInstancesComponent.html
new file mode 100644
index 0000000..6047a2f
--- /dev/null
+++ b/src/app/instances/ns-instances/NSInstancesComponent.html
@@ -0,0 +1,43 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'NSINSTANCES' | translate}}</div>
+ <span class="button">
+ <button class="btn btn-primary" type="button" placement="top" container="body" ngbTooltip="{{'PAGE.NSINSTANCE.NEWNSINSTANCE' | translate}}"
+ (click)="instantiateNS()">
+ <i class="fa fa-paper-plane" aria-hidden="true"></i> {{'PAGE.NSINSTANCE.NEWNSINSTANCE' | translate}}
+ </button>
+ </span>
+</div>
+<div class="row mt-2 mb-0 list-utilites-actions">
+ <div class="col-auto mr-auto">
+ <nav class="custom-items-config">
+ <span><i class="fas fa-clock text-warning"></i>{{operationalStateFirstStep}}</span>
+ <span><i class="fas fa-check-circle text-success"></i>{{operationalStateSecondStep}} /
+ {{configStateSecondStep}}</span>
+ <span><i class="fas fa-times-circle text-danger"></i>{{operationalStateThirdStep}}</span>
+ </nav>
+ </div>
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)">
+ </ng2-smart-table>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/ns-instances/NSInstancesComponent.scss b/src/app/instances/ns-instances/NSInstancesComponent.scss
new file mode 100644
index 0000000..0ecd95d
--- /dev/null
+++ b/src/app/instances/ns-instances/NSInstancesComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
\ No newline at end of file
diff --git a/src/app/instances/ns-instances/NSInstancesComponent.ts b/src/app/instances/ns-instances/NSInstancesComponent.ts
new file mode 100644
index 0000000..07184da
--- /dev/null
+++ b/src/app/instances/ns-instances/NSInstancesComponent.ts
@@ -0,0 +1,278 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file NS Instance Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { CONFIGCONSTANT, ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { InstantiateNsComponent } from 'InstantiateNs';
+import { LocalDataSource } from 'ng2-smart-table';
+import { NSDInstanceData, NSInstanceDetails } from 'NSInstanceModel';
+import { NSInstancesActionComponent } from 'NSInstancesActionComponent';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+
+/**
+ * Creating component
+ * @Component takes NSInstancesComponent.html as template url
+ */
+@Component({
+ templateUrl: './NSInstancesComponent.html',
+ styleUrls: ['./NSInstancesComponent.scss']
+})
+/** Exporting a class @exports NSInstancesComponent */
+export class NSInstancesComponent implements OnInit {
+ /** Injector to invoke other services @public */
+ public injector: Injector;
+
+ /** NS Instance array @public */
+ public nsInstanceData: object[] = [];
+
+ /** Datasource instance @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+
+ /** SelectedRows array @public */
+ public selectedRows: object[] = [];
+
+ /** Selected list array @public */
+ public selectList: object[] = [];
+
+ /** Instance component are stored in settings @public */
+ public settings: {} = {};
+
+ /** Contains objects for menu settings @public */
+ public columnList: {} = {};
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+
+ /** operational State init data @public */
+ public operationalStateFirstStep: string = CONFIGCONSTANT.operationalStateFirstStep;
+
+ /** operational State running data @public */
+ public operationalStateSecondStep: string = CONFIGCONSTANT.operationalStateSecondStep;
+
+ /** operational State failed data @public */
+ public operationalStateThirdStep: string = CONFIGCONSTANT.operationalStateThirdStep;
+
+ /** Config State init data @public */
+ public configStateFirstStep: string = CONFIGCONSTANT.configStateFirstStep;
+
+ /** Config State init data @public */
+ public configStateSecondStep: string = CONFIGCONSTANT.configStateSecondStep;
+
+ /** Config State init data @public */
+ public configStateThirdStep: string = CONFIGCONSTANT.configStateThirdStep;
+
+ /** Instance of the modal service @private */
+ private modalService: NgbModal;
+
+ /** dataService to pass the data from one component to another @private */
+ private dataService: DataService;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.sharedService = this.injector.get(SharedService);
+ this.translateService = this.injector.get(TranslateService);
+ this.modalService = this.injector.get(NgbModal);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ this.generateTableColumn();
+ this.generateTableSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableSettings(): void {
+ this.settings = {
+ columns: this.columnList,
+ actions: { add: false, edit: false, delete: false, position: 'right' },
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableColumn(): void {
+ this.columnList = {
+ name: { title: this.translateService.instant('NAME'), width: '15%', sortDirection: 'asc' },
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '20%' },
+ NsdName: { title: this.translateService.instant('NSDNAME'), width: '15%' },
+ OperationalStatus: {
+ title: this.translateService.instant('OPERATIONALSTATUS'), width: '10%', type: 'html',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
+ { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
+ { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
+ if (row.OperationalStatus === this.operationalStateFirstStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.OperationalStatus === this.operationalStateSecondStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.OperationalStatus === this.operationalStateThirdStep) {
+ return `<span class="icon-label" title="${row.OperationalStatus}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.OperationalStatus}</span>`;
+ }
+ }
+ },
+ ConfigStatus: {
+ title: this.translateService.instant('CONFIGSTATUS'), width: '10%', type: 'html',
+ filter: {
+ type: 'list',
+ config: {
+ selectText: 'Select',
+ list: [
+ { value: this.configStateFirstStep, title: this.configStateFirstStep },
+ { value: this.configStateSecondStep, title: this.configStateSecondStep },
+ { value: this.configStateThirdStep, title: this.configStateThirdStep }
+ ]
+ }
+ },
+ valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
+ if (row.ConfigStatus === this.configStateFirstStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-clock text-warning"></i>
+ </span>`;
+ } else if (row.ConfigStatus === this.configStateSecondStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-check-circle text-success"></i>
+ </span>`;
+ } else if (row.ConfigStatus === this.configStateThirdStep) {
+ return `<span class="icon-label" title="${row.ConfigStatus}">
+ <i class="fas fa-times-circle text-danger"></i>
+ </span>`;
+ } else {
+ return `<span>${row.ConfigStatus}</span>`;
+ }
+ }
+ },
+ DetailedStatus: { title: this.translateService.instant('DETAILEDSTATUS'), width: '15%' },
+ Actions: {
+ name: 'Action', width: '15%', filter: false, sort: false, type: 'custom',
+ title: this.translateService.instant('ACTIONS'),
+ valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): NSDInstanceData => row,
+ renderComponent: NSInstancesActionComponent
+ }
+ };
+ }
+
+ /** generateData initiate the ns-instance list @public */
+ public generateData(): void {
+ this.isLoadingResults = true;
+ this.restService.getResource(environment.NSDINSTANCES_URL).subscribe((nsdInstancesData: NSInstanceDetails[]) => {
+ this.nsInstanceData = [];
+ nsdInstancesData.forEach((nsdInstanceData: NSInstanceDetails) => {
+ const nsDataObj: NSDInstanceData = {
+ name: nsdInstanceData.name,
+ identifier: nsdInstanceData.id,
+ NsdName: nsdInstanceData['nsd-name-ref'],
+ OperationalStatus: nsdInstanceData['operational-status'],
+ ConfigStatus: nsdInstanceData['config-status'],
+ DetailedStatus: nsdInstanceData['detailed-status'],
+ memberIndex: nsdInstanceData.nsd['constituent-vnfd'],
+ nsConfig: nsdInstanceData.nsd['ns-configuration']
+ };
+ this.nsInstanceData.push(nsDataObj);
+ });
+ if (this.nsInstanceData.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(this.nsInstanceData).then((data: {}) => {
+ this.isLoadingResults = false;
+ }).catch();
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /** smart table listing manipulation @public */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+
+ /** smart table listing manipulation @public */
+ public onUserRowSelect(event: MessageEvent): void {
+ Object.assign(event.data, { page: 'ns-instance' });
+ this.dataService.changeMessage(event.data);
+ }
+
+ /** Instantiate NS using modalservice @public */
+ public instantiateNS(): void {
+ const modalRef: NgbModalRef = this.modalService.open(InstantiateNsComponent, { backdrop: 'static' });
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
+ if (result) {
+ this.generateData();
+ }
+ }).catch();
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+}
diff --git a/src/app/instances/ns-primitive/NSPrimitiveComponent.html b/src/app/instances/ns-primitive/NSPrimitiveComponent.html
new file mode 100644
index 0000000..646c8ae
--- /dev/null
+++ b/src/app/instances/ns-primitive/NSPrimitiveComponent.html
@@ -0,0 +1,92 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="modal-header">
+ <h4 class="modal-title" id="modal-basic-title">{{'PERFORMACTION' | translate}}</h4>
+ <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()">
+ <i class="fas fa-times-circle text-danger"></i>
+ </button>
+</div>
+<form [formGroup]="primitiveForm" (ngSubmit)="execNSPrimitive()">
+ <div class="modal-body">
+ <div class="form-group row">
+ <label class="col-sm-4 col-form-label">{{'PRIMITIVETYPE' | translate}}*</label>
+ <div class="col-sm-8">
+ <ng-select (change)="primitiveTypeChange($event)" [clearable]="false"
+ placeholder="{{'SELECT' | translate}}" [items]="primitiveTypeList" bindLabel="title"
+ bindValue="value" [(ngModel)]="primitiveType" id="primitiveType"
+ [ngModelOptions]="{standalone: true}"></ng-select>
+ </div>
+ </div>
+ <div class="form-group row">
+ <ng-container *ngIf="primitiveType == 'VNF_Primitive'">
+ <label class="col-sm-4 col-form-label">VNF {{'MEMBERINDEX' | translate}}*</label>
+ <div class="col-sm-3">
+ <ng-select (change)="indexChange($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}"
+ [items]="params.memberIndex" bindLabel="member-vnf-index" bindValue="member-vnf-index"
+ formControlName="vnf_member_index" id="vnf_member_index"
+ [ngClass]="{ 'is-invalid': submitted && f.vnf_member_index.errors }"></ng-select>
+ </div>
+ </ng-container>
+ <label [ngClass]="{ 'col-sm-4': primitiveType != 'VNF_Primitive', 'col-sm-2': primitiveType == 'VNF_Primitive' }" class="col-form-label">
+ {{'PAGE.NSPRIMITIVE.PRIMITIVE' | translate}}*</label>
+ <div [ngClass]="{ 'col-sm-8': primitiveType != 'VNF_Primitive', 'col-sm-3': primitiveType == 'VNF_Primitive' }" class="col-sm-3">
+ <ng-select (change)="primitiveChange($event)" [clearable]="false" placeholder="{{'SELECT' | translate}}"
+ [items]="primitiveList" bindLabel="name" bindValue="name" formControlName="primitive" id="primitive"
+ [ngClass]="{ 'is-invalid': submitted && f.primitive.errors }"></ng-select>
+ </div>
+ </div>
+ <ng-container *ngIf="primitiveParameter.length > 0">
+ <div class="form-group row p-2 bg-light text-white justify-content-end">
+ <div class="col-5">
+ <button type="button" class="btn btn-primary" (click)="createPrimitiveParams()">
+ <i class="fas fa-plus-circle"></i>
+ {{'PAGE.NSPRIMITIVE.ADDPRIMITIVEPARAMS' | translate}}</button>
+ </div>
+ </div>
+ <div formArrayName="primitive_params" *ngFor="let params of getControls(); let i = index;">
+ <div class="form-group row" [formGroupName]="i">
+ <label class="col-sm-2 col-form-label">{{'NAME' | translate}}:</label>
+ <div class="col-sm-3">
+ <ng-select placeholder="{{'SELECT' | translate}}" [clearable]="false"
+ [items]="primitiveParameter" bindLabel="name" bindValue="name"
+ formControlName="primitive_params_name" id="parameter{{i}}"
+ [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_name.errors }">
+ </ng-select>
+ </div>
+ <div class="col-sm-1"></div>
+ <label class="col-sm-2 col-form-label">{{'VALUE' | translate}}:</label>
+ <div class="col-sm-3">
+ <input type="text" class="form-control" formControlName="primitive_params_value"
+ [ngClass]="{ 'is-invalid': submitted && params.controls.primitive_params_value.errors }">
+ </div>
+ <div class="col-sm-1" [hidden]="i==0">
+ <button type="button" class="btn btn-sm btn-danger remove-mapping"
+ (click)="removePrimitiveParams(i)">
+ <i class="fas fa-times-circle"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </ng-container>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button>
+ <button type="submit" class="btn btn-primary">{{'EXECUTE' | translate}}</button>
+ </div>
+</form>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/ns-primitive/NSPrimitiveComponent.scss b/src/app/instances/ns-primitive/NSPrimitiveComponent.scss
new file mode 100644
index 0000000..edad97f
--- /dev/null
+++ b/src/app/instances/ns-primitive/NSPrimitiveComponent.scss
@@ -0,0 +1,34 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+@import '../../../assets/scss/mixins/mixin';
+@import '../../../assets/scss/variable';
+
+.primitive-params-head {
+ @include padding-value(10, 10, 10, 10);
+ line-height: 2em;
+ .btn-params {
+ @include border(all, 1, solid, $white);
+ }
+}
+
+.remove-params {
+ display: flex;
+ align-items: center;
+ font-size: 20px;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/src/app/instances/ns-primitive/NSPrimitiveComponent.ts b/src/app/instances/ns-primitive/NSPrimitiveComponent.ts
new file mode 100644
index 0000000..02269d3
--- /dev/null
+++ b/src/app/instances/ns-primitive/NSPrimitiveComponent.ts
@@ -0,0 +1,271 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file NS Instance Primitive Component
+ */
+import { Component, Injector, Input, OnInit } from '@angular/core';
+import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { NotifierService } from 'angular-notifier';
+import { APIURLHEADER, ERRORDATA, URLPARAMS } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { NSData } from 'NSDModel';
+import { NSPrimitiveParams } from 'NSInstanceModel';
+import { RestService } from 'RestService';
+import { SharedService } from 'SharedService';
+import { isNullOrUndefined } from 'util';
+
+/**
+ * Creating component
+ * @Component takes NSPrimitiveComponent.html as template url
+ */
+@Component({
+ templateUrl: './NSPrimitiveComponent.html',
+ styleUrls: ['./NSPrimitiveComponent.scss']
+})
+/** Exporting a class @exports NSPrimitiveComponent */
+export class NSPrimitiveComponent implements OnInit {
+ /** Form valid on submit trigger @public */
+ public submitted: boolean = false;
+
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** Instance for active modal service @public */
+ public activeModal: NgbActiveModal;
+
+ /** FormGroup instance added to the form @ html @public */
+ public primitiveForm: FormGroup;
+
+ /** Primitive params array @public */
+ public primitiveParams: FormArray;
+
+ /** Variable set for twoway binding @public */
+ public nsdId: string;
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = false;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Contains list of primitive parameter @public */
+ public primitiveParameter: {}[] = [];
+
+ /** Input contains component objects @public */
+ @Input() public params: URLPARAMS;
+
+ /** Contains list of primitive actions @public */
+ public primitiveList: {}[];
+
+ /** Contains objects that is used to hold types of primitive @public */
+ public primitiveTypeList: {}[] = [];
+
+ /** Model value used to hold selected primitive type @public */
+ public primitiveType: string;
+
+ /** FormBuilder instance added to the formBuilder @private */
+ private formBuilder: FormBuilder;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** packages data service collections @private */
+ private dataService: DataService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Notifier service to popup notification @private */
+ private notifierService: NotifierService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Contains objects that is used to convert key/value pair @private */
+ private objectPrimitiveParams: {} = {};
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.translateService = this.injector.get(TranslateService);
+ this.notifierService = this.injector.get(NotifierService);
+ this.sharedService = this.injector.get(SharedService);
+ this.activeModal = this.injector.get(NgbActiveModal);
+ this.formBuilder = this.injector.get(FormBuilder);
+ this.primitiveTypeList = [{ title: this.translateService.instant('VNFPRIMITIVE'), value: 'VNF_Primitive' }];
+ this.primitiveType = 'VNF_Primitive';
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ /** Setting up initial value for NSD */
+ this.dataService.currentMessage.subscribe((event: NSData) => {
+ if (event.identifier !== undefined || event.identifier !== '' || event.identifier !== null) {
+ this.nsdId = event.identifier;
+ }
+ });
+ if (!isNullOrUndefined(this.params.nsConfig)) {
+ this.primitiveTypeList.push({ title: this.translateService.instant('NSPRIMITIVE'), value: 'NS_Primitive' });
+ }
+ this.initializeForm();
+ }
+
+ /** convenience getter for easy access to form fields */
+ get f(): FormGroup['controls'] { return this.primitiveForm.controls; }
+
+ /** initialize Forms @public */
+ public initializeForm(): void {
+ this.primitiveForm = this.formBuilder.group({
+ primitive: [null, [Validators.required]],
+ vnf_member_index: [null, [Validators.required]],
+ primitive_params: this.formBuilder.array([this.primitiveParamsBuilder()])
+ });
+ }
+
+ /** Generate primitive params @public */
+ public primitiveParamsBuilder(): FormGroup {
+ return this.formBuilder.group({
+ primitive_params_name: [null, [Validators.required]],
+ primitive_params_value: ['', [Validators.required]]
+ });
+ }
+
+ /** Handle FormArray Controls @public */
+ public getControls(): AbstractControl[] {
+ return (this.getFormControl('primitive_params') as FormArray).controls;
+ }
+
+ /** Push all primitive params on user's action @public */
+ public createPrimitiveParams(): void {
+ this.primitiveParams = this.getFormControl('primitive_params') as FormArray;
+ this.primitiveParams.push(this.primitiveParamsBuilder());
+ }
+
+ /** Remove primitive params on user's action @public */
+ public removePrimitiveParams(index: number): void {
+ this.primitiveParams.removeAt(index);
+ }
+
+ /** Execute NS Primitive @public */
+ public execNSPrimitive(): void {
+ this.submitted = true;
+ this.objectPrimitiveParams = {};
+ this.sharedService.cleanForm(this.primitiveForm);
+ if (this.primitiveForm.invalid) { return; } // Proceed, onces form is valid
+ this.primitiveForm.value.primitive_params.forEach((params: NSPrimitiveParams) => {
+ if (params.primitive_params_name !== null && params.primitive_params_value !== '') {
+ this.objectPrimitiveParams[params.primitive_params_name] = params.primitive_params_value;
+ }
+ });
+ //Prepare primitive params
+ const primitiveParamsPayLoads: {} = {
+ primitive: this.primitiveForm.value.primitive,
+ primitive_params: this.objectPrimitiveParams
+ };
+ if (this.primitiveType === 'VNF_Primitive') {
+ // tslint:disable-next-line: no-string-literal
+ primitiveParamsPayLoads['vnf_member_index'] = this.primitiveForm.value.vnf_member_index;
+ }
+ const apiURLHeader: APIURLHEADER = {
+ url: environment.NSDINSTANCES_URL + '/' + this.nsdId + '/action'
+ };
+ this.isLoadingResults = true;
+ this.restService.postResource(apiURLHeader, primitiveParamsPayLoads).subscribe((result: {}) => {
+ this.activeModal.dismiss();
+ this.notifierService.notify('success', this.translateService.instant('PAGE.NSPRIMITIVE.EXECUTEDSUCCESSFULLY'));
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ this.restService.handleError(error, 'post');
+ });
+ }
+ /** Primitive type change event @public */
+ public primitiveTypeChange(data: { value: string }): void {
+ this.primitiveList = [];
+ this.primitiveParameter = [];
+ this.initializeForm();
+ if (data.value === 'NS_Primitive') {
+ this.primitiveList = !isNullOrUndefined(this.params.nsConfig['config-primitive']) ?
+ this.params.nsConfig['config-primitive'] : [];
+ this.getFormControl('vnf_member_index').setValidators([]);
+ }
+ }
+ /** Member index change event */
+ public indexChange(data: {}): void {
+ if (data) {
+ this.getVnfdInfo(data['vnfd-id-ref']);
+ } else {
+ this.primitiveList = [];
+ this.getFormControl('primitive').setValue(null);
+ this.primitiveParameter = [];
+ }
+ }
+ /** Primivtive change event */
+ public primitiveChange(data: { parameter: {}[] }): void {
+ this.primitiveParameter = [];
+ const formArr: FormArray = this.getFormControl('primitive_params') as FormArray;
+ formArr.controls = [];
+ this.createPrimitiveParams();
+ if (data) {
+ this.updatePrimitive(data);
+ }
+ }
+ /** Update primitive value based on parameter */
+ private updatePrimitive(primitive: { parameter: {}[] }): void {
+ if (primitive.parameter) {
+ this.primitiveParameter = primitive.parameter;
+ } else {
+ this.primitiveParameter = [];
+ const formArr: AbstractControl[] = this.getControls();
+ formArr.forEach((formGp: FormGroup) => {
+ formGp.controls.primitive_params_name.setValidators([]);
+ formGp.controls.primitive_params_name.updateValueAndValidity();
+ formGp.controls.primitive_params_value.setValidators([]);
+ formGp.controls.primitive_params_value.updateValueAndValidity();
+ });
+ }
+ }
+ /** Get primivitive actions from vnfd data */
+ private getVnfdInfo(vnfdRef: string): void {
+ this.primitiveList = [];
+ this.primitiveParameter = [];
+ this.getFormControl('primitive').setValue(null);
+ const apiUrl: string = environment.VNFPACKAGES_URL + '?short-name=' + vnfdRef;
+ this.isLoadingResults = true;
+ this.restService.getResource(apiUrl)
+ .subscribe((vnfdInfo: {}) => {
+ if (vnfdInfo[0]['vnf-configuration']) {
+ this.primitiveList = vnfdInfo[0]['vnf-configuration']['config-primitive'];
+ }
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ this.restService.handleError(error, 'get');
+ });
+ }
+ /** Used to get the AbstractControl of controlName passed @private */
+ private getFormControl(controlName: string): AbstractControl {
+ return this.primitiveForm.controls[controlName];
+ }
+}
diff --git a/src/app/instances/ns-topology/NSTopologyComponent.html b/src/app/instances/ns-topology/NSTopologyComponent.html
new file mode 100644
index 0000000..0a3051c
--- /dev/null
+++ b/src/app/instances/ns-topology/NSTopologyComponent.html
@@ -0,0 +1,173 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<ng-sidebar-container class="ns-instance-topology-sidebar-container">
+ <!-- A sidebar -->
+ <ng-sidebar [(opened)]="sideBarOpened" position="left">
+ <div class="sidebar-header">
+ <span class="topology_title" *ngIf="isShowNSDetails">{{'NS' | translate}} {{'VIEW' | translate}}</span>
+ <span class="topology_title" *ngIf="isShowVLetails">{{'PAGE.TOPOLOGY.VIRTUALLINK' | translate}}</span>
+ <span class="topology_title" *ngIf="isShowVNFRDetails">{{'PAGE.TOPOLOGY.VNF' | translate}}</span>
+ </div>
+ <div class="sidebar-body">
+ <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="isShowNSDetails && nsInfo">
+ <div class="row">
+ <div class="col-12 p-0">
+ <table class="table table-bordered text-dark custom-table">
+ <tr>
+ <td>{{'NS' | translate}} {{'INSTANCE' | translate}} Id</td>
+ <td>{{(nsInfo.nsInstanceID)?nsInfo.nsInstanceID:'-'}}</td>
+ </tr>
+ <tr>
+ <td>{{'NSDNAME' | translate}}</td>
+ <td>{{(nsInfo.nsName)?nsInfo.nsName:'-'}}</td>
+ </tr>
+ <tr>
+ <td>{{'OPERATIONALSTATUS' | translate}}</td>
+ <td>{{(nsInfo.nsOperationalStatus)?nsInfo.nsOperationalStatus:'-'}}</td>
+ </tr>
+ <tr>
+ <td>{{'CONFIGSTATUS' | translate}}</td>
+ <td>{{(nsInfo.nsConfigStatus)?nsInfo.nsConfigStatus:'-'}}</td>
+ </tr>
+ <tr>
+ <td>{{'DETAILEDSTATUS' | translate}}</td>
+ <td>{{(nsInfo.nsDetailedStatus)?nsInfo.nsDetailedStatus:'-'}}</td>
+ </tr>
+ <tr>
+ <td>{{'RESOURCEORCHESTRATOR' | translate}}</td>
+ <td>{{(nsInfo.nsResourceOrchestrator)?nsInfo.nsResourceOrchestrator:'-'}}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="isShowVLetails && virtualLink">
+ <div class="row">
+ <div class="col-12 p-0">
+ <table class="table table-bordered text-dark custom-table">
+ <tbody>
+ <tr>
+ <td>short-name</td>
+ <td>{{(virtualLink.shortName)?virtualLink.shortName:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Name</td>
+ <td>{{(virtualLink.name)?virtualLink.name:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Vim network name</td>
+ <td>{{(virtualLink.vimNetworkName)?virtualLink.vimNetworkName:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Type</td>
+ <td>{{(virtualLink.type)?virtualLink.type:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Id</td>
+ <td>{{(virtualLink.id)?virtualLink.id:'-'}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="isShowVNFRDetails && vnfr">
+ <div class="row">
+ <div class="col-12 p-0">
+ <table class="table table-bordered text-dark custom-table">
+ <tbody>
+ <tr>
+ <td>VIM Id</td>
+ <td>{{(vnfr.vimID)?vnfr.vimID:'-'}}</td>
+ </tr>
+ <tr>
+ <td>_id</td>
+ <td>{{(vnfr._id)?vnfr._id:'-'}}</td>
+ </tr>
+ <tr>
+ <td>IP</td>
+ <td>{{(vnfr.ip)?vnfr.ip:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Nsr Id</td>
+ <td>{{(vnfr.nsrID)?vnfr.nsrID:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Id</td>
+ <td>{{(vnfr.id)?vnfr.id:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Vnfd Ref</td>
+ <td>{{(vnfr.vnfdRef)?vnfr.vnfdRef:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Vnfd Id</td>
+ <td>{{(vnfr.vnfdID)?vnfr.vnfdID:'-'}}</td>
+ </tr>
+ <tr>
+ <td>Member index</td>
+ <td>{{(vnfr.memberIndex)?vnfr.memberIndex:'-'}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+ </ng-sidebar>
+ <!-- Page content -->
+ <div ng-sidebar-content>
+ <button (click)="toggleSidebar()" class="btn btn-default" placement="right" ngbTooltip="{{'OPEN' | translate }}">
+ <i class="fa fa-arrow-right detail-sidebar" aria-hidden="true"></i>
+ </button>
+ </div>
+</ng-sidebar-container>
+<div class="container-fluid text-dark">
+ <div class="row ns-instance-form justify-content-end ">
+ <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
+ <div class="row">
+ <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 pl-0">
+ <div class="btn-group list" role="group" aria-label="Basic example">
+ <button type="button" class="btn btn-primary topology-btn" (click)="onFreeze()"
+ [class.pinned]="classApplied" placement="top" container="body"
+ ngbTooltip="{{(classApplied ? 'UNFREEZE' : 'FREEZE') | translate}}">
+ <i class="fas fa-thumbtack"></i>
+ </button>
+ </div>
+ </div>
+ <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right pr-0 badgegroup">
+ <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
+ <img src="assets/images/VNFD.svg" class="ns-svg" draggable="false"/>
+ <br>VNFR</span>
+ <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
+ <img src="assets/images/VL.svg" class="ns-svg" draggable="false"/>
+ <br>VL</span>
+ <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
+ <img src="assets/images/CP.svg" class="ns-svg" draggable="false"/>
+ <br>CP</span>
+ </div>
+ </div>
+ <div class="row border-all">
+ <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 svg-container">
+ <svg preserveAspectRatio="xMidYMin slice" id="graphContainer" #graphContainer></svg>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/ns-topology/NSTopologyComponent.scss b/src/app/instances/ns-topology/NSTopologyComponent.scss
new file mode 100644
index 0000000..d750ccc
--- /dev/null
+++ b/src/app/instances/ns-topology/NSTopologyComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/instances/ns-topology/NSTopologyComponent.ts b/src/app/instances/ns-topology/NSTopologyComponent.ts
new file mode 100644
index 0000000..44c6309
--- /dev/null
+++ b/src/app/instances/ns-topology/NSTopologyComponent.ts
@@ -0,0 +1,573 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file NS Topology Component
+ */
+/* tslint:disable:no-increment-decrement */
+import { Component, ElementRef, Injector, ViewChild, ViewEncapsulation } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { Router } from '@angular/router';
+import { TranslateService } from '@ngx-translate/core';
+import { ERRORDATA } from 'CommonModel';
+import * as d3 from 'd3';
+import { environment } from 'environment';
+import * as HttpStatus from 'http-status-codes';
+import { VNFDCONNECTIONPOINTREF } from 'NSDModel';
+import { COMPOSERNODES, CONNECTIONPOINT, NSD, NSDVLD, NSINFO, NSInstanceDetails, NSINSTANCENODES, VLINFO, VNFRINFO } from 'NSInstanceModel';
+import { GRAPHDETAILS, Tick, TickPath } from 'NSTopologyModel';
+import { RestService } from 'src/services/RestService';
+import { isNullOrUndefined } from 'util';
+
+/**
+ * Creating component
+ * @Component takes NSTopologyComponent.html as template url
+ */
+@Component({
+ selector: 'app-ns-topology',
+ templateUrl: './NSTopologyComponent.html',
+ styleUrls: ['./NSTopologyComponent.scss'],
+ encapsulation: ViewEncapsulation.None
+})
+/** Exporting a class @exports NSTopologyComponent */
+export class NSTopologyComponent {
+ /** Injector to invoke other services @public */
+ public injector: Injector;
+ /** View child contains graphContainer ref @public */
+ @ViewChild('graphContainer', { static: true }) public graphContainer: ElementRef;
+ /** Holds the basic information of NS @public */
+ public nsInfo: NSINFO;
+ /** Contains tranlsate instance @private */
+ public translateService: TranslateService;
+ /** Add the activeclass for the selected @public */
+ public activeClass: string = 'active';
+ /** Add the fixed class for the freeze @public */
+ public fixedClass: string = 'fixed';
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+ /** Assign the forcesimulation active @public */
+ public forceSimulationActive: boolean = false;
+ /** Assign pinned class for the button when freezed @public */
+ public classApplied: boolean = false;
+ /** Contains sidebar open status @public */
+ public sideBarOpened: boolean = true;
+ /** Need to show the NS Details @public */
+ public isShowNSDetails: boolean = true;
+ /** Need to show the VL Details @public */
+ public isShowVLetails: boolean = false;
+ /** Need to show the VNFR Details @public */
+ public isShowVNFRDetails: boolean = false;
+ /** Show right side info of Virtual Link @public */
+ public virtualLink: VLINFO;
+ /** Show right side info of Virtual Link @public */
+ public vnfr: VNFRINFO;
+
+ /** Contains lastkeypressed instance @private */
+ private lastKeyDown: number = -1;
+ /** Instance of the rest service @private */
+ private restService: RestService;
+ /** Holds the instance of AuthService class of type AuthService @private */
+ private activatedRoute: ActivatedRoute;
+ /** Holds the NS Id @private */
+ private nsIdentifier: string;
+ /** Contains SVG attributes @private */
+ // tslint:disable-next-line:no-any
+ private svg: any;
+ /** Contains forced node animations @private */
+ // tslint:disable-next-line:no-any
+ private force: any;
+ /** Contains path information of the node */
+ // tslint:disable-next-line:no-any
+ private path: any;
+ /** Contains node network @private */
+ // tslint:disable-next-line:no-any
+ private network: any;
+ /** Contains node square @private */
+ // tslint:disable-next-line:no-any
+ private square: any;
+ /** Contains node circle @private */
+ // tslint:disable-next-line:no-any
+ private circle: any;
+ /** Contains the NS information @private */
+ private nsData: NSInstanceDetails;
+ /** Contains NDS information of a descriptors */
+ private nsdData: NSD;
+ /** Contains node information @private */
+ private nodes: NSINSTANCENODES[] = [];
+ /** Contains links information @private */
+ private links: {}[] = [];
+ /** holds cp count/iteration @private */
+ private cpCount: number;
+ /** VNFD nodes @private */
+ private vnfdNodes: {}[] = [];
+ /** VLD nodes @private */
+ private vldNodes: {}[] = [];
+ /** Connection CP nodes @private */
+ private cpNodes: {}[] = [];
+ /** Set timeout @private */
+ private TIMEOUT: number = 2000;
+ /** Rendered nodes represent vnf @private */
+ // tslint:disable-next-line:no-any
+ private gSquare: any;
+ /** Rendered nodes represent network @private */
+ // tslint:disable-next-line:no-any
+ private gNetwork: any;
+ /** Rendered nodes represent network @private */
+ // tslint:disable-next-line:no-any
+ private gCircle: any;
+ /** Service holds the router information @private */
+ private router: Router;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.activatedRoute = this.injector.get(ActivatedRoute);
+ this.translateService = this.injector.get(TranslateService);
+ this.router = this.injector.get(Router);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate @public
+ */
+ public ngOnInit(): void {
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ this.nsIdentifier = this.activatedRoute.snapshot.paramMap.get('id');
+ this.generateData();
+ }
+ /** Event to freeze the animation @public */
+ public onFreeze(): void {
+ this.classApplied = !this.classApplied;
+ const alreadyFixedIsActive: boolean = d3.select('svg#graphContainer').classed(this.fixedClass);
+ d3.select('svg#graphContainer').classed(this.fixedClass, !alreadyFixedIsActive);
+ if (alreadyFixedIsActive) {
+ this.force.stop();
+ }
+ this.forceSimulationActive = alreadyFixedIsActive;
+ this.nodes.forEach((d: COMPOSERNODES) => {
+ d.fx = (alreadyFixedIsActive) ? null : d.x;
+ d.fy = (alreadyFixedIsActive) ? null : d.y;
+ });
+ if (alreadyFixedIsActive) {
+ this.force.restart();
+ }
+ }
+ /** Events handles when dragended @public */
+ public toggleSidebar(): void {
+ this.sideBarOpened = !this.sideBarOpened;
+ this.deselectAllNodes();
+ this.showRightSideInfo(true, false, false);
+ }
+ /** Get the default Configuration of containers @private */
+ private getGraphContainerAttr(): GRAPHDETAILS {
+ return {
+ width: 700,
+ height: 400,
+ nodeHeight: 50,
+ nodeWidth: 35,
+ textX: -35,
+ textY: 30,
+ radius: 5,
+ distance: 50,
+ strength: -500,
+ forcex: 2,
+ forcey: 2,
+ sourcePaddingYes: 17,
+ sourcePaddingNo: 12,
+ targetPaddingYes: 4,
+ targetPaddingNo: 3,
+ alphaTarget: 0.3,
+ imageX: -25,
+ imageY: -25,
+ shiftKeyCode: 17
+ };
+ }
+ /** Show the right-side information @private */
+ private showRightSideInfo(nsDetails: boolean, vlDetails: boolean, vnfrDeails: boolean): void {
+ this.isShowNSDetails = nsDetails;
+ this.isShowVLetails = vlDetails;
+ this.isShowVNFRDetails = vnfrDeails;
+ }
+ /** De-select all the selected nodes @private */
+ private deselectAllNodes(): void {
+ this.square.select('image').classed(this.activeClass, false);
+ this.network.select('image').classed(this.activeClass, false);
+ this.circle.select('image').classed(this.activeClass, false);
+ }
+ /** Prepare all the information for node creation @private */
+ private generateData(): void {
+ this.restService.getResource(environment.NSINSTANCESCONTENT_URL + '/' + this.nsIdentifier).subscribe((nsData: NSInstanceDetails) => {
+ this.nsData = nsData;
+ this.nsInfo = {
+ nsInstanceID: nsData._id,
+ nsName: nsData.name,
+ nsOperationalStatus: nsData['operational-status'],
+ nsConfigStatus: nsData['config-status'],
+ nsDetailedStatus: nsData['detailed-status'],
+ nsResourceOrchestrator: nsData['resource-orchestrator']
+ };
+ if (this.nsData['constituent-vnfr-ref'] !== undefined) {
+ this.generateVNFRCPNodes();
+ }
+ if (this.nsData.vld !== undefined) {
+ this.generateVLDNetworkNodes();
+ }
+ setTimeout(() => {
+ this.pushAllNodes();
+ this.generateVNFDCP();
+ this.generateVLDCP();
+ this.isLoadingResults = false;
+ this.createNode(this.nodes, this.links);
+ }, this.TIMEOUT);
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) {
+ this.router.navigateByUrl('404', { skipLocationChange: true }).catch();
+ } else {
+ this.restService.handleError(error, 'get');
+ }
+ });
+ }
+
+ /** Fetching all the VNFR Information @private */
+ private generateVNFRCPNodes(): void {
+ this.nsData['constituent-vnfr-ref'].forEach((vnfdrID: string) => {
+ this.restService.getResource(environment.VNFINSTANCES_URL + '/' + vnfdrID).subscribe((vndfrDetail: NSD) => {
+ this.nodes.push({
+ id: vndfrDetail['vnfd-ref'] + ':' + vndfrDetail['member-vnf-index-ref'],
+ nodeTypeRef: 'vnfd',
+ cp: vndfrDetail['connection-point'],
+ vdur: vndfrDetail.vdur,
+ vld: vndfrDetail.vld,
+ nsID: vndfrDetail['nsr-id-ref'],
+ vnfdID: vndfrDetail['vnfd-id'],
+ vimID: vndfrDetail['vim-account-id'],
+ vndfrID: vndfrDetail.id,
+ ipAddress: vndfrDetail['ip-address'],
+ memberIndex: vndfrDetail['member-vnf-index-ref'],
+ vnfdRef: vndfrDetail['vnfd-ref'],
+ selectorId: 'nsInst-' + vndfrDetail.id
+ });
+ // Fetching all the connection point of VNF & Interface
+ vndfrDetail['connection-point'].forEach((cp: CONNECTIONPOINT) => {
+ this.nodes.push({
+ id: cp.name + ':' + vndfrDetail['member-vnf-index-ref'],
+ vndfCPRef: vndfrDetail['vnfd-ref'] + ':' + vndfrDetail['member-vnf-index-ref'],
+ nodeTypeRef: 'cp',
+ name: cp.name
+ });
+ });
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ });
+ });
+ }
+
+ /** Fetching all the VLD/Network Information @private */
+ private generateVLDNetworkNodes(): void {
+ this.nsdData = this.nsData.nsd;
+ this.nsdData.vld.forEach((ref: NSDVLD) => {
+ this.nodes.push({
+ id: ref.id,
+ nodeTypeRef: 'vld',
+ name: ref.name,
+ type: ref.type,
+ vnfdCP: ref['vnfd-connection-point-ref'],
+ vimNetworkName: ref['vim-network-name'],
+ shortName: ref['short-name'],
+ selectorId: 'nsInst-' + ref.id
+ });
+ });
+ }
+
+ /** Pushing connection points of path/links nodes @private */
+ private pushAllNodes(): void {
+ this.nodes.forEach((nodeList: NSINSTANCENODES) => {
+ if (nodeList.nodeTypeRef === 'vnfd') {
+ this.vnfdNodes.push(nodeList);
+ } else if (nodeList.nodeTypeRef === 'vld') {
+ this.vldNodes.push(nodeList);
+ } else if (nodeList.nodeTypeRef === 'cp') {
+ this.cpNodes.push(nodeList);
+ }
+ });
+ }
+
+ /** Get CP position based on vndf @private */
+ private generateVNFDCP(): void {
+ this.vnfdNodes.forEach((list: NSINSTANCENODES) => {
+ const vndfPos: number = this.nodes.map((e: NSINSTANCENODES) => { return e.id; }).indexOf(list.id);
+ this.cpCount = 0;
+ this.nodes.forEach((res: NSINSTANCENODES) => {
+ if (res.nodeTypeRef === 'cp' && res.vndfCPRef === list.id) {
+ this.links.push({ source: this.nodes[vndfPos], target: this.nodes[this.cpCount] });
+ }
+ this.cpCount++;
+ });
+ });
+ }
+
+ /** Get CP position based on vld @private */
+ private generateVLDCP(): void {
+ let vldPos: number = 0;
+ this.vldNodes.forEach((list: NSINSTANCENODES) => {
+ if (!isNullOrUndefined(list.vnfdCP)) {
+ list.vnfdCP.forEach((cpRef: VNFDCONNECTIONPOINTREF) => {
+ this.cpCount = 0;
+ this.nodes.forEach((res: NSINSTANCENODES) => {
+ if (res.nodeTypeRef === 'cp' && res.id === cpRef['vnfd-connection-point-ref'] + ':' + cpRef['member-vnf-index-ref']) {
+ this.links.push({ source: this.nodes[vldPos], target: this.nodes[this.cpCount] });
+ }
+ this.cpCount++;
+ });
+ });
+ vldPos++;
+ }
+ });
+ }
+
+ /** Node is created and render at D3 region @private */
+ private createNode(nodes: NSINSTANCENODES[], links: {}[]): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ d3.selectAll('svg#graphContainer > *').remove();
+ d3.select(window).on('keydown', () => { this.keyDown(); });
+ d3.select(window).on('keyup', () => { this.keyUp(); });
+ this.svg = d3.select('#graphContainer')
+ .attr('oncontextmenu', 'return false;')
+ .attr('width', graphContainerAttr.width)
+ .attr('height', graphContainerAttr.height);
+ this.force = d3.forceSimulation()
+ .force('charge', d3.forceManyBody().strength(graphContainerAttr.strength))
+ .force('link', d3.forceLink().id((d: TickPath) => d.id).distance(graphContainerAttr.distance))
+ .force('center', d3.forceCenter(graphContainerAttr.width / graphContainerAttr.forcex,
+ graphContainerAttr.height / graphContainerAttr.forcey))
+ .force('x', d3.forceX(graphContainerAttr.width / graphContainerAttr.forcex))
+ .force('y', d3.forceY(graphContainerAttr.height / graphContainerAttr.forcey))
+ .on('tick', () => { this.tick(); });
+ // handles to link and node element groups
+ this.path = this.svg.append('svg:g').selectAll('path');
+ this.network = this.svg.append('svg:g').selectAll('network');
+ this.square = this.svg.append('svg:g').selectAll('rect');
+ this.circle = this.svg.append('svg:g').selectAll('circle');
+ this.restart(nodes, links);
+ }
+
+ /** Update force layout (called automatically each iteration) @private */
+ private tick(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ // draw directed edges with proper padding from node centers
+ this.path.attr('class', 'link').attr('d', (d: Tick) => {
+ const deltaX: number = d.target.x - d.source.x;
+ const deltaY: number = d.target.y - d.source.y;
+ const dist: number = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ const normX: number = deltaX / dist;
+ const normY: number = deltaY / dist;
+ const sourcePadding: number = d.left ? graphContainerAttr.sourcePaddingYes : graphContainerAttr.sourcePaddingNo;
+ const targetPadding: number = d.right ? graphContainerAttr.targetPaddingYes : graphContainerAttr.targetPaddingNo;
+ const sourceX: number = d.source.x + (sourcePadding * normX);
+ const sourceY: number = d.source.y + (sourcePadding * normY);
+ const targetX: number = d.target.x - (targetPadding * normX);
+ const targetY: number = d.target.y - (targetPadding * normY);
+ return `M${sourceX},${sourceY}L${targetX},${targetY}`;
+ });
+ this.network.attr('transform', (t: TickPath) => `translate(${t.x},${t.y})`);
+ this.square.attr('transform', (t: TickPath) => `translate(${t.x},${t.y})`);
+ this.circle.attr('transform', (t: TickPath) => `translate(${t.x},${t.y})`);
+ }
+
+ /** Update graph (called when needed) @private */
+ private restart(nodes: NSINSTANCENODES[], links: {}[]): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ this.path = this.path.data(links);
+ const vnfdNodes: {}[] = []; const vldNodes: {}[] = []; const cpNodes: {}[] = []; // NB: Nodes are known by id, not by index!
+ nodes.forEach((nodeList: NSINSTANCENODES) => {
+ if (nodeList.nodeTypeRef === 'vnfd') { vnfdNodes.push(nodeList); }
+ else if (nodeList.nodeTypeRef === 'vld') { vldNodes.push(nodeList); }
+ else if (nodeList.nodeTypeRef === 'cp') { cpNodes.push(nodeList); }
+ });
+ this.square = this.square.data(vnfdNodes, (d: { id: number }) => d.id);
+ this.network = this.network.data(vldNodes, (d: { id: number }) => d.id);
+ this.circle = this.circle.data(cpNodes, (d: { id: number }) => d.id);
+ this.resetAndCreateNodes();
+ this.force.nodes(nodes).force('link').links(links); //Set the graph in motion
+ this.force.alphaTarget(graphContainerAttr.alphaTarget).restart();
+ }
+
+ /** Rest and create nodes @private */
+ private resetAndCreateNodes(): void {
+ this.path.exit().remove();
+ this.square.exit().remove();
+ this.network.exit().remove();
+ this.circle.exit().remove();
+ // tslint:disable-next-line:no-any
+ const gPath: any = this.path.enter().append('svg:path').attr('class', 'link');
+ this.getgSquare();
+ this.getgNetwork();
+ this.getgCircle();
+ this.square = this.gSquare.merge(this.square);
+ this.network = this.gNetwork.merge(this.network);
+ this.path = gPath.merge(this.path);
+ this.circle = this.gCircle.merge(this.circle);
+ }
+
+ /** Events handles when Shift Click to perform create cp @private */
+ // tslint:disable-next-line: no-any
+ private singleClick(nodeSelected: any, d: COMPOSERNODES): void {
+ this.selectNodeExclusive(nodeSelected, d);
+ }
+ /** Selected nodes @private */
+ // tslint:disable-next-line: no-any
+ private selectNodeExclusive(nodeSelected: any, d: COMPOSERNODES): void {
+ const alreadyIsActive: boolean = nodeSelected.select('#' + d.selectorId).classed(this.activeClass);
+ this.deselectAllNodes();
+ nodeSelected.select('#' + d.selectorId).classed(this.activeClass, !alreadyIsActive);
+ if (d.nodeTypeRef === 'vld' && !alreadyIsActive) {
+ this.virtualLink = {
+ id: d.id,
+ name: d.name,
+ type: d.type,
+ shortName: d.shortName,
+ vimNetworkName: d.vimNetworkName
+ };
+ this.showRightSideInfo(false, true, false);
+ } else if (d.nodeTypeRef === 'vnfd' && !alreadyIsActive) {
+ this.vnfr = {
+ vimID: d.vimID,
+ _id: d.vndfrID,
+ ip: d.ipAddress,
+ nsrID: d.nsID,
+ id: d.selectorId,
+ vnfdRef: d.vnfdRef,
+ vnfdId: d.vnfdID,
+ memberIndex: d.memberIndex
+ };
+ this.showRightSideInfo(false, false, true);
+ } else {
+ this.showRightSideInfo(true, false, false);
+ }
+ }
+ /** Setting all the square/vnf attributes of nodes @private */
+ private getgSquare(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ this.gSquare = this.square.enter().append('svg:g');
+ this.gSquare.append('svg:circle').attr('r', graphContainerAttr.radius).style('fill', '#eeeeee');
+ this.gSquare.append('svg:image')
+ .style('opacity', 1)
+ .attr('x', graphContainerAttr.imageX)
+ .attr('y', graphContainerAttr.imageY)
+ .attr('id', (d: COMPOSERNODES) => { return d.selectorId; })
+ .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight)
+ .attr('xlink:href', 'assets/images/VNFD.svg')
+ .on('click', (d: COMPOSERNODES) => { this.singleClick(this.gSquare, d); this.onNodeClickToggleSidebar(); });
+ this.gSquare.append('svg:text')
+ .attr('class', 'node_text')
+ .attr('y', graphContainerAttr.textY)
+ .text((d: COMPOSERNODES) => d.id);
+ }
+
+ /** Settings all the network attributes of nodes @private */
+ private getgNetwork(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ this.gNetwork = this.network.enter().append('svg:g');
+ this.gNetwork.append('svg:circle').attr('r', graphContainerAttr.radius).style('fill', '#eeeeee');
+ this.gNetwork.append('svg:image')
+ .style('opacity', 1)
+ .attr('x', graphContainerAttr.imageX)
+ .attr('y', graphContainerAttr.imageY)
+ .attr('id', (d: COMPOSERNODES) => { return d.selectorId; })
+ .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight)
+ .attr('xlink:href', 'assets/images/VL.svg')
+ .on('click', (d: COMPOSERNODES) => { this.singleClick(this.gNetwork, d); this.onNodeClickToggleSidebar(); });
+ this.gNetwork.append('svg:text')
+ .attr('class', 'node_text')
+ .attr('y', graphContainerAttr.textY)
+ .text((d: COMPOSERNODES) => d.name);
+ }
+
+ /** Settings all the connection point attributes of nodes @private */
+ private getgCircle(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ this.gCircle = this.circle.enter().append('svg:g');
+ this.gCircle.append('svg:circle').attr('r', graphContainerAttr.radius).style('fill', '#eeeeee');
+ this.gCircle.append('svg:image')
+ .style('opacity', 1)
+ .attr('x', graphContainerAttr.imageX)
+ .attr('y', graphContainerAttr.imageY)
+ .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight)
+ .attr('xlink:href', 'assets/images/CP.svg');
+ this.gCircle.append('svg:text')
+ .attr('class', 'node_text')
+ .attr('y', graphContainerAttr.textY)
+ .text((d: COMPOSERNODES) => d.name);
+ }
+
+ /** Key press event @private */
+ private keyDown(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ if (this.lastKeyDown !== -1) { return; }
+ this.lastKeyDown = d3.event.keyCode;
+ if (d3.event.keyCode === graphContainerAttr.shiftKeyCode) {
+ this.gSquare.call(d3.drag()
+ .on('start', this.dragstarted).on('drag', this.dragged).on('end', this.dragended)
+ );
+ this.gNetwork.call(d3.drag()
+ .on('start', this.dragstarted).on('drag', this.dragged).on('end', this.dragended)
+ );
+ this.gCircle.call(d3.drag()
+ .on('start', this.dragstarted).on('drag', this.dragged).on('end', this.dragended)
+ );
+ this.svg.classed('ctrl', true);
+ }
+ }
+ /** Key realse event @private */
+ private keyUp(): void {
+ const graphContainerAttr: GRAPHDETAILS = this.getGraphContainerAttr();
+ this.lastKeyDown = -1;
+ if (d3.event.keyCode === graphContainerAttr.shiftKeyCode) {
+ this.gSquare.on('.drag', null);
+ this.gNetwork.on('.drag', null);
+ this.gCircle.on('.drag', null);
+ this.svg.classed('ctrl', false);
+ }
+ }
+ /** Events handles when dragstarted @private */
+ private dragstarted(d: COMPOSERNODES): void {
+ d.fx = d.x;
+ d.fy = d.y;
+ }
+ /** Events handles when dragged @private */
+ private dragged(d: COMPOSERNODES): void {
+ d.fx = d.x = d3.event.x;
+ d.fy = d.y = d3.event.y;
+ }
+ /** Events handles when dragended @private */
+ private dragended(d: COMPOSERNODES): void {
+ if (this.forceSimulationActive) {
+ d.fx = null;
+ d.fy = null;
+ } else {
+ d.fx = d.x;
+ d.fy = d.y;
+ this.forceSimulationActive = false;
+ }
+ }
+ /** Events handles when node single click @private */
+ private onNodeClickToggleSidebar(): void {
+ this.sideBarOpened = true;
+ }
+}
diff --git a/src/app/instances/pdu-instances/PDUInstancesComponent.html b/src/app/instances/pdu-instances/PDUInstancesComponent.html
new file mode 100644
index 0000000..3c18bfa
--- /dev/null
+++ b/src/app/instances/pdu-instances/PDUInstancesComponent.html
@@ -0,0 +1,36 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'PDUINSTANCES' | translate}}</div>
+ <span class="button">
+ <button class="btn btn-primary" type="button" placement="top" container="body"
+ ngbTooltip="{{'PAGE.PDUINSTANCE.NEWPDUINSTANCE' | translate}}" (click)="addPDUInstanceModal()">
+ <i class="fas fa-plus-circle" aria-hidden="true"></i>
+ {{'PAGE.PDUINSTANCE.NEWPDUINSTANCE' | translate}}
+ </button>
+ </span>
+</div>
+<div class="row mt-2 mb-0 form-group justify-content-end list-utilites-actions">
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)">
+ </ng2-smart-table>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/pdu-instances/PDUInstancesComponent.scss b/src/app/instances/pdu-instances/PDUInstancesComponent.scss
new file mode 100644
index 0000000..0ecd95d
--- /dev/null
+++ b/src/app/instances/pdu-instances/PDUInstancesComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
\ No newline at end of file
diff --git a/src/app/instances/pdu-instances/PDUInstancesComponent.ts b/src/app/instances/pdu-instances/PDUInstancesComponent.ts
new file mode 100644
index 0000000..20b44df
--- /dev/null
+++ b/src/app/instances/pdu-instances/PDUInstancesComponent.ts
@@ -0,0 +1,197 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file PDU Instance Component
+ */
+import { Component, Injector, OnDestroy, OnInit } from '@angular/core';
+import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { AddPDUInstancesComponent } from 'AddPDUInstancesComponent';
+import { ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { LocalDataSource } from 'ng2-smart-table';
+import { PDUInstanceDetails } from 'PDUInstanceModel';
+import { PDUInstancesActionComponent } from 'PDUInstancesActionComponent';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+
+/**
+ * Creating component
+ * @Component takes PDUInstancesComponent.html as template url
+ */
+@Component({
+ templateUrl: './PDUInstancesComponent.html',
+ styleUrls: ['./PDUInstancesComponent.scss']
+})
+/** Exporting a class @exports PDUInstancesComponent */
+export class PDUInstancesComponent implements OnInit, OnDestroy {
+ /** Injector to invoke other services @public */
+ public injector: Injector;
+
+ /** NS Instance array @public */
+ public pduInstanceData: object[] = [];
+
+ /** Datasource instance @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+
+ /** SelectedRows array @public */
+ public selectedRows: object[] = [];
+
+ /** Selected list array @public */
+ public selectList: object[] = [];
+
+ /** Instance component are stored in settings @public */
+ public settings: {} = {};
+
+ /** Contains objects for menu settings @public */
+ public columnList: {} = {};
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+
+ /** Instance of the modal service @private */
+ private modalService: NgbModal;
+
+ /** dataService to pass the data from one component to another @private */
+ private dataService: DataService;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.sharedService = this.injector.get(SharedService);
+ this.translateService = this.injector.get(TranslateService);
+ this.modalService = this.injector.get(NgbModal);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ this.generateTableColumn();
+ this.generateTableSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableSettings(): void {
+ this.settings = {
+ columns: this.columnList,
+ actions: { add: false, edit: false, delete: false, position: 'right' },
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableColumn(): void {
+ this.columnList = {
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%' },
+ name: { title: this.translateService.instant('NAME'), width: '20%', sortDirection: 'asc' },
+ type: { title: this.translateService.instant('TYPE'), width: '15%' },
+ usageState: { title: this.translateService.instant('USAGESTATE'), width: '15%' },
+ CreatedAt: { title: this.translateService.instant('CREATEDAT'), width: '15%' },
+ Actions: {
+ name: 'Action', width: '10%', filter: false, sort: false, type: 'custom',
+ title: this.translateService.instant('ACTIONS'),
+ valuePrepareFunction: (cell: PDUInstanceDetails, row: PDUInstanceDetails): PDUInstanceDetails => row,
+ renderComponent: PDUInstancesActionComponent
+ }
+ };
+ }
+
+ /** generateData initiate the ns-instance list @public */
+ public generateData(): void {
+ this.pduInstanceData = [];
+ this.isLoadingResults = true;
+ this.restService.getResource(environment.PDUINSTANCE_URL).subscribe((pduInstancesData: PDUInstanceDetails[]) => {
+ pduInstancesData.forEach((pduInstanceData: PDUInstanceDetails) => {
+ const pduDataObj: {} = {
+ name: pduInstanceData.name,
+ identifier: pduInstanceData._id,
+ type: pduInstanceData.type,
+ usageState: pduInstanceData._admin.usageState,
+ CreatedAt: this.sharedService.convertEpochTime(Number(pduInstanceData._admin.created))
+ };
+ this.pduInstanceData.push(pduDataObj);
+ });
+ if (this.pduInstanceData.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(this.pduInstanceData).then((data: {}) => {
+ this.isLoadingResults = false;
+ }).catch();
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /** smart table listing manipulation @public */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+
+ /** smart table listing manipulation @public */
+ public onUserRowSelect(event: MessageEvent): void {
+ Object.assign(event.data, { page: 'pdu-instances' });
+ this.dataService.changeMessage(event.data);
+ }
+
+ /** Add PDU Instance modal using modalservice @public */
+ public addPDUInstanceModal(): void {
+ const modalRef: NgbModalRef = this.modalService.open(AddPDUInstancesComponent, { backdrop: 'static' });
+ modalRef.componentInstance.title = this.translateService.instant('PAGE.PDUINSTANCE.NEWPDUINSTANCE');
+ modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
+ if (result) {
+ this.generateData();
+ }
+ }).catch();
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+}
diff --git a/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.html b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.html
new file mode 100644
index 0000000..f785426
--- /dev/null
+++ b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.html
@@ -0,0 +1,95 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="modal-header">
+ <h4 class="modal-title" id="modal-basic-title">{{title}}</h4>
+ <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()">
+ <i class="fas fa-times-circle text-danger"></i>
+ </button>
+</div>
+<form [formGroup]="pduInstancesForm" (ngSubmit)="createPDUInstances()" autocomplete="off">
+ <div class="modal-body">
+ <div class="form-group row">
+ <label class="col-sm-12 col-form-label mandatory-label" [ngClass]="{'text-danger': pduInstancesForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label>
+ <label class="col-sm-3 col-form-label" for="name">{{'NAME' | translate}}*</label>
+ <div class="col-sm-3">
+ <input placeholder="{{'NAME' | translate}}" type="text" class="form-control" formControlName="name" id="name" [ngClass]="{ 'is-invalid': submitted && f.name.errors }"
+ required>
+ </div>
+ <label class="col-sm-3 col-form-label" for="type">{{'PAGE.PDUINSTANCE.PDUTYPE' | translate}}*</label>
+ <div class="col-sm-3">
+ <input placeholder="{{'PAGE.PDUINSTANCE.PDUTYPE' | translate}}" type="text" class="form-control" formControlName="type" id="type" [ngClass]="{ 'is-invalid': submitted && f.type.errors }">
+ </div>
+ </div>
+ <div class="form-group row">
+ <label class="col-sm-3 col-form-label" for="vim_accounts">{{'VIMACCOUNTS' | translate}}*</label>
+ <div class="col-sm-9">
+ <ng-select placeholder="{{'VIMACCOUNTS' | translate}}" [items]="vimAccountSelect" multiple="true" bindLabel="name" bindValue="_id" formControlName="vim_accounts" id="vim_accounts"
+ [ngClass]="{ 'is-invalid': submitted && f.vim_accounts.errors }" [(ngModel)]="selectedVIM">
+ </ng-select>
+ </div>
+ </div>
+ <div class="form-group row p-2 bg-light text-dark">
+ <div class="col-sm-7 align-self-center"><span>{{'PAGE.PDUINSTANCE.PARAMETERS' | translate}}</span></div>
+ <div class="col-sm-5">
+ <button type="button" class="btn btn-primary" (click)="createInterfaces()">
+ <i class="fas fa-plus-square"></i> {{'PAGE.PDUINSTANCE.ADDINSTANCEPARAMS' | translate}}</button>
+ </div>
+ </div>
+ <div formArrayName="interfaces" *ngFor="let params of getControls(); let i = index;">
+ <div class="form-group" [formGroupName]="i">
+ <div class="row">
+ <div class="col-sm-11">
+ <div class="row">
+ <label class="col-sm-2 col-form-label" for="name_{{i}}">{{'NAME' | translate}}*</label>
+ <div class="col-sm-4">
+ <input placeholder="{{'NAME' | translate}}" type="text" class="form-control" formControlName="name" id="name_{{i}}" [ngClass]="{ 'is-invalid': submitted && params.controls.name.errors }">
+ </div>
+ <label class="col-sm-2 col-form-label padLeft0 padRight0" for="ipAddress{{i}}">{{'IPADDRESS' | translate}}*</label>
+ <div class="col-sm-4">
+ <input placeholder="{{'IPADDRESS' | translate}}" type="text" class="form-control" formControlName="ip-address" id="ipAddress{{i}}" [ngClass]="{ 'is-invalid': submitted && params.controls['ip-address'].errors }">
+ <div *ngIf="pduInstancesForm.invalid" class="invalid-feedback">
+ <div *ngIf="params.controls['ip-address'].errors && params.controls['ip-address'].value">{{'DOMVALIDATIONS.INVALIDIPADDRESS' | translate}}</div>
+ </div>
+ </div>
+ </div>
+ <div class="row mr-top-5">
+ <label class="col-sm-2 col-form-label" for="mgmt{{i}}">{{'MGMT' | translate}}*</label>
+ <div class="col-sm-4">
+ <ng-select placeholder="{{'SELECT' | translate}} {{'MGMT' | translate}}" [items]="mgmtState" bindLabel="name" bindValue="value" formControlName="mgmt" id="mgmt{{i}}" [(ngModel)]="selectedMgmt" [ngClass]="{ 'is-invalid': submitted && params.controls.mgmt.errors }"></ng-select>
+ </div>
+ <label class="col-sm-2 col-form-label padLeft0 padRight0" for="vimNetName{{i}}">{{'NETNAME' | translate}}*</label>
+ <div class="col-sm-4">
+ <input placeholder="{{'NETNAME' | translate}}" type="text" class="form-control" formControlName="vim-network-name" id="vimNetName{{i}}" [ngClass]="{ 'is-invalid': submitted && params.controls['vim-network-name'].errors }">
+ </div>
+ </div>
+ </div>
+ <div class="col-sm-1 remove-params" [hidden]="i==0">
+ <button type="button" class="btn btn-sm btn-danger remove-mapping" (click)="removeInterfaces(i)">
+ <i class="fas fa-times-circle"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button>
+ <button type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
+ </div>
+</form>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.scss b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.scss
new file mode 100644
index 0000000..950bb39
--- /dev/null
+++ b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.scss
@@ -0,0 +1,34 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+@import '../../../../assets/scss/mixins/mixin';
+@import '../../../../assets/scss/variable';
+
+.head {
+ @include padding-value(10, 10, 10, 10);
+ line-height: 2em;
+ .btn-params {
+ @include border(all, 1, solid, $white);
+ }
+}
+
+.remove-params {
+ display: flex;
+ align-items: center;
+ font-size: 20px;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts
new file mode 100644
index 0000000..0dcbb60
--- /dev/null
+++ b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts
@@ -0,0 +1,197 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+ */
+/**
+ * @file ADD PDU Instances Component
+ */
+import { Component, Injector, Input, OnInit, Output } from '@angular/core';
+import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { NotifierService } from 'angular-notifier';
+import { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { PDUInstanceDetails } from 'PDUInstanceModel';
+import { RestService } from 'RestService';
+import { SharedService } from 'SharedService';
+import { VimAccountDetails } from 'VimAccountModel';
+
+/**
+ * Creating component
+ * @Component takes AddPDUInstancesComponent.html as template url
+ */
+@Component({
+ templateUrl: './AddPDUInstancesComponent.html',
+ styleUrls: ['./AddPDUInstancesComponent.scss']
+})
+/** Exporting a class @exports AddPDUInstancesComponent */
+export class AddPDUInstancesComponent implements OnInit {
+ /** Form valid on submit trigger @public */
+ public submitted: boolean = false;
+
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** Instance for active modal service @public */
+ public activeModal: NgbActiveModal;
+
+ /** FormGroup instance added to the form @ html @public */
+ public pduInstancesForm: FormGroup;
+
+ /** Primitive params array @public */
+ public pduInterfaces: FormArray;
+
+ /** Variable set for twoway binding @public */
+ public pduInstanceId: string;
+
+ /** Set mgmt field to empty on load @public */
+ public selectedMgmt: string;
+
+ /** Set vim field to empty on load @public */
+ public selectedVIM: string;
+
+ /** Contains boolean value as select options for mgmt @public */
+ public mgmtState: {}[] = [{ name: 'True', value: true }, { name: 'False', value: false }];
+
+ /** Input contains Modal dialog component Instance @private */
+ @Input() public title: string;
+
+ /** Contains all the vim accounts list @public */
+ public vimAccountSelect: VimAccountDetails;
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = false;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** FormBuilder instance added to the formBuilder @private */
+ private formBuilder: FormBuilder;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** packages data service collections @private */
+ private dataService: DataService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Notifier service to popup notification @private */
+ private notifierService: NotifierService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.translateService = this.injector.get(TranslateService);
+ this.notifierService = this.injector.get(NotifierService);
+ this.sharedService = this.injector.get(SharedService);
+ this.activeModal = this.injector.get(NgbActiveModal);
+ this.formBuilder = this.injector.get(FormBuilder);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ /** Setting up initial value for NSD */
+ this.dataService.currentMessage.subscribe((event: PDUInstanceDetails) => {
+ if (event.identifier !== undefined || event.identifier !== '' || event.identifier !== null) {
+ this.pduInstanceId = event.identifier;
+ }
+ });
+ this.generateVIMAccounts();
+ this.initializeForm();
+ }
+
+ /** convenience getter for easy access to form fields */
+ get f(): FormGroup['controls'] { return this.pduInstancesForm.controls; }
+
+ /** initialize Forms @public */
+ public initializeForm(): void {
+ this.pduInstancesForm = this.formBuilder.group({
+ name: ['', [Validators.required]],
+ type: ['', [Validators.required]],
+ vim_accounts: ['', [Validators.required]],
+ interfaces: this.formBuilder.array([this.interfacesBuilder()])
+ });
+ }
+
+ /** Generate interfaces fields @public */
+ public interfacesBuilder(): FormGroup {
+ return this.formBuilder.group({
+ name: ['', [Validators.required]],
+ 'ip-address': ['', [Validators.required, Validators.pattern(this.sharedService.REGX_IP_PATTERN)]],
+ mgmt: ['', [Validators.required]],
+ 'vim-network-name': ['', [Validators.required]]
+ });
+ }
+
+ /** Handle FormArray Controls @public */
+ public getControls(): AbstractControl[] {
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ return (this.pduInstancesForm.get('interfaces') as FormArray).controls;
+ }
+
+ /** Push all primitive params on user's action @public */
+ public createInterfaces(): void {
+ // tslint:disable-next-line:no-backbone-get-set-outside-model
+ this.pduInterfaces = this.pduInstancesForm.get('interfaces') as FormArray;
+ this.pduInterfaces.push(this.interfacesBuilder());
+ }
+
+ /** Remove interfaces on user's action @public */
+ public removeInterfaces(index: number): void {
+ this.pduInterfaces.removeAt(index);
+ }
+
+ /** Execute New PDU Instances @public */
+ public createPDUInstances(): void {
+ this.submitted = true;
+ this.sharedService.cleanForm(this.pduInstancesForm);
+ if (this.pduInstancesForm.invalid) { return; } // Proceed, onces form is valid
+ this.isLoadingResults = true;
+ const modalData: MODALCLOSERESPONSEDATA = {
+ message: 'Done'
+ };
+ const apiURLHeader: APIURLHEADER = {
+ url: environment.PDUINSTANCE_URL
+ };
+ this.restService.postResource(apiURLHeader, this.pduInstancesForm.value).subscribe((result: {}) => {
+ this.activeModal.close(modalData);
+ this.notifierService.notify('success', this.translateService.instant('PAGE.PDUINSTANCE.CREATEDSUCCESSFULLY'));
+ this.isLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'post');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /** Generate vim accounts list @public */
+ public generateVIMAccounts(): void {
+ this.restService.getResource(environment.VIMACCOUNTS_URL).subscribe((vimData: VimAccountDetails) => {
+ this.vimAccountSelect = vimData;
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ });
+ }
+}
diff --git a/src/app/instances/vnf-instances/VNFInstancesComponent.html b/src/app/instances/vnf-instances/VNFInstancesComponent.html
new file mode 100644
index 0000000..e36cc3d
--- /dev/null
+++ b/src/app/instances/vnf-instances/VNFInstancesComponent.html
@@ -0,0 +1,29 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<div class="row d-flex flex-row justify-content-between">
+ <div class="d-flex align-items-center header-style">{{'VNFINSTANCES' | translate}}</div>
+</div>
+<div class="row mt-2 mb-0 form-group justify-content-end list-utilites-actions">
+ <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
+ <page-reload></page-reload>
+</div>
+<div class="smarttable-style bg-white mt-1">
+ <ng2-smart-table [ngClass]="checkDataClass" [settings]="settings" [source]="dataSource" (userRowSelect)="onUserRowSelect($event)">
+ </ng2-smart-table>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/instances/vnf-instances/VNFInstancesComponent.scss b/src/app/instances/vnf-instances/VNFInstancesComponent.scss
new file mode 100644
index 0000000..021d205
--- /dev/null
+++ b/src/app/instances/vnf-instances/VNFInstancesComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/instances/vnf-instances/VNFInstancesComponent.ts b/src/app/instances/vnf-instances/VNFInstancesComponent.ts
new file mode 100644
index 0000000..d829ee2
--- /dev/null
+++ b/src/app/instances/vnf-instances/VNFInstancesComponent.ts
@@ -0,0 +1,187 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file NVF Instance Component
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { TranslateService } from '@ngx-translate/core';
+import { ERRORDATA } from 'CommonModel';
+import { DataService } from 'DataService';
+import { environment } from 'environment';
+import { LocalDataSource } from 'ng2-smart-table';
+import { RestService } from 'RestService';
+import { Subscription } from 'rxjs';
+import { SharedService } from 'SharedService';
+import { VNFInstanceData, VNFInstanceDetails } from 'VNFInstanceModel';
+import { VNFInstancesActionComponent } from 'VNFInstancesActionComponent';
+import { VNFLinkComponent } from 'VNFLinkComponent';
+
+/**
+ * Creating component
+ * @Component takes VNFInstancesComponent.html as template url
+ */
+@Component({
+ templateUrl: './VNFInstancesComponent.html',
+ styleUrls: ['./VNFInstancesComponent.scss']
+})
+/** Exporting a class @exports VNFInstancesComponent */
+export class VNFInstancesComponent implements OnInit {
+ /** To inject services @public */
+ public injector: Injector;
+
+ /** smart table data service collections @public */
+ public dataSource: LocalDataSource = new LocalDataSource();
+
+ /** Instance component are stored in settings @public */
+ public settings: {} = {};
+
+ /** Contains objects for menu settings @public */
+ public columnList: {} = {};
+
+ /** vnf instance array @public */
+ public vnfInstanceData: {}[] = [];
+
+ /** selected rows array @public */
+ public selectedRows: string[] = [];
+
+ /** selected list array @public */
+ public selectList: string[] = [];
+
+ /** Check the loading results @public */
+ public isLoadingResults: boolean = true;
+
+ /** Give the message for the loading @public */
+ public message: string = 'PLEASEWAIT';
+
+ /** Class for empty and present data @public */
+ public checkDataClass: string;
+
+ /** Utilizes rest service for any CRUD operations @private */
+ private restService: RestService;
+
+ /** packages data service collections @private */
+ private dataService: DataService;
+
+ /** Contains all methods related to shared @private */
+ private sharedService: SharedService;
+
+ /** Contains tranlsate instance @private */
+ private translateService: TranslateService;
+
+ /** Instance of subscriptions @private */
+ private generateDataSub: Subscription;
+
+ constructor(injector: Injector) {
+ this.injector = injector;
+ this.restService = this.injector.get(RestService);
+ this.dataService = this.injector.get(DataService);
+ this.sharedService = this.injector.get(SharedService);
+ this.translateService = this.injector.get(TranslateService);
+ }
+
+ /**
+ * Lifecyle Hooks the trigger before component is instantiate
+ */
+ public ngOnInit(): void {
+ this.generateTableColumn();
+ this.generateTableSettings();
+ this.generateData();
+ this.generateDataSub = this.sharedService.dataEvent.subscribe(() => { this.generateData(); });
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableSettings(): void {
+ this.settings = {
+ actions: { add: false, edit: false, delete: false, position: 'right' },
+ columns: this.columnList,
+ attr: this.sharedService.tableClassConfig(),
+ pager: this.sharedService.paginationPagerConfig(),
+ noDataMessage: this.translateService.instant('NODATAMSG')
+ };
+ }
+
+ /** Generate smart table row title and filters @public */
+ public generateTableColumn(): void {
+ this.columnList = {
+ identifier: { title: this.translateService.instant('IDENTIFIER'), width: '25%', sortDirection: 'asc' },
+ VNFD: {
+ title: this.translateService.instant('VNFD'), width: '20%', type: 'custom',
+ valuePrepareFunction: (cell: VNFInstanceData, row: VNFInstanceData): VNFInstanceData => row,
+ renderComponent: VNFLinkComponent
+ },
+ MemberIndex: { title: this.translateService.instant('MEMBERINDEX'), width: '15%' },
+ NS: { title: this.translateService.instant('NS'), width: '20%' },
+ CreatedAt: { title: this.translateService.instant('CREATEDAT'), width: '15%' },
+ Actions: {
+ name: 'Action', width: '5%', filter: false, sort: false, type: 'custom',
+ title: this.translateService.instant('ACTIONS'),
+ valuePrepareFunction: (cell: VNFInstanceData, row: VNFInstanceData): VNFInstanceData => row,
+ renderComponent: VNFInstancesActionComponent
+ }
+ };
+ }
+
+ /** generateData initiate the vnf-instance list */
+ public generateData(): void {
+ this.isLoadingResults = true;
+ this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]) => {
+ this.vnfInstanceData = [];
+ vnfInstancesData.forEach((vnfInstanceData: VNFInstanceDetails) => {
+ const vnfDataObj: {} =
+ {
+ VNFD: vnfInstanceData['vnfd-ref'],
+ identifier: vnfInstanceData._id,
+ MemberIndex: vnfInstanceData['member-vnf-index-ref'],
+ NS: vnfInstanceData['nsr-id-ref'],
+ VNFID: vnfInstanceData['vnfd-id'],
+ CreatedAt: this.sharedService.convertEpochTime(Number(vnfInstanceData['created-time']))
+ };
+ this.vnfInstanceData.push(vnfDataObj);
+ });
+ if (this.vnfInstanceData.length > 0) {
+ this.checkDataClass = 'dataTables_present';
+ } else {
+ this.checkDataClass = 'dataTables_empty';
+ }
+ this.dataSource.load(this.vnfInstanceData).then((data: {}) => {
+ this.isLoadingResults = false;
+ }).catch();
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLoadingResults = false;
+ });
+ }
+
+ /** smart table listing manipulation @public */
+ public onChange(perPageValue: number): void {
+ this.dataSource.setPaging(1, perPageValue, true);
+ }
+
+ /** smart table listing manipulation @public */
+ public onUserRowSelect(event: MessageEvent): void {
+ Object.assign(event.data, { page: 'vnf-instance' });
+ this.dataService.changeMessage(event.data);
+ }
+
+ /**
+ * Lifecyle hook which get trigger on component destruction
+ */
+ public ngOnDestroy(): void {
+ this.generateDataSub.unsubscribe();
+ }
+}
diff --git a/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.html b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.html
new file mode 100644
index 0000000..450e8a3
--- /dev/null
+++ b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.html
@@ -0,0 +1,18 @@
+<!--
+Copyright 2020 TATA ELXSI
+
+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.
+
+Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+-->
+<a class="link" routerLink="/packages/vnf/edit/{{value.VNFID}}">{{value.VNFD}}</a>
diff --git a/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.scss b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.scss
new file mode 100644
index 0000000..021d205
--- /dev/null
+++ b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.scss
@@ -0,0 +1,17 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts
new file mode 100644
index 0000000..15ea6ff
--- /dev/null
+++ b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts
@@ -0,0 +1,46 @@
+/*
+ Copyright 2020 TATA ELXSI
+
+ 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.
+
+ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
+*/
+/**
+ * @file VNFD Link Component.
+ */
+import { Component, Injector, OnInit } from '@angular/core';
+import { VNFInstanceData } from 'VNFInstanceModel';
+/**
+ * Creating component
+ * @Component takes VNFLinkComponent.html as template url
+ */
+@Component({
+ selector: 'app-vnf-link',
+ templateUrl: './VNFLinkComponent.html',
+ styleUrls: ['./VNFLinkComponent.scss']
+})
+/** Exporting a class @exports VnfLinkComponent */
+export class VNFLinkComponent implements OnInit {
+ /** Invoke service injectors @public */
+ public injector: Injector;
+ /** To get the value from the VNFInstance via valuePrepareFunction default Property of ng-smarttable @public */
+ public value: VNFInstanceData;
+ constructor(injector: Injector) {
+ this.injector = injector;
+ }
+ /** Lifecyle Hooks the trigger before component is instantiate @public */
+ public ngOnInit(): void {
+ //empty
+ }
+
+}