Skip to content

Commit

Permalink
test: mup t1st separation of test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
takehaya committed Dec 19, 2023
1 parent f1e344b commit 84de2bf
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 19 deletions.
25 changes: 25 additions & 0 deletions etc/exabgp/conf-srv6-mup-v3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
neighbor 127.0.0.1 {
router-id 10.0.0.1;
local-address 127.0.0.1;
local-as 65000;
peer-as 65000;

family {
ipv4 mup;
ipv6 mup;
}
announce {
ipv4 {
mup \
mup-t1st 192.168.0.2/32 rd 100:100 teid 12345 qfi 9 endpoint 10.0.0.1 source 10.0.1.1 \
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];
}
ipv6 {
mup \
mup-t1st 2001:db8:1:1::2/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 source 2002::2 \
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];
}
}
}
10 changes: 0 additions & 10 deletions etc/exabgp/conf-srv6-mup.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ neighbor 127.0.0.1 {
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];

mup \
mup-t1st 192.168.0.2/32 rd 100:100 teid 12345 qfi 9 endpoint 10.0.0.1 source 10.0.1.1 \
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];

mup \
mup-t2st 10.0.0.1 rd 100:100 teid 12345/32 \
next-hop 10.0.0.2 \
Expand Down Expand Up @@ -65,11 +60,6 @@ neighbor 127.0.0.1 {
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];

mup \
mup-t1st 2001:db8:1:1::2/128 rd 100:100 teid 12345 qfi 9 endpoint 2001::1 source 2002::2 \
next-hop 10.0.0.2 \
extended-community [ target:10:10 ];

mup \
mup-t2st 2001::1 rd 100:100 teid 12345/32 \
next-hop 10.0.0.2 \
Expand Down
1 change: 1 addition & 0 deletions qa/encoding/conf-srv6-mup-v3.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conf-srv6-mup-v3.conf
2 changes: 2 additions & 0 deletions qa/encoding/conf-srv6-mup-v3.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0063:02:0000004C400101004002004003040A00000240050400000064C010080002000A0000000A800E29000155040A000002000100031C000000640000006420C0A800020000303909200A000001200A000101
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:008C:02:000000754001010040020040050400000064C010080002000A0000000A800E590002551000000000000000000000FFFF0A000002000100034000000064000000648020010DB8000100010000000000000002000030390980200100000000000000000000000000018020020000000000000000000000000002
2 changes: 0 additions & 2 deletions qa/encoding/conf-srv6-mup.msg
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0080:02:000000694001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004800010006401810000000800E250001551020010000000000000000000000000001000100010C0000006400000064180A0001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0088:02:000000714001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800010001000000000000000000001300010006401810000000800E250001551020010000000000000000000000000002000100020C00000064000000640A000001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005E:02:00000047400101004002004003040A00000240050400000064C010080002000A0000000A800E24000155040A0000020001000317000000640000006420C0A800010000303909200A000001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0063:02:0000004C400101004002004003040A00000240050400000064C010080002000A0000000A800E29000155040A000002000100031C000000640000006420C0A800020000303909200A000001200A000101
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0060:02:00000049400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1E000155040A00000200010004110000006400000064400A00000100003039
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005F:02:00000048400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1D000155040A00000200010004100000006400000064370A000001000030
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:005C:02:00000045400101004002004003040A00000240050400000064C010100002000A0000000A0C00000A0000000A800E1A000155040A000002000100040D0000006400000064200A000001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0085:02:0000006E4001010040020040050400000064C010080002000A0000000AC028250500220001001E0020010DB800010001000000000000000000004700010006401810000000800E2A000255102001000000000000000000000000000200010001110000006400000064402001000000000000
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0094:02:0000007D4001010040020040050400000064C010100002000A0000000A0C00000A0000000AC028250500220001001E0020010DB800020002000000000000000000001800010006401810000000800E3100025510200100000000000000000000000000020001000218000000640000006420010000000000000000000000000001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:007B:02:000000644001010040020040050400000064C010080002000A0000000A800E480002551000000000000000000000FFFF0A000002000100032F00000064000000648020010DB800010001000000000000000100003039098020010000000000000000000000000001
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:008C:02:000000754001010040020040050400000064C010080002000A0000000A800E590002551000000000000000000000FFFF0A000002000100034000000064000000648020010DB8000100010000000000000002000030390980200100000000000000000000000000018020020000000000000000000000000002
1:raw:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:0071:02:0000005A4001010040020040050400000064C010100002000A0000000A0C00000A0000000A800E360002551000000000000000000000FFFF0A000002000100041D0000006400000064A02001000000000000000000000000000100003039
17 changes: 10 additions & 7 deletions src/exabgp/bgp/message/update/nlri/mup/t1st.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,22 @@ def __ne__(self, other):
return not self.__eq__(other)

def __str__(self):
return "%s:%s:%s%s:%s:%s:%s:%s:%s:%s" % (
s = "%s:%s:%s%s:%s:%s:%s%s" % (
self._prefix(),
self.rd._str(),
self.ipprefix,
"/%d" % self.ipprefix_len,
self.teid,
self.qfi,
self.endpoint_ip_len,
self.endpoint_ip,
self.source_ip_len,
self.source_ip,
"/%d" % self.ipprefix_len,
)

if self.source_ip_len != 0 and self.source_ip != b'':
s += "%s%s" % (self.source_ip, "/%d" % self.source_ip_len)

return s

def pack_index(self):
# removed teid, qfi, endpointip
packed = self.rd.pack() + pack('!B', self.ipprefix_len) + self.ipprefix.pack()
Expand Down Expand Up @@ -190,17 +193,17 @@ def unpack(cls, data, afi):
endpoint_ip = IP.unpack(data[size : size + endpoint_ip_len])
size += endpoint_ip_len
else:
raise RuntimeError('endpoint ip length is not 4 or 16')
raise RuntimeError('mup t1st endpoint ip length is not 32bit or 128bit, unexpect len: %d' % endpoint_ip_len)

source_ip_size = datasize - size
if 0 < source_ip_size:
source_ip_len = data[size]
size += 1
if source_ip_len in [4, 16]:
if source_ip_len in [32, 128]:
source_ip = IP.unpack(data[size : size + source_ip_len])
size += source_ip_len
else:
raise RuntimeError('source ip length is not 4 or 16')
raise RuntimeError('mup t1st source ip length is not 32bit or 128bit, unexpect len: %d' % source_ip_len)

return cls(rd, ipprefix_len, ipprefix, teid, qfi, endpoint_ip_len, endpoint_ip, source_ip_len, source_ip, afi)

Expand Down

0 comments on commit 84de2bf

Please sign in to comment.