From 586535e8db04552d61d265dd14f74548fb86eeec Mon Sep 17 00:00:00 2001 From: Nikhil Date: Wed, 30 Mar 2016 16:56:37 -0700 Subject: [PATCH] addons: vrf: ifquery fixes for vrf Ticket: CM-10175 Reviewed By: Roopa Prabhu Testing Done: yes, by installing ifupdown .deb onto dell-s3000-02 This patch fixes inappropriate ifquery fails. This patch also include a review comment update for addressvirtual.py [CCR-4310], ticket: [CM-8658] Signed-off-by: Nikhil --- addons/addressvirtual.py | 2 +- addons/vrf.py | 2 +- ifupdownaddons/iproute2.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/addressvirtual.py b/addons/addressvirtual.py index 45a582c..bfe640c 100644 --- a/addons/addressvirtual.py +++ b/addons/addressvirtual.py @@ -244,7 +244,7 @@ class addressvirtual(moduleBase): return True mac = mac.lower() try: - if int(mac.split(":")[0][1], 16) & 1 : + if int(mac.split(":")[0], 16) & 1 : self.logger.error("%s: Multicast bit is set in the virtual mac address '%s'" %(ifaceobj.name, mac)) return False return True diff --git a/addons/vrf.py b/addons/vrf.py index 338a06d..bb25427 100644 --- a/addons/vrf.py +++ b/addons/vrf.py @@ -764,7 +764,7 @@ class vrf(moduleBase): try: master = self.ipcmd.link_get_master(ifaceobj.name) if not master or master != vrf: - ifaceobjcurr.update_config_with_status('vrf', master, 1) + ifaceobjcurr.update_config_with_status('vrf', str(master), 1) else: ifaceobjcurr.update_config_with_status('vrf', master, 0) except Exception, e: diff --git a/ifupdownaddons/iproute2.py b/ifupdownaddons/iproute2.py index 48a6752..28014f3 100644 --- a/ifupdownaddons/iproute2.py +++ b/ifupdownaddons/iproute2.py @@ -116,9 +116,9 @@ class iproute2(utilsBase): [linkCache.update_attrdict([ifname], linkattrs) for ifname, linkattrs in linkout.items()] - def _addr_filter(self, addr, scope=None): + def _addr_filter(self, ifname, addr, scope=None): default_addrs = ['127.0.0.1/8', '::1/128' , '0.0.0.0'] - if addr in default_addrs: + if ifname == 'lo' and addr in default_addrs: return True if scope and scope == 'link': return True @@ -158,14 +158,14 @@ class iproute2(utilsBase): except KeyError: linkout[ifname] = linkattrs if citems[2] == 'inet': - if self._addr_filter(citems[3], scope=citems[5]): + if self._addr_filter(citems[3], ifname, scope=citems[5]): continue addrattrs = {} addrattrs['scope'] = citems[5] addrattrs['type'] = 'inet' linkout[ifname]['addrs'][citems[3]] = addrattrs elif citems[2] == 'inet6': - if self._addr_filter(citems[3], scope=citems[5]): + if self._addr_filter(citems[3], ifname, scope=citems[5]): continue if citems[5] == 'link': continue #skip 'link' addresses addrattrs = {} -- 2.39.5