Page MenuHomeVyOS Platform

extend interface schema to include which parameters are required
Open, NormalPublicENHANCEMENT

Description

Currently the logic to check if a parameter / node is required is done in the python part of the commands, if this was included in the schema definition instead it would allow for much easer development of tooling that can integrate with HTTP API, or via ssh.

For example if the checks to see if port was moved from the bcast_relay.py into the bcast-relay.xml.in it would mean that those that create tooling could more easily include those requirements without relying onthe API to respond with an error, or digging into the source code to understand how the API will behave.

I tried working on a terraform provider based on the schemas, but this issue combined with how the API did not always give the full error message back (missing the reason for the error) made it difficult to continue as the user would not understand why something went wrong as shown below:

cli:

user@vyos02# set service broadcast-relay id 33 description "test"
[edit]
user@vyos02# commit

Port number mandatory for udp broadcast relay "33"

[[service broadcast-relay]] failed
Commit failed
[edit]

api:

user@vyos02:~$ curl -k --location --request POST 'https://localhost/configure' --form data='{"op": "set", "path": ["service", "broadcast-relay", "id", "33", "description", "test"]}' --form key='KEY'
{"success": false, "error": "[[service broadcast-relay]] failed\nCommit failed\n", "data": null}

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Improvement (missing useful functionality)

Event Timeline

Viacheslav closed this task as Resolved.EditedJan 20 2024, 12:10 PM
Viacheslav claimed this task.
Viacheslav added a subscriber: Viacheslav.

Fixed VyOS 1.5-rolling-202401190024

vyos@r4:~$ curl -k --location --request POST 'https://localhost/configure' --form data='{"op": "set", "path": ["service", "broadcast-relay", "id", "33", "description", "test"]}' --form key='VyOS-key'
{"success": false, "error": "[ service broadcast-relay ]\nPort number is mandatory for UDP broadcast relay \"33\"\n\n[[service broadcast-relay]] failed\nCommit failed\n", "data": null}

This issue seem to be wider than just 1 occurance as I just stumbled into it again on the latest version (1.5-rolling-202402240021)

$ curl -k --location --request POST "https://$VYOS_HOST/configure" --form key="$VYOS_KEY" --form data='[
    {"op":"set","path":["firewall","zone","TF-Examples","intra-zone-filtering","action","accept"]},
    {"op":"set","path":["firewall","zone","TF-Examples","intra-zone-filtering","firewall","name","test"]}
]'
{"success": false, "error": "[[firewall]] failed\nCommit failed\n", "data": null}
USER@vyos02# compare
[firewall zone]
+ CLI-Example {
+     intra-zone-filtering {
+         action "accept"
+         firewall {
+             name "test"
+         }
+     }
+ }

[edit]
USER@vyos02# commit

Zone "CLI-Example" has no interfaces and is not the local zone

[[firewall]] failed
Commit failed
[edit]

The full, and useful part of, description is only showing on the CLI.
I wanted to see if I could figure out a pattern to the issue, but met a dead end when I was unable to track down the change that fixed it.

Viacheslav triaged this task as Normal priority.

Bumped into another instance of this issue:

sh
curl -k --location --request POST "https://$VYOS_HOST/configure" --form key="$VYOS_KEY" --form data='[{"op":"set","path":["policy", "access-list", "2", "rule", "5", "description", "2024-03-16T14:52:44Z"]}]'
{"success": false, "error": "[[policy]] failed\nCommit failed\n", "data": null}
USER@vyos02# compare
+ policy {
+     access-list 2 {
+         rule 5 {
+             description "2024-03-16T14:52:44Z"
+         }
+     }
+ }

[edit]
USER@vyos02# commit

Action must be specified for "access-list 2 rule 5"!

[[policy]] failed
Commit failed
[edit]