Skip to content

[BUG]: sonic_bgp_af: diff produced by --check doesn't match actual changes #606

@rkerr

Description

@rkerr

Bug Description

When using sonic_bgp_af module the output from --check mode doesn't match the config to be applied.

When not using --check mode the correct config is applied and the correct diff produced.

Product Name

Enterprise SONiC Distribution by Broadcom - Enterprise Base package

Component or Module Name

sonic_bgp_af

DellEMC Enterprise SONiC Ansible Collection Version

dellemc.enterprise_sonic 3.2.0

SONiC Software Version

Software Version : 4.4.2-Enterprise_Base

Configuration

ANSIBLE_PIPELINING(/home/administrator/git/sonic-test/ansible.cfg) = True
CONFIG_FILE() = /home/administrator/git/sonic-test/ansible.cfg
DEFAULT_FORKS(/home/administrator/git/sonic-test/ansible.cfg) = 50
DEFAULT_HOST_LIST(/home/administrator/git/sonic-test/ansible.cfg) = ['/home/administrator/git/sonic-test/hosts.yml']
DEFAULT_JINJA2_EXTENSIONS(/home/administrator/git/sonic-test/ansible.cfg) = jinja2.ext.do
DEFAULT_ROLES_PATH(/home/administrator/git/sonic-test/ansible.cfg) = ['/home/administrator/git/sonic-test/roles']
DEFAULT_STDOUT_CALLBACK(/home/administrator/git/sonic-test/ansible.cfg) = yaml
DEFAULT_VAULT_PASSWORD_FILE(/home/administrator/git/sonic-test/ansible.cfg) = /home/administrator/.ansible_vault_pass.txt
DIFF_ALWAYS(/home/administrator/git/sonic-test/ansible.cfg) = True
DIFF_CONTEXT(/home/administrator/git/sonic-test/ansible.cfg) = 20
HOST_KEY_CHECKING(/home/administrator/git/sonic-test/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/administrator/git/sonic-test/ansible.cfg) = 240
RETRY_FILES_ENABLED(/home/administrator/git/sonic-test/ansible.cfg) = False

Steps to Reproduce

Initially create some basic BGP config:

- name: Set BGP configuration
  dellemc.enterprise_sonic.sonic_bgp:
    config:
      - bgp_as: "65000"
        router_id: "1.1.1.1"

Then try to set some address family settings:

- name: Set BGP Address family configuration
  dellemc.enterprise_sonic.sonic_bgp_af:
    config:
      - bgp_as: "65000"
        address_family:
          afis:
            - afi: ipv4
              safi: unicast
              redistribute:
                - protocol: connected
                - protocol: static
              network:
                - "192.168.56.0/24"
            - afi: l2vpn
              safi: evpn
              route_advertise_list:
                - advertise_afi: ipv4
    state: replace

If you run the address family config with --check you get:

*** before
--- after
***************
*** 1,5 ****
--- 1,16 ----
  [
      {
+         'address_family': {
+             'afis': [
+                 {
+                     'afi': 'ipv4',
+                     'network': [
+                         '192.168.56.0/24'
+                     ],
+                     'safi': 'unicast'
+                 }
+             ]
+         },
          'bgp_as': '65000',
          'vrf_name': 'default'
      }

Which is obviously missing a lot of the specified options.

If you run it without --check the correct config is applied, and as a diff you get:

*** before
--- after
***************
*** 1,5 ****
--- 1,41 ----
  [
      {
+         'address_family': {
+             'afis': [
+                 {
+                     'afi': 'ipv4',
+                     'dampening': false,
+                     'max_path': {
+                         'ebgp': 1,
+                         'ibgp': 1
+                     },
+                     'network': [
+                         '192.168.56.0/24'
+                     ],
+                     'redistribute': [
+                         {
+                             'protocol': 'connected'
+                         },
+                         {
+                             'protocol': 'static'
+                         }
+                     ],
+                     'safi': 'unicast'
+                 },
+                 {
+                     'afi': 'l2vpn',
+                     'dup_addr_detection': {
+                         'enabled': true
+                     },
+                     'route_advertise_list': [
+                         {
+                             'advertise_afi': 'ipv4'
+                         }
+                     ],
+                     'safi': 'evpn'
+                 }
+             ]
+         },
          'bgp_as': '65000',
          'vrf_name': 'default'
      }

Which is correct, but doesn't match --check

Expected Behavior

The output from --check should match the config to be applied

Actual Behavior

They don't match

Logs

NA

Screenshots

No response

Additional Information

No response

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions