Configuration mode templates vyos vyatta cli 命令化模板

本文介绍了VyOS配置CLI命令如何使用模板定义。模板是文本文件,存储在目录树中,目录名定义命令名,模板文件定义命令行为。通过创建目录和模板文件,可以为系统选项添加新的命令,并进行设置和提交。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vyos vyatta  cli  template   

Configuration mode templates
VyOS configuration CLI commands are defined in templates. Templates are text files stored in a directory tree, 
where directory names define command names, and template files define command behaviour.

Configuration templates are stored in /opt/vyatta/share/vyatta-cfg-templates

Quick example: suppose we want to add a dummy option that will be set with "set system options dummy-option".

# Create the directory for the command
sudo mkdir /opt/vyatta/share/vyatta-cfg/templates/system/options/dummy-option

# Create a template file
sudo sh -c 'echo "help: Dummy option" > /opt/vyatta/share/vyatta-cfg/templates/system/options/dummy-option/node.def'
Now you can see it in Tab completion, set it, and commit it.

vyos@vyos# set system options 
Possible completions:
   dummy-option Dummy option
   reboot-on-panic
                Reboot system on kernel panic

vyos@vyos# set system options dummy-option 

vyos@vyos# commit

vyos@vyos# show system options 
 dummy-option
Contents
1    Template fields
1.1    Node type fields
1.1.1    type:
1.1.2    multi:
1.1.3    tag:
1.2    Completion help fields
1.2.1    help:
1.2.2    comp_help:
1.2.3    val_help:
1.2.4    allowed:
1.3    Syntax check fields
1.3.1    syntax:
1.3.2    commit:
1.4    Other fields
1.4.1    priority:
1.4.2    default:
1.5    Commit action fields
1.5.1    begin:
1.5.2    end:
1.5.3    create:
1.5.4    update:
1.5.5    delete:
Template fiel

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值