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

swss-common: Changes to support SONiC Gearbox Manager #347

Merged
merged 6 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions common/database_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@
"id" : 7,
"separator": "|",
"instance" : "redis"
},
"ASIC_DB2" : {
"id" : 8,
"separator": "|",
"instance" : "redis"
},
"COUNTERS_DB2" : {
"id" : 9,
"separator": "|",
"instance" : "redis"
},
"FLEX_COUNTER_DB2" : {
"id" : 10,
"separator": "|",
"instance" : "redis"
},
"STATE_DB2" : {
"id" : 11,
"separator": "|",
"instance" : "redis"
}
},
"VERSION" : "1.0"
Expand Down
7 changes: 7 additions & 0 deletions common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ namespace swss {
#define FLEX_COUNTER_DB 5
#define STATE_DB 6
#define SNMP_OVERLAY_DB 7
#define ASIC_DB2 8
#define COUNTERS_DB2 9
#define FLEX_COUNTER_DB2 10
#define STATE_DB2 11
lguohan marked this conversation as resolved.
Show resolved Hide resolved
lguohan marked this conversation as resolved.
Show resolved Hide resolved

/***** APPLICATION DATABASE *****/

#define APP_PORT_TABLE_NAME "PORT_TABLE"
#define APP_GEARBOX_TABLE_NAME "GEARBOX_TABLE"
#define APP_VLAN_TABLE_NAME "VLAN_TABLE"
#define APP_VLAN_MEMBER_TABLE_NAME "VLAN_MEMBER_TABLE"
#define APP_LAG_TABLE_NAME "LAG_TABLE"
Expand Down Expand Up @@ -152,6 +157,8 @@ namespace swss {
#define CFG_PORT_TABLE_NAME "PORT"
#define CFG_PORT_CABLE_LEN_TABLE_NAME "CABLE_LENGTH"

#define CFG_GEARBOX_TABLE_NAME "GEARBOX"

#define CFG_INTF_TABLE_NAME "INTERFACE"
#define CFG_LOOPBACK_INTERFACE_TABLE_NAME "LOOPBACK_INTERFACE"
#define CFG_MGMT_INTERFACE_TABLE_NAME "MGMT_INTERFACE"
Expand Down
20 changes: 12 additions & 8 deletions common/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ const std::string TableBase::TABLE_NAME_SEPARATOR_COLON = ":";
const std::string TableBase::TABLE_NAME_SEPARATOR_VBAR = "|";

const TableNameSeparatorMap TableBase::tableNameSeparatorMap = {
{ APPL_DB, TABLE_NAME_SEPARATOR_COLON },
{ ASIC_DB, TABLE_NAME_SEPARATOR_COLON },
{ COUNTERS_DB, TABLE_NAME_SEPARATOR_COLON },
{ LOGLEVEL_DB, TABLE_NAME_SEPARATOR_COLON },
{ CONFIG_DB, TABLE_NAME_SEPARATOR_VBAR },
{ PFC_WD_DB, TABLE_NAME_SEPARATOR_COLON },
{ FLEX_COUNTER_DB, TABLE_NAME_SEPARATOR_COLON },
{ STATE_DB, TABLE_NAME_SEPARATOR_VBAR }
{ APPL_DB, TABLE_NAME_SEPARATOR_COLON },
{ ASIC_DB, TABLE_NAME_SEPARATOR_COLON },
{ COUNTERS_DB, TABLE_NAME_SEPARATOR_COLON },
{ LOGLEVEL_DB, TABLE_NAME_SEPARATOR_COLON },
{ CONFIG_DB, TABLE_NAME_SEPARATOR_VBAR },
{ PFC_WD_DB, TABLE_NAME_SEPARATOR_COLON },
{ FLEX_COUNTER_DB, TABLE_NAME_SEPARATOR_COLON },
{ STATE_DB, TABLE_NAME_SEPARATOR_VBAR },
{ ASIC_DB2, TABLE_NAME_SEPARATOR_VBAR },
Copy link
Contributor

Choose a reason for hiding this comment

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

what is ASIC_DB2? it is unclear what it is.

Choose a reason for hiding this comment

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

Hi Guohan;

The new ASIC_DB2 (as well as counters, flex, and state) database designations are being used by Gearbox and the new PHY SYNCD DOCKER.
These definitions are also specified in the specific HWSKU context_config.json files, such as in the following excerpt;

{
"guid" : 1,
"name" : "phy1",
"dbAsic" : "ASIC_DB2",
"dbCounters" : "COUNTERS_DB2",
"dbFlex": "FLEX_COUNTER_DB2",
"dbState" : "STATE_DB2",
"switches": [
{
"index" : 1,
"hwinfo" : ""
}
]
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should rename it to PHY_DB

Choose a reason for hiding this comment

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

Just thinking ahead here...
The design supports multiple phys for which each phy "could" have their own set of databases.
So I'm guessing the naming scheme made something like?
PHY_DB
PHY_DB2
etc...
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We used asic_db2 because we antiipate multiple switches in the future, and phy and switch are not differentiated in sairedis, so I believe we should give them all the same name. In the future, we may have multiredis support and we might then consider not needing this (redis then become namespace for the table names, one redis per switch). Please accept the change as it currently is proposed, future this might change but for now, asic_db2 is most consistent naming for switch related tables.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think all the phy db can be put into the same db since there are not much query/config activities. I think PHY_DB is a better name and give user more information on the nature of this db.

Copy link
Contributor

Choose a reason for hiding this comment

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

just to clarify, a added "2" for each of second db names since i didn't have any better name, we could add PHY or GB (as gearbox) prefixx or something more explanatory then just "2"

{ COUNTERS_DB2, TABLE_NAME_SEPARATOR_VBAR },
{ FLEX_COUNTER_DB2, TABLE_NAME_SEPARATOR_VBAR },
{ STATE_DB2, TABLE_NAME_SEPARATOR_VBAR }
};

Table::Table(const DBConnector *db, const string &tableName)
Expand Down