Greeting,
I have installed sflow-rt to used for my research paper. I'm using Ubuntu 18.04 mininet 2.3.0, python 2.7.17, python3 3.6.9. I have written this function on my script:
collector = '127.0.0.1'
def getIfInfo(ip):
'''
Get interface name of ip address (collector)
'''
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((ip, 0))
ip = s.getsockname()[0]
ifconfig = check_output(['ifconfig'])
ifs = re.findall(r'^(\S+).*?inet addr:(\S+).*?', ifconfig, re.S | re.M)
for entry in ifs:
if entry[1] == ip:
return entry
and called it with this line in my script:
(ifname, agent) = getIfInfo(collector)
but it keeps shows me this when I run the script:
(ifname, agent) = getIfInfo(collector)
'TypeError: NoneType' object is not iterable
Can you please give me an insight about this?
Best regards,