Skip to content

Commit e8bb6b9

Browse files
committed
Made ODL version check more robust
1 parent 9a9589e commit e8bb6b9

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

pathman_sr.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
20160831, Niklas - ver 5.7b - added pseudo node fix from Pathman project
4444
20160905, Niklas - ver 5.8 - Added ODL version detection and new netconf urls for Boron.
4545
20160906, Giles - ver 5.9 - Fixed TE metric get for ISIS,
46-
20160906, Niklas - ver 5.9 - Added topologies for TE and IGP metrics
46+
20160906, Niklas - ver 5.9b - Added topologies for TE and IGP metrics
47+
20160912, Niklas - ver 5.9c - Fixed Boron version check from false positives
4748
"""
4849
__author__ = 'niklas'
4950

@@ -60,7 +61,7 @@
6061

6162

6263
#==============================================================
63-
version = '5.9b'
64+
version = '5.9c'
6465
# Defaults overridden by pathman_ini.py
6566
odl_ip = '127.0.0.1'
6667
odl_port = '8181'
@@ -100,11 +101,12 @@
100101

101102
string = "bgpls://IsisLevel2:1/type=node&as=65504&domain=505290270&router=0000.0000.0029"
102103

103-
odl_version_dict = {'beryllium':{'name':"odl-rsvp-parser-spi-cfg", 'revision':"2015-08-26"},
104-
'lithium':{'name':"aaa-authn-model", 'revision':"2014-10-29"},
105-
'helium':{'name':"opendaylight-topology", 'revision':"2013-10-30"},
106-
'boron':{'name': "openconfig-interfaces", 'revision': "2016-04-12"},
107-
}
104+
odl_version_list = [
105+
{'boron':{'name': "openconfig-interfaces", 'revision': "2016-04-12"}},
106+
{'beryllium':{'name':"odl-rsvp-parser-spi-cfg", 'revision':"2015-08-26"}},
107+
{'lithium':{'name':"aaa-authn-model", 'revision':"2014-10-29"}},
108+
{'helium':{'name':"opendaylight-topology", 'revision':"2013-10-30"}},
109+
]
108110

109111
lsp07_xml = '''<input xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep">
110112
<node>{pcc}</node>
@@ -317,14 +319,14 @@ def version_check():
317319
if True:
318320
name_list = [mod['name'] for mod in result['modules']['module']]
319321
rev_list = [mod['revision'] for mod in result['modules']['module']]
320-
for odl_ver in odl_version_dict.keys():
321-
if odl_version_dict[odl_ver]['name'] in name_list:
322-
if odl_version_dict[odl_ver]['revision'] == rev_list[name_list.index(odl_version_dict[odl_ver]['name'])]:
323-
logging.info("Found ODL Release: %s" % odl_ver)
324-
return odl_ver
322+
for odl_ver in odl_version_list:
323+
version = odl_ver.keys()[0]
324+
if odl_ver[version]['name'] in name_list:
325+
if odl_ver[version]['revision'] == rev_list[name_list.index(odl_ver[version]['name'])]:
326+
logging.info("Found ODL Release: %s" % version)
327+
return version
325328
return ""
326329

327-
328330
def netconf_list(dummy=None):
329331
'''modified from from odl_gateway'''
330332

@@ -731,8 +733,15 @@ def list_pcep_lsp(node_list, debug):
731733
sid_list = []
732734
if 'odl-pcep-ietf-stateful07:lsp' in path['path'][0].keys():
733735
if 'operational' in path['path'][0]['odl-pcep-ietf-stateful07:lsp'].keys():
734-
if path['path'][0]['odl-pcep-ietf-stateful07:lsp']['operational'] == 'up':
735-
for nexthop in path['path'][0]['ero']['subobject']:
736+
oper = path['path'][0]['odl-pcep-ietf-stateful07:lsp']['operational']
737+
# if path['path'][0]['odl-pcep-ietf-stateful07:lsp']['operational'] == 'up':
738+
if oper == 'up' or oper == 'active':
739+
if 'rro' in path['path'][0].keys():
740+
route_obj = path['path'][0]['rro']['subobject']
741+
else:
742+
route_obj = path['path'][0]['ero']['subobject']
743+
# for nexthop in path['path'][0]['ero']['subobject']:
744+
for nexthop in route_obj:
736745
if 'ip-prefix' in nexthop.keys():
737746
ip_hoplist.append(nexthop['ip-prefix']['ip-prefix'])
738747
if 'odl-pcep-segment-routing:sid-type' in nexthop.keys():

0 commit comments

Comments
 (0)