From 8791a2e3f3416055fd9fbd8d6ea34257f55fca18 Mon Sep 17 00:00:00 2001 From: Renaud Walder Date: Fri, 22 May 2026 22:51:15 +0200 Subject: [PATCH] Adding some schema for validation and AI generation --- schema/test.tum | 73 +++++++++ schema/tum.json | 417 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 490 insertions(+) create mode 100644 schema/test.tum create mode 100644 schema/tum.json diff --git a/schema/test.tum b/schema/test.tum new file mode 100644 index 0000000..073e890 --- /dev/null +++ b/schema/test.tum @@ -0,0 +1,73 @@ +config_file: + - premier + - saluT + +main: + name: Main file + steps: + - group: + name: Test + doc: Une peitite documentation + no_fail: true + steps: + - let: + values: + - my_var: <| ${salut} |> + - check: + values: + - <| ${salut} |> + + - dialog_message: + question: c'est quoi? + + - lua_func: + file: c'est quoi? + func_name: c'est quoi? + + - console: + console_name: cons_1 + steps: + - open: + protocol: telnet + terminal_path: ijfeifj + - read_until : {expected: "tutu", timeout: -4.5, mute: true} + - write: something + - writeln: tutu + - close : + + - json_rpc: + name: JSONRPC console Query + doc: JSONRPC console Query not waiting (only send) + console: + name : jsonrpc_server + prompt: "@@>" + timeout: 1 + version: "2.0" + steps: + - query: + method: echo + params: + - Hello world + - [0, 1, 2, 3] + id: 3095372 + no_wait: true + - json_rpc: + name: JSONRPC console Reception + doc: JSONRPC console reception of the previous request + console: {name : jsonrpc_server} + timeout: 1 + steps: + - receive: + id: 3095372 + timeout: 0.5 + +report: + enabled: true + log_stored: true + export: + junit: + path: $(validation_report_path) + file_name: $(validation_report_file).junit + sqlite: + file_name: $(validation_report_file).sqlite + path: $(validation_report_path) \ No newline at end of file diff --git a/schema/tum.json b/schema/tum.json new file mode 100644 index 0000000..a86da5d --- /dev/null +++ b/schema/tum.json @@ -0,0 +1,417 @@ +{ + "$defs": { + "config_file":{ + "desciption": "The list of the configuration files", + "type": "array", + "items": { + "type": "string" + } + }, + + "cons_open" : { + "type":"object", + "properties": { + "protocol" : { + "enum": ["telnet", "ssh", "serial", "rawtcp", "terminal"] + }, + "telnet_host" : {"type": "string"}, + "telnet_port" : {"type": "string"}, + "ssh_host": {"type": "string"}, + "ssh_user": {"type": "string"}, + "ssh_pwd": {"type": "string"}, + "serial_port": {"type": "string"}, + "serial_baudrate": {"type": "integer"}, + "buffered": {"type": "boolean"}, + "tcp_host" : {"type": "string"}, + "tcp_port" : {"type": "string"}, + "terminal_path": {"type":"string"}, + "shell": {"type":"string"} + + }, + "required":["protocol"], + "additionalProperties": false + }, + + "cons_read": { + "type":"object", + "properties": { + "protocol" : { + "enum": ["telnet", "ssh", "serial", "rawtcp", "terminal"] + }, + "expected" : {"type": "string"}, + "timeout": {"type": "number"}, + "mute": {"type": "boolean"} + }, + "required":["expected"], + "additionalProperties": false + + }, + + "console" : { + "description": "The let items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "console_name": {"type":"string" }, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties":{ + "open": { + "$ref": "#/$defs/cons_open" + }, + "write": { "type": "string" }, + "writeln": { "type": "string" }, + "read_until": { + "$ref": "#/$defs/cons_read" + }, + "close": { "type": "null"} + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": ["steps", "console_name"] + }, + + + "json_rpc_console": { + "type":"object", + "properties": { + "name" : {"type": "string"}, + "prompt" : {"type": "string"} + }, + "required":["name"], + "additionalProperties": false + }, + "json_rpc_udp": { + "type":"object", + "properties": { + "server" : {"type": "string"}, + "udp_snd_port" : {"type": "integer"}, + "udp_rcv_port" : {"type": "integer"}, + "bufsize" : {"type": "integer"} + }, + "required":["name"], + "additionalProperties": false + }, + "json_rpc_query": { + "type":"object", + "properties": { + "method" : { "type": "string"}, + "params" : { "type": "array"}, + "id" : {"type": "integer"}, + "no_wait" : {"type": "boolean"} + }, + "required":["method"], + "additionalProperties": false + }, + + "json_rpc_receive": { + "type":"object", + "properties": { + "id" : {"type": "integer"}, + "timeout" : {"type": "number"} + }, + "required":["id"], + "additionalProperties": false + }, + + "json_rpc" : { + "description": "The json_rpc items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "expected" : {"type": "string"}, + "udp" : { "$ref": "#/defs/json_rpc_udp"}, + "console" : { "$ref": "#/$defs/json_rpc_console"}, + "timeout": {"type": "number"}, + "version": {"enum": ["1.0", "2.0"]}, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties":{ + "open": { "type": "null"}, + "query": { "$ref": "#/$defs/json_rpc_query" }, + "receive": { "$ref": "#/$defs/json_rpc_receive" }, + "writeln": { "type": "string" }, + "read_until": { "$ref": "#/$defs/cons_read" + }, + "close": { "type": "null"} + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": ["steps"] + }, + + "group" : { + "description": "The group items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties":{ + "let": { "$ref": "#/$defs/let" }, + "check": { "$ref": "#/$defs/check" }, + "dialog_message": { "$ref": "#/$defs/dialog_txt" }, + "dialog_note": { "$ref": "#/$defs/dialog_txt" }, + "dialog_value": { "$ref": "#/$defs/dialog_txt" }, + "lua_func": { "$ref": "#/$defs/func" }, + "py_func": { "$ref": "#/$defs/func" }, + "console": { "$ref": "#/$defs/console" }, + "json_rpc": { "$ref": "#/$defs/json_rpc" }, + "group": { "$ref": "#/$defs/group" } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": ["steps"] + }, + + "main" : { + "description": "The Main items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "version": { "type": "string"}, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties":{ + "let": { "$ref": "#/$defs/let" }, + "check": { "$ref": "#/$defs/check" }, + "dialog_message": { "$ref": "#/$defs/dialog_txt" }, + "dialog_note": { "$ref": "#/$defs/dialog_txt" }, + "dialog_value": { "$ref": "#/$defs/dialog_txt" }, + "lua_func": { "$ref": "#/$defs/func" }, + "py_func": { "$ref": "#/$defs/func" }, + "console": { "$ref": "#/$defs/console" }, + "json_rpc": { "$ref": "#/$defs/json_rpc" }, + "group": { "$ref": "#/$defs/group" } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": ["steps"] + }, + + "sleep" : { + "description": "Sleep for X time [secondes", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "dialog": { "type": "boolean"}, + "timeout": { "type": "number"} + }, + "additionalProperties": false, + "required": ["timeout"] + }, + + "let" : { + "description": "The let items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "values": { + "type": "array", + "items": {"type": "object" } + } + }, + "additionalProperties": false, + "required": ["values"] + }, + + "check" : { + "description": "The let items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "values": { + "type": "array", + "items": { "type": "string" } + } + }, + "additionalProperties": false, + "required": ["values"] + }, + + "dialog_txt" : { + "description": "The let items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "question": { "type": "string" } + }, + "additionalProperties": false, + "required": ["question"] + }, + + "func" : { + "description": "The py_fun and lua_func items", + "type": "object", + "properties":{ + "name": { "type": "string" }, + "stop_on_failure":{ "type": "boolean"}, + "execute_on_stop":{ "type": "boolean"}, + "skipped":{ "type": "boolean"}, + "no_fail":{ "type": "boolean"}, + "doc":{ "type": "string"}, + "key":{ "type": "string"}, + "report":{ "type": "string"}, + "condition":{ "type": "string"}, + "process_result":{ "type": "string"}, + "expeted_result":{ "type": "string"}, + "store_result":{ "type": "string"}, + "file": { "type": "string"}, + "func_name": { "type": "string"}, + "context_id": { "type": "string"}, + "param" : { + "type": "array", + "items": { "type": "string" } + } + }, + "additionalProperties": false, + "required": ["file", "func_name"] + }, + + "report_export": { + "type": "object", + "properties": { + "path": {"type":"string"}, + "file_name": {"type":"string"}, + "pattern": {"type":"string"}, + "key": {"type":"string"} + } + }, + "report":{ + "desciption": "The list of the configuration files", + "type": "object", + "properties": { + "enabled": {"type":"boolean"}, + "log_stored": {"type":"boolean"}, + "export": { + "type": "object", + "properties":{ + "html": { "$ref": "#/$defs/report_export" }, + "sqlite": { "$ref": "#/$defs/report_export" }, + "junit": { "$ref": "#/$defs/report_export" } + } + } + } + } + + }, + + "type": "object", + "properties": { + "config_file" : { "$ref": "#/$defs/config_file" }, + "main": { "$ref": "#/$defs/group" }, + "report" : { "$ref": "#/$defs/report" } + + }, + "required" : ["main"], + "additionalProperties": false + +} \ No newline at end of file