def __init__(self, context, distro, system_nics_by_mac=None): self.context = context if system_nics_by_mac is None: system_nics_by_mac = get_physical_nics_by_mac(distro) self.ifaces = collections.OrderedDict( [k for k in sorted(system_nics_by_mac.items(), key=lambda k: net.natural_sort_key(k[1]))]) # OpenNebula 4.14+ provide macaddr for ETHX in variable ETH_MAC. # context_devname provides {mac.lower():ETHX, mac2.lower():ETHX} self.context_devname = {} for k, v in context.items(): m = re.match(r'^(.+)_MAC$', k) if m: self.context_devname[v.lower()] = m.group(1)
def __init__(self, context, system_nics_by_mac=None): self.context = context if system_nics_by_mac is None: system_nics_by_mac = get_physical_nics_by_mac() self.ifaces = collections.OrderedDict( [k for k in sorted(system_nics_by_mac.items(), key=lambda k: net.natural_sort_key(k[1]))]) # OpenNebula 4.14+ provide macaddr for ETHX in variable ETH_MAC. # context_devname provides {mac.lower():ETHX, mac2.lower():ETHX} self.context_devname = {} for k, v in context.items(): m = re.match(r'^(.+)_MAC$', k) if m: self.context_devname[v.lower()] = m.group(1)