Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip processing ip addresses that do not belong to the router any more #114

Merged
merged 3 commits into from
Nov 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def process(self):
ip.setAddress(address)
logging.info("Address found in DataBag ==> %s" % address)

if not address['add'] and not ip.configured():
logging.info("Skipping %s as the add flag is set to %s " % (address['public_ip'], address['add']))
continue

if ip.configured():
logging.info(
"Address %s on device %s already configured", ip.ip(), dev)
Expand Down Expand Up @@ -531,15 +535,8 @@ def list(self):
for i in CsHelper.execute(cmd):
vals = i.lstrip().split()
if (vals[0] == 'inet'):

cidr = vals[1]
for ip, device in self.iplist.iteritems():
logging.info(
"Iterating over the existing IPs. CIDR to be configured ==> %s, existing IP ==> %s on device ==> %s",
cidr, ip, device)

if cidr[0] != ip[0] and device != self.dev:
self.iplist[cidr] = self.dev
self.iplist[cidr] = self.dev

def configured(self):
if self.address['cidr'] in self.iplist.keys():
Expand Down Expand Up @@ -615,7 +612,10 @@ def is_guest_gateway(self, bag, ip):
gw = interface.get_gateway()
logging.info("Interface has the following gateway ==> %s", gw)

if bag['nw_type'] == "guest" and rip == gw:
guest_gw = self.config.cmdline().get_guest_gw()
logging.info("Interface has the following gateway ==> %s", guest_gw)

if bag['nw_type'] == "guest" and (rip == gw or rip == guest_gw):
return True
return False

Expand Down