Skip to content

Commit 34b5a46

Browse files
committed
e2e: test against L2 networks in VRF-Lite test cases
Signed-off-by: Jaime Caamaño Ruiz <[email protected]>
1 parent dfc14b4 commit 34b5a46

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

test/e2e/route_advertisements.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,7 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
10781078
// long timeouts
10791079
timeout = 240 * time.Second
10801080
timeoutNOK = 10 * time.Second
1081+
pollingNOK = 1 * time.Second
10811082
netexecPort = 8080
10821083
)
10831084
var netexecPortStr = fmt.Sprintf("%d", netexecPort)
@@ -1132,7 +1133,7 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
11321133
ip, _, err = net.SplitHostPort(ip)
11331134
g.Expect(err).NotTo(gomega.HaveOccurred())
11341135
g.Expect(ip).To(gomega.Equal(expect))
1135-
}).WithTimeout(timeout).WithPolling(framework.Poll).Should(gomega.Succeed())
1136+
}).WithTimeout(timeout).WithPolling(pollingNOK).Should(gomega.Succeed())
11361137
}
11371138
testPodToClientIPNOK := func(src *corev1.Pod, dstIP string) {
11381139
gomega.Consistently(func(g gomega.Gomega) {
@@ -1142,7 +1143,7 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
11421143
fmt.Sprintf("curl --max-time 2 -g -q -s http://%s/clientip", net.JoinHostPort(dstIP, netexecPortStr)),
11431144
)
11441145
g.Expect(err).To(gomega.HaveOccurred())
1145-
}).WithTimeout(timeoutNOK).WithPolling(framework.Poll).Should(gomega.Succeed())
1146+
}).WithTimeout(timeoutNOK).WithPolling(pollingNOK).Should(gomega.Succeed())
11461147
}
11471148
testContainerToClientIPNOK := func(src, dstIP string) {
11481149
gomega.Consistently(func(g gomega.Gomega) {
@@ -1151,7 +1152,7 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
11511152
[]string{"curl", "--max-time", "2", "-g", "-q", "-s", fmt.Sprintf("http://%s/clientip", net.JoinHostPort(dstIP, netexecPortStr))},
11521153
)
11531154
g.Expect(err).To(gomega.HaveOccurred())
1154-
}).WithTimeout(timeoutNOK).WithPolling(framework.Poll).Should(gomega.Succeed())
1155+
}).WithTimeout(timeoutNOK).WithPolling(pollingNOK).Should(gomega.Succeed())
11551156
}
11561157

11571158
const (
@@ -1202,6 +1203,13 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
12021203
Subnets: []udnv1.Layer3Subnet{{CIDR: cudnCIDRv4, HostSubnet: 24}, {CIDR: cudnCIDRv6, HostSubnet: 64}},
12031204
},
12041205
}
1206+
layer2NetworkSpec = &udnv1.NetworkSpec{
1207+
Topology: udnv1.NetworkTopologyLayer2,
1208+
Layer2: &udnv1.Layer2Config{
1209+
Role: "Primary",
1210+
Subnets: udnv1.DualStackCIDRs{cudnCIDRv4, cudnCIDRv6},
1211+
},
1212+
}
12051213
)
12061214

12071215
matchL3SubnetsByIPFamilies := func(families sets.Set[utilnet.IPFamily], in ...udnv1.Layer3Subnet) (out []udnv1.Layer3Subnet) {
@@ -1223,6 +1231,7 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
12231231

12241232
networksToTest := []ginkgo.TableEntry{
12251233
ginkgo.Entry("Layer 3", layer3NetworkSpec),
1234+
ginkgo.Entry("Layer 2", layer2NetworkSpec),
12261235
}
12271236

12281237
ginkgo.DescribeTableSubtree("When the tested network is of type",
@@ -1248,7 +1257,13 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
12481257

12491258
ginkgo.BeforeEach(func() {
12501259
var err error
1251-
networkSpec.Layer3.Subnets = matchL3SubnetsByIPFamilies(ipFamilySet, networkSpec.Layer3.Subnets...)
1260+
1261+
switch {
1262+
case networkSpec.Layer3 != nil:
1263+
networkSpec.Layer3.Subnets = matchL3SubnetsByIPFamilies(ipFamilySet, networkSpec.Layer3.Subnets...)
1264+
case networkSpec.Layer2 != nil:
1265+
networkSpec.Layer2.Subnets = matchL2SubnetsByIPFamilies(ipFamilySet, networkSpec.Layer2.Subnets...)
1266+
}
12521267

12531268
ginkgo.By("Configuring the namespace and network")
12541269
testNamespace, err = createNamespaceWithPrimaryNetworkOfType(f, ictx, testBaseName, testNetworkName, cudnAdvertisedVRFLite, networkSpec)
@@ -1534,6 +1549,8 @@ var _ = ginkgo.Describe("BGP: For a VRF-Lite configured network", func() {
15341549
ginkgo.Entry("Layer 3 CUDN advertised", cudnAdvertised, otherLayer3NetworkSpec),
15351550
ginkgo.Entry("Layer 3 CUDN advertised VRF-Lite", cudnAdvertisedVRFLite, otherLayer3NetworkSpec),
15361551
ginkgo.Entry("Layer 2 UDN non advertised", udn, otherLayer2NetworkSpec),
1552+
ginkgo.Entry("Layer 2 CUDN advertised", cudnAdvertised, otherLayer2NetworkSpec),
1553+
ginkgo.Entry("Layer 2 CUDN advertised VRF-Lite", cudnAdvertisedVRFLite, otherLayer2NetworkSpec),
15371554
}
15381555

15391556
ginkgo.DescribeTableSubtree("Of type",

0 commit comments

Comments
 (0)