fix: change type and key of parameters 56/112156/2
authorwangyuerg <wangyuerg@chinamobile.com>
Fri, 4 Sep 2020 10:30:46 +0000 (18:30 +0800)
committerYue Wang <wangyuerg@chinamobile.com>
Mon, 7 Sep 2020 01:46:37 +0000 (01:46 +0000)
Change-Id: I51f96580758f10c9bc7bcc7d909b5d7b3bb5d7e9
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Issue-ID: USECASEUI-444

usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json
usecaseui-portal/src/app/shared/utils/utils.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html
usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts
usecaseui-portal/src/constants/constants.ts

index a9640f4..0db434d 100644 (file)
             "suggest_nsi_name": "eMBB instance1",\r
             "an_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411a",\r
             "an_suggest_nssi_name": "eMBB ANinstance1",\r
-            "an_service_snssai": "an_1-010101",\r
-            "an_resource_sharing_level": "shared",\r
-            "an_ue_mobility_level": "stationary",\r
+            "sliceProfile_AN_sNSSAI": "an_1-010101",\r
+            "sliceProfile_AN_resourceSharingLevel": "shared",\r
+            "sliceProfile_AN_uEMobilityLevel": "stationary",\r
             "an_latency": "10",\r
-            "an_max_number_of_ues": "10000",\r
-            "an_max_number_of_pud_session":"10000",\r
-            "an_activity_factor": "60",\r
-            "an_exp_data_rate_dl": "300",\r
-            "an_exp_data_rate_ul": "300",\r
-            "an_area_traffic_cap_dl": "300",\r
-            "an_area_traffic_cap_ul": "300",\r
-            "an_overalluser_density":"test_an_overalluser_density_01",\r
+            "sliceProfile_AN_maxNumberofUEs": "10000",\r
+            "sliceProfile_AN_maxNumberofPDUSession":"10000",\r
+            "sliceProfile_AN_activityFactor": "60",\r
+            "sliceProfile_AN_expDataRateDL": "300",\r
+            "sliceProfile_AN_expDataRateUL": "300",\r
+            "sliceProfile_AN_areaTrafficCapDL": "300",\r
+            "sliceProfile_AN_areaTrafficCapUL": "300",\r
+            "sliceProfile_AN_overallUserDensity":"test_an_overalluser_density_01",\r
             "an_enableNSSISelection":false,\r
-            "an_Endpoint":[\r
-                {\r
-                    "an_ip_address":"test_an_ip_address_01"\r
-                },\r
-                {\r
-                    "an_logical_link": "test_an_logical_link_01"\r
-                },\r
-                {\r
-                    "an_nexthop_info":"test_info_01"\r
-                }\r
-            ],\r
+            "sliceProfile_AN_ipAddress":"test_an_ip_address_01",\r
+            "sliceProfile_AN_logicInterfaceId":"test_an_logical_link_01",\r
+            "sliceProfile_AN_nextHopInfo":"sliceProfile_AN_nextHopInfo",\r
             "an_script_name":"test_an_01",\r
             "an_coverage_area_ta_list": ["北京;北京市;海淀区", "北京;北京市;西城区", "北京;北京市;昌平区"],\r
             "tn_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411b",\r
@@ -73,8 +65,8 @@
             "tn_latency": "10",\r
             "tn_bandwidth": "300",\r
             "tn_script_name":"test_tn_01",\r
-            "tn_jitter":"test_tn_jitter_01",\r
-            "tn_service_snssai":"test_tn_service_snssai_01",\r
+            "sliceProfile_TN_jitte":"test_tn_jitter_01",\r
+            "sliceProfile_TN_sNSSAI":"test_tn_service_snssai_01",\r
             "tn_enableNSSISelection":false,\r
             "cn_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411c",\r
             "cn_suggest_nssi_name": "eMBB CNinstance3",\r
             "cn_area_traffic_cap_dl": "300",\r
             "cn_area_traffic_cap_ul": "300",\r
             "cn_script_name":"test_cn_01",\r
-            "cn_max_number_of_pud_session":"10000",\r
-            "cn_overalluser_density":"test_cn_overalluser_density_01",\r
+            "sliceProfile_CN_maxNumberofPDUSession":"10000",\r
+            "sliceProfile_CN_overallUserDensity":"test_cn_overalluser_density_01",\r
             "cn_enableNSSISelection":true,\r
-            "cn_Endpoint":[\r
-                {\r
-                    "cn_ip_address":"test_cn_ip_address_01"\r
-                },\r
-                {\r
-                    "cn_logical_link": "test_cn_logical_link_01"\r
-                },\r
-                {\r
-                    "cn_nexthop_info":"test_info_01"\r
-                }\r
-            ]\r
+            "sliceProfile_CN_coverageAreaTAList": "",\r
+            "sliceProfile_CN_ipAddress":"1.1.1.1",\r
+            "sliceProfile_CN_logicInterfaceId":"2222",\r
+            "sliceProfile_CN_nextHopInfo":"nexthopj"\r
         }\r
 \r
     }\r
index ad6a2f1..6864d60 100644 (file)
@@ -79,7 +79,7 @@ export class Util {
                        return false;
                } else if (isNaN(parseInt(value))) {
                        return false;
-               } else if (Number(value) >= 0 && Number(value)%1 !== 0){
+               } else if (Number(value) < 0 || (Number(value)%1 !== 0)){
                        return false;
                } else {
                        return true;
@@ -90,7 +90,7 @@ export class Util {
     }
     isEmpty (a: any): boolean {
         const type = this.judgeType(a);
-        if (type === 'object Null' || type === '[object undefined]' || a === false || a === '') {
+        if (type === 'object Null' || type === '[object undefined]' || a === '') {
             return true;
         } else {
             return false;
@@ -122,4 +122,12 @@ export class Util {
                }
                return true;
     }
+    pick(obj: object, arr: Array<string>): Object {
+        return arr.reduce((iter, val) => {
+          if(val in obj) {
+            iter[val] = obj[val];
+          }
+          return iter;
+        }, {});
+      }
 }
\ No newline at end of file
index c9f6121..ae5102a 100644 (file)
@@ -159,23 +159,25 @@ export class SlicingTaskModelComponent implements OnInit {
         // 前端模拟数据
         let area = ["Beijing;Beijing;Haidian District", "Beijing;Beijing;Xicheng District", "Beijing;Beijing;Changping District"];
         this.slicingSubnet[0].params = {...this.pick(nsi_nssi_info, [
-                'an_service_snssai',
-                'an_resource_sharing_level',
-                'an_ue_mobility_level',
+                'sliceProfile_AN_sNSSAI',
+                'sliceProfile_AN_resourceSharingLevel',
+                'sliceProfile_AN_uEMobilityLevel',
                 'an_latency',
-                'an_max_number_of_ues',
-                'an_activity_factor',
-                'an_exp_data_rate_dl',
-                'an_exp_data_rate_ul',
-                'an_area_traffic_cap_dl',
-                'an_area_traffic_cap_ul',
+                'sliceProfile_AN_maxNumberofUEs',
+                'sliceProfile_AN_activityFactor',
+                'sliceProfile_AN_expDataRateDL',
+                'sliceProfile_AN_expDataRateUL',
+                'sliceProfile_AN_areaTrafficCapDL',
+                'sliceProfile_AN_areaTrafficCapUL',
                 'an_script_name',
-                'an_overalluser_density',
-                'an_Endpoint',
+                'sliceProfile_AN_overallUserDensity',
                 'an_enableNSSISelection',
-                'an_max_number_of_pud_session'
+                'sliceProfile_AN_maxNumberofPDUSession',
+                'sliceProfile_AN_ipAddress',
+                'sliceProfile_AN_logicInterfaceId',
+                'sliceProfile_AN_nextHopInfo'
             ]), an_coverage_area_ta_list: area};
-        this.slicingSubnet[1].params = this.pick(nsi_nssi_info, ['tn_latency', 'tn_bandwidth', 'tn_script_name', 'tn_jitter', 'tn_service_snssai',"tn_enableNSSISelection"]);
+        this.slicingSubnet[1].params = this.pick(nsi_nssi_info, ['tn_latency', 'tn_bandwidth', 'tn_script_name', 'sliceProfile_TN_jitte', 'sliceProfile_TN_sNSSAI',"tn_enableNSSISelection"]);
         this.slicingSubnet[2].params = {...this.pick(nsi_nssi_info, [
           'cn_service_snssai',
           'cn_resource_sharing_level',
@@ -188,10 +190,12 @@ export class SlicingTaskModelComponent implements OnInit {
           'cn_area_traffic_cap_dl',
           'cn_area_traffic_cap_ul',
           'cn_script_name',
-          'cn_overalluser_density',
-          'cn_Endpoint',
+          'sliceProfile_CN_overallUserDensity',
           'cn_enableNSSISelection',
-          'cn_max_number_of_pud_session'
+          'sliceProfile_CN_maxNumberofPDUSession',
+          'sliceProfile_CN_logicInterfaceId',
+          'sliceProfile_CN_ipAddress',
+          'sliceProfile_CN_nextHopInfo'
         ])};
       } else {
         this.message.error(result_message || 'Failed to get data')
index 93e6f48..cde444b 100644 (file)
                                                                <input nz-input
                                                                   [id]="option.key"
                                                                   [name]="option.key"
-                                                                  [title]="EndpointInputs[i][option.key]"
-                                                                  [(ngModel)]="EndpointInputs[i][option.key]"
+                                                                  [title]="EndpointInputs[option.key]"
+                                                                  [(ngModel)]="EndpointInputs[option.key]"
                                                                   [placeholder]="option.holder"
-                                                                  (input)="onInput($event, option.title)"
                                                                   style="width:32%;margin-right:1%" />
-                                                               <div class="end_alert_ip" *ngIf="option.title === 'ip_address'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div>
-                                                               <div class="end_alert_logical"  *ngIf="option.title === 'logical_link'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div>
-                                                               <div class="end_alert_nexthop"  *ngIf="option.title === 'nexthop_info'">{{validateEndPoint(option.title, EndpointInputs[i][option.key])}}</div>
+                                                               <div class="end_alert_ip" *ngIf="option.title === 'ip_address'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div>
+                                                               <div class="end_alert_logical"  *ngIf="option.title === 'logical_link'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div>
+                                                               <div class="end_alert_nexthop"  *ngIf="option.title === 'nexthop_info'">{{validateEndPoint(option.title, EndpointInputs[option.key])}}</div>
                                                        </div>
                                                </div>
                                        </nz-input-group>
index fb1e5b5..9d1ee34 100644 (file)
@@ -24,8 +24,9 @@ export class SubnetParamsModelComponent implements OnInit {
        areaList: any[] = [];
     // 2020.08.17  Add 3 parameters for Endpoint, Comment: The following code
     NexthopInfoOptions = NexthopInfo_Options;
-    EndpointInputs: any[] = [];
+    EndpointInputs: object = {};
        EndpointEnable: boolean = true;  // Whether to enable the three parameters of Endpoint
+       keyList: string[] = []; // keys of endPoint
     //  Comment: Above code
 
        constructor(
@@ -41,16 +42,13 @@ export class SubnetParamsModelComponent implements OnInit {
                if(this.title){
                        this.coreFormItems = this.title === 'An'?CORE_FORM_ITEMS.An:this.title === 'Cn'?CORE_FORM_ITEMS.Cn:[];
                        this.formData = JSON.parse(JSON.stringify(this.detailData));
+                       this.keyList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options.map((val) => {return val.key});
             if(this.formData !==undefined && Object.keys(this.formData).length!==0){
-                this.EndpointEnable = (this.formData.hasOwnProperty("an_Endpoint") && this.formData['an_Endpoint'].length!==0) || (this.formData.hasOwnProperty("cn_Endpoint") && this.formData['cn_Endpoint'].length!==0)
+                               this.EndpointEnable = this.keyList.every((item) => {return this.formData.hasOwnProperty(item)})
             }
             // -------> 2020.08.17  Add 3 parameters for Endpoint, Comment: The following code
             if(this.EndpointEnable){
-                this.EndpointInputs = this.title === 'An'
-                    ?this.formData["an_Endpoint"]
-                    :this.title === 'Cn'
-                        ?this.formData["cn_Endpoint"]
-                        :[];
+                               this.EndpointInputs = this.Util.pick(this.formData, this.keyList)// no?
             }else{
                 this.coreFormItems.map((item,index)=>{
                     if(item.title === 'Endpoint'){
@@ -85,21 +83,21 @@ export class SubnetParamsModelComponent implements OnInit {
                }
        }
 
-       onInput ($event:any, title: string) {
-               if (!$event) {
-                       return;
-               }
-               const target = $event.target;
-               if (title === 'ip_address') {
-                   // only number and '.' can be inputted
-                       const regexp = /[^\d^\.]+/g;
-                       target.value = target.value.replace(regexp, '');
-               } else if (title === 'logical_link') {
-                   // only number can be inputted
-                       const regxp = /[^\d]/g;
-                       target.value = target.value.replace(regxp, '');
-               }
-       }
+       // onInput ($event:any, title: string) {
+       //      if (!$event) {
+       //              return;
+       //      }
+       //      const target = $event.target;
+       //      if (title === 'ip_address') {
+       //          // only number and '.' can be inputted
+       //              const regexp = /[^\d^\.]+/g;
+       //              target.value = target.value.replace(regexp, '');
+       //      } else if (title === 'logical_link') {
+       //          // only number can be inputted
+       //              const regxp = /[^\d]/g;
+       //              target.value = target.value.replace(regxp, '');
+       //      }
+       // }
        AreaFormatting () {
                let areaList = [...this.formData.an_coverage_area_ta_list];
                this.areaList = areaList.map ( (item: any) => {
@@ -212,35 +210,27 @@ export class SubnetParamsModelComponent implements OnInit {
        endCheckBeforeSubmit () : Array<any>{
                // check params of Endpoint
                let result: Array<any> = [true, ''];
-               let formatedEndpoint = {};
-               this.EndpointInputs.forEach((item) => {
-                       formatedEndpoint[Object.keys(item)[0]] = item[Object.keys(item)[0]];
-               })
-               if (this.title === 'An') {
-                       for (let prop in formatedEndpoint) {
-                               if (prop === 'an_ip_address') {
-                                       if (!this.regxpIP.test(formatedEndpoint[prop])) {
-                                               result = [false, 'Illegal IpAddress']
-                                       }
-                               } else if (prop === 'an_logical_link') {
-                                       if (!this.Util.isInteger(formatedEndpoint[prop])) {
-                                               result = [false, 'LogicalID can only be an integer']
-                                       }
+               const endPointList = this.coreFormItems.find((item) => {return item.title === 'Endpoint'}).options;
+               let ipKey = '';
+               let logicalKey = '';
+               for (let item of endPointList) {
+                       if (item.title === 'ip_address') {
+                               ipKey = item.key
+                       } else if (item.title === 'logical_link') {
+                               logicalKey = item.key
+                       }
+               }
+               for (let prop in this.EndpointInputs) {
+                       if (prop === ipKey) {
+                               if (!this.regxpIP.test(this.EndpointInputs[prop])) {
+                                       result = [false, 'Illegal IpAddress']
                                }
-                       } 
-               } else if (this.title === 'Cn') {
-                       for (let prop in formatedEndpoint) {
-                               if (prop === 'cn_ip_address') {
-                                       if (!this.regxpIP.test(formatedEndpoint[prop])) {
-                                               result = [false, 'Illegal IpAddress']
-                                       }
-                               } else if (prop === 'cn_logical_link') {
-                                       if (!this.Util.isInteger(formatedEndpoint[prop])) {
-                                               result = [false, 'LogicalID can only be an integer']
-                                       }
+                       } else if (prop === logicalKey) {
+                               if (!this.Util.isInteger(this.EndpointInputs[prop])) {
+                                       result = [false, 'LogicalID can only be an integer']
                                }
-                       } 
-               }
+                       }
+               } 
                return result;
        }
 
@@ -270,6 +260,12 @@ export class SubnetParamsModelComponent implements OnInit {
                        this.message.error(endCheckResult[1].toString());
                        return;
                }
+               // replace the params about endPoint
+               for (let prop in this.formData) {
+                       if (typeof this.EndpointInputs[prop] !== 'undefined') {
+                               this.formData[prop] = this.EndpointInputs[prop];
+                       }
+               }
                let params: object;
                if (this.title === 'An') {
                        const an_coverage_area_ta_list: string[] = [];
index 14a323f..0ddb23b 100644 (file)
@@ -132,7 +132,7 @@ export const BUSINESS_REQUIREMENT = [
 export const TRANSFRER_FORM_ITEMS = [\r
     {\r
         title: 'S-NSSAI',\r
-        key: 'tn_service_snssai',\r
+        key: 'iceProfile_TN_sNSSAI',\r
         required: true\r
     },\r
        {\r
@@ -142,7 +142,7 @@ export const TRANSFRER_FORM_ITEMS = [
     },\r
     {\r
         title: 'Jitter',\r
-        key: 'tn_jitter',\r
+        key: 'sliceProfile_TN_jitte',\r
         required: false,\r
     },\r
        {\r
@@ -156,12 +156,12 @@ export const CORE_FORM_ITEMS = {
     "An": [\r
         {\r
             title: 'S-NSSAI',\r
-            key: 'an_service_snssai',\r
+            key: 'sliceProfile_AN_sNSSAI',\r
             required: true\r
         },\r
         {\r
             title: 'Resource Sharing Level',\r
-            key: 'an_resource_sharing_level',\r
+            key: 'sliceProfile_AN_resourceSharingLevel',\r
             required: true,\r
             options: [\r
                 {\r
@@ -176,7 +176,7 @@ export const CORE_FORM_ITEMS = {
         },\r
         {\r
             title: 'Mobility',\r
-            key: 'an_ue_mobility_level',\r
+            key: 'sliceProfile_AN_uEMobilityLevel',\r
             required: true,\r
             options: [\r
                 {\r
@@ -204,38 +204,38 @@ export const CORE_FORM_ITEMS = {
         },\r
         {\r
             title: 'Max Number of PUD Session',\r
-            key: 'an_max_number_of_pud_session',\r
+            key: 'sliceProfile_AN_maxNumberofPDUSession',\r
             required: true\r
         },\r
         {\r
             title: 'Max Number of UEs',\r
-            key: 'an_max_number_of_ues',\r
+            key: 'sliceProfile_AN_maxNumberofUEs',\r
             required: true\r
         },\r
         {\r
             title: 'Activity Factor (%)',\r
-            key: 'an_activity_factor',\r
+            key: 'sliceProfile_AN_activityFactor',\r
             required: true\r
         },\r
         {\r
             title: 'User Downlink Experience Rate(Mbps)',\r
-            key: 'an_exp_data_rate_dl',\r
+            key: 'sliceProfile_AN_expDataRateDL',\r
             required: true\r
         },\r
         {\r
             title: 'User Uplink Experience Rate(Mbps)',\r
-            key: 'an_exp_data_rate_ul',\r
+            key: 'sliceProfile_AN_expDataRateUL',\r
             required: true\r
         },\r
         {\r
             title: 'Downlink Regional Traffic Density(Mbps/km )',\r
-            key: 'an_area_traffic_cap_dl',\r
+            key: 'sliceProfile_AN_areaTrafficCapDL',\r
             required: true\r
         },\r
         {\r
             title: 'Uplink Regional Traffic Density(Mbps/km )',\r
-            key: 'an_area_traffic_cap_ul',\r
-            required: true\r
+            key: 'sliceProfile_AN_areaTrafficCapUL',\r
+            required: true,\r
         },\r
         {\r
             title: 'Script Name',\r
@@ -244,7 +244,7 @@ export const CORE_FORM_ITEMS = {
         },\r
         {\r
             title: 'Overall User Density',\r
-            key: 'an_overalluser_density',\r
+            key: 'sliceProfile_AN_overallUserDensity',\r
             required: true\r
         },\r
         {\r
@@ -254,21 +254,39 @@ export const CORE_FORM_ITEMS = {
             options: [\r
                 {\r
                     title: 'ip_address',\r
-                    key: 'an_ip_address',\r
+                    key: 'sliceProfile_AN_ipAddress',\r
                     holder: 'IpAddress'\r
                 },\r
                 {\r
                     title: 'logical_link',\r
-                    key: 'an_logical_link',\r
+                    key: 'sliceProfile_AN_logicInterfaceId',\r
                     holder: 'LogicId'\r
                 },\r
                 {\r
                     title: 'nexthop_info',\r
-                    key: 'an_nexthop_info',\r
+                    key: 'sliceProfile_AN_nextHopInfo',\r
                     holder: 'NextHop'\r
                 }\r
             ]\r
         },\r
+        // {\r
+        //     title: 'ip_address',\r
+        //     key: 'an_coverage_area_ta_list',\r
+        //     required: true,\r
+        //     holder: 'IpAddress'\r
+        // },\r
+        // {\r
+        //     title: 'logical_link',\r
+        //     key: 'sliceProfile_AN_logicInterfaceId',\r
+        //     required: true,\r
+        //     holder: 'LogicalId'\r
+        // },\r
+        // {\r
+        //     title: 'nexthop_info',\r
+        //     key: 'sliceProfile_AN_nextHopInfo',\r
+        //     required: true,\r
+        //     holder: 'NextHop'\r
+        // },\r
         {\r
             title: 'Coverage Area Ta List',\r
             key: 'an_coverage_area_ta_list',\r
@@ -361,14 +379,32 @@ export const CORE_FORM_ITEMS = {
         },\r
         {\r
             title: 'Max Number of PUD Session',\r
-            key: 'cn_max_number_of_pud_session',\r
+            key: 'sliceProfile_CN_maxNumberofPDUSession',\r
             required: true\r
         },\r
         {\r
             title: 'OverAll User Density',\r
-            key: 'cn_overalluser_density',\r
+            key: 'sliceProfile_CN_overallUserDensity',\r
             required: true\r
         },\r
+        // {\r
+        //     title: 'ip-address',\r
+        //     key: 'sliceProfile_CN_ipAddress',\r
+        //     required: true,\r
+        //     holder: 'IpAddress'\r
+        // },\r
+        // {\r
+        //     title: 'logical_link',\r
+        //     key: 'sliceProfile_CN_logicInterfaceId',\r
+        //     required: true,\r
+        //     holder: 'LogicId'\r
+        // },\r
+        // {\r
+        //     title: 'cn_nexthop_info',\r
+        //     key: 'sliceProfile_CN_nextHopInfo',\r
+        //     required: true,\r
+        //     holder: 'NextHop'\r
+        // },\r
         {\r
             title:'Endpoint',\r
             key:"cn_Endpoint",\r
@@ -376,17 +412,17 @@ export const CORE_FORM_ITEMS = {
             options: [\r
                 {\r
                     title: 'ip_address',\r
-                    key: 'cn_ip_address',\r
+                    key: 'sliceProfile_CN_ipAddress',\r
                     holder: 'IpAddress'\r
                 },\r
                 {\r
                     title: 'logical_link',\r
-                    key: 'cn_logical_link',\r
+                    key: 'sliceProfile_CN_logicInterfaceId',\r
                     holder: 'LogicId'\r
                 },\r
                 {\r
                     title: 'nexthop_info',\r
-                    key: 'cn_nexthop_info',\r
+                    key: 'sliceProfile_CN_nextHopInfo',\r
                     holder: 'NextHop'\r
                 }\r
             ]\r