From e4faf63c624d76f6bf501c3d08fb9558ce82c88b Mon Sep 17 00:00:00 2001 From: Pramod Maurya Date: Tue, 10 Sep 2024 14:17:08 +0000 Subject: [PATCH] added deviation in bgp_2byte_4byte_asn_policy_test --- .../bgp_2byte_4byte_asn_policy_test.go | 10 +++++++--- .../bgp_2byte_4byte_asn_policy_test/metadata.textproto | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/bgp_2byte_4byte_asn_policy_test.go b/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/bgp_2byte_4byte_asn_policy_test.go index a90d728ebc8..dbdbbcf0ab8 100644 --- a/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/bgp_2byte_4byte_asn_policy_test.go +++ b/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/bgp_2byte_4byte_asn_policy_test.go @@ -157,7 +157,7 @@ func TestBgpSession(t *testing.T) { configureRegexPolicy(t, dut) d := &oc.Root{} - rpl := configureBGPPolicy(t, d, tc.nbr.isV4) + rpl := configureBGPPolicy(t, d, tc.nbr.isV4, dut) gnmi.Replace(t, dut, gnmi.OC().RoutingPolicy().Config(), rpl) t.Log("Configure BGP on DUT") @@ -259,7 +259,7 @@ func configureRegexPolicy(t *testing.T, dut *ondatra.DUTDevice) { // configureBGPPolicy configures a BGP routing policy to accept or reject routes based on prefix match conditions // Additonally, it also configures policy to match prefix based on community and regex for as path -func configureBGPPolicy(t *testing.T, d *oc.Root, isV4 bool) *oc.RoutingPolicy { +func configureBGPPolicy(t *testing.T, d *oc.Root, isV4 bool, dut *ondatra.DUTDevice) *oc.RoutingPolicy { t.Helper() rp := d.GetOrCreateRoutingPolicy() pset := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(rejectPrefix) @@ -299,7 +299,11 @@ func configureBGPPolicy(t *testing.T, d *oc.Root, isV4 bool) *oc.RoutingPolicy { t.Errorf("Error while creating new statement %v", err) } stmt50.GetOrCreateActions().PolicyResult = oc.RoutingPolicy_PolicyResultType_REJECT_ROUTE - stmt50.GetOrCreateConditions().GetOrCreateBgpConditions().CommunitySet = ygot.String(communitySet) + if deviations.BGPConditionsMatchCommunitySetUnsupported(dut) { + stmt50.GetOrCreateConditions().GetOrCreateBgpConditions().SetCommunitySet(communitySet) + } else { + stmt50.GetOrCreateConditions().GetOrCreateBgpConditions().GetOrCreateMatchCommunitySet().SetCommunitySet(communitySet) + } stmt60, err := pdefComm.AppendNewStatement(aclStatement4) if err != nil { diff --git a/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/metadata.textproto b/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/metadata.textproto index eaae52b496a..58e2412e7cb 100644 --- a/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/metadata.textproto +++ b/feature/bgp/otg_tests/bgp_2byte_4byte_asn_policy_test/metadata.textproto @@ -11,6 +11,7 @@ platform_exceptions: { } deviations: { ipv4_missing_enabled: true + bgp_conditions_match_community_set_unsupported: true } } platform_exceptions: { @@ -21,6 +22,7 @@ platform_exceptions: { explicit_port_speed: true explicit_interface_in_default_vrf: true interface_enabled: true + bgp_conditions_match_community_set_unsupported: true } } platform_exceptions: {