@@ -39,10 +39,7 @@ def _is_neighbor_ipaddress(ipaddress):
3939 """
4040 config_db = ConfigDBConnector ()
4141 config_db .connect ()
42-
43- # Convert the IP address to uppercase because IPv6 addresses are stored
44- # in ConfigDB with all uppercase alphabet characters
45- entry = config_db .get_entry ('BGP_NEIGHBOR' , ipaddress .upper ())
42+ entry = config_db .get_entry ('BGP_NEIGHBOR' , ipaddress )
4643 return True if entry else False
4744
4845def _get_all_neighbor_ipaddresses ():
@@ -73,16 +70,17 @@ def _change_bgp_session_status_by_addr(ipaddress, status, verbose):
7370 config_db = ConfigDBConnector ()
7471 config_db .connect ()
7572
76- # Convert the IP address to uppercase because IPv6 addresses are stored
77- # in ConfigDB with all uppercase alphabet characters
78- config_db .mod_entry ('bgp_neighbor' , ipaddress .upper (), {'admin_status' : status })
73+ config_db .mod_entry ('bgp_neighbor' , ipaddress , {'admin_status' : status })
7974
8075def _change_bgp_session_status (ipaddr_or_hostname , status , verbose ):
8176 """Start up or shut down BGP session by IP address or hostname
8277 """
8378 ip_addrs = []
84- if _is_neighbor_ipaddress (ipaddr_or_hostname ):
85- ip_addrs .append (ipaddr_or_hostname )
79+
80+ # If we were passed an IP address, convert it to lowercase because IPv6 addresses were
81+ # stored in ConfigDB with all lowercase alphabet characters during minigraph parsing
82+ if _is_neighbor_ipaddress (ipaddr_or_hostname .lower ()):
83+ ip_addrs .append (ipaddr_or_hostname .lower ())
8684 else :
8785 # If <ipaddr_or_hostname> is not the IP address of a neighbor, check to see if it's a hostname
8886 ip_addrs = _get_neighbor_ipaddress_list_by_hostname (ipaddr_or_hostname )
0 commit comments