Repository navigation
[Namespace]: Fix SNMP AgentX socket connection timeout when using Namespace.get_all() - #140
Conversation
to reduce time taken. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
sync_d functions to reduce time taken in dbs_get_all. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
The Namespace functions will be used for both single and multi-asic platforms. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
| # 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.
kwargs['blocking'] = False [](start = 28, length = 26)
Please move it in next line. #Closed
There was a problem hiding this comment.
fixed as per comment.
| # 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.
( [](start = 11, length = 1)
you can remove '()' #Closed
There was a problem hiding this comment.
Fixed as per comment.
| # 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.
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.
@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.
As per suggestion, instead of modifying kwargs directly, did a shallow copy to change.
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
do a shallow copy instead. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
…espace.get_all() (#140) * [Namespace]: Remove key exists check in dbs_get_all to reduce time taken. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Minor fix. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * 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 <sumeenak@microsoft.com> * 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 <sumeenak@microsoft.com> * Fix review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Remove whitespace. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix review comment. Avoid modifying mutable object kwargs, do a shallow copy instead. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
…espace.get_all() (sonic-net#140) * [Namespace]: Remove key exists check in dbs_get_all to reduce time taken. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Minor fix. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * 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 <sumeenak@microsoft.com> * 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 <sumeenak@microsoft.com> * Fix review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix as per review comment. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Remove whitespace. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com> * Fix review comment. Avoid modifying mutable object kwargs, do a shallow copy instead. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi sumeenak@microsoft.com
- 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