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

Do not add layer2 interfaces to a virtual router #461

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

m4rcu5
Copy link

@m4rcu5 m4rcu5 commented Jun 28, 2022

Description

Prevent layer2 interfaces being added to virtual routers

Motivation and Context

The origin of this PR stems downstream from pan-os-ansible, where adding a aggregate interface with mode set to layer2 results in an error. This error seems to be due to the network module trying to add the layer2 interface to a virtual-router.

code example

- panos_aggregate_interface:
    if_name: "ae2"
    mode: layer2
    lacp_enable: True
    lldp_enabled: True
    lldp_profile: default
    commit: False

As layer2 interfaces do not have any routable properties, and cannot be added to a virtual-router in the PAN-OS interface, they should be excluded.

downstream error message

The full traceback is:
  File "/tmp/ansible_panos_aggregate_interface_payload_8n5bzkkx/ansible_panos_aggregate_interface_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_aggregate_interface.py", line 297, in main
  File "/home/mvandam/.local/lib/python3.10/site-packages/panos/network.py", line 433, in set_virtual_router
    return self._set_reference(
  File "/home/mvandam/.local/lib/python3.10/site-packages/panos/base.py", line 1664, in _set_reference
    obj.update(reference_var)
  File "/home/mvandam/.local/lib/python3.10/site-packages/panos/base.py", line 712, in update
    device.xapi.edit(
  File "/home/mvandam/.local/lib/python3.10/site-packages/panos/base.py", line 3899, in method
    raise the_exception
fatal: [fra01.lsvpn-hub.leaseweb.org]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "adjust_tcp_mss": null,
            "api_key": null,
            "comment": null,
            "commit": false,
            "create_dhcp_default_route": null,
            "dhcp_default_route_metric": null,
            "enable_dhcp": null,
            "if_name": "ae2",
            "ip": null,
            "ip_address": null,
            "ipv4_mss_adjust": null,
            "ipv6_enabled": null,
            "ipv6_mss_adjust": null,
            "lacp_enable": true,
            "lacp_mode": null,
            "lacp_passive_pre_negotiation": null,
            "lacp_rate": null,
            "lldp_enabled": true,
            "lldp_profile": "default",
            "management_profile": null,
            "mode": "layer2",
            "mtu": null,
            "netflow_profile": null,
            "password": null,
            "port": 443,
            "provider": {},
            "state": "present",
            "template": null,
            "username": "admin",
            "vr_name": "default",
            "vsys": null,
            "zone_name": null
        }
    },
    "msg": "Failed setref:  interface 'ae2' is not a valid reference"
}

How Has This Been Tested?

I have tested and can confirm that layer2 and layer3 aggregate interfaces are now correctly deployed. This has been tested against PAN-OS 10.1.6

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@welcome-to-palo-alto-networks

🎉 Thanks for opening this pull request! We really appreciate contributors like you! 🙌

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 this pull request may close these issues.

None yet

1 participant