Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT_1.54 bgp_override_as_path_split_horizon_test.go #3723

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ func TestMain(m *testing.M) {
}

const (
advertisedRoutesv4CIDR = "203.0.113.1/32"
advertisedRoutesv4Net = "203.0.113.1"
advertisedRoutesv4Prefix = 32
peerGrpName1 = "BGP-PEER-GROUP1"
peerGrpName2 = "BGP-PEER-GROUP2"
dutGlobalAS = 64512
dutLocalAS1 = 65501
dutLocalAS2 = 64513
ateAS1 = 65502
ateAS2 = 65503
plenIPv4 = 30
plenIPv6 = 126
policyName = "ALLOW"
advertisedRoutesv4CIDR = "203.0.113.1/32"
advertisedRoutesv4Net = "203.0.113.1"
advertisedRoutesv4Prefix = 32
advertisedRoutesv4PrefixLen = "32..32"
peerGrpName1 = "BGP-PEER-GROUP1"
peerGrpName2 = "BGP-PEER-GROUP2"
dutGlobalAS = 64512
dutLocalAS1 = 65501
dutLocalAS2 = 64513
ateAS1 = 65502
ateAS2 = 65503
plenIPv4 = 30
plenIPv6 = 126
policyName = "ALLOW"
prefixSetName = "prefSet"
)

var (
Expand Down Expand Up @@ -234,14 +236,17 @@ func verifyPrefixesTelemetry(t *testing.T, dut *ondatra.DUTDevice, nbr string, w
func configureRoutePolicy(t *testing.T, dut *ondatra.DUTDevice, name string, pr oc.E_RoutingPolicy_PolicyResultType) {
d := &oc.Root{}
rp := d.GetOrCreateRoutingPolicy()

prefixSet := rp.GetOrCreateDefinedSets().GetOrCreatePrefixSet(prefixSetName)
prefixSet.GetOrCreatePrefix(advertisedRoutesv4CIDR, advertisedRoutesv4PrefixLen)
pdef := rp.GetOrCreatePolicyDefinition(name)
stmt, err := pdef.AppendNewStatement(name)
if err != nil {
t.Fatalf("AppendNewStatement(%s) failed: %v", name, err)
}
stmt.GetOrCreateConditions().GetOrCreateMatchPrefixSet().SetPrefixSet(prefixSetName)
stmt.GetOrCreateActions().PolicyResult = pr
gnmi.Update(t, dut, gnmi.OC().RoutingPolicy().Config(), rp)

}

// verifyOTGPrefixTelemetry is to Validate prefix received on OTG por2.
Expand All @@ -260,7 +265,7 @@ func verifyOTGPrefixTelemetry(t *testing.T, otg *otg.OTG, wantPrefix bool) {
gotASPath := prefix.AsPath[len(prefix.AsPath)-1].GetAsNumbers()
t.Logf("Received prefix %v on otg as expected with AS-PATH %v", prefix.GetAddress(), gotASPath)
} else {
t.Errorf("Prefix %v is not received on otg", prefix.GetAddress())
t.Errorf("Prefix %v is received on otg when it is not expected", prefix.GetAddress())
}
}
}
Expand Down
Loading