diff --git a/napalm_iosxr/iosxr.py b/napalm_iosxr/iosxr.py index 40f275d..7be99bc 100644 --- a/napalm_iosxr/iosxr.py +++ b/napalm_iosxr/iosxr.py @@ -818,8 +818,8 @@ def build_prefix_limit(af_table, limit, prefix_percent, prefix_timeout): bgp_group, 'NeighborGroupAFTable/NeighborGroupAF/RoutePolicyIn') export_policy = napalm_base.helpers.find_txt( bgp_group, 'NeighborGroupAFTable/NeighborGroupAF/RoutePolicyOut') - multipath = eval((napalm_base.helpers.find_txt( - bgp_group, 'NeighborGroupAFTable/NeighborGroupAF/Multipath') or 'false').title()) + multipath = napalm_base.helpers.find_txt( + bgp_group, 'NeighborGroupAFTable/NeighborGroupAF/Multipath') == 'true' peer_as = napalm_base.helpers.convert( int, napalm_base.helpers.find_txt(bgp_group, 'RemoteAS/AS_YY'), 0) local_as = napalm_base.helpers.convert( @@ -949,8 +949,8 @@ def get_bgp_neighbors_detail(self, neighbor_address=''): napalm_base.helpers.find_txt(neighbor, 'Naming/NeighborAddress/IPV4Address') or napalm_base.helpers.find_txt(neighbor, 'Naming/NeighborAddress/IPV6Address') ) - local_address_configured = eval(napalm_base.helpers.find_txt( - neighbor, 'IsLocalAddressConfigured', 'false').title()) + local_address_configured = napalm_base.helpers.find_txt( + neighbor, 'IsLocalAddressConfigured') == 'true' local_address = napalm_base.helpers.ip( napalm_base.helpers.find_txt(neighbor, 'ConnectionLocalAddress/IPV4Address') or napalm_base.helpers.find_txt(neighbor, 'ConnectionLocalAddress/IPV6Address') @@ -963,12 +963,12 @@ def get_bgp_neighbors_detail(self, neighbor_address=''): ) remote_port = napalm_base.helpers.convert( int, napalm_base.helpers.find_txt(neighbor, 'ConnectionRemotePort')) - multihop = eval(napalm_base.helpers.find_txt( - neighbor, 'IsExternalNeighborNotDirectlyConnected', 'false').title()) - remove_private_as = eval(napalm_base.helpers.find_txt( - neighbor, 'AFData/Entry/RemovePrivateASFromUpdates', 'false').title()) - multipath = eval(napalm_base.helpers.find_txt( - neighbor, 'AFData/Entry/SelectiveMultipathEligible', 'false').title()) + multihop = napalm_base.helpers.find_txt( + neighbor, 'IsExternalNeighborNotDirectlyConnected') == 'true' + remove_private_as = napalm_base.helpers.find_txt( + neighbor, 'AFData/Entry/RemovePrivateASFromUpdates') == 'true' + multipath = napalm_base.helpers.find_txt( + neighbor, 'AFData/Entry/SelectiveMultipathEligible') == 'true' import_policy = napalm_base.helpers.find_txt( neighbor, 'AFData/Entry/RoutePolicyIn') export_policy = napalm_base.helpers.find_txt( @@ -1000,10 +1000,10 @@ def get_bgp_neighbors_detail(self, neighbor_address=''): advertised_prefix_count = napalm_base.helpers.convert( int, napalm_base.helpers.find_txt( neighbor, 'AFData/Entry/PrefixesAdvertised'), 0) - suppress_4byte_as = eval(napalm_base.helpers.find_txt( - neighbor, 'Suppress4ByteAs', 'false').title()) - local_as_prepend = not eval(napalm_base.helpers.find_txt( - neighbor, 'LocalASNoPrepend', 'false').title()) + suppress_4byte_as = napalm_base.helpers.find_txt( + neighbor, 'Suppress4ByteAs') == 'true' + local_as_prepend = napalm_base.helpers.find_txt( + neighbor, 'LocalASNoPrepend') != 'true' holdtime = napalm_base.helpers.convert( int, napalm_base.helpers.find_txt(neighbor, 'HoldTime'), 0) or vrf_holdtime configured_holdtime = napalm_base.helpers.convert( @@ -1142,7 +1142,7 @@ def get_ntp_stats(self): xpath = './/NodeTable/Node/Associations/PeerSummaryInfo/Entry/PeerInfoCommon' for node in result_tree.xpath(xpath): - synchronized = eval(napalm_base.helpers.find_txt(node, 'IsSysPeer', 'false').title()) + synchronized = napalm_base.helpers.find_txt(node, 'IsSysPeer') == 'true' address = napalm_base.helpers.find_txt(node, 'Address') if address == 'DLRSC node': continue @@ -1365,8 +1365,8 @@ def get_route_to(self, destination='', protocol=''): for bgp_path in bgp_route_tree.xpath('.//Path'): single_route_details = route_details.copy() if 'NotFound' not in bgp_path.keys(): - best_path = eval(napalm_base.helpers.find_txt( - bgp_path, 'PathInformation/IsBestPath', 'false').title()) + best_path = napalm_base.helpers.find_txt( + bgp_path, 'PathInformation/IsBestPath') == 'true' local_preference = napalm_base.helpers.convert( int, napalm_base.helpers.find_txt(