Skip to content

Commit a28d94d

Browse files
committed
tests/bgp-simple: prepare adding announcements
1 parent 5c1cab8 commit a28d94d

File tree

1 file changed

+56
-17
lines changed

1 file changed

+56
-17
lines changed

tests/bgp-simple/default.nix

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
services.frr = {
2626
bgpd.enable = true;
2727
config = ''
28+
ip route 198.51.100.0/25 reject
29+
ipv6 route 2001:db8:beef::/48 reject
30+
2831
router bgp 64496
2932
no bgp ebgp-requires-policy
3033
no bgp default ipv4-unicast
@@ -37,11 +40,13 @@
3740
neighbor 2001:db8::3 remote-as 64498
3841
3942
address-family ipv4 unicast
43+
network 198.51.100.0/25
4044
neighbor 192.0.2.2 activate
4145
neighbor 192.0.2.3 activate
4246
exit-address-family
4347
4448
address-family ipv6 unicast
49+
network 2001:db8:beef::/48
4550
neighbor 2001:db8::2 activate
4651
neighbor 2001:db8::3 activate
4752
exit-address-family
@@ -96,9 +101,13 @@
96101
# families and to disable/enable various groups of static routes on the fly).
97102
protocol static static4 {
98103
ipv4;
104+
105+
route 198.51.100.128/25 unreachable;
99106
}
100107
protocol static static6 {
101108
ipv6;
109+
110+
route 2001:db8:c0de::/48 unreachable;
102111
}
103112
104113
protocol bgp a_v4 {
@@ -145,19 +154,35 @@
145154
};
146155
c = {
147156
environment.systemPackages = with pkgs; [ gobgp ];
148-
networking.interfaces.eth1 = {
149-
ipv4.addresses = [
150-
{
151-
address = "192.0.2.3";
152-
prefixLength = 29;
153-
}
154-
];
155-
ipv6.addresses = [
156-
{
157-
address = "2001:db8::3";
158-
prefixLength = 64;
159-
}
160-
];
157+
networking.interfaces = {
158+
eth1 = {
159+
ipv4.addresses = [
160+
{
161+
address = "192.0.2.3";
162+
prefixLength = 29;
163+
}
164+
];
165+
ipv6.addresses = [
166+
{
167+
address = "2001:db8::3";
168+
prefixLength = 64;
169+
}
170+
];
171+
};
172+
lo = {
173+
ipv4.routes = [
174+
{
175+
address = "203.0.113.0";
176+
prefixLength = 24;
177+
}
178+
];
179+
ipv6.routes = [
180+
{
181+
address = "2001:db8:dead::";
182+
prefixLength = 48;
183+
}
184+
];
185+
};
161186
};
162187
services.gobgpd = {
163188
enable = true;
@@ -228,19 +253,33 @@
228253
b.wait_for_unit("bird.service")
229254
c.wait_for_unit("gobgpd.service")
230255
231-
a.wait_until_succeeds("vtysh -c 'show bgp ipv4 summary' | grep '192.0.2.2.*0\\s*0\\s*N/A'")
232-
a.wait_until_succeeds("vtysh -c 'show bgp ipv4 summary' | grep '192.0.2.3.*0\\s*0\\s*N/A'")
256+
a.wait_until_succeeds("vtysh -c 'show bgp ipv4 summary' | grep '192.0.2.2.*1\\s*2\\s*N/A'")
257+
a.wait_until_succeeds("vtysh -c 'show bgp ipv4 summary' | grep '192.0.2.3.*1\\s*2\\s*N/A'")
233258
b.wait_until_succeeds("birdc show protocols | grep 'a_v4.*Established'")
234259
b.wait_until_succeeds("birdc show protocols | grep 'c_v4.*Established'")
235260
c.wait_until_succeeds("gobgp neighbor -a 'ipv4' | grep '192.0.2.1.*Establ'")
236261
c.wait_until_succeeds("gobgp neighbor -a 'ipv4' | grep '192.0.2.2.*Establ'")
237262
238263
# IPv6 DAD might need some time to complete for the local link address, which is required by frr
239-
a.wait_until_succeeds("vtysh -c 'show bgp ipv6 summary' | grep '2001:db8::2.*0\\s*0\\s*N/A'")
240-
a.wait_until_succeeds("vtysh -c 'show bgp ipv6 summary' | grep '2001:db8::3.*0\\s*0\\s*N/A'")
264+
a.wait_until_succeeds("vtysh -c 'show bgp ipv6 summary' | grep '2001:db8::2.*1\\s*2\\s*N/A'")
265+
a.wait_until_succeeds("vtysh -c 'show bgp ipv6 summary' | grep '2001:db8::3.*1\\s*2\\s*N/A'")
241266
b.wait_until_succeeds("birdc show protocols | grep 'a_v6.*Established'")
242267
b.wait_until_succeeds("birdc show protocols | grep 'c_v4.*Established'")
243268
c.wait_until_succeeds("gobgp neighbor -a 'ipv6' | grep '2001:db8::1.*Establ'")
244269
c.wait_until_succeeds("gobgp neighbor -a 'ipv6' | grep '2001:db8::2.*Establ'")
270+
271+
with subtest("ensure routes have been installed in fib"):
272+
b.succeed("ip route show | grep 198.51.100.0/25")
273+
# c.succeed("ip route show | grep 198.51.100.0/25")
274+
a.succeed("ip route show | grep 198.51.100.128/25")
275+
# c.succeed("ip route show | grep 198.51.100.128/25")
276+
# a.succeed("ip route show | grep 203.0.113.0/24")
277+
# b.succeed("ip route show | grep 203.0.113.0/24")
278+
b.succeed("ip -6 route show | grep 2001:db8:beef::/48")
279+
# c.succeed("ip -6 route show | grep 2001:db8:beef::/48")
280+
a.succeed("ip -6 route show | grep 2001:db8:c0de::/48")
281+
# c.succeed("ip -6 route show | grep 2001:db8:c0de::/48")
282+
# a.succeed("ip -6 route show | grep 2001:db8:dead::/48")
283+
# b.succeed("ip -6 route show | grep 2001:db8:dead::/48")
245284
'';
246285
}

0 commit comments

Comments
 (0)