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

dcnm_vrf: 500 error at /rest/top-down/fabrics/f1/vrfs/attachments #357

Open
allenrobel opened this issue Dec 14, 2024 · 0 comments · May be fixed by #354
Open

dcnm_vrf: 500 error at /rest/top-down/fabrics/f1/vrfs/attachments #357

allenrobel opened this issue Dec 14, 2024 · 0 comments · May be fixed by #354

Comments

@allenrobel
Copy link
Collaborator

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

While running the merged-state integration test, dcnm_vrf appears to be sending an invalid payload, which results in the following 500 error response:

"com.google.gson.JsonArray incompatible with com.google.gson.JsonObject"

Ansible Version and collection version

DCNM version

  • V 3.6.0

Affected module(s)

  • dcnm_vrf

Ansible Playbook

This happens when the following test from the merged.yaml integration test is run.

- name: TEST.3 - MERGED - [merged] Create, Attach, Deploy VLAN+VRF+LITE EXTENSION ansible-vrf-int1 switch_2 (user provided)
  cisco.dcnm.dcnm_vrf: &conf3
    fabric: "{{ fabric_1 }}"
    state: merged
    config:
    - vrf_name: ansible-vrf-int1
      vrf_id: 9008011
      vrf_template: Default_VRF_Universal
      vrf_extension_template: Default_VRF_Extension_Universal
      vlan_id: 500
      attach:
      - ip_address: "{{ switch_1 }}"
      - ip_address: "{{ switch_2 }}"
        vrf_lite:
          - peer_vrf: ansible-vrf-int1 # optional
            interface: "{{ interface_2a }}" # mandatory
            ipv4_addr: 10.33.0.2/30 # optional
            neighbor_ipv4: 10.33.0.1 # optional
            ipv6_addr: 2010::10:34:0:7/64 # optional
            neighbor_ipv6: 2010::10:34:0:3 # optional
            dot1q: 2 # dot1q can be got from dcnm
      deploy: true
  register: result_3

Debug Output

500 vs 200 responses with their payloads

Expected Behavior

We should get a 200 response.

Actual Behavior

We get a 500 response

Steps to Reproduce

Topology

  • edge router is in an ISN fabric
  • bgw_1 is switch_1 in the merged.yaml file.
  • bgw_2 is switch_2 in the merged.yaml file.
  • bgw_2.Eth2/9 is interface_2a in the merged.yaml file.
bgw_1.Eth2/9 --- Eth1/1.edge router
bgw_2.Eth2/9 --- Eth1/2.edge router

Switch Roles

  • edge router is an Edge Router role
  • bgw_1 is a Border role
  • bgw_2 is a Border role

This test was running with no errors with a different topology where bgw_1 and bgw_2 were both Border Gateway Spine role.

References

@allenrobel allenrobel linked a pull request Dec 16, 2024 that will close this issue
@allenrobel allenrobel linked a pull request Dec 16, 2024 that will close this issue
allenrobel added a commit that referenced this issue Dec 16, 2024
1. Potential fix for issue #357

If any interface in the playbook task's vrf_lite configuration does not match an interface on the switch that had extensionValues, call fail_json().

- Refactor vrf_lite processing out of push_diff_attach() and into:

- update_vrf_attach_vrf_lite_extensions()

- In update_vrf_attach_vrf_lite_extensions() verify that all interfaces in the playbook's vrf_lite section match an interface on the switch that has extensionValues.  If this check fails, call fail_json()

2. Rename get_extension_values_from_lite_object() to get_extension_values_from_lite_objects() and be explicit that the method takes a list of objects and returns a list of objects, or an empty list.

3. Add some debug statements

4. Rename vrf to vrf_name in push_to_remote()
allenrobel added a commit that referenced this issue Dec 20, 2024
Some test cases were previously (incorrectly) passing, but starting failing after the commit for issue #357   This commit updates these test cases to (correctly pass and adds corresponding test cases which (correctly) fail.

1. Updated test cases that previously passed incorrectly to now pass correctly.  These test cases previously passed despite using an interface that did not contain extensionValues.  Modified these test cases to use an interface WITH extensionValues.

2. Added test cases, corresponding to the above test cases, which fail due to using an interface without extensionValues.  These test cases are modified to expect fail_json() to be called.

3. Modified ALL testcases to call self.test_data.get() to retrieve their playbook.  Previously, global vars were used for their playbook.  This has a couple advantages.  a. when a testcase (or set of testcases) are run, only the playbook fixtures needed to be retrieved are retrieved.  Previously, ALL playbook fixtures where retrieved even if only one test case was run.  b. The dict() definition is now simpler and more consistent between testcases, since the config key in the dict() will always be playbook i.e. dict(config=playbook), where previously the config key contained different vars for every testcase.

4. Fixed a reference to a non-existent fixture in delete_std_lite.

This test case was trying to access self.mock_vrf_attach_get_ext_object_dcnm_att4_only, which does not exist.  Modified it to use self.mock_vrf_attach_get_ext_object_dcnm_att2_only.

5. Ran black, isort linters.
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.

1 participant