Skip to content

Commit

Permalink
[config] Fix snmpagentaddress doesn't support the uppercase letters f…
Browse files Browse the repository at this point in the history
…or ipv6 address (#1989)

* [config] Fix snmpagentaddress doesn't support the uppercase letters for ipv6 address (#4852)

	-What I did
	Snmpagentaddress now support upper letters input for ipv6 address
	Fix some grammer mistakes

	-How I did
	Convert all agentip to lower letters to match netifaces addresses
	delete ; after break, convert addfress to address

	-How to verify it
	'sudo config snmpagentaddress add FC00:1::32 -v mgmt'
	The ipv6 address can be obtained by command 'sudo ifconfig'

* [config] Change the way to solve issue 4852

-What I did
Snmpagentaddress now support upper letters input for ipv6 address

-How I did
Compare the lower letter of input and netifaces addresses

-How to verify it
'sudo config snmpagentaddress add FC00:1::32 -v mgmt'
The ipv6 address can be obtained by command 'sudo ifconfig'

Co-authored-by: Ubuntu <xiawei@xiawei-vm-01.tisdilhqf3cutp031mpllu05ca.syx.internal.cloudapp.net>
Co-authored-by: xwjiang2021 <xwjiang2021@github.com>
  • Loading branch information
3 people authored Feb 16, 2022
1 parent 84ddbfd commit 9e50124
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2497,13 +2497,13 @@ def add_snmp_agent_address(ctx, agentip, port, vrf):
ipaddresses = netifaces.ifaddresses(intf)
if ip_family[ip.version] in ipaddresses:
for ipaddr in ipaddresses[ip_family[ip.version]]:
if agentip == ipaddr['addr']:
if agentip.lower() == ipaddr['addr'].lower():
found = 1
break;
break
if found == 1:
break;
break
else:
click.echo("IP addfress is not available")
click.echo("IP address is not available")
return

key = agentip+'|'
Expand Down

0 comments on commit 9e50124

Please sign in to comment.