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

Don't handle buffer pool watermark during warm reboot reconciling #1987

Merged
merged 2 commits into from
Nov 24, 2021

Conversation

stephenxs
Copy link
Collaborator

What I did
Don't handle buffer pool watermark during warm reboot reconciling

Why I did it
This is to fix the community issue sonic-net/sonic-sairedis#862 and sonic-net/sonic-buildimage#8722

How I verified it
Perform a warm reboot. Check whether

  • buffer pool watermark handling is skipped during reconciling and handled after it.
  • other watermark handling is handled during reconciling as it was before.

Details if related
The warm reboot flow is like this:

  1. System starts. Orchagent fetches the items from database stored before warm reboot and pushes them into m_toSync of all orchagents. This is done by bake, which can be overridden by sub orchagent.
  2. All sub orchagents handle the items in m_toSync. At this point, any notification from redis-db is blocked.
  3. Warm reboot converges.
  4. Orchagent starts to handle notifications from redis-db.

The fix is like this: in FlexCounterOrch::bake. the buffer pool watermark handling is skipped.

…Y_VIEW

This is because

Signed-off-by: Stephen Sun <stephens@nvidia.com>
… during warm reboot

Signed-off-by: Stephen Sun <stephens@nvidia.com>
@stephenxs
Copy link
Collaborator Author

Test record:

  1. In bake, BUFFER_POOL_WATERMARK was skipped in warm reboot
    Oct 13 07:45:39.383950 sonic NOTICE swss#orchagent: :- bake: Add warm input: HW_MUX_CABLE_TABLE, 0
    Oct 13 07:45:39.384187 sonic NOTICE swss#orchagent: :- bake: FlexCounterOrch: Do not handle any FLEX_COUNTER table for 
    BUFFER_POOL_WATERMARK update during reconciling
    Oct 13 07:45:39.384664 sonic NOTICE swss#orchagent: :- bake: Add warm input: PFC_WD, 2
    
  2. FlexCounterOrch handles updates during reconciling, all other flex counters were handled except for BUFFER_POOL_WATERMARK
    Oct 13 07:45:50.601289 sonic NOTICE swss#orchagent: :- handlePortQosMapTable: Applied QoS maps to ports
    Oct 13 07:45:53.596008 sonic NOTICE swss#orchagent: message repeated 103 times: [ :- handlePortQosMapTable: Applied QoS maps to ports]
    Oct 13 07:45:53.596008 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PFCWD field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.596008 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PFCWD field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:53.596289 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_DROP field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.596289 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_DROP field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:53.596645 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_WATERMARK field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.596774 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_WATERMARK field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:53.863136 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.863136 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:53.874369 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT_BUFFER_DROP field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.874369 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT_BUFFER_DROP field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:53.883365 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:53.883365 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:58.295654 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE_WATERMARK field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:58.295654 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE_WATERMARK field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:58.295889 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key RIF field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:45:58.295889 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key RIF field FLEX_COUNTER_STATUS value enable
    Oct 13 07:45:58.297577 sonic NOTICE swss#orchagent: :- createEntry: Started PFC Watchdog on port Ethernet0
    Oct 13 07:45:58.298748 sonic NOTICE swss#orchagent: :- createEntry: Started PFC Watchdog on port Ethernet116
    Oct 13 07:46:06.539956 sonic NOTICE swss#orchagent: :- setWarmStartState: orchagent warm start state changed to restored
    Oct 13 07:46:06.539956 sonic NOTICE swss#orchagent: :- warmRestoreAndSyncUp: Orchagent state restore done
    Oct 13 07:46:06.539956 sonic NOTICE swss#orchagent: :- syncd_apply_view: Notify syncd APPLY_VIEW
    Oct 13 07:46:06.539983 sonic NOTICE swss#orchagent: :- notifySyncd: sending syncd: APPLY_VIEW
    Oct 13 07:46:15.950517 sonic NOTICE swss#orchagent: :- sai_redis_notify_syncd: switched ASIC to APPLY VIEW
    ```
    
  3. buffer pool watermarks were handled after warm reboot converged
    Oct 13 07:46:27.356273 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key BUFFER_POOL_WATERMARK field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.356273 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key BUFFER_POOL_WATERMARK field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.361367 sonic NOTICE swss#orchagent: :- generateBufferPoolWatermarkCounterIdList: Read shared headroom pool watermark failed on egress_lossless_pool, rv: SAI_STATUS_NOT_IMPLEMENTED
    Oct 13 07:46:27.365310 sonic NOTICE swss#orchagent: :- generateBufferPoolWatermarkCounterIdList: Read shared headroom pool watermark failed on egress_lossy_pool, rv: SAI_STATUS_NOT_IMPLEMENTED
    Oct 13 07:46:27.373391 sonic NOTICE swss#orchagent: :- generateBufferPoolWatermarkCounterIdList: Read shared headroom pool watermark failed on ingress_lossless_pool, rv: SAI_STATUS_NOT_IMPLEMENTED
    Oct 13 07:46:27.378326 sonic NOTICE swss#orchagent: :- generateBufferPoolWatermarkCounterIdList: Read shared headroom pool watermark failed on ingress_lossy_pool, rv: SAI_STATUS_NOT_IMPLEMENTED
    Oct 13 07:46:27.382201 sonic NOTICE swss#orchagent: :- generateBufferPoolWatermarkCounterIdList: Read shared headroom pool watermark failed on ingress_zero_pool, rv: SAI_STATUS_NOT_IMPLEMENTED
    Oct 13 07:46:27.385653 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PFCWD field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.385653 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PFCWD field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.385839 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_DROP field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.385839 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_DROP field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.386070 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_WATERMARK field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.386070 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PG_WATERMARK field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.386237 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.386237 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.386419 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT_BUFFER_DROP field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.386542 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key PORT_BUFFER_DROP field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.386640 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.386640 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.386885 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE_WATERMARK field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.386885 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key QUEUE_WATERMARK field FLEX_COUNTER_STATUS value enable
    Oct 13 07:46:27.387097 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key RIF field FLEX_COUNTER_DELAY_STATUS value false
    Oct 13 07:46:27.387124 sonic NOTICE swss#orchagent: :- doTask: FlexCounterOrch: Handling key RIF field FLEX_COUNTER_STATUS value enable
    

@stephenxs
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Contributor

@stephenxs So this issue exists because we call get_buffer_pool_stats and clear_buffer_pool_stats in generateBufferPoolWatermarkCounterIdList that you want to postpone in this change?
Why not using sai_query_stats_capability which tells whether object supports READ, READ_CLEAR capabilities?

@stephenxs
Copy link
Collaborator Author

@stephenxs So this issue exists because we call get_buffer_pool_stats and clear_buffer_pool_stats in generateBufferPoolWatermarkCounterIdList that you want to postpone in this change? Why not using sai_query_stats_capability which tells whether object supports READ, READ_CLEAR capabilities?

@stepanblyschak
Thanks for the suggestion. Yes, that's the motivation but I'm afraid sai_query_stats_capability is not able to satisfy the requirement.

/**
 * @brief Query statistics capability for statistics bound at object level
 *
 * @param[in] switch_id SAI Switch object id
 * @param[in] object_type SAI object type
 * @param[inout] stats_capability List of implemented enum values, and the statistics modes (bit mask) supported per value
 *
 * @return #SAI_STATUS_SUCCESS on success, #SAI_STATUS_BUFFER_OVERFLOW if lists size insufficient, failure status code on error
 */

sai_query_stats_capability provides the ability to query capability on a per-object-type basis.
However, it is required to do it on a per-object basis here. Eg. on some platforms, SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_BYTES can be fetched on ingress_lossless_pool only. (This code is not here for now. It had been there but was reverted because of the bug we try to fix by this PR. We need to re-add it after the bug is fixed.)

@liat-grozovik liat-grozovik merged commit fb0a5fd into sonic-net:master Nov 24, 2021
@stephenxs stephenxs deleted the fix-flexcounter-reading branch November 24, 2021 13:17
judyjoseph pushed a commit that referenced this pull request Dec 1, 2021
)

- What I did
Don't handle buffer pool watermark during warm reboot reconciling

- Why I did it
This is to fix the community issue sonic-net/sonic-sairedis#862 and sonic-net/sonic-buildimage#8722

- How I verified it
Perform a warm reboot. Check whether

buffer pool watermark handling is skipped during reconciling and handled after it.
other watermark handling is handled during reconciling as it was before.
Details if related
The warm reboot flow is like this:

System starts. Orchagent fetches the items from database stored before warm reboot and pushes them into m_toSync of all orchagents. This is done by bake, which can be overridden by sub orchagent.
All sub orchagents handle the items in m_toSync. At this point, any notification from redis-db is blocked.
Warm reboot converges.
Orchagent starts to handle notifications from redis-db.
The fix is like this: in FlexCounterOrch::bake. the buffer pool watermark handling is skipped.

Signed-off-by: Stephen Sun <stephens@nvidia.com>
liat-grozovik pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 28, 2021
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086)
a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041)
71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051)
5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071)
8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072)
ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811)
89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064)
8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040)
b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT
ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060)
45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049)
b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054)
d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009)
24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029)
15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897)
ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951)
e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955)
bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997)
f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026)
fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910)
9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992)
3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048)
fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987)
16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907)
9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642)

Signed-off-by: Stephen Sun stephens@nvidia.com
stephenxs added a commit to stephenxs/sonic-buildimage that referenced this pull request Jan 6, 2022
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086)
a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041)
71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051)
5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071)
8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072)
ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811)
89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064)
8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040)
b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT
ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060)
45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049)
b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054)
d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009)
24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029)
15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897)
ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951)
e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955)
bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997)
f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026)
fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910)
9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992)
3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048)
fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987)
16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907)
9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642)

Signed-off-by: Stephen Sun stephens@nvidia.com
judyjoseph pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jan 6, 2022
691c37b [Route bulk] Fix bugs in case a SET operation follows a DEL operation in the same bulk (sonic-net/sonic-swss#2086)
a4c80c3 patch for issue sonic-net/sonic-swss#1971 - enable Rx Drop handling for cisco-8000 (sonic-net/sonic-swss#2041)
71751d1 [macsec] Support setting IPG by gearbox_config.json (sonic-net/sonic-swss#2051)
5d5c169 [bulk mode] Fix bulk conflict when in case there are both remove and set operations (sonic-net/sonic-swss#2071)
8bbdbd2 Fix SRV6 NHOP CRM object type (sonic-net/sonic-swss#2072)
ef5b35f [vstest] VS test failure fix after fabric port orch PR merge (sonic-net/sonic-swss#1811)
89ea538 Supply the missing ingress/egress port profile list in document (sonic-net/sonic-swss#2064)
8123437 [pfc_detect] fix RedisReply errors (sonic-net/sonic-swss#2040)
b38f527 [swss][CRM][MPLS] MPLS CRM Nexthop - switch back to using SAI OBJECT rather than SWITCH OBJECT
ae061e5 create debug_shell_enable config to enable debug shell (sonic-net/sonic-swss#2060)
45e446d [cbf] Fix max FC value (sonic-net/sonic-swss#2049)
b1b5b29 Initial p4orch pytest code. (sonic-net/sonic-swss#2054)
d352d5a Update default route status to state DB (sonic-net/sonic-swss#2009)
24a64d6 Orchagent: Integrate P4Orch (sonic-net/sonic-swss#2029)
15a3b6c Delete the IPv6 link-local Neighbor when ipv6 link-local mode is disabled (sonic-net/sonic-swss#1897)
ed783e1 [orchagent] Add trap flow counter support (sonic-net/sonic-swss#1951)
e9b05a3 [vnetorch] ECMP for vnet tunnel routes with endpoint health monitor (sonic-net/sonic-swss#1955)
bcb7d61 P4Orch: inital add of source (sonic-net/sonic-swss#1997)
f6f6f86 [mclaglink] fix acl out ports (sonic-net/sonic-swss#2026)
fd887bf [Reclaim buffer] Reclaim unused buffer for dynamic buffer model (sonic-net/sonic-swss#1910)
9258978 [orchagent, cfgmgr] Add response publisher and state recording (sonic-net/sonic-swss#1992)
3d862a7 Fixing subport vs test script for subport under VNET (sonic-net/sonic-swss#2048)
fb0a5fd Don't handle buffer pool watermark during warm reboot reconciling (sonic-net/sonic-swss#1987)
16d4bcd Routed subinterface enhancements (sonic-net/sonic-swss#1907)
9639db7 [vstest/subintf] Add vs test to validate sub interface ingress to a vnet (sonic-net/sonic-swss#1642)

Signed-off-by: Stephen Sun stephens@nvidia.com
qiluo-msft pushed a commit that referenced this pull request Jan 10, 2022
)

- What I did
Don't handle buffer pool watermark during warm reboot reconciling

- Why I did it
This is to fix the community issue sonic-net/sonic-sairedis#862 and sonic-net/sonic-buildimage#8722

- How I verified it
Perform a warm reboot. Check whether

buffer pool watermark handling is skipped during reconciling and handled after it.
other watermark handling is handled during reconciling as it was before.
Details if related
The warm reboot flow is like this:

System starts. Orchagent fetches the items from database stored before warm reboot and pushes them into m_toSync of all orchagents. This is done by bake, which can be overridden by sub orchagent.
All sub orchagents handle the items in m_toSync. At this point, any notification from redis-db is blocked.
Warm reboot converges.
Orchagent starts to handle notifications from redis-db.
The fix is like this: in FlexCounterOrch::bake. the buffer pool watermark handling is skipped.

Signed-off-by: Stephen Sun <stephens@nvidia.com>
liat-grozovik pushed a commit that referenced this pull request Jan 24, 2022
…OOM_WATERMARK_BYTES on a pool where it is not supported (#1857) (#2106)

- What I did
Currently, SAI_BUFFER_POOL_STAT_WATERMARK_BYTES and SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_BYTES are queried for buffer pools.
However, the latter is not supported on all pools and all platforms, which will results in sairedis complaint
To avoid that, we need to test whether it is supported before putting it to FLEX_COUNTER table

It depends on #1987 to be cherry-picked to 202012.

- Why I did it
[Bugfix] Don't query SAI_BUFFER_POOL_STAT_XOFF_ROOM_WATERMARK_BYTES if it is not supported by a pool

- How I verified it
Run vstest and manually test.
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
… replace operation in NoDependencyMoveValidator (sonic-net#1987)

#### What I did
Using `SimulatedConfig` instead of `TargetConfig` for validating a move using `NoDependencyMoveValidator`

SimulatedConfig: config after applying the given move
TargetConfig: the final config state that's required by the patch

The problem is if the moves is to update a list item, the list item location in the `TargetConfig` might have different location in the `CurrentConfig`.

The reason for that is the `TargetConfig` has the final outcome after applying the `patch`, but the move might be just making a small change towards this goal.

Example:
Assume current_config
```
{
    "VLAN": {
        "Vlan100": {
            "vlanid": "100",
            "dhcp_servers": [
                "192.0.0.1",
                "192.0.0.2"
            ]
        }
    }
}
```
TargetConfig:
```
{
    "VLAN": {
        "Vlan100": {
            "vlanid": "100",
            "dhcp_servers": [
                "192.0.0.3"
            ]
        }
    }
}
```
Move:
```python
ps.JsonMove(diff, OperationType.REPLACE, ["VLAN", "Vlan100", "dhcp_servers", 1], ["VLAN", "Vlan100", "dhcp_servers", 0])
```


The move means:
```
Replace the value in CurrentConfig that has path `/VLAN/Vlan100/dhcp_servers/1` with
the value from the TargetConfig that has the path `/VLAN/Vlan100/dhcp_servers/0`
```
Notice how the array index in CurrentConfig does not exist in TargetConfig

Instead of using TargetConfig to validate, use SimulatedConfig which is the config after applying the move. In this case it would be:
```
{
    "VLAN": {
        "Vlan100": {
            "vlanid": "100",
            "dhcp_servers": [
                "192.0.0.1",
                "192.0.0.3"
            ]
        }
    }
}
```

#### How I did it
Replace `diff.target_config` with `simulated_config`

#### How to verify it
added a unit-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants