Fix & test Route6.ifchange()

This commit is contained in:
Pierre LALET 2016-12-21 12:56:18 +01:00
parent a0821eb475
commit 300e96a7c5
3 changed files with 10 additions and 3 deletions

View File

@ -172,6 +172,8 @@ class CacheInstance(dict):
self.timeout = timeout
self.name = name
self._timetable = {}
def flush(self):
self.__init__(name=self.name, timeout=self.timeout)
def __getitem__(self, item):
val = dict.__getitem__(self,item)
if self.timeout is not None:

View File

@ -128,11 +128,11 @@ class Route6:
if iface != iff:
continue
if gw == '::':
self.routes[i] = (the_net,the_plen,gw,iface,the_addr)
self.routes[i] = (the_net,the_plen,gw,iface,[the_addr])
else:
self.routes[i] = (net,the_plen,gw,iface,the_addr)
self.routes[i] = (net,plen,gw,iface,[the_addr])
self.invalidate_cache()
ip6_neigh_cache.flush()
conf.netcache.in6_neighbor.flush()
def ifdel(self, iff):
""" removes all route entries that uses 'iff' interface. """

View File

@ -67,6 +67,11 @@ if len(routes6):
else:
True
= Test ifchange()
conf.route6.ifchange(LOOPBACK_NAME, "::1/128")
True
############
############
+ Basic tests