From: Ondrej Lichtner olichtne@redhat.com
These methods will be used by the Python Task API. The both return complete lists of either interfaces or ip addresses (tuple of address and prefix) which can be iterated.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Controller/Machine.py | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py index 26e475a..8c2c41e 100644 --- a/lnst/Controller/Machine.py +++ b/lnst/Controller/Machine.py @@ -121,6 +121,9 @@ class Machine(object): msg = "Interface '%s' not found on machine '%s'" % (if_id, self._id) raise MachineError(msg)
+ def get_interfaces(self): + return self._interfaces + def get_ordered_interfaces(self): ordered_list = list(self._interfaces) change = True @@ -556,6 +559,12 @@ class Interface(object): def get_address(self, num): return self._addresses[num].split('/')[0]
+ def get_addresses(self): + addrs = [] + for addr in self._addresses: + addrs.append(tuple(addr.split('/'))) + return addrs + def set_ovs_conf(self, ovs_conf): self._ovs_conf = ovs_conf