首先在本地linux环境上执行netopeer2-cli进入命令交互界面。
edit-config [--help] --target running|candidate --config[=<file>] [--defop merge|replace|none] [--test set|test-only|test-then-set] [--error stop|continue|rollback] [--rpc-timeout <seconds>]
示例:edit-config --target running --config=./example_configuration/ssh_callhome.xml
edit-data操作类似edit-config,区别在于edit-data不能操作startup数据库。
delete-config [--help] --target startup [--rpc-timeout <seconds>]
示例:delete-config --target startup
copy-config [--help] --target running|startup|candidate (--source running|startup|candidate | --src-config[=<file>]) [--defaults report-all|report-all-tagged|trim|explicit] [--rpc-timeout <seconds>]
示例:copy-config --target candidate --source running
connect [--help] [--ssh] [--host <hostname>] [--port <num>] [--login <username>]
connect [--help] --tls [--host <hostname>] [--port <num>] [--cert <cert_path> [--key <key_path>]] [--trusted <trusted_CA_store.pem>]
connect [--help] --unix [--socket <path>]
示例:connect --tls --cert ./example_configuration/tls_certs/client.crt --key ./example_configuration/tls_certs/client.key --trusted ./example_configuration/tls_certs/ca.pem
get [--help] [--filter-subtree[=<file>] | --filter-xpath <XPath>] [--defaults report-all|report-all-tagged|trim|explicit] [--out <file>] [--rpc-timeout <seconds>]
示例: get --filter-xpath '/ietf-netconf-acm:*'
get-config [--help] --source running|startup|candidate [--filter-subtree[=<file>] | --filter-xpath <XPath>] [--defaults report-all|report-all-tagged|trim|explicit] [--out <file>] [--rpc-timeout <seconds
示例:
get-config --source running
get-config --source running --filter-xpath /examples:*
get-data [--help] --datastore running|startup|candidate|operational [--filter-subtree[=<file>] | --filter-xpath <XPath>] [--config true|false] [--origin <origin>]* [--negated-origin] [--depth <subtree-depth>] [--with-origin] [--defaults report-all|report-all-tagged|trim|explicit] [--out <file>] [--rpc-timeout <seconds>]
示例:get-data --datastore running
get-schema [--help] --model <identifier> [--version <version>] [--format <format>] [--out <file>] [--rpc-timeout <seconds>]
示例(format 不指定默认是yang):
get-schema --model ietf-hardware
get-schema --model ietf-hardware --version 2018-03-13 --format yang
特别说明:若读者不知道有哪些schemas,可以通过get操作查看,执行
get --filter-xpath '/ietf-netconf-monitoring:*'