Skip to content

Commit

Permalink
add test for #1209
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mangin committed Jun 8, 2024
1 parent 53a17f5 commit bece14a
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
43 changes: 43 additions & 0 deletions etc/exabgp/api-flow-merge.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
process announce-routes {
run ./run/api-flow-merge.run;
encoder json;
}

neighbor 127.0.0.1 {
router-id 1.2.3.4;
local-address 127.0.0.1;
local-as 1;
peer-as 1;
group-updates false;

family {
ipv4 flow;
}
api {
processes [ announce-routes ];
}
flow {
route one {
match {
source 202.255.238.1/32;
}
scope {
interface-set [ non-transitive:input:3405770241:1 ];
}
then {
discard;
}
}
route two {
match {
source 202.255.238.1/32;
}
scope {
interface-set [ non-transitive:input:3405770241:1 transitive:output:254:254 ];
}
then {
discard;
}
}
}
}
35 changes: 35 additions & 0 deletions etc/exabgp/run/api-flow-merge.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3

import os
import sys
import time

time.sleep(2) # let the EOR pass


messages = [
'announce flow route { match { source 0.0.0.0/32; } then { rate-limit 0; } }',
'announce flow route { match { source 1.1.1.1/32; } then { discard; } }',
'announce flow route { match { source 2.2.2.2/32; } scope { interface-set [ non-transitive:input:3405770241:1 ]; } then { discard; } }',
'announce flow route { match { source 2.2.2.2/32; } scope { interface-set [ non-transitive:input:3405770241:1 transitive:output:254:254 ]; } then { discard; } }',
]

while messages:
message = messages.pop(0)
try:
sys.stdout.write(message + '\n')
sys.stdout.flush()
except IOError:
sys.stderr.write('IOError - ExaBGP exited ? ')
sys.stderr.write('Could not write message: %s\n' % message)
sys.stderr.flush()

try:
now = time.time()
while os.getppid() != 1 and time.time() < now + 1:
line = sys.stdin.readline().strip()
if not line or 'shutdown' in line:
break
time.sleep(0.5)
except IOError:
pass
1 change: 1 addition & 0 deletions qa/encoding/api-flow-merge.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api-flow-merge.conf
10 changes: 10 additions & 0 deletions qa/encoding/api-flow-merge.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0047:02:000000304001010040020040050400000064C010104702CAFFEE0140018006000000000000800E0C0001850000060220CAFFEE01
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:004F:02:000000384001010040020040050400000064C010184702CAFFEE0140010702000000FE80FE8006000000000000800E0C0001850000060220CAFFEE01

1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:00000007900F0003000185

2:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:003F:02:000000284001010040020040050400000064C010088006000000000000800E0C000185000006022000000000
3:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:003F:02:000000284001010040020040050400000064C010088006000000000000800E0C000185000006022001010101
4:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0047:02:000000304001010040020040050400000064C010104702CAFFEE0140018006000000000000800E0C000185000006022002020202
5:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:004F:02:000000384001010040020040050400000064C010184702CAFFEE0140010702000000FE80FE8006000000000000800E0C000185000006022002020202

0 comments on commit bece14a

Please sign in to comment.