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/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];
+    }
+}