-
Notifications
You must be signed in to change notification settings - Fork 114
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
[Namespace]: Fix SNMP AgentX socket connection timeout when using Namespace.get_all() #140
Conversation
to reduce time taken. Signed-off-by: SuvarnaMeenakshi <[email protected]>
Signed-off-by: SuvarnaMeenakshi <[email protected]>
Signed-off-by: SuvarnaMeenakshi <[email protected]>
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.
LGTM
sync_d functions to reduce time taken in dbs_get_all. Signed-off-by: SuvarnaMeenakshi <[email protected]>
The Namespace functions will be used for both single and multi-asic platforms. Signed-off-by: SuvarnaMeenakshi <[email protected]>
src/sonic_ax_impl/mibs/__init__.py
Outdated
# If there are multiple namespaces, _hash might not be | ||
# present in all namespace, ignore if not present in a | ||
# specfic namespace. | ||
if (len(dbs) > 1) : kwargs['blocking'] = False |
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.
kwargs['blocking'] = False [](start = 28, length = 26)
Please move it in next line. #Closed
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.
fixed as per comment.
src/sonic_ax_impl/mibs/__init__.py
Outdated
# If there are multiple namespaces, _hash might not be | ||
# present in all namespace, ignore if not present in a | ||
# specfic namespace. | ||
if (len(dbs) > 1) : kwargs['blocking'] = False |
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.
( [](start = 11, length = 1)
you can remove '()' #Closed
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.
Fixed as per comment.
src/sonic_ax_impl/mibs/__init__.py
Outdated
# If there are multiple namespaces, _hash might not be | ||
# present in all namespace, ignore if not present in a | ||
# specfic namespace. | ||
if (len(dbs) > 1) : kwargs['blocking'] = False |
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.
kwargs [](start = 28, length = 6)
This parameter is passed as reference, and it is mutable.
If you change it inside function, it will have side-effect to the caller's scope. Could you do not change it? #Closed
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.
@qiluo-msft We were initially updating all the function call arguments and the changes were spread in multiple places. This approach looks better where only for Multi-Asic we are making blocking as False and for single asic behavior remains unchanged.
Also caller should not be impacted by this as it does not get used in caller scope and just passes the value to the library.
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.
As per suggestion, instead of modifying kwargs directly, did a shallow copy to change.
Signed-off-by: SuvarnaMeenakshi <[email protected]>
Signed-off-by: SuvarnaMeenakshi <[email protected]>
Signed-off-by: SuvarnaMeenakshi <[email protected]>
do a shallow copy instead. Signed-off-by: SuvarnaMeenakshi <[email protected]>
…espace.get_all() (#140) * [Namespace]: Remove key exists check in dbs_get_all to reduce time taken. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Minor fix. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Connect to all required namespace dbs during init and periodic sync_d functions to reduce time taken in dbs_get_all. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Change test_mibs to use generic wrapper function added. The Namespace functions will be used for both single and multi-asic platforms. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Fix review comment. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Remove whitespace. Signed-off-by: SuvarnaMeenakshi <[email protected]> * Fix review comment. Avoid modifying mutable object kwargs, do a shallow copy instead. Signed-off-by: SuvarnaMeenakshi <[email protected]>
Signed-off-by: SuvarnaMeenakshi [email protected]
- What I did
To support namespaces, we added a Namespace class with functions to support getting data from all databases.
The Namespace dbs_get_all function , checks if the key exists in the database and does db connect before executing get_all.
Both of this operation causes additional time, which was causing agentx socket to disconnect.
- How I did it
- How to verify it
For single-asic platform and multi-asic, execute snmp queries to verify that the agentx socket does not disconnect and time issue is seen.
- Description for the changelog