Commit 5e8f4e94 authored by Sigmund Augdal's avatar Sigmund Augdal

Convert mac addresses to lower case wherever relevant

parent b448b200
......@@ -47,11 +47,12 @@ class NeighborCache(object):
if router not in addresses:
for n in neighbors:
if n.get_attr('NDA_DST') == router:
self.blacklist_mac.add(n.get_attr('NDA_LLADDR'))
self.blacklist_mac.add(n.get_attr('NDA_LLADDR').lower())
for np in neighbors:
self.process_event(np)
def get_ipaddress_from_mac(self, mac, addrtype):
mac = mac.lower()
try:
return self.etcd_client.get(etcd_key(mac, addrtype)).value
except etcd.EtcdError as ex:
......@@ -76,9 +77,11 @@ class NeighborCache(object):
return None
def add_pair(self, mac, ipaddress, addrtype):
mac = mac.lower()
self.etcd_client.testandset(etcd_key(mac, addrtype), "", ipaddress)
def new(self, mac, ipaddr, addrtype):
mac = mac.lower()
old_address = self.get_ipaddress_from_mac(mac, addrtype)
if not old_address is None:
......@@ -100,6 +103,7 @@ class NeighborCache(object):
self.add_pair(mac, ipaddr, addrtype)
def remove(self, mac, ipaddress, addrtype):
mac = mac.lower()
self.etcd_client.delete(etcd_key(mac, addrtype))
def process_event(self, np):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment