Added DistributeTraffic LCM command support

Proposed change adds support for new LCM API dedicated for
traffic distribution accross different VNFs.

Change-Id: Ib73a9dea6810163f504f5126b35640971eb7f87a
Issue-ID: APPC-1170
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
diff --git a/src/app/test/test.component.spec.ts b/src/app/test/test.component.spec.ts
index 42e8be7..cb69445 100644
--- a/src/app/test/test.component.spec.ts
+++ b/src/app/test/test.component.spec.ts
@@ -426,6 +426,7 @@
             expect(component.getUrlEndPoint('healthcheck')).toEqual('health-check');
             expect(component.getUrlEndPoint('quiescetraffic')).toEqual('quiesce-traffic');
             expect(component.getUrlEndPoint('resumetraffic')).toEqual('resume-traffic');
+            expect(component.getUrlEndPoint('distributetraffic')).toEqual('distribute-traffic');
             expect(component.getUrlEndPoint('startapplication')).toEqual('start-application');
             expect(component.getUrlEndPoint('stopapplication')).toEqual('stop-application');
             expect(component.getUrlEndPoint('upgradebackout')).toEqual('upgrade-backout');
diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts
index 529e628..f3f6a94 100644
--- a/src/app/test/test.component.ts
+++ b/src/app/test/test.component.ts
@@ -482,6 +482,8 @@
                 return 'quiesce-traffic';
             case 'resumetraffic':
                 return 'resume-traffic';
+            case 'distributetraffic':
+                return 'distribute-traffic';
             case 'startapplication':
                 return 'start-application';
             case 'stopapplication':
diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.ts b/src/app/vnfs/build-artifacts/build-artifacts.component.ts
index 095c239..d95b478 100644
--- a/src/app/vnfs/build-artifacts/build-artifacts.component.ts
+++ b/src/app/vnfs/build-artifacts/build-artifacts.component.ts
@@ -28,7 +28,7 @@
 import { NotificationsService } from 'angular2-notifications';
 import { appConstants } from '../../../constants/app-constants';
 
-export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut'];
+export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut', 'DistributeTraffic'];
 
 @Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] })
 export class BuildDesignComponent implements OnInit {
diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
index 28c2a19..f7d1837 100644
--- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
+++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
@@ -84,7 +84,8 @@
         { action: appConstants.Actions.getRunningConfig, value: appConstants.Actions.getRunningConfig },
         { action: appConstants.Actions.healthCheck, value: appConstants.Actions.healthCheck },
         { action: appConstants.Actions.startApplication, value: appConstants.Actions.startApplication },
-        { action: appConstants.Actions.stopApplication, value: appConstants.Actions.stopApplication }
+        { action: appConstants.Actions.stopApplication, value: appConstants.Actions.stopApplication },
+        { action: appConstants.Actions.distributeTraffic, value: appConstants.Actions.distributeTraffic }
     ];
     public uploadTypes = appConstants.uploadTypes;
 
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
index e9a8c64..564cd32 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
@@ -44,7 +44,7 @@
                     <span class="error-message" [hidden]="vnfParams?.vnfType || vnftype.valid || (vnftype.pristine && !userForm.submitted)">Required Field</span>
                 </div>
 
-                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="((displayVnfc=='true') || isVnfcType) && (referenceDataObject['action']=='Configure' || referenceDataObject['action']=='ConfigModify')">
+                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="((displayVnfc=='true') || isVnfcType) && (referenceDataObject['action']=='Configure' || referenceDataObject['action']=='ConfigModify' || referenceDataObject['action']=='DistributeTraffic')">
                     <label>VNFC Type</label>
                     <input *ngIf="isVnfcType" type="text" class="form-control" readonly id="txtVnfcType" [(ngModel)]="referenceDataObject.scope['vnfc-type']" (blur)="setVnfcType($event.target.value)" (ngModelChange)="updateSessionValues($event,'vnfcType')" #vnfcType="ngModel"
                         name="vnfcType">
@@ -55,7 +55,7 @@
                     <a *ngIf="isVnfcTypeList" style="    color: blue;" href="javascript:void(0)" (click)="vnfcModal.open()">Add New VNFC Type</a>
                 </div>
 
-                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="displayVnfc!='true' || (referenceDataObject['action']!='Configure' && referenceDataObject['action']!='ConfigModify')">
+                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="displayVnfc!='true' || (referenceDataObject['action']!='Configure' && referenceDataObject['action']!='ConfigModify' && referenceDataObject['action']!='DistributeTraffic')">
                 </div>
                 <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
                     <label>Device Protocol*</label>
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
index 79be2c5..83d61fe 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
@@ -137,6 +137,7 @@
                         appConstants.Actions.stopApplication,
                         appConstants.Actions.quiesceTraffic,
                         appConstants.Actions.resumeTraffic,
+                        appConstants.Actions.distributeTraffic,
                         appConstants.Actions.upgradeBackout,
                         appConstants.Actions.upgradeBackup,
                         appConstants.Actions.upgradePostCheck,
@@ -185,7 +186,7 @@
     public firstArrayElement = [];
     public remUploadedDataArray = [];
     isConfigScaleOut = false
-    isConfigOrConfigModify = false;
+    isConfigureAction = false;
     configScaleOutExist: boolean = true;
     displayVnfc = 'false';
     isVnfcType: boolean;
@@ -222,9 +223,9 @@
         console.log( this.classNm+": "+methName+": start.");
         this.displayVnfc = sessionStorage.getItem("vnfcSelectionFlag");
         if (this.configScaleOutExist) {
-            this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
+            this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
         } else {
-            this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions'];
+            this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions'];
         }
         this.self = this;
         let path = this.location.path;
@@ -1094,6 +1095,7 @@
             case 'UpgradeBackout':
             case 'ResumeTraffic':
             case 'QuiesceTraffic':
+            case 'DistributeTraffic':
             case 'UpgradeBackup':
             case 'UpgradePostCheck':
             case 'UpgradePreCheck':
@@ -1182,10 +1184,10 @@
                         this.refernceScopeObj.from = '';
                     }
 
-                    if (this.referenceDataObject.action === 'Configure' || this.referenceDataObject.action === 'ConfigModify') {
-                        this.isConfigOrConfigModify = true;
+                    if (this.referenceDataObject.action === 'Configure' || this.referenceDataObject.action === 'ConfigModify' || this.referenceDataObject.action === 'DistributeTraffic') {
+                        this.isConfigureAction = true;
                     } else {
-                        this.isConfigOrConfigModify = false;
+                        this.isConfigureAction = false;
                         delete this.mappingEditorService.newObject['vnfc'];
                     }
 
@@ -1255,7 +1257,7 @@
                 }*/
             ];
         }
-        if (data == 'Configure' || data == 'ConfigModify') {
+        if (data == 'Configure' || data == 'ConfigModify' || data == 'DistributeTraffic') {
             this.nonConfigureAction = false;
         } else {
             this.nonConfigureAction = true;
@@ -1506,7 +1508,7 @@
             this.referenceDataObject.scope['vnfc-type-list'].push(newVnfcTypeV);
         }
         this.tempAllData.forEach(obj => {
-            if (obj.action == "Configure" || obj.action == "ConfigModify") {
+            if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic") {
                 obj.scope['vnfc-type-list'] = this.referenceDataObject.scope['vnfc-type-list']
             }
             this.resetArtifactList(obj);
@@ -1567,7 +1569,7 @@
         //if VNFC is entered set action level & Scope type to VNFC for configure and configure modify, and default the values to vnf and vnf type for all other actions  
         else {
             scopeName = this.referenceDataObject.scope['vnfc-type'];
-            if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify') {
+            if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
                 this.referenceDataObject['action-level'] = 'vnfc';
                 this.referenceDataObject['scopeType'] = 'vnfc-type';
             } else {
@@ -1722,7 +1724,7 @@
         if (newObj.action != 'HealthCheck') {
             delete newObj['url'];
         }
-        if (newObj.action != "Configure" && newObj.action != "ConfigModify") {
+        if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action != "DistributeTraffic") {
             newObj.scope['vnfc-type-list'] = [];
         }
         return newObj
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
index 0be5f68..8afa5bc 100644
--- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
@@ -92,7 +92,8 @@
     { action: "GetRunningConfig", value: "GetRunningConfig" },
     { action: "HealthCheck", value: "HealthCheck" },
     { action: "StartApplication", value: "StartApplication" },
-    { action: "StopApplication", value: "StopApplication" }
+    { action: "StopApplication", value: "StopApplication" },
+    { action: "DistributeTraffic", value: "DistributeTraffic" }
   ];
   options = {
     timeOut: 1000,
diff --git a/src/constants/app-constants.ts b/src/constants/app-constants.ts
index 290d299..bd06feb 100644
--- a/src/constants/app-constants.ts
+++ b/src/constants/app-constants.ts
@@ -63,6 +63,7 @@
         "stopApplication": "StopApplication",
         "quiesceTraffic": "QuiesceTraffic",
         "resumeTraffic": "ResumeTraffic",
+        "distributeTraffic": "DistributeTraffic",
         "upgradeBackout": "UpgradeBackout",
         "upgradeBackup": "UpgradeBackup",
         "upgradePostCheck": "UpgradePostCheck",