pvl/hosts/interface.py
changeset 740 74352351d6f5
parent 739 5149c39f3dfc
equal deleted inserted replaced
739:5149c39f3dfc 740:74352351d6f5
     1 import collections
     1 import collections
     2 import ipaddress, ipaddr # XXX: conversion
     2 import ipaddress
     3 import pvl.hosts
     3 import pvl.hosts
     4 import pvl.hosts.host
     4 import pvl.hosts.host
     5 
     5 
     6 class HostInterface(object):
     6 class HostInterface(object):
     7     """
     7     """
    55             Yield additional sub-addresses for host interfaces.
    55             Yield additional sub-addresses for host interfaces.
    56         """
    56         """
    57 
    57 
    58         for iface in self:
    58         for iface in self:
    59             if iface.ip4:
    59             if iface.ip4:
    60                 # XXX: convert
    60                 yield iface.name, iface.ip4.ip
    61                 yield iface.name, ipaddr.IPv4Address(str(iface.ip4.ip))
       
    62     
    61     
    63     def __iter__(self):
    62     def __iter__(self):
    64         """
    63         """
    65             HostInterface's with stable ordering.
    64             HostInterface's with stable ordering.
    66         """
    65         """