@@ -295,6 +295,8 @@ def reinit_data(self):
295
295
"""
296
296
Subclass update data routine.
297
297
"""
298
+ self .man_addr_list = []
299
+
298
300
# establish connection to application database.
299
301
self .db_conn .connect (mibs .APPL_DB )
300
302
mgmt_ip_bytes = self .db_conn .get (mibs .APPL_DB , mibs .LOC_CHASSIS_TABLE , b'lldp_loc_man_addr' )
@@ -306,10 +308,16 @@ def reinit_data(self):
306
308
logger .debug ("Got mgmt ip from db : {}" .format (self .mgmt_ip_str ))
307
309
try :
308
310
addr_subtype_sub_oid = 4
309
- mgmt_ip_sub_oid = (addr_subtype_sub_oid , * [int (i ) for i in self .mgmt_ip_str .split ('.' )])
311
+ mgmt_ip_sub_oid = None
312
+ for mgmt_ip in self .mgmt_ip_str .split (',' ):
313
+ if '.' in mgmt_ip :
314
+ mgmt_ip_sub_oid = (addr_subtype_sub_oid , * [int (i ) for i in mgmt_ip .split ('.' )])
315
+ break
310
316
except ValueError :
311
317
logger .error ("Invalid local mgmt IP {}" .format (self .mgmt_ip_str ))
312
318
return
319
+ if mgmt_ip_sub_oid == None :
320
+ return
313
321
sub_oid = (ManAddrConst .man_addr_subtype_ipv4 ,
314
322
* mgmt_ip_sub_oid )
315
323
self .man_addr_list .append (sub_oid )
@@ -340,7 +348,11 @@ def man_addr(self, sub_id):
340
348
:param sub_id:
341
349
:return: MGMT IP in HEX
342
350
"""
343
- hex_ip = " " .join ([format (int (i ), '02X' ) for i in self .mgmt_ip_str .split ('.' )])
351
+ hex_ip = ''
352
+ for mgmt_ip in self .mgmt_ip_str .split (',' ):
353
+ if '.' in mgmt_ip :
354
+ hex_ip = " " .join ([format (int (i ), '02X' ) for i in mgmt_ip .split ('.' )])
355
+ break
344
356
return hex_ip
345
357
346
358
@staticmethod
0 commit comments