I previously created a tool to help generate the XML for Op Commands which can be found here:
I created a new tool to help speed up testing of new op commands. This tool will write the XML file for the new op command to the /opt/vyatta/share/vyatta-op/ directory, so it can be immediately called.
The new tool can be found here:
Example XML:
<?xml version="1.0" ?>
<interfaceDefinition>
<node name="test">
<properties>
<help>Some New command</help>
</properties>
<children>
<leafNode name="this">
<properties>
<help>Run the command</help>
</properties>
<command>ifconfig</command>
</leafNode>
</children>
</node>
</interfaceDefinition>
Run the script:
root@vyos:/home/vyos/test# python3 op_write.py test.xml
Test the command:
vyos@vyos# run
Possible completions:
test Some New command
vyos@vyos# run test
Possible completions:
this Run the command
vyos@vyos# run test this
Possible completions:
<Enter> Execute the current command
[edit]
vyos@vyos# run test this
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
more output omitted....