This commit is contained in:
parent
6956f49192
commit
d6c268dc0e
3 changed files with 7 additions and 4 deletions
|
@ -29,9 +29,12 @@ def parse_freebsd(content):
|
|||
else:
|
||||
if current_section:
|
||||
result[current_section] += line + "\n"
|
||||
for section in result:
|
||||
print(" parsing {}...".format(section))
|
||||
if section in ["interfaces"]:
|
||||
result[section] = loads(result[section])
|
||||
from pprint import pprint
|
||||
#pprint(result)
|
||||
result["ip"] = parse_ip(result["interfaces"])
|
||||
result["os"] = loads(result["version"])
|
||||
return result
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ ip
|
|||
========= ==============
|
||||
interface adresses
|
||||
========= =============={% for interface in ip %}
|
||||
{{ "{:<10}".format(interface["ifname"]) }} {% for ip in interface["addr_info"] %} {% if interface["addr_info"].index(ip) != 0 %} {% endif %}{{ ip["local"] }}/{{ ip["prefixlen"]}}
|
||||
{{ "{:<10}".format(interface["ifname"]) }} {% for ip in interface["addr_info"] %} {% if interface["addr_info"].index(ip) != 0 %} {% endif %}* {{ ip["local"] }}/{{ ip["prefixlen"]}}
|
||||
{% endfor %}{% endfor %}========= ==============
|
||||
|
||||
routes
|
||||
|
|
|
@ -5,6 +5,6 @@ network
|
|||
|
||||
========= ==========
|
||||
interface ip
|
||||
========= =========={% for interface in ip %}
|
||||
{{ "{:<10}".format(interface.replace("\n","")) }} {% for addr in ip[interface] %} {{ addr.replace("\n","") }}{% endfor %}{% endfor %}
|
||||
========= =========={% for interface in interfaces %}
|
||||
{{ "{:<11}".format(interface["name"]) }} {{ interface["ipv4_addr"] }}{% endfor %}
|
||||
========= ==========
|
||||
|
|
Loading…
Add table
Reference in a new issue