diff options
author | wangyuerg <wangyuerg@chinamobile.com> | 2020-09-04 18:30:46 +0800 |
---|---|---|
committer | Yue Wang <wangyuerg@chinamobile.com> | 2020-09-07 01:46:37 +0000 |
commit | 926b57b4d540c73f1930e6d2d2070e5ac6939e5d (patch) | |
tree | 0e7cbc7ef248ededda4e1a96ca10cd31347dcc55 /usecaseui-portal/src | |
parent | c271c4e5c5f63753f7545bea64b7d24551fb3d2c (diff) |
fix: change type and key of parameters
Change-Id: I51f96580758f10c9bc7bcc7d909b5d7b3bb5d7e9
Signed-off-by: wangyuerg <wangyuerg@chinamobile.com>
Issue-ID: USECASEUI-444
Diffstat (limited to 'usecaseui-portal/src')
6 files changed, 160 insertions, 132 deletions
diff --git a/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json b/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json index a9640f48..0db434df 100644 --- a/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json +++ b/usecaseui-portal/src/app/mock/json/slicing_task_auditInfo.json @@ -42,30 +42,22 @@ "suggest_nsi_name": "eMBB instance1",
"an_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411a",
"an_suggest_nssi_name": "eMBB ANinstance1",
- "an_service_snssai": "an_1-010101",
- "an_resource_sharing_level": "shared",
- "an_ue_mobility_level": "stationary",
+ "sliceProfile_AN_sNSSAI": "an_1-010101",
+ "sliceProfile_AN_resourceSharingLevel": "shared",
+ "sliceProfile_AN_uEMobilityLevel": "stationary",
"an_latency": "10",
- "an_max_number_of_ues": "10000",
- "an_max_number_of_pud_session":"10000",
- "an_activity_factor": "60",
- "an_exp_data_rate_dl": "300",
- "an_exp_data_rate_ul": "300",
- "an_area_traffic_cap_dl": "300",
- "an_area_traffic_cap_ul": "300",
- "an_overalluser_density":"test_an_overalluser_density_01",
+ "sliceProfile_AN_maxNumberofUEs": "10000",
+ "sliceProfile_AN_maxNumberofPDUSession":"10000",
+ "sliceProfile_AN_activityFactor": "60",
+ "sliceProfile_AN_expDataRateDL": "300",
+ "sliceProfile_AN_expDataRateUL": "300",
+ "sliceProfile_AN_areaTrafficCapDL": "300",
+ "sliceProfile_AN_areaTrafficCapUL": "300",
+ "sliceProfile_AN_overallUserDensity":"test_an_overalluser_density_01",
"an_enableNSSISelection":false,
- "an_Endpoint":[
- {
- "an_ip_address":"test_an_ip_address_01"
- },
- {
- "an_logical_link": "test_an_logical_link_01"
- },
- {
- "an_nexthop_info":"test_info_01"
- }
- ],
+ "sliceProfile_AN_ipAddress":"test_an_ip_address_01",
+ "sliceProfile_AN_logicInterfaceId":"test_an_logical_link_01",
+ "sliceProfile_AN_nextHopInfo":"sliceProfile_AN_nextHopInfo",
"an_script_name":"test_an_01",
"an_coverage_area_ta_list": ["北京;北京市;海淀区", "北京;北京市;西城区", "北京;北京市;昌平区"],
"tn_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411b",
@@ -73,8 +65,8 @@ "tn_latency": "10",
"tn_bandwidth": "300",
"tn_script_name":"test_tn_01",
- "tn_jitter":"test_tn_jitter_01",
- "tn_service_snssai":"test_tn_service_snssai_01",
+ "sliceProfile_TN_jitte":"test_tn_jitter_01",
+ "sliceProfile_TN_sNSSAI":"test_tn_service_snssai_01",
"tn_enableNSSISelection":false,
"cn_suggest_nssi_id": "46da8cf8-0878-48ac-bea3-f2200959411c",
"cn_suggest_nssi_name": "eMBB CNinstance3",
@@ -89,20 +81,13 @@ "cn_area_traffic_cap_dl": "300",
"cn_area_traffic_cap_ul": "300",
"cn_script_name":"test_cn_01",
- "cn_max_number_of_pud_session":"10000",
- "cn_overalluser_density":"test_cn_overalluser_density_01",
+ "sliceProfile_CN_maxNumberofPDUSession":"10000",
+ "sliceProfile_CN_overallUserDensity":"test_cn_overalluser_density_01",
"cn_enableNSSISelection":true,
- "cn_Endpoint":[
- {
- "cn_ip_address":"test_cn_ip_address_01"
- },
- {
- "cn_logical_link": "test_cn_logical_link_01"
- },
- {
- "cn_nexthop_info":"test_info_01"
- }
- ]
+ "sliceProfile_CN_coverageAreaTAList": "",
+ "sliceProfile_CN_ipAddress":"1.1.1.1",
+ "sliceProfile_CN_logicInterfaceId":"2222",
+ "sliceProfile_CN_nextHopInfo":"nexthopj"
}
}
diff --git a/usecaseui-portal/src/app/shared/utils/utils.ts b/usecaseui-portal/src/app/shared/utils/utils.ts index ad6a2f10..6864d60d 100644 --- a/usecaseui-portal/src/app/shared/utils/utils.ts +++ b/usecaseui-portal/src/app/shared/utils/utils.ts @@ -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 diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts index c9f61215..ae5102ae 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/slicing-task-model.component.ts @@ -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') diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html index 93e6f485..cde444bf 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.html @@ -47,14 +47,13 @@ <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> diff --git a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts index fb1e5b55..9d1ee34d 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/slicing-task-management/slicing-task-model/subnet-params-model/subnet-params-model.component.ts @@ -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[] = []; diff --git a/usecaseui-portal/src/constants/constants.ts b/usecaseui-portal/src/constants/constants.ts index 14a323fe..0ddb23b3 100644 --- a/usecaseui-portal/src/constants/constants.ts +++ b/usecaseui-portal/src/constants/constants.ts @@ -132,7 +132,7 @@ export const BUSINESS_REQUIREMENT = [ export const TRANSFRER_FORM_ITEMS = [
{
title: 'S-NSSAI',
- key: 'tn_service_snssai',
+ key: 'iceProfile_TN_sNSSAI',
required: true
},
{
@@ -142,7 +142,7 @@ export const TRANSFRER_FORM_ITEMS = [ },
{
title: 'Jitter',
- key: 'tn_jitter',
+ key: 'sliceProfile_TN_jitte',
required: false,
},
{
@@ -156,12 +156,12 @@ export const CORE_FORM_ITEMS = { "An": [
{
title: 'S-NSSAI',
- key: 'an_service_snssai',
+ key: 'sliceProfile_AN_sNSSAI',
required: true
},
{
title: 'Resource Sharing Level',
- key: 'an_resource_sharing_level',
+ key: 'sliceProfile_AN_resourceSharingLevel',
required: true,
options: [
{
@@ -176,7 +176,7 @@ export const CORE_FORM_ITEMS = { },
{
title: 'Mobility',
- key: 'an_ue_mobility_level',
+ key: 'sliceProfile_AN_uEMobilityLevel',
required: true,
options: [
{
@@ -204,38 +204,38 @@ export const CORE_FORM_ITEMS = { },
{
title: 'Max Number of PUD Session',
- key: 'an_max_number_of_pud_session',
+ key: 'sliceProfile_AN_maxNumberofPDUSession',
required: true
},
{
title: 'Max Number of UEs',
- key: 'an_max_number_of_ues',
+ key: 'sliceProfile_AN_maxNumberofUEs',
required: true
},
{
title: 'Activity Factor (%)',
- key: 'an_activity_factor',
+ key: 'sliceProfile_AN_activityFactor',
required: true
},
{
title: 'User Downlink Experience Rate(Mbps)',
- key: 'an_exp_data_rate_dl',
+ key: 'sliceProfile_AN_expDataRateDL',
required: true
},
{
title: 'User Uplink Experience Rate(Mbps)',
- key: 'an_exp_data_rate_ul',
+ key: 'sliceProfile_AN_expDataRateUL',
required: true
},
{
title: 'Downlink Regional Traffic Density(Mbps/km )',
- key: 'an_area_traffic_cap_dl',
+ key: 'sliceProfile_AN_areaTrafficCapDL',
required: true
},
{
title: 'Uplink Regional Traffic Density(Mbps/km )',
- key: 'an_area_traffic_cap_ul',
- required: true
+ key: 'sliceProfile_AN_areaTrafficCapUL',
+ required: true,
},
{
title: 'Script Name',
@@ -244,7 +244,7 @@ export const CORE_FORM_ITEMS = { },
{
title: 'Overall User Density',
- key: 'an_overalluser_density',
+ key: 'sliceProfile_AN_overallUserDensity',
required: true
},
{
@@ -254,21 +254,39 @@ export const CORE_FORM_ITEMS = { options: [
{
title: 'ip_address',
- key: 'an_ip_address',
+ key: 'sliceProfile_AN_ipAddress',
holder: 'IpAddress'
},
{
title: 'logical_link',
- key: 'an_logical_link',
+ key: 'sliceProfile_AN_logicInterfaceId',
holder: 'LogicId'
},
{
title: 'nexthop_info',
- key: 'an_nexthop_info',
+ key: 'sliceProfile_AN_nextHopInfo',
holder: 'NextHop'
}
]
},
+ // {
+ // title: 'ip_address',
+ // key: 'an_coverage_area_ta_list',
+ // required: true,
+ // holder: 'IpAddress'
+ // },
+ // {
+ // title: 'logical_link',
+ // key: 'sliceProfile_AN_logicInterfaceId',
+ // required: true,
+ // holder: 'LogicalId'
+ // },
+ // {
+ // title: 'nexthop_info',
+ // key: 'sliceProfile_AN_nextHopInfo',
+ // required: true,
+ // holder: 'NextHop'
+ // },
{
title: 'Coverage Area Ta List',
key: 'an_coverage_area_ta_list',
@@ -361,14 +379,32 @@ export const CORE_FORM_ITEMS = { },
{
title: 'Max Number of PUD Session',
- key: 'cn_max_number_of_pud_session',
+ key: 'sliceProfile_CN_maxNumberofPDUSession',
required: true
},
{
title: 'OverAll User Density',
- key: 'cn_overalluser_density',
+ key: 'sliceProfile_CN_overallUserDensity',
required: true
},
+ // {
+ // title: 'ip-address',
+ // key: 'sliceProfile_CN_ipAddress',
+ // required: true,
+ // holder: 'IpAddress'
+ // },
+ // {
+ // title: 'logical_link',
+ // key: 'sliceProfile_CN_logicInterfaceId',
+ // required: true,
+ // holder: 'LogicId'
+ // },
+ // {
+ // title: 'cn_nexthop_info',
+ // key: 'sliceProfile_CN_nextHopInfo',
+ // required: true,
+ // holder: 'NextHop'
+ // },
{
title:'Endpoint',
key:"cn_Endpoint",
@@ -376,17 +412,17 @@ export const CORE_FORM_ITEMS = { options: [
{
title: 'ip_address',
- key: 'cn_ip_address',
+ key: 'sliceProfile_CN_ipAddress',
holder: 'IpAddress'
},
{
title: 'logical_link',
- key: 'cn_logical_link',
+ key: 'sliceProfile_CN_logicInterfaceId',
holder: 'LogicId'
},
{
title: 'nexthop_info',
- key: 'cn_nexthop_info',
+ key: 'sliceProfile_CN_nextHopInfo',
holder: 'NextHop'
}
]
|