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

Feat(eos_designs): Add platform match criteria for network_ports #4798

Merged
merged 23 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6d26f6e
Feat(eos_designs): Add platform match criteria for network_ports
kpbush30 Dec 9, 2024
cbed447
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 9, 2024
380710c
Make things happy again
kpbush30 Dec 9, 2024
b6f92e3
Merge branch 'network_ports_4786' of github.com:kpbush30/avd into net…
kpbush30 Dec 9, 2024
43847bd
Alter behavior to allow platform only criteria
kpbush30 Dec 9, 2024
bed8213
Better comments for your eyes
kpbush30 Dec 9, 2024
1ff40bc
Remove extra comments
kpbush30 Dec 9, 2024
3bff360
Add no match test and better desc
kpbush30 Dec 10, 2024
ea076d1
Update schema and docs with expected behavior
kpbush30 Dec 11, 2024
ba8b5e8
Fix behavior on match criteria to avoid bad time
kpbush30 Dec 11, 2024
9dfb310
Fix comment
kpbush30 Dec 11, 2024
acd3486
Updates docs on maatch criteria usage.
kpbush30 Dec 16, 2024
5f931bc
Update test to test on platform regex match
kpbush30 Dec 16, 2024
2673c94
Convert regex match to 'fullmatch'
kpbush30 Dec 16, 2024
80fe61b
Update platform match description
kpbush30 Dec 16, 2024
5276f51
Move TODO comment
kpbush30 Dec 16, 2024
48c4668
Merge branch 'devel' into network_ports_4786
ClausHolbechArista Jan 17, 2025
5749f54
Rerun molecule after rebase
ClausHolbechArista Jan 17, 2025
689479a
Update python-avd/pyavd/_eos_designs/schema/schema_fragments/network_…
ClausHolbechArista Jan 22, 2025
ba2e018
Update python-avd/pyavd/_eos_designs/structured_config/connected_endp…
ClausHolbechArista Jan 22, 2025
1e521d6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 22, 2025
ce7f0fb
Merge branch 'devel' into network_ports_4786
gmuloc Jan 22, 2025
7cad85a
Update ansible_collections/arista/avd/roles/eos_designs/docs/input-va…
gmuloc Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,24 @@ interface Ethernet17
no shutdown
switchport
!
interface Ethernet23
description PCs
no shutdown
switchport access vlan 100
switchport mode access
switchport
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface Ethernet24
description PCs
no shutdown
switchport access vlan 100
switchport mode access
switchport
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface Ethernet51
no shutdown
channel-group 43 mode active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,24 @@ interface Ethernet14
no shutdown
switchport
!
interface Ethernet47
description PCs
no shutdown
switchport access vlan 100
switchport mode access
switchport
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface Ethernet48
description PCs
no shutdown
switchport access vlan 100
switchport mode access
switchport
spanning-tree portfast
spanning-tree bpdufilter enable
!
interface Ethernet51
shutdown
switchport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,30 @@ ethernet_interfaces:
channel_group:
id: 43
mode: active
- name: Ethernet23
peer: PCs
peer_type: network_port
port_profile: pc
description: PCs
shutdown: false
switchport:
enabled: true
mode: access
access_vlan: 100
spanning_tree_portfast: edge
spanning_tree_bpdufilter: enabled
- name: Ethernet24
peer: PCs
peer_type: network_port
port_profile: pc
description: PCs
shutdown: false
switchport:
enabled: true
mode: access
access_vlan: 100
spanning_tree_portfast: edge
spanning_tree_bpdufilter: enabled
mlag_configuration:
domain_id: mlag
local_interface: Vlan4094
Expand All @@ -833,3 +857,5 @@ monitor_sessions:
destinations:
- Ethernet17
encapsulation_gre_metadata_tx: true
metadata:
platform: 720XPM-24Y6
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,30 @@ ethernet_interfaces:
shutdown: true
switchport:
enabled: true
- name: Ethernet47
peer: PCs
peer_type: network_port
port_profile: pc
description: PCs
shutdown: false
switchport:
enabled: true
mode: access
access_vlan: 100
spanning_tree_portfast: edge
spanning_tree_bpdufilter: enabled
- name: Ethernet48
peer: PCs
peer_type: network_port
port_profile: pc
description: PCs
shutdown: false
switchport:
enabled: true
mode: access
access_vlan: 100
spanning_tree_portfast: edge
spanning_tree_bpdufilter: enabled
mlag_configuration:
domain_id: mlag
local_interface: Vlan4094
Expand All @@ -760,3 +784,5 @@ mlag_configuration:
reload_delay_non_mlag: '330'
ip_igmp_snooping:
globally_enabled: true
metadata:
platform: 720XPM-48Y6
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,35 @@ network_ports:
channel_id: 43
mode: "active"

# Tests below test hostname and platform matching.
# Test regex match all switches and specific platform match criteria.
- switches:
- network-ports-tests.*
laxmikantchintakindi marked this conversation as resolved.
Show resolved Hide resolved
switch_ports:
- Ethernet47-48
platforms:
- 720XPM-48Y6
profile: pc
endpoint: PCs

# Test regex match switch and no match on platform.
- switches:
- network-ports-tests.2
switch_ports:
- Ethernet47-48
gmuloc marked this conversation as resolved.
Show resolved Hide resolved
platforms:
- 720XPM-48Y6
profile: pc
endpoint: PCs

# Test only platform match.
- switch_ports:
- Ethernet23-24
platforms:
- 720XPM-24Y6
profile: pc
endpoint: PCs

servers:
- name: CONNECTED_ENDPOINT_OVERWRITING_NETWORK_PORT
adapters:
Expand Down Expand Up @@ -171,7 +200,23 @@ l2leaf:
nodes:
- name: network-ports-tests.1
id: 1
platform: 720XPM-48Y6
- name: network-ports-tests-2
filter:
only_vlans_in_use: true
id: 2
platform: 720XPM-24Y6

# Used for platform filtering tests
custom_platform_settings:
- platforms:
- 720XPM-48Y6
- 720XPM-24Y6
feature_support:
poe: true
queue_monitor_length_notify: false
reload_delay:
mlag: 300
non_mlag: 330
trident_forwarding_table_partition: flexible exact-match 16000 l2-shared 18000 l3-shared
22000

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions python-avd/pyavd/_eos_designs/schema/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ keys:
The regular expression must match the full hostname.
items:
type: str
platforms:
gmuloc marked this conversation as resolved.
Show resolved Hide resolved
type: list
kpbush30 marked this conversation as resolved.
Show resolved Hide resolved
description: |
ClausHolbechArista marked this conversation as resolved.
Show resolved Hide resolved
Matching the platform type of one or more switches. If you need to add custom platforms to match specific port quantities, create them under `custom_platform_settings`.
Entries under `custom_platform_settings` should match the platform match criteria.
For example, `720XP-48Y6` would require a custom platform type:

platforms:
- 720XP
- 720XP-48Y6
items:
type: str
switch_ports:
type: list
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def _filtered_network_ports(self: AvdStructuredConfigConnectedEndpoints) -> list
for index, network_port in enumerate(self.inputs.network_ports):
network_port._context = f"network_ports[{index}]"
network_port_settings = self.shared_utils.get_merged_adapter_settings(network_port)
if not self._match_regexes(network_port_settings.switches, self.shared_utils.hostname):
if network_port_settings.switches and not self._match_regexes(network_port_settings.switches, self.shared_utils.hostname):
gmuloc marked this conversation as resolved.
Show resolved Hide resolved
continue
if network_port_settings.platforms and self.shared_utils.platform not in network_port_settings.platforms:
continue

filtered_network_ports.append(network_port_settings)
Expand Down
Loading