bit more logging

This commit is contained in:
brent s. 2020-05-18 05:24:43 -04:00
parent 80765e58ed
commit 1655dd1e89
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import ipaddress
import logging
import socket
##
import netaddr
@ -8,6 +9,10 @@ from . import ra
from . import utils


# TODO: more logging
logger = logging.getLogger()


class IP(object):
type = None
version = None
@ -88,12 +93,15 @@ class Assignment(object):
_iface_txt = self.xml.attrib['iface'].strip()
self.iface = _iface_txt.strip()
ipr = IPRoute()
logger.debug('Looking for iface {0}'.format(self.iface))
self.iface_idx = ipr.link_lookup(ifname = self.iface)[0]
logger.debug('Found iface {0} at idx {1}'.format(self.iface, self.iface_idx))
# Link-Local address
ll = ipr.get_addr(index = self.iface_idx,
family = socket.AF_INET6,
scope = 253)[0]['attrs']
addrs = dict(ll)['IFA_ADDRESS']
logger.debug('Link-Local address for {0}: {1}'.format(addrs))
if isinstance(addrs, (list, tuple)):
addr = addrs[0]
else: