Skip to content

Commit

Permalink
Merge "Link uve dont disappear when prouter goes down"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 17, 2015
2 parents 74b198a + 5b5d4d5 commit e023e96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def _check_and_update_ttl(self, up2down):
if self._if_data[dev][intf][0] == 1:
if t - self._if_data[dev][intf][1] > expry:
self._set_status(up2down, dev, intf, 7) #no resp
self._if_data[dev][intf] = (7, t)

def _get_if_changes(self, if_cdata):
down2up, up2down, others = {}, {}, {}
t = time.time()
for dev in if_cdata:
if dev in self._if_data:
for intf in if_cdata[dev]:
Expand Down
10 changes: 9 additions & 1 deletion src/analytics/contrail-topology/contrail_topology/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ def _add_link(self, prouter, remote_system_name, local_interface_name,
return True
return False

def _chk_lnk(self, pre, index):
if 'ifIndexOperStatusTable' in pre:
for d in pre['ifIndexOperStatusTable']:
if d['ifIndex'] == index:
return d['ifOperStatus'] == 1
return False

def compute(self):
self.link = {}
for prouter in self.constnt_schdlr.work_items():
Expand All @@ -106,7 +113,8 @@ def compute(self):
ifm = dict(map(lambda x: (x['ifIndex'], x['ifDescr']),
d['PRouterEntry']['ifTable']))
for pl in d['PRouterEntry']['lldpTable']['lldpRemoteSystemsData']:
if pl['lldpRemLocalPortNum'] in ifm:
if pl['lldpRemLocalPortNum'] in ifm and self._chk_lnk(
d['PRouterEntry'], pl['lldpRemLocalPortNum']):
if pl['lldpRemPortId'].isdigit():
rii = int(pl['lldpRemPortId'])
else:
Expand Down

0 comments on commit e023e96

Please sign in to comment.