-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: correctly handle that lldp_loc_man_addr contains only IPv6 address without IPv4 address #164
Conversation
what is the miss here? can you add unit test to prevent future regression? |
We are trying to figure out a way to unit test. |
what changed? is this a regression? |
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
I have not investigate outside snmp container. I believe it is an image regression issue. |
how many ipv6 addresses does this have before? |
Sorry for misleading. The statement should be: |
what is the situation before? |
In a good system, I see one IPv4 plus one IPv6 address. |
make sense, can you put this into the issue and ask @gen-hwa to look at it further? why we are missing ipv4 address now? |
@@ -334,12 +337,12 @@ def update_data(self): | |||
|
|||
def get_next(self, sub_id): | |||
right = bisect_right(self.man_addr_list, sub_id) | |||
if right == len(self.man_addr_list): | |||
if right >= len(self.man_addr_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change required? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required. It just make code more robust.
In reply to: 503552127 [](ancestors = 503552127)
@@ -317,6 +317,9 @@ def reinit_data(self): | |||
if '.' in mgmt_ip: | |||
mgmt_ip_sub_oid = (addr_subtype_sub_oid, *[int(i) for i in mgmt_ip.split('.')]) | |||
break | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else block is not intended to match the right if block. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for-else structure, which is a critical change in this PR. If there is no IPv4 address matched in the for loop, we need to return soon. Otherwise future statement will fail since mgmt_ip_sub_oid==None
In reply to: 503552324 [](ancestors = 503552324)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thank you.
…ss without IPv4 address (#164) * Fix mgmt_ip_sub_oid default value to prevent later exception * Refix * Reimplement LLDPLocManAddrUpdater * Fix test case * Revert some back and fix lookup()
Fixed https://github.com/Azure/sonic-snmpagent/issues/163