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-7.3: Fixing IPv6 route generation, DefaultImportPolicy and regexp pattern #3632

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions feature/bgp/policybase/otg_tests/aspath_test/aspath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func configureImportBGPPolicy(t *testing.T, dut *ondatra.DUTDevice, ipv4 string,
pathV4 := gnmi.OC().NetworkInstance(dni).Protocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, bgpName).Bgp().Neighbor(ipv4).AfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).ApplyPolicy()
policyV4 := root.GetOrCreateNetworkInstance(dni).GetOrCreateProtocol(oc.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, bgpName).GetOrCreateBgp().GetOrCreateNeighbor(ipv4).GetOrCreateAfiSafi(oc.BgpTypes_AFI_SAFI_TYPE_IPV4_UNICAST).GetOrCreateApplyPolicy()
if !deviations.DefaultRoutePolicyUnsupported(dut) {
policyV4.SetDefaultImportPolicy(oc.RoutingPolicy_DefaultPolicyType_ACCEPT_ROUTE)
policyV4.SetDefaultImportPolicy(oc.RoutingPolicy_DefaultPolicyType_REJECT_ROUTE)
}
policyV4.SetImportPolicy([]string{"routePolicy"})
gnmi.Replace(t, dut, pathV4.Config(), policyV4)
Expand All @@ -111,10 +111,6 @@ func configureOTG(t *testing.T, bs *cfgplugins.BGPSession, prefixesV4 [][]string
ipv6 := devices[0].Ethernets().Items()[0].Ipv6Addresses().Items()[0]
bgp6Peer := devices[0].Bgp().Ipv6Interfaces().Items()[0].Peers().Items()[0]

bgp6PeerRoute := bgp6Peer.V6Routes().Add()
bgp6PeerRoute.SetName(bs.ATEPorts[0].Name + ".BGP6.peer.dut")
bgp6PeerRoute.SetNextHopIpv6Address(ipv6.Address())

for index, prefixes := range prefixesV4 {
bgp4PeerRoute := bgp4Peer.V4Routes().Add()
bgp4PeerRoute.SetName("prefix-set-" + strconv.Itoa(index) + "-" + bs.ATEPorts[0].Name + ".BGP4.peer.dut")
Expand All @@ -125,12 +121,16 @@ func configureOTG(t *testing.T, bs *cfgplugins.BGPSession, prefixesV4 [][]string
route4Address2.SetPrefix(prefixV4Len)
asp4 := bgp4PeerRoute.AsPath().Segments().Add()
asp4.SetAsNumbers(aspathMembers[index])
}

route6Address1 := bgp6PeerRoute.Addresses().Add().SetAddress(prefixesV6[index][0])
for index, prefixes := range prefixesV6 {
bgp6PeerRoute := bgp6Peer.V6Routes().Add()
bgp6PeerRoute.SetName("prefix-set-" + strconv.Itoa(index) + "-" + bs.ATEPorts[0].Name + ".BGP6.peer.dut")
bgp6PeerRoute.SetNextHopIpv6Address(ipv6.Address())
route6Address1 := bgp6PeerRoute.Addresses().Add().SetAddress(prefixes[0])
route6Address1.SetPrefix(prefixV6Len)
route6Address2 := bgp6PeerRoute.Addresses().Add().SetAddress(prefixesV6[index][1])
route6Address2 := bgp6PeerRoute.Addresses().Add().SetAddress(prefixes[1])
route6Address2.SetPrefix(prefixV6Len)

asp6 := bgp6PeerRoute.AsPath().Segments().Add()
asp6.SetAsNumbers(aspathMembers[index])
}
Expand Down Expand Up @@ -263,14 +263,14 @@ func TestAsPathSet(t *testing.T) {
{
desc: "Testing with match_my_regex_aspath-1",
aspathSetName: "match_my_regex_aspath-1",
aspathMatch: []string{"^100", "20[0-9]", "200$"},
aspathMatch: []string{"100", "20[0-9]", "200$"},
matchSetOptions: oc.RoutingPolicy_MatchSetOptionsType_ANY,
testResults: [6]bool{true, true, false, false, true, true},
},
{
desc: "Testing with my_regex_aspath-2",
aspathSetName: "my_regex_aspath-2",
aspathMatch: []string{"(^100)(.*)+(300$)"},
aspathMatch: []string{"(100)(.*)+(300$)"},
matchSetOptions: oc.RoutingPolicy_MatchSetOptionsType_ANY,
testResults: [6]bool{true, true, false, false, false, false},
},
Expand Down
10 changes: 10 additions & 0 deletions feature/bgp/policybase/otg_tests/aspath_test/metadata.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ platform_exceptions: {
default_route_policy_unsupported: true
}
}
platform_exceptions: {
platform: {
vendor: NOKIA
}
deviations: {
interface_enabled: true
static_protocol_name: "static"
explicit_interface_in_default_vrf: true
}
}
Loading