From fa8c149a384fdea9c584691ea1275fc397177e8e Mon Sep 17 00:00:00 2001 From: Kunhui-Li Date: Wed, 27 Jul 2022 13:12:29 +0800 Subject: [PATCH] cofig_tools: apply vBDF pattern check to vUART and ivshmem apply vBDF pattern check to vUART and ivshmem. Tracked-On: #7925 Signed-off-by: Kunhui-Li Reviewed-by: Junjie Mao --- .../ConfigForm/CustomWidget/IVSHMEM_REGION.vue | 9 +++++++-- .../Config/ConfigForm/CustomWidget/VUART.vue | 15 +++++++++++++-- misc/config_tools/schema/types.xsd | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/IVSHMEM_REGION.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/IVSHMEM_REGION.vue index 948f414b7..ba22f59ee 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/IVSHMEM_REGION.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/IVSHMEM_REGION.vue @@ -87,9 +87,9 @@ - + - must have value + {{ this.VBDFType["err:pattern"] }} @@ -171,6 +171,7 @@ export default { IVSHMEMSize: this.rootSchema.definitions['IVSHMEMSize']['enum'], IVSHMEMRegionType: this.rootSchema.definitions['IVSHMEMRegionType'], IVSHMEM_VM: this.rootSchema.definitions['IVSHMEMVM'], + VBDFType: this.rootSchema.definitions['VBDFType'], defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath) }; }, @@ -196,6 +197,10 @@ export default { var regexp = new RegExp(this.IVSHMEMRegionType.properties.NAME.pattern); return (value != null) && regexp.test(value); }, + validateVBDF(value) { + var regexp = new RegExp(this.VBDFType.pattern); + return (value != null) && regexp.test(value); + }, validation(value) { return (value != null) && (value.length !== 0); }, diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/VUART.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/VUART.vue index f00ccbec1..7f4ff3f0e 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/VUART.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm/CustomWidget/VUART.vue @@ -96,14 +96,20 @@ Connection_{{ index + 1 }}-{{ VUARTConn.endpoint[0].vm_name }} - + + + {{ this.VBDFType["err:pattern"] }} + Connection_{{ index + 1 }}-{{ VUARTConn.endpoint[1].vm_name }} - + + + {{ this.VBDFType["err:pattern"] }} + @@ -186,6 +192,7 @@ export default { IOPortDefault: this.rootSchema.definitions['VuartEndpointType']['properties']['io_port']['default'], VMConfigType: this.rootSchema.definitions['VMConfigType'], VuartConnectionType: this.rootSchema.definitions['VuartConnectionType'], + VBDFType: this.rootSchema.definitions['VBDFType'], defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath) }; }, @@ -210,6 +217,10 @@ export default { validation(value) { return (value != null) && (value.length != 0); }, + validateVBDF(value) { + var regexp = new RegExp(this.VBDFType.pattern); + return (value != null) && regexp.test(value); + }, removeVUARTConnection(index) { this.defaultVal.splice(index, 1); }, diff --git a/misc/config_tools/schema/types.xsd b/misc/config_tools/schema/types.xsd index cdfffb218..4aa4c5cbc 100644 --- a/misc/config_tools/schema/types.xsd +++ b/misc/config_tools/schema/types.xsd @@ -178,7 +178,7 @@ Read more about the available scheduling options in :ref:`cpu_sharing`. - + A string with up to two hex digits, a ``:``, two hex digits, a ``.``, and one digit between 0-7.