Skip to content

Commit

Permalink
Moving logic to facts
Browse files Browse the repository at this point in the history
  • Loading branch information
sugetha24 committed Oct 29, 2024
1 parent a50827b commit be91a88
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,25 @@ interface Ethernet1
mtu 9214
no switchport
ip address 10.254.2.1/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet2
description P2P_ptp-tests-spine1_Ethernet2
no shutdown
mtu 9214
no switchport
ip address 10.254.2.3/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet3
description SERVER_Endpoint-with-specific-PTP-profile_eth3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,25 @@ interface Ethernet1
mtu 9214
no switchport
ip address 10.254.2.5/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet2
description P2P_ptp-tests-spine1_Ethernet4
no shutdown
mtu 9214
no switchport
ip address 10.254.2.7/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet5
description SERVER_video-endpoint_PCI2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,51 @@ interface Ethernet1
mtu 9214
no switchport
ip address 10.254.2.0/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet2
description P2P_ptp-tests-leaf1_Ethernet2
no shutdown
mtu 9214
no switchport
ip address 10.254.2.2/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet3
description P2P_ptp-tests-leaf2_Ethernet1
no shutdown
mtu 9214
no switchport
ip address 10.254.2.4/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet4
description P2P_ptp-tests-leaf2_Ethernet2
no shutdown
mtu 9214
no switchport
ip address 10.254.2.6/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Ethernet6
description P2P_ptp-tests-spine2_Ethernet6
Expand Down Expand Up @@ -116,6 +140,12 @@ interface Ethernet10
mtu 9214
no switchport
ip address 10.254.2.12/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Loopback0
description ROUTER_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ interface Ethernet10
mtu 9214
no switchport
ip address 10.254.2.14/31
ptp enable
ptp announce interval 0
ptp announce timeout 3
ptp delay-req interval -3
ptp sync-message interval -3
ptp transport ipv4
!
interface Loopback0
description ROUTER_ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.1/31
- name: Ethernet2
peer: ptp-tests-spine1
Expand All @@ -155,6 +164,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.3/31
- name: Ethernet11
peer: ptp-tests-l2leaf1-ptp-disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.5/31
- name: Ethernet2
peer: ptp-tests-spine1
Expand All @@ -166,6 +175,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.7/31
- name: Ethernet11
peer: ptp-tests-l2leaf1-ptp-disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.0/31
- name: Ethernet2
peer: ptp-tests-leaf1
Expand All @@ -152,6 +161,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.2/31
- name: Ethernet3
peer: ptp-tests-leaf2
Expand All @@ -162,6 +180,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.4/31
- name: Ethernet4
peer: ptp-tests-leaf2
Expand All @@ -172,6 +199,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.6/31
- name: Ethernet10
peer: ptp-tests-restrict-uplinks-leaf1
Expand All @@ -182,6 +218,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.12/31
- name: Ethernet6
peer: ptp-tests-spine2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ ethernet_interfaces:
mtu: 9214
switchport:
enabled: false
ptp:
announce:
interval: 0
timeout: 3
delay_req: -3
sync_message:
interval: -3
transport: ipv4
enable: true
ip_address: 10.254.2.14/31
- name: Ethernet6
peer: ptp-tests-spine1
Expand Down

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

9 changes: 7 additions & 2 deletions python-avd/pyavd/_eos_designs/eos_designs_facts/uplinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ def _get_p2p_uplink(self: EosDesignsFacts, uplink_index: int, uplink_interface:

if self.shared_utils.uplink_ptp is not None:
uplink["ptp"] = self.shared_utils.uplink_ptp
elif self.shared_utils.ptp_enabled:
elif self.shared_utils.ptp_enabled and (
(self.shared_utils.ptp_uplinks and uplink["interface"] in self.shared_utils.ptp_uplinks) or (self.shared_utils.ptp_uplinks == [])
):
uplink["ptp"] = {"enable": True}

if self.shared_utils.uplink_macsec is not None:
Expand Down Expand Up @@ -264,7 +266,10 @@ def _get_l2_uplink(

if self.shared_utils.uplink_ptp is not None:
uplink["ptp"] = self.shared_utils.uplink_ptp
elif self.shared_utils.ptp_enabled:

elif self.shared_utils.ptp_enabled and (
(self.shared_utils.ptp_uplinks and uplink["interface"] in self.shared_utils.ptp_uplinks) or (self.shared_utils.ptp_uplinks == [])
):
uplink["ptp"] = {"enable": True}

# Remove vlans if upstream switch does not have them #}
Expand Down
7 changes: 3 additions & 4 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 @@ -67,7 +67,7 @@ def ethernet_interfaces(self: AvdStructuredConfigUnderlay) -> list | None:
)

# PTP
if get(link, "ptp.enable") is True and link["interface"] in self.shared_utils.ptp_uplinks:
if get(link, "ptp.enable") is True:
ptp_config = {}

# Apply PTP profile config if using the new ptp config style
Expand Down

0 comments on commit be91a88

Please sign in to comment.