Skip to content

Commit

Permalink
Add Intf config state to StateDB (sonic-net#642)
Browse files Browse the repository at this point in the history
Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
  • Loading branch information
jipanyang authored and lguohan committed Oct 16, 2018
1 parent 1f8e499 commit e1cc0de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
m_statePortTable(stateDb, STATE_PORT_TABLE_NAME),
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME),
m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME),
m_stateIntfTable(stateDb, STATE_INTERFACE_TABLE_NAME),
m_appIntfTableProducer(appDb, APP_INTF_TABLE_NAME)
{
}
Expand Down Expand Up @@ -108,10 +109,12 @@ void IntfMgr::doTask(Consumer &consumer)
continue;
}
setIntfIp(alias, "add", ip_prefix.to_string(), ip_prefix.isV4());
m_stateIntfTable.hset(keys[0] + state_db_key_delimiter + keys[1], "state", "ok");
}
else if (op == DEL_COMMAND)
{
setIntfIp(alias, "del", ip_prefix.to_string(), ip_prefix.isV4());
m_stateIntfTable.del(keys[0] + state_db_key_delimiter + keys[1]);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/intfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IntfMgr : public Orch
private:
ProducerStateTable m_appIntfTableProducer;
Table m_cfgIntfTable, m_cfgVlanIntfTable;
Table m_statePortTable, m_stateLagTable, m_stateVlanTable;
Table m_statePortTable, m_stateLagTable, m_stateVlanTable, m_stateIntfTable;

bool setIntfIp(const string &alias, const string &opCmd, const string &ipPrefixStr, const bool ipv4 = true);
void doTask(Consumer &consumer);
Expand Down
1 change: 1 addition & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const char ref_end = ']';
const char comma = ',';
const char range_specifier = '-';
const char config_db_key_delimiter = '|';
const char state_db_key_delimiter = '|';

#define MLNX_PLATFORM_SUBSTRING "mellanox"
#define BRCM_PLATFORM_SUBSTRING "broadcom"
Expand Down

0 comments on commit e1cc0de

Please sign in to comment.