MCPcopy Create free account
hub / github.com/apache/cloudstack / get_device_info

Function get_device_info

systemvm/debian/opt/cloud/bin/cs/CsHelper.py:117–135  ·  view source on GitHub ↗

Returns all devices on system with their ipv4 ip netmask

()

Source from the content-addressed store, hash-verified

115
116
117def get_device_info():
118 """ Returns all devices on system with their ipv4 ip netmask """
119 list = []
120 mtu = None
121 for i in execute("ip addr show |grep -v secondary"):
122 vals = i.strip().lstrip().rstrip().split()
123 if re.search('[0-9]:', vals[0]):
124 mtu = vals[4]
125
126 if vals[0] == "inet":
127 to = {}
128 to['ip'] = vals[1]
129 to['dev'] = vals[-1]
130 to['network'] = IPNetwork(to['ip'])
131 to['dnsmasq'] = False
132 if mtu:
133 to['mtu'] = mtu
134 list.append(to)
135 return list
136
137
138def get_domain():

Callers

nothing calls this directly

Calls 3

executeFunction · 0.70
searchMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected