@@ -267,6 +267,7 @@ def _load_candidate(self, filename, config, overwrite):
267267 ignore_warning = self .ignore_warning ,
268268 )
269269 except ConfigLoadError as e :
270+ self .discard_config ()
270271 if self .config_replace :
271272 raise ReplaceConfigException (e .errs )
272273 else :
@@ -284,7 +285,7 @@ def load_merge_candidate(self, filename=None, config=None):
284285
285286 def compare_config (self ):
286287 """Compare candidate config with running."""
287- diff = self .device .cu .diff ()
288+ diff = self .device .cu .diff (ignore_warning = self . ignore_warning )
288289
289290 if diff is None :
290291 return ""
@@ -383,7 +384,7 @@ def confirm_commit(self):
383384
384385 def discard_config (self ):
385386 """Discard changes (rollback 0)."""
386- self .device .cu .rollback (rb_id = 0 )
387+ self .device .cu .rollback (rb_id = 0 , ignore_warning = self . ignore_warning )
387388 if not self .lock_disable and not self .session_config_lock :
388389 self ._unlock ()
389390 if self .config_private :
@@ -448,7 +449,7 @@ def _convert_to_dict(interfaces):
448449 iface_data ["mac_address" ],
449450 str (iface_data ["mac_address" ]),
450451 ),
451- "speed" : - 1 ,
452+ "speed" : - 1.0 ,
452453 "mtu" : 0 ,
453454 }
454455 # result[iface]['last_flapped'] = float(result[iface]['last_flapped'])
@@ -463,12 +464,13 @@ def _convert_to_dict(interfaces):
463464 )
464465 if match is None :
465466 continue
466- speed_value = napalm .base .helpers .convert (int , match .group (1 ), - 1 )
467- if speed_value == - 1 :
467+ speed_value = napalm .base .helpers .convert (float , match .group (1 ), - 1.0 )
468+
469+ if speed_value == - 1.0 :
468470 continue
469471 speed_unit = match .group (2 )
470472 if speed_unit .lower () == "gbps" :
471- speed_value *= 1000
473+ speed_value *= 1000.0
472474 result [iface ]["speed" ] = speed_value
473475
474476 return result
@@ -908,7 +910,18 @@ def get_lldp_neighbors(self):
908910 for neigh in result :
909911 if neigh [0 ] not in neighbors .keys ():
910912 neighbors [neigh [0 ]] = []
911- neighbors [neigh [0 ]].append ({x [0 ]: str (x [1 ]) for x in neigh [1 ]})
913+
914+ neigh_dict = {}
915+ for neigh_data in neigh [1 ]:
916+ key = neigh_data [0 ]
917+ value = (
918+ str (neigh_data [1 ][0 ])
919+ # When return value is a list of multiple objects, we pick the first one
920+ if neigh_data [1 ] and isinstance (neigh_data [1 ], list )
921+ else str (neigh_data [1 ])
922+ )
923+ neigh_dict [key ] = value
924+ neighbors [neigh [0 ]].append (neigh_dict )
912925
913926 return neighbors
914927
0 commit comments