Skip to content
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 to reduce time and fix counters related MIB #139

Closed
wants to merge 8 commits into from

Conversation

SuvarnaMeenakshi
Copy link
Contributor

- What I did

  • Fix add to reduce time in Namespace get_all, which is taking more time due to additional check to see if the key exists in a database.
  • In multi-asic platform, sai id is unique only within namespace, so avoid using sai id as key.

- How I did it

  • Remove key exists check in dbs_get_all
  • Make changes to MIB implementation using SAI ID as key, to use interface index as key instead:
    InterfacesMIB
    InterfaceMIBObjects
    cpfcIfTable
    csqIfQosGroupStatsTable
  • Make changes to rif/vlan related counters to use interface index as key instead of SAI ID.

- How to verify it

- Description for the changelog

reduce the overall time taken.

Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
unique across the device. The SAI object ID is unique for asic
or within a namespace. Modify the existing code to make sure that
data structures using SAI OID, it is not used as a key directly.
Modify implementation for MIB tables using COUNTER_DB and ASIC_DB
so that SAI OID is used to retrieve data only from a single
namespace.
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Jul 9, 2020

This pull request introduces 3 alerts when merging 389d92a into 253f58e - view on LGTM.com

new alerts:

  • 3 for Unused local variable

use sai oid as key.

Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>

self.if_bpid_map = Namespace.dbs_get_bridge_port_map(self.db_conn, mibs.ASIC_DB)
self.if_bpid_map = Namespace.dbs_get_bridge_port_map(self.db_conn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we don't need second Argument Here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbs_get_bridge_port_map() does not use the db name, the function only retrieves data from ASIC_DB, so did not have to use an argument to specify the db name.

if_idx = self.sai_oid_map[db_index][port_sai_id]
else:
continue
rif_counters = self.db_conn[db_index].get_all(mibs.COUNTERS_DB, mibs.counter_table(rif_sai_id), blocking=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why blocking is True in this case ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code did a get_all with blocking=true, so kept the same. should not cause an issue because we get based on rif_sai_id from the specific db instance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it will add to time taken ? same as original problem

@@ -1,11 +1,11 @@
{
"ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{\"bridge_id\":\"oid:0x0\",\"bridge_type\":\"SAI_FDB_ENTRY_BRIDGE_TYPE_1Q\",\"mac\":\"7C:FE:90:80:9F:10\",\"switch_id\":\"oid:0x21000000000000\",\"vlan\":\"1000\"}": {
"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID": "oid:0x3a0000000006208",
"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID": "oid:0x3a000000000616",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what trigger all these below changes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in mock tables are done so that the SAI ID for port and other objects are same in different namespace. Earlier, in the mock tables, it was unique across the device. To reflect the actual scenario where the same SAI Id can appear in a different namespace, the changes are made in asic_db and counter_db.

@@ -373,7 +376,7 @@ def init_sync_d_queue_tables(db_conn):

# Parse the queue_name_map and create the following maps:
# port_queues_map -> {"if_index : queue_index" : sai_oid}
# queue_stat_map -> {queue stat table name : {counter name : value}}
# queue_stat_map -> {"if_index : queue stat table name" : {counter name : value}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some comment as why these changes are needed (OID overlap) in Multi-Asic platforms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as per comment.

for oid in self.vlan_oid_sai_map:
if oid in self.vlan_oid_namespace:
db_index = self.vlan_oid_namespace[oid]
self.rif_counters[oid] = self.db_conn[db_index].get_all(mibs.COUNTERS_DB, mibs.counter_table(self.vlan_oid_sai_map[oid]), blocking=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the if condition will it not add to time taken ?

Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
@qiluo-msft
Copy link
Contributor

qiluo-msft commented Jul 9, 2020

Remove extra file foo #Closed

Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
@SuvarnaMeenakshi
Copy link
Contributor Author

Closing this PR as changes in this PR are not required.
Time increase and socket connection error is fixed using: #140
SAI ID fixes will be done in: #138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants