diff --git a/misc/config_tools/configurator/packages/configurator/src/lib/acrn.ts b/misc/config_tools/configurator/packages/configurator/src/lib/acrn.ts index c064cecd5..1eee4e1ea 100644 --- a/misc/config_tools/configurator/packages/configurator/src/lib/acrn.ts +++ b/misc/config_tools/configurator/packages/configurator/src/lib/acrn.ts @@ -39,8 +39,8 @@ class PythonObject { return this.api('validateScenarioStructure', 'plaintext', scenarioXMLText) } - validateScenario(boardXMLText, scenarioXMLText, completed_verify = false) { - return this.api('validateScenario', 'json', boardXMLText, scenarioXMLText, completed_verify) + validateScenario(boardXMLText, scenarioXMLText) { + return this.api('validateScenario', 'json', boardXMLText, scenarioXMLText) } generateLaunchScript(boardXMLText, scenarioXMLText) { diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue index fc7b61731..9e4f794d7 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue @@ -114,7 +114,6 @@ export default { window.getCurrentFormSchemaData = this.getCurrentFormSchemaData window.getCurrentScenarioData = this.getCurrentScenarioData window.getBoardData = this.getBoardData - window.getErrors = this.getErrors this.showFlag = this.isNewConfig === 'true' }, data() { @@ -143,9 +142,6 @@ export default { } }, methods: { - getErrors() { - return this.errors - }, back() { this.$router.back() }, @@ -220,11 +216,7 @@ export default { } else { if (this.schemas.ServiceVM.BasicConfigType.properties.hasOwnProperty('vm_type') === false) { this.schemas.ServiceVM.BasicConfigType.properties.vm_type = - { - $ref: '#/definitions/BasicVMType', - title: 'VM type', - description: '
Select the VM type. A standard VM ('
- }
+ {$ref: '#/definitions/BasicVMType', title: 'VM type', description: ' Select the VM type. A standard VM ('}
}
}
}
@@ -387,33 +379,11 @@ export default {
let scenarioWithDefault = configurator.pythonObject.populateDefaultValues(scenarioXMLData)
scenarioWithDefault = scenarioWithDefault.json['acrn-config']
- if ((!scenarioWithDefault.hv.FEATURES.hasOwnProperty('RDT')) || scenarioWithDefault.hv.FEATURES.RDT.RDT_ENABLED === 'n') {
+ if (scenarioWithDefault.hv.FEATURES.RDT.RDT_ENABLED === 'n') {
delete scenarioWithDefault.hv.CACHE_REGION
}
return scenarioWithDefault
},
- translateErrors() {
- let messageRegex = [
- {
- regex: /The content of element '(.+?)' is not complete. Tag '(.+?)' expected./,
- replace: '"$2" field in "$1" is required.'
- },
- {
- regex: /Unexpected child with tag 'VBDF' at position 1. Tag 'VM_NAME' expected./,
- replace: '"VM name" in "InterVM shared memory region" is required.'
- }
- ]
- const translate = (error) => {
- for (const messageRegexKey in messageRegex) {
- if (messageRegex[messageRegexKey].regex.test(error.message)) {
- error.message = error.message.replace(messageRegex[messageRegexKey].regex, messageRegex[messageRegexKey].replace)
- }
- }
- }
- this.errors.map((error) => {
- translate(error)
- })
- },
saveScenario() {
if (_.isEmpty(this.scenario.vm)) {
alert("Please add at least one VM")
@@ -454,21 +424,13 @@ export default {
}
// begin write down and verify
- this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData, false)
- // noinspection ExceptionCaughtLocallyJS
- if (this.errors.length !== 0) {
- this.translateErrors()
- alert('Scenario have struct error, save failed!')
- return;
- }
configurator.writeFile(this.WorkingFolder + 'scenario.xml', scenarioXMLData)
.then(() => {
stepDone = 1
console.log("validate settings...")
- this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData, true)
+ this.errors = configurator.pythonObject.validateScenario(this.board.content, scenarioXMLData)
// noinspection ExceptionCaughtLocallyJS
if (this.errors.length !== 0) {
- this.translateErrors()
throw new Error("validation failed")
}
console.log("validation ok")
@@ -482,6 +444,8 @@ export default {
writeDone.push(configurator.writeFile(this.WorkingFolder + filename, launchScripts[filename]))
}
return Promise.all(writeDone)
+ } else {
+ return
}
})
.then((result) => {
diff --git a/misc/config_tools/configurator/pyodide/validateScenario.py b/misc/config_tools/configurator/pyodide/validateScenario.py
index 90261531f..0509cf04b 100644
--- a/misc/config_tools/configurator/pyodide/validateScenario.py
+++ b/misc/config_tools/configurator/pyodide/validateScenario.py
@@ -12,11 +12,13 @@ from scenario_config.xml_loader import XMLLoadStage
from .pyodide import (
convert_result, write_temp_file,
+ # Todo: add debug switch
+ # is_debug,
nuc11_board, nuc11_scenario, scenario_xml_schema_path, datachecks_xml_schema_path
)
-def main(board, scenario, completed_verify=False):
+def main(board, scenario):
pipeline = PipelineEngine(["board_path", "scenario_path", "schema_path", "datachecks_path"])
stages = [
ValidatorConstructionByFileStage(),
@@ -25,10 +27,11 @@ def main(board, scenario, completed_verify=False):
XMLLoadStage("board"),
XMLLoadStage("scenario"),
DefaultValuePopulatingStage(),
- SyntacticValidationStage()
+ SemanticValidationStage(),
]
- if completed_verify:
- stages.append(SemanticValidationStage())
+ #
+ # if is_debug:
+ # stages.append(SyntacticValidationStage())
pipeline.add_stages(stages)
with TemporaryDirectory() as tmpdir:
@@ -47,9 +50,7 @@ def main(board, scenario, completed_verify=False):
)
pipeline.run(obj)
- validate_result: list = obj.get("syntactic_errors")
- if completed_verify:
- validate_result.extend(obj.get("semantic_errors"))
+ validate_result = obj.get("semantic_errors")
return convert_result(validate_result)