Skip to content

Commit

Permalink
added deviation in bgp_2byte_4byte_asn_policy_test
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya committed Sep 10, 2024
1 parent 5dd4e85 commit 11a759f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ platform_exceptions: {
}
deviations: {
ipv4_missing_enabled: true
bgp_conditions_match_community_set_unsupported: true
}
}
platform_exceptions: {
Expand All @@ -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: {
Expand Down

0 comments on commit 11a759f

Please sign in to comment.