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

lib: fix processing of choices in northbound (backport #15423) #15425

Merged
merged 4 commits into from
Feb 26, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Feb 25, 2024

This is an automatic backport of pull request #15423 done by Mergify.


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

idryzhov and others added 4 commits February 25, 2024 21:55
When ordering operations, destroys must always come before other
operations, to correctly cover the change of a "case" in a "choice".

The problem can be reproduced with the following commands:
```
access-list test seq 1 permit 10.0.0.0/8
access-list test seq 1 permit host 10.0.0.1
access-list test seq 1 permit 10.0.0.0/8
```

Before this commit, the order of changes would be the following:
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
- `access-list test seq 1 permit host 10.0.0.1`
  - `destroy` for `ipv4-prefix`
  - `modify` for `host`
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
  - `destroy` for `host`

As `destroy` for `host` is called last, it rewrites the fields that were
filled by `modify` callback of `ipv4-prefix`. This commit fixes this
problem by always calling `destroy` callbacks first.

Signed-off-by: Igor Ryzhov <[email protected]>
(cherry picked from commit 38b85e0)
Containers inside a choice's case must be treated as presence containers
as they can be explicitly created and deleted. They must have `create`
and `destroy` callbacks, otherwise the internal data they represent may
never be deleted.

The issue can be reproduced with the following steps:
- create an access-list with destination-network params
  ```
  # access-list test seq 1 permit ip any 10.10.10.0 0.0.0.255
  ```
- delete the `destination-network` container
  ```
  # mgmt delete-config /frr-filter:lib/access-list[name='test'][type='ipv4']/entry[sequence='1']/destination-network
  # mgmt commit apply
  MGMTD: No changes found to be committed!
  ```

As the `destination-network` container is non-presence, and all its
leafs are mandatory, mgmtd doesn't see any changes to be commited and
simply updates its YANG data tree without passing any updates to backend
daemons.

This commit fixes the issue by requiring `create` and `destroy`
callbacks for containers inside choice's cases.

Signed-off-by: Igor Ryzhov <[email protected]>
(cherry picked from commit 0b905f7)
Signed-off-by: Christian Hopps <[email protected]>
(cherry picked from commit a37f5f9)
Signed-off-by: Christian Hopps <[email protected]>
(cherry picked from commit e5acf67)
@frrbot frrbot bot added bugfix libfrr tests Topotests, make check, etc labels Feb 25, 2024
@ton31337 ton31337 merged commit 3496e9b into dev/10.0 Feb 26, 2024
16 checks passed
@ton31337 ton31337 deleted the mergify/bp/dev/10.0/pr-15423 branch February 26, 2024 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants