Skip to content

Commit

Permalink
Update error msg and add negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Laxmikant Chintakindi committed Oct 21, 2024
1 parent 357e133 commit 5504ee0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
type: l3leaf

ptp_profiles:
- profile: PROFILE-1

l3leaf:
defaults:
loopback_ipv4_pool: 10.254.1.0/27
vtep_loopback_ipv4_pool: 10.254.11.0/27
nodes:
- name: failure-p2p-links-ptp-profile-does-not-exist
id: 1
bgp_as: 65101
mgmt_ip: 192.168.0.101/24
ptp:
enabled: true

l3_edge:
p2p_links:
- nodes: [failure-p2p-links-ptp-profile-does-not-exist, not-in-fabric]
interfaces: [Ethernet10, Ethernet11]
ip: [192.168.0.2/31, 192.168.0.3/31]
ptp:
enabled: true
profile: PROFILE DOES NOT EXIST

expected_error_message: >-
PTP Profile 'PROFILE DOES NOT EXIST' referenced under l3_edge.p2p_links does not exist in `ptp_profiles`.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ all:
failure-missing-evpn-multicast-peg-rps:
failure-missing-evpn-multicast-with-pim:
failure-network-port-ptp-profile-does-not-exist:
failure-p2p-links-ptp-profile-does-not-exist:
failure-no-local-path-group-in-default-policy:
failure-adapter-ptp-profile-does-not-exist:
failure-svi-grandparent-profile-does-not-exist:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def _get_ethernet_cfg(self: AvdStructuredConfigCoreInterfacesAndL3Edge, p2p_link
ptp_config = {}

if (ptp_profile_name := get(p2p_link, "ptp.profile", default=self.shared_utils.ptp_profile_name)) is not None:
msg = f"PTP Profile '{ptp_profile_name}' referenced under {context} does not exist in `ptp_profiles`."
msg = f"PTP Profile '{ptp_profile_name}' referenced under {context}.p2p_links does not exist in `ptp_profiles`."
ptp_config.update(get_item(self.shared_utils.ptp_profiles, "profile", ptp_profile_name, required=True, custom_error_msg=msg))

# Apply PTP profile config
Expand Down

0 comments on commit 5504ee0

Please sign in to comment.