sonic-net/sonic-swss

[teamsyncd] The TeamSync::addLag method does not update field "oper_status" of LAG_TABLE in state_db

super-jiying opened this issue · 0 comments

Description:

TeamSync::addLag method only updates "admin_status" and "mtu" field to m_stateLagTable.

    bool lag_update = true;
    /* Return when the team instance has already been tracked */
    if (m_teamSelectables.find(lagName) != m_teamSelectables.end())
    {
        auto tsync = m_teamSelectables[lagName];
        if (tsync->admin_state == admin_state && tsync->mtu == mtu)
            return;
        tsync->admin_state = admin_state;
        tsync->mtu = mtu;
        lag_update = false;
    }

    FieldValueTuple s("state", "ok");
    fvVector.push_back(s);
    if (m_warmstart)
    {
        m_stateLagTablePreserved[lagName] = fvVector;
    }
    else
    {
        m_stateLagTable.set(lagName, fvVector);
    }

This will result in the "oper_status" value of LAG_TABLE in state_db remaining unchanged.

Steps to reproduce the issue:

  1. config portchannel
  2. config portchannel member

Describe the results you received:

In appl_db,"oper_status" is "up".

127.0.0.1:6379> hgetall LAG_TABLE:PortChannel0101
1) "mtu"
2) "9216"
3) "admin_status"
4) "up"
5) "oper_status"
6) "up"

In state_db,"oper_status" is "down".

127.0.0.1:6379[6]> hgetall LAG_TABLE|PortChannel0101
 1) "admin_status"
 2) "up"
 3) "oper_status"
 4) "down"
 5) "mtu"
 6) "9216"
 7) "state"
 8) "ok"
 9) "team_device.ifinfo.ifindex"
10) "14"
11) "team_device.ifinfo.dev_addr"
12) "74:fe:48:7b:29:3e"
13) "runner.fast_rate"
14) "false"
15) "runner.fallback"
16) "false"
17) "runner.active"
18) "true"
19) "setup.pid"
20) "33"
21) "setup.kernel_team_mode_name"
22) "loadbalance"

Describe the results you expected:

The "oper_status" of LAG_TABLE in state_db keeps consistent with with it in appl_db.