ironic_inspector/plugins/standard.py
def _get_interfaces(self, data=None):
        """Convert inventory to a dict with interfaces.

        :return: dict interface name -> dict with keys 'mac' and 'ip'
        """
        result = {}
        inventory = utils.get_inventory(data)

        pxe_mac = utils.get_pxe_mac(data)

        for iface in inventory['interfaces']:
            name = iface.get('name')
            mac = iface.get('mac_address')
            ipv4_address = iface.get('ipv4_address')
            ipv6_address = iface.get('ipv6_address')
            # NOTE(kaifeng) ipv6 address may in the form of fd00::1%enp2s0,
            # which is not supported by netaddr, remove the suffix if exists.
            if ipv6_address and '%' in ipv6_address:
                ipv6_address = ipv6_address.split('%')[0]
            ip = ipv4_address or ipv6_address
            client_id = iface.get('client_id')

            if not name:
                LOG.error('Malformed interface record: %s',
                          iface, data=data)
                continue

            if not mac:
                LOG.debug('Skipping interface %s without link information',
                          name, data=data)
                continue

            if not netutils.is_valid_mac(mac):
                LOG.warning('MAC %(mac)s for interface %(name)s is '
                            'not valid, skipping',
                            {'mac': mac, 'name': name},
                            data=data)
                continue

            mac = mac.lower()

            LOG.debug('Found interface %(name)s with MAC "%(mac)s", '
                      'IP address "%(ip)s" and client_id "%(client_id)s"',
                      {'name': name, 'mac': mac, 'ip': ip,
                       'client_id': client_id}, data=data)
            result[name] = {'ip': ip, 'mac': mac, 'client_id': client_id,
                            'pxe': (mac == pxe_mac)}

        return result
Convert inventory to a dict with interfaces.

        :return: dict interface name -> dict with keys 'mac' and 'ip'
        
Convert inventory to a dict with interfaces.
Convert inventory to a dict with interfaces .
def _get_interfaces(self, data=None):
        result = {}
        inventory = utils.get_inventory(data)
        pxe_mac = utils.get_pxe_mac(data)
        for iface in inventory['interfaces']:
            name = iface.get('name')
            mac = iface.get('mac_address')
            ipv4_address = iface.get('ipv4_address')
            ipv6_address = iface.get('ipv6_address')
            if ipv6_address and '%' in ipv6_address:
                ipv6_address = ipv6_address.split('%')[0]
            ip = ipv4_address or ipv6_address
            client_id = iface.get('client_id')
            if not name:
                LOG.error('Malformed interface record: %s',
                          iface, data=data)
                continue
            if not mac:
                LOG.debug('Skipping interface %s without link information',
                          name, data=data)
                continue
            if not netutils.is_valid_mac(mac):
                LOG.warning('MAC %(mac)s for interface %(name)s is '
                            'not valid, skipping',
                            {'mac': mac, 'name': name},
                            data=data)
                continue
            mac = mac.lower()
            LOG.debug('Found interface %(name)s with MAC "%(mac)s", '
                      'IP address "%(ip)s" and client_id "%(client_id)s"',
                      {'name': name, 'mac': mac, 'ip': ip,
                       'client_id': client_id}, data=data)
            result[name] = {'ip': ip, 'mac': mac, 'client_id': client_id,
                            'pxe': (mac == pxe_mac)}
        return result
def _get_interfaces ( self , data = None ) : result = { } inventory = utils . get_inventory ( data ) pxe_mac = utils . get_pxe_mac ( data ) for iface in inventory [ 'interfaces' ] : name = iface . get ( 'name' ) mac = iface . get ( 'mac_address' ) ipv4_address = iface . get ( 'ipv4_address' ) ipv6_address = iface . get ( 'ipv6_address' ) if ipv6_address and '%' in ipv6_address : ipv6_address = ipv6_address . split ( '%' ) [ 0 ] ip = ipv4_address or ipv6_address client_id = iface . get ( 'client_id' ) if not name : LOG . error ( 'Malformed interface record: %s' , iface , data = data ) continue if not mac : LOG . debug ( 'Skipping interface %s without link information' , name , data = data ) continue if not netutils . is_valid_mac ( mac ) : LOG . warning ( 'MAC %(mac)s for interface %(name)s is ' 'not valid, skipping' , { 'mac' : mac , 'name' : name } , data = data ) continue mac = mac . lower ( ) LOG . debug ( 'Found interface %(name)s with MAC "%(mac)s", ' 'IP address "%(ip)s" and client_id "%(client_id)s"' , { 'name' : name , 'mac' : mac , 'ip' : ip , 'client_id' : client_id } , data = data ) result [ name ] = { 'ip' : ip , 'mac' : mac , 'client_id' : client_id , 'pxe' : ( mac == pxe_mac ) } return result
Convert inventory to a dict with interfaces.
Convert inventory to a dict with interfaces .
"""Convert inventory to a dict with interfaces.

        :return: dict interface name -> dict with keys 'mac' and 'ip'
        """ # NOTE(kaifeng) ipv6 address may in the form of fd00::1%enp2s0, # which is not supported by netaddr, remove the suffix if exists.
dict interface name -> dict with keys 'mac' and 'ip'
dict interface name - > dict with keys ' mac ' and ' ip '
self
data