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

[GCU] bgp speaker rollback failure #2119

Closed
wen587 opened this issue Mar 28, 2022 · 3 comments · Fixed by #2145
Closed

[GCU] bgp speaker rollback failure #2119

wen587 opened this issue Mar 28, 2022 · 3 comments · Fixed by #2145

Comments

@wen587
Copy link
Contributor

wen587 commented Mar 28, 2022

Description

SONiC doesn't allow two bgp speaker have the same listen range. But it might happen during the GCU.
Let's say SPEAKER_CONFIG_A has IP_RANGE_A. We want to replace it with SPEAKER_CONFIG_B with IP_RANGE_A.
If the GCU sorting algorithm give out this patch order:
{op_1: add SPEAKER_CONFIG_B; op_2: remove SPEAKER_CONFIG_A}
Then after the op_1, there are two config share the same ip range, which result in the failure.

Steps to reproduce the issue

  1. Env: kvm-t0.
    original speaker config:
admin@vlab-01:~/speaker/test$ sudo config checkpoint init

{
"BGP_PEER_RANGE": {
        "BGPSLBPassive": {
            "ip_range": [
                "10.255.0.0/25"
            ],
            "name": "BGPSLBPassive",
            "src_address": "10.1.0.32"
        },
        "BGPVac": {
            "ip_range": [
                "192.168.0.0/21"
            ],
            "name": "BGPVac",
            "src_address": "10.1.0.32"
        }
    }
}
  1. Apply test config to speaker

admin@vlab-01:~/speaker/test$ cat tc_add.json
[
 {
  "op": "add",
  "path": "/BGP_PEER_RANGE",
  "value": {
   "BGPSLBPassive": {
    "ip_range": [
     "192.168.0.0/21"
    ],
    "name": "BGPSLBPassive",
    "src_address": "10.1.0.32"
   },
   "BGPSLBPassiveV6": {
    "ip_range": [
     "fc02:1000::/64"
    ],
    "name": "BGPSLBPassiveV6",
    "src_address": "fc00:1::32"
   }
  }
 }
]
admin@vlab-01:~/speaker/test$ sudo config apply-patch tc_add.json
...
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPVac"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6", "value": {"ip_range": ["fc02:1000::/64"], "name": "BGPSLBPassiveV6", "src_address": "fc00:1::32"}}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassive"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPSLBPassive", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}]
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Patch Applier: Patch application completed.

Config after the patch:

{
  "BGP_PEER_RANGE": {
        "BGPSLBPassive": {
            "ip_range": [
                "192.168.0.0/21"
            ],
            "name": "BGPSLBPassive",
            "src_address": "10.1.0.32"
        },
        "BGPSLBPassiveV6": {
            "ip_range": [
                "fc02:1000::/64"
            ],
            "name": "BGPSLBPassiveV6",
            "src_address": "fc00:1::32"
        }
    }
}
  1. rollback to init config and check syslog err
admin@vlab-01:~/speaker/test$ sudo config rollback init
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6"}]

========Below "add" is ahead of "remove" operation results in two same ip range occur at the same time, which is incorrect======

Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPVac", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPVac", "src_address": "10.1.0.32"}}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassive"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPSLBPassive", "value": {"ip_range": ["10.255.0.0/25"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}]
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Patch Applier: Patch application completed.
Config Replacer: Verifying config replacement is reflected on ConfigDB.
Config Replacer: Config replacement completed.
Config Rollbacker: Config rollbacking completed.
Config rolled back successfully.

admin@vlab-01:~$ show logging -f | grep ERR
...
Mar 28 07:45:54.686979 vlab-01 ERR bgp#bgpcfgd: command execution returned 13. Command: '['vtysh', '-f', '/tmp/tmp5d_n7k5w']', stdout: '% Same listen range is attached to peer-group BGPSLBPassive#012', stderr: 'line 37: Failure to communicate[13] to bgpd, line:   bgp listen range 192.168.0.0/21 peer-group BGPVac#012#012'
Mar 28 07:45:54.686979 vlab-01 ERR bgp#bgpcfgd: ConfigMgr::commit(): can't push configuration from file='/tmp/tmp5d_n7k5w', rc='13', stdout='% Same listen range is attached to peer-group BGPSLBPassive#012', stderr='line 37: Failure to communicate[13] to bgpd, line:   bgp listen range 192.168.0.0/21 peer-group BGPVac#012#012'

Describe the results you received

Describe the results you expected

Additional information you deem important (e.g. issue happens only occasionally)

Output of show version

(paste your output here)
@ghooo
Copy link
Contributor

ghooo commented Mar 28, 2022

This is a YANG validation issue, it is not correctly validating the ip_ranges are different. We need to create an issue to fix the yang. If the YANG issue will take a long time to fix, we can hard-code the fix in GCU similar to what we did for the lanes validator, and remove the hard-coding once yang model validation isupdated.

@wen587
Copy link
Contributor Author

wen587 commented Mar 29, 2022

Link yang issue here.
sonic-net/sonic-buildimage#10376

@ghooo
Copy link
Contributor

ghooo commented Apr 29, 2022

qiluo-msft pushed a commit that referenced this issue May 17, 2022
#### What I did

Fixes #2119

#### Previous command output (if the output of a command-line utility has changed)
Sorting output:
```
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPVac", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPVac", "src_address": "10.1.0.32"}}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassive"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPSLBPassive", "value": {"ip_range": ["10.255.0.0/25"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}]

```
#### New command output (if the output of a command-line utility has changed)

Sorting output:
```
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6"}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE", "value": {"BGPSLBPassive": {"ip_range": ["10.255.0.0/25"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPVac", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPVac", "src_address": "10.1.0.32"}}]
```
yxieca pushed a commit that referenced this issue Jun 17, 2022
#### What I did

Fixes #2119

#### Previous command output (if the output of a command-line utility has changed)
Sorting output:
```
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPVac", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPVac", "src_address": "10.1.0.32"}}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassive"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPSLBPassive", "value": {"ip_range": ["10.255.0.0/25"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}]

```
#### New command output (if the output of a command-line utility has changed)

Sorting output:
```
Patch Applier: Applying 4 changes in order:
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE/BGPSLBPassiveV6"}]
Patch Applier:   * [{"op": "remove", "path": "/BGP_PEER_RANGE"}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE", "value": {"BGPSLBPassive": {"ip_range": ["10.255.0.0/25"], "name": "BGPSLBPassive", "src_address": "10.1.0.32"}}}]
Patch Applier:   * [{"op": "add", "path": "/BGP_PEER_RANGE/BGPVac", "value": {"ip_range": ["192.168.0.0/21"], "name": "BGPVac", "src_address": "10.1.0.32"}}]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants