我们需要将Juniper配置转换成json,有没有这样的Juniper命令,或者我们应该如何编写一个小的ruby代码来将默认的juniper配置转换成json。
发布于 2013-03-26 18:15:51
AFAIK没有转换为JSON的命令,但也许您可以读取XML格式,然后使用Ruby将XML转换为JSON?
JunOS
show configuration | display xml红宝石
Hash.from_xml('...').to_json发布于 2015-03-07 02:53:15
如果有人在看:https://beastiebytes.com/public_files/juniper_hash.rb
require 'json'
require 'juniper_hash'
JuniperHash.get_hash(File.open('juniper.conf').read).to_json发布于 2015-03-31 16:24:41
在Junos 14.2版之后,可以使用show config | display json命令。http://www.juniper.net/techpubs/en_US/junos14.2/topics/concept/junos-cli-pipe-filter-functions-overview.html
https://stackoverflow.com/questions/15229429
复制相似问题