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:
|
else:
|
||||||
if current_section:
|
if current_section:
|
||||||
result[current_section] += line + "\n"
|
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
|
from pprint import pprint
|
||||||
#pprint(result)
|
#pprint(result)
|
||||||
result["ip"] = parse_ip(result["interfaces"])
|
|
||||||
result["os"] = loads(result["version"])
|
result["os"] = loads(result["version"])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ ip
|
||||||
========= ==============
|
========= ==============
|
||||||
interface adresses
|
interface adresses
|
||||||
========= =============={% for interface in ip %}
|
========= =============={% 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 %}========= ==============
|
{% endfor %}{% endfor %}========= ==============
|
||||||
|
|
||||||
routes
|
routes
|
||||||
|
|
|
@ -5,6 +5,6 @@ network
|
||||||
|
|
||||||
========= ==========
|
========= ==========
|
||||||
interface ip
|
interface ip
|
||||||
========= =========={% for interface in ip %}
|
========= =========={% for interface in interfaces %}
|
||||||
{{ "{:<10}".format(interface.replace("\n","")) }} {% for addr in ip[interface] %} {{ addr.replace("\n","") }}{% endfor %}{% endfor %}
|
{{ "{:<11}".format(interface["name"]) }} {{ interface["ipv4_addr"] }}{% endfor %}
|
||||||
========= ==========
|
========= ==========
|
||||||
|
|
Loading…
Add table
Reference in a new issue