Skip to content

Commit e1cc0de

Browse files
jipanyanglguohan
authored andcommitted
Add Intf config state to StateDB (sonic-net#642)
Signed-off-by: Jipan Yang <[email protected]>
1 parent 1f8e499 commit e1cc0de

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

cfgmgr/intfmgr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ IntfMgr::IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, c
2121
m_statePortTable(stateDb, STATE_PORT_TABLE_NAME),
2222
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME),
2323
m_stateVlanTable(stateDb, STATE_VLAN_TABLE_NAME),
24+
m_stateIntfTable(stateDb, STATE_INTERFACE_TABLE_NAME),
2425
m_appIntfTableProducer(appDb, APP_INTF_TABLE_NAME)
2526
{
2627
}
@@ -108,10 +109,12 @@ void IntfMgr::doTask(Consumer &consumer)
108109
continue;
109110
}
110111
setIntfIp(alias, "add", ip_prefix.to_string(), ip_prefix.isV4());
112+
m_stateIntfTable.hset(keys[0] + state_db_key_delimiter + keys[1], "state", "ok");
111113
}
112114
else if (op == DEL_COMMAND)
113115
{
114116
setIntfIp(alias, "del", ip_prefix.to_string(), ip_prefix.isV4());
117+
m_stateIntfTable.del(keys[0] + state_db_key_delimiter + keys[1]);
115118
}
116119
else
117120
{

cfgmgr/intfmgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class IntfMgr : public Orch
1919
private:
2020
ProducerStateTable m_appIntfTableProducer;
2121
Table m_cfgIntfTable, m_cfgVlanIntfTable;
22-
Table m_statePortTable, m_stateLagTable, m_stateVlanTable;
22+
Table m_statePortTable, m_stateLagTable, m_stateVlanTable, m_stateIntfTable;
2323

2424
bool setIntfIp(const string &alias, const string &opCmd, const string &ipPrefixStr, const bool ipv4 = true);
2525
void doTask(Consumer &consumer);

orchagent/orch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const char ref_end = ']';
3030
const char comma = ',';
3131
const char range_specifier = '-';
3232
const char config_db_key_delimiter = '|';
33+
const char state_db_key_delimiter = '|';
3334

3435
#define MLNX_PLATFORM_SUBSTRING "mellanox"
3536
#define BRCM_PLATFORM_SUBSTRING "broadcom"

0 commit comments

Comments
 (0)