-
Notifications
You must be signed in to change notification settings - Fork 231
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
Feat(eos_designs): Add support for l3_port_channel_interfaces for WAN #4752
base: devel
Are you sure you want to change the base?
Feat(eos_designs): Add support for l3_port_channel_interfaces for WAN #4752
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4752
# Activate the virtual environment
source test-avd-pr-4752/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/ashenoy-arista/avd.git@samplePRBranch#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/ashenoy-arista/avd.git#/ansible_collections/arista/avd/,samplePRBranch --force
# Optional: Install AVD examples
cd test-avd-pr-4752
ansible-playbook arista.avd.install_examples |
2f1a500
to
d3086d9
Compare
d3086d9
to
7d8c276
Compare
...on-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type_l3_port_channels.schema.yml
Show resolved
Hide resolved
...on-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type_l3_port_channels.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml
Outdated
Show resolved
Hide resolved
a8fa6b9
to
1d61e17
Compare
2e10ead
to
f35199a
Compare
cfae876
to
fccd4c8
Compare
b8175d8
to
ffc3188
Compare
...rista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/node-type-l3-port-channels.yml
Outdated
Show resolved
Hide resolved
...rista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/node-type-l3-port-channels.yml
Outdated
Show resolved
Hide resolved
...rista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/node-type-l3-port-channels.yml
Outdated
Show resolved
Hide resolved
...rista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/node-type-l3-port-channels.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/base/__init__.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/utils_wan.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/underlay/static_routes.py
Outdated
Show resolved
Hide resolved
c689203
to
41612ab
Compare
bc465c9
to
4722769
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
4722769
to
f926bdf
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
f926bdf
to
6b2c856
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
6b2c856
to
f4f9bd5
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
f4f9bd5
to
48b2c8e
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
48b2c8e
to
4d92071
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
228bd56
to
20929d7
Compare
38cffe1
to
9b5741b
Compare
9b5741b
to
d7b934f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partial review - need to continue but sending initial comments
@@ -430,7 +431,9 @@ interface Dps1 | |||
| --------- | ----------- | ------------- | ---------- | ----| ---- | -------- | ------ | ------- | | |||
| Ethernet1.42 | RED-TEST | - | 10.42.3.1/24 | RED | - | False | - | - | | |||
| Ethernet1.666 | BLUE-TEST | - | 10.66.3.1/24 | BLUE | - | False | - | - | | |||
| Ethernet4 | REGION2-INTERNET-CORP_inet-site3-wan1_inet-cloud_Ethernet8 | - | dhcp | default | - | False | ACL-INTERNET-IN_Ethernet4 | - | | |||
| Ethernet4 | REGION2-INTERNET-CORP_inet-site3-wan1_inet-cloud | 4 | *dhcp | **default | **- | *False | *ACL-INTERNET-IN_Port-Channel4 | **- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the ACL be there? I think it should not be inherited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be correct here.
The generated config itself does not have any ACL being applied to Ethernet4 interface.
ACL-INTERNET-IN_Port-Channel4 is being applied for Port-Channel4 interface. So that seems fine.
Issue is with documentation table being generated.
This documentation related snippet appears to be being generated via logic in python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/ethernet-interfaces.j2
lines 430-440
In the case when ethernet intf is a member of a port-channel, we seem to be setting ip_address, vrf, mtu, shutdown, acl_in, acl_out for ethernet_interface based on values derived from corresponding Port-Channel<> interface.
Would it be correct to inherit values for such attributes?
- name: Port-Channel4 | ||
mode: active | ||
member_interfaces: | ||
- name: Ethernet4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's set peer_interface
here for the example
raw_eos_cli: | | ||
dhcp server ipv4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this back to structured_config? If not lets open an issue to add this in eos_cli_config_gen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed it is not there - lets open an issue to support this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue has been opened for eos_cli_config_gen
to support dhcp_server_ipv4
attribute when populated for Port-Channel interface within structured config
#4875
Once we have the fix, we could replace raw_eos_cli
with block below
structured_config: dhcp_server_ipv4: true
@@ -276,14 +273,6 @@ metadata: | |||
tags: | |||
- name: Type | |||
value: lan | |||
- interface: Ethernet4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just confirming we should not have a tag here for Port-Channel?
(From our discussion I think thats correct but jsut want to make sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on our discussion, we are NOT generating any interface tag for L3 Port-channel and its member ethernet interfaces. Once we have added support in CVaaS side to handle tags/etc associated with Port-Channel interface, we would then revisit this to generate interface tags.
@@ -24,4 +24,4 @@ wan_path_groups: | |||
|
|||
expected_error_message: >- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a similar test for port-channel to make sure we catch this as well (from a security purposes)
# TODO: Unable to add validation for 'mode' setting for Port-Channel sub-interface. | ||
# Since we have default value specified in schema for this, | ||
# we end up finding default value even when no explicit value is specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ClausHolbechArista not sure what we can do here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you call it with ._get("mode")
you will only get the value if it was manually given.
# Since we have default value specified in schema for this, | ||
# we end up finding default value even when no explicit value is specified. | ||
if l3_port_channel.member_interfaces: | ||
msg = f"Port-Channel sub-interface '{l3_port_channel}' has 'member_interfaces' set.This is not a valid setting." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg = f"Port-Channel sub-interface '{l3_port_channel}' has 'member_interfaces' set.This is not a valid setting." | |
# TODO: Add better context with source | |
msg = f"Port-Channel sub-interface '{l3_port_channel}' has 'member_interfaces' set.This is not a valid setting." |
please add a negative unit test for this
for parent_port_channel in subif_parent_port_channel_names: | ||
if parent_port_channel not in regular_l3_port_channel_names: | ||
msg = "At least one L3 Port-Channel subinterface does not have parent Port-Channel interface specified." | ||
raise AristaAvdInvalidInputsError(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should not try to be more specifc here by listing all of the ones with issues using set difference:
- refactor error message
for parent_port_channel in subif_parent_port_channel_names: | |
if parent_port_channel not in regular_l3_port_channel_names: | |
msg = "At least one L3 Port-Channel subinterface does not have parent Port-Channel interface specified." | |
raise AristaAvdInvalidInputsError(msg) | |
if (missing_parent_port_channel := subif_parent_port_channel_names.difference(regular_l3_port_channel_names)): | |
msg = "At least one L3 Port-Channel subinterface does not have parent Port-Channel interface specified." | |
raise AristaAvdInvalidInputsError(msg) |
# Note: structured config for individual member ethernet ports of each port-channel | ||
# would be generated by logic within EthernetInterfacesMixin class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need
# Note: structured config for individual member ethernet ports of each port-channel | |
# would be generated by logic within EthernetInterfacesMixin class. |
else: | ||
# This is a regular Port-Channel (not sub-interface) | ||
regular_l3_port_channel_names.add(interface_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch if and else and use
if "." not in interface_name:
regular_l3_port_channel_names.add(interface_name)
continue
<continue with code for subif>
Change Summary
Revised schema to support L3 Port-Channel interfaces and supporting changes to
eos_designs
Primary use-case is to allow such interfaces as wan-facing interfaces.
Related Issue(s)
Fixes #4695
Component(s) name
arista.avd.eos_designs
Proposed changes
How to test
This change introduces revised schema within
eos_designs
with node keyl3_port_channels
to represent L3 port-channel interfaces that may be used as wan-facing interfaces.
Includes logic to support the newly added schema and unit tests to validate handling of newly added schema attributes.
Checklist
User Checklist
Repository Checklist