Skip to content

Commit

Permalink
fixing sorting of switchport port-security vlan
Browse files Browse the repository at this point in the history
  • Loading branch information
Vibhu-gslab committed Oct 11, 2024
1 parent 5e73725 commit 33d199b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ interface Ethernet26.500
interface Ethernet27
description EVPN-Vxlan single-active redundancy
switchport
!
evpn ethernet-segment
identifier 0000:0000:0000:0102:0304
redundancy single-active
Expand All @@ -773,6 +774,7 @@ interface Ethernet27
interface Ethernet28
description EVPN-MPLS multihoming
switchport
!
evpn ethernet-segment
identifier 0000:0000:0000:0102:0305
mpls tunnel flood filter time 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,21 @@ interface Ethernet3
switchport trunk allowed vlan 2,14
switchport mode trunk
switchport
!
sync-e
priority 10
!
interface Ethernet5
description DC1-AGG01_Ethernet1
!
sync-e
!
interface Ethernet6
description P2P_LINK_TO_DC1-SPINE1_Ethernet6
mtu 1500
no switchport
ip address 172.31.255.15/31
!
sync-e
priority disabled
```
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ interface Ethernet26.500
interface Ethernet27
description EVPN-Vxlan single-active redundancy
switchport
!
evpn ethernet-segment
identifier 0000:0000:0000:0102:0304
redundancy single-active
Expand All @@ -388,6 +389,7 @@ interface Ethernet27
interface Ethernet28
description EVPN-MPLS multihoming
switchport
!
evpn ethernet-segment
identifier 0000:0000:0000:0102:0305
mpls tunnel flood filter time 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ interface Ethernet3
switchport trunk allowed vlan 2,14
switchport mode trunk
switchport
!
sync-e
priority 10
!
interface Ethernet5
description DC1-AGG01_Ethernet1
!
sync-e
!
interface Ethernet6
description P2P_LINK_TO_DC1-SPINE1_Ethernet6
mtu 1500
no switchport
ip address 172.31.255.15/31
!
sync-e
priority disabled
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ interface Ethernet17
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:213f:36b8:ff71
redundancy single-active
Expand All @@ -246,6 +247,7 @@ interface Ethernet18
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:00dd:00dd:00dd
redundancy all-active
Expand All @@ -258,6 +260,7 @@ interface Ethernet19
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:885b:86cc:8bac
redundancy single-active
Expand All @@ -275,6 +278,7 @@ interface Ethernet21
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:5d0b:68d3:6ff9
redundancy single-active
Expand All @@ -292,6 +296,7 @@ interface Ethernet23
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:262b:7df9:c98b
redundancy single-active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ interface Ethernet17
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:213f:36b8:ff71
redundancy single-active
Expand All @@ -246,6 +247,7 @@ interface Ethernet18
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:00dd:00dd:00dd
redundancy all-active
Expand All @@ -258,6 +260,7 @@ interface Ethernet19
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:885b:86cc:8bac
redundancy single-active
Expand All @@ -275,6 +278,7 @@ interface Ethernet21
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:5d0b:68d3:6ff9
redundancy single-active
Expand All @@ -292,6 +296,7 @@ interface Ethernet23
switchport trunk allowed vlan 310
switchport mode trunk
switchport
!
evpn ethernet-segment
identifier 0000:0000:262b:7df9:c98b
redundancy single-active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ interface {{ ethernet_interface.name }}
l2-protocol encapsulation dot1q vlan {{ ethernet_interface.l2_protocol.encapsulation_dot1q_vlan }}
{% endif %}
{% if ethernet_interface.evpn_ethernet_segment is arista.avd.defined %}
!
evpn ethernet-segment
{% if ethernet_interface.evpn_ethernet_segment.identifier is arista.avd.defined %}
identifier {{ ethernet_interface.evpn_ethernet_segment.identifier }}
Expand Down Expand Up @@ -684,13 +685,18 @@ interface {{ ethernet_interface.name }}
{% endif %}
{% if ethernet_interface.switchport.port_security.violation.mode is not arista.avd.defined('protect') %}
{% if ethernet_interface.switchport.port_security.vlans is arista.avd.defined %}
{% set sorted_vlans_cli = [] %}
{% for vlan in ethernet_interface.switchport.port_security.vlans %}
{% if vlan.range is arista.avd.defined and vlan.mac_address_maximum is arista.avd.defined %}
{% for id in vlan.range | arista.avd.range_expand %}
switchport port-security vlan {{ id }} mac-address maximum {{ vlan.mac_address_maximum }}
{% set port_sec_cli = "switchport port-security vlan " ~ id ~ " mac-address maximum " ~ vlan.mac_address_maximum %}
{% do sorted_vlans_cli.append(port_sec_cli) %}
{% endfor %}
{% endif %}
{% endfor %}
{% for vlan_cli in sorted_vlans_cli | arista.avd.natural_sort %}
{{ vlan_cli }}
{% endfor %}
{% endif %}
{% if ethernet_interface.switchport.port_security.vlan_default_mac_address_maximum is arista.avd.defined %}
switchport port-security vlan default mac-address maximum {{ ethernet_interface.switchport.port_security.vlan_default_mac_address_maximum }}
Expand Down Expand Up @@ -887,6 +893,7 @@ interface {{ ethernet_interface.name }}
{% endif %}
{% endif %}
{% if ethernet_interface.sync_e.enable is arista.avd.defined(true) %}
!
sync-e
{% if ethernet_interface.sync_e.priority is arista.avd.defined %}
priority {{ ethernet_interface.sync_e.priority }}
Expand Down

0 comments on commit 33d199b

Please sign in to comment.