1#################################### bgp.py ################################## 2% Regression tests for the bgp module 3 4# Default configuration : OLD speaker (see RFC 6793) 5bgp_module_conf.use_2_bytes_asn = True 6 7################################ BGPNLRI_IPv4 ################################ 8+ BGPNLRI_IPv4 class tests 9 10= BGPNLRI_IPv4 - Instantiation 11raw(BGPNLRI_IPv4()) == b'\x00' 12 13= BGPNLRI_IPv4 - Instantiation with specific values (1) 14raw(BGPNLRI_IPv4(prefix = '255.255.255.255/32')) == b' \xff\xff\xff\xff' 15 16= BGPNLRI_IPv4 - Instantiation with specific values (2) 17raw(BGPNLRI_IPv4(prefix = '0.0.0.0/0')) == b'\x00' 18 19= BGPNLRI_IPv4 - Instantiation with specific values (3) 20raw(BGPNLRI_IPv4(prefix = '192.0.2.0/24')) == b'\x18\xc0\x00\x02' 21 22= BGPNLRI_IPv4 - Basic dissection 23nlri = BGPNLRI_IPv4(b'\x00') 24nlri.prefix == '0.0.0.0/0' 25 26= BGPNLRI_IPv4 - Dissection with specific values 27nlri = BGPNLRI_IPv4(b'\x18\xc0\x00\x02') 28nlri.prefix == '192.0.2.0/24' 29 30 31################################ BGPNLRI_IPv6 ################################ 32+ BGPNLRI_IPv6 class tests 33 34= BGPNLRI_IPv6 - Instantiation 35raw(BGPNLRI_IPv6()) == b'\x00' 36 37= BGPNLRI_IPv6 - Instantiation with specific values (1) 38raw(BGPNLRI_IPv6(prefix = '::/0')) == b'\x00' 39 40= BGPNLRI_IPv6 - Instantiation with specific values (2) 41raw(BGPNLRI_IPv6(prefix = '2001:db8::/32')) == b' \x01\r\xb8' 42 43= BGPNLRI_IPv6 - Basic dissection 44nlri = BGPNLRI_IPv6(b'\x00') 45nlri.prefix == '::/0' 46 47= BGPNLRI_IPv6 - Dissection with specific values 48nlri = BGPNLRI_IPv6(b' \x01\r\xb8') 49nlri.prefix == '2001:db8::/32' 50 51 52#################################### BGP ##################################### 53+ BGP class tests 54 55= BGP - Instantiation (Should be a KEEPALIVE) 56m = BGP() 57assert(raw(m) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') 58assert(m.type == BGP.KEEPALIVE_TYPE) 59 60= BGP - Instantiation with specific values (1) 61raw(BGP(type = 0)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x00' 62 63= BGP - Instantiation with specific values (2) 64raw(BGP(type = 1)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01' 65 66= BGP - Instantiation with specific values (3) 67raw(BGP(type = 2)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x02' 68 69= BGP - Instantiation with specific values (4) 70raw(BGP(type = 3)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x03' 71 72= BGP - Instantiation with specific values (5) 73raw(BGP(type = 4)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' 74 75= BGP - Instantiation with specific values (6) 76raw(BGP(type = 5)) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x05' 77 78= BGP - Basic dissection 79h = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04') 80assert(h.type == BGP.KEEPALIVE_TYPE) 81assert(h.len == 19) 82 83= BGP - Dissection with specific values 84h = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x01') 85assert(h.type == BGP.OPEN_TYPE) 86assert(h.len == 19) 87 88############################### BGPKeepAlive ################################# 89+ BGPKeepAlive class tests 90 91= BGPKeepAlive - Instantiation (by default, should be a "generic" capability) 92raw(BGPKeepAlive()) 93raw(BGPKeepAlive()) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' 94 95= BGPKeepAlive - Swallowing tests: combined BGPKeepAlive 96o = BGPKeepAlive() 97m=IP(src="12.0.0.1",dst="12.0.0.2")/TCP(dport=54321)/BGP(raw(o)*2) 98m.show() 99assert isinstance(m[BGPKeepAlive].payload, BGPKeepAlive) 100assert m[BGPKeepAlive].payload.marker == 0xffffffffffffffffffffffffffffffff 101 102############################### BGPCapability ################################# 103+ BGPCapability class tests 104 105= BGPCapability - Instantiation (by default, should be a "generic" capability) 106raw(BGPCapability()) 107raw(BGPCapability()) == b'\x00\x00' 108 109= BGPCapability - Instantiation with specific values (1) 110c = BGPCapability(code = 70) 111assert(raw(c) == b'F\x00') 112 113= BGPCapability - Check exception 114from scapy.contrib.bgp import _BGPInvalidDataException 115try: 116 BGPCapability("\x00") 117 False 118except _BGPInvalidDataException: 119 True 120 121= BGPCapability - Test haslayer() 122assert BGPCapFourBytesASN().haslayer(BGPCapability) 123assert BGPCapability in BGPCapFourBytesASN() 124 125= BGPCapability - Test getlayer() 126assert isinstance(BGPCapFourBytesASN().getlayer(BGPCapability), BGPCapFourBytesASN) 127assert isinstance(BGPCapFourBytesASN()[BGPCapability], BGPCapFourBytesASN) 128 129 130############################ BGPCapMultiprotocol ############################## 131+ BGPCapMultiprotocol class tests 132 133= BGPCapMultiprotocol - Inheritance 134c = BGPCapMultiprotocol() 135assert(isinstance(c, BGPCapability)) 136 137= BGPCapMultiprotocol - Instantiation 138raw(BGPCapMultiprotocol()) == b'\x01\x04\x00\x00\x00\x00' 139 140= BGPCapMultiprotocol - Instantiation with specific values (1) 141raw(BGPCapMultiprotocol(afi = 1, safi = 1)) == b'\x01\x04\x00\x01\x00\x01' 142 143= BGPCapMultiprotocol - Instantiation with specific values (2) 144raw(BGPCapMultiprotocol(afi = 2, safi = 1)) == b'\x01\x04\x00\x02\x00\x01' 145 146= BGPCapMultiprotocol - Dissection with specific values 147c = BGPCapMultiprotocol(b'\x01\x04\x00\x02\x00\x01') 148assert(c.code == 1) 149assert(c.length == 4) 150assert(c.afi == 2) 151assert(c.reserved == 0) 152assert(c.safi == 1) 153 154############################### BGPCapORFBlock ############################### 155+ BGPCapORFBlock class tests 156 157= BGPCapORFBlock - Instantiation 158raw(BGPCapORFBlock()) == b'\x00\x00\x00\x00\x00' 159 160= BGPCapORFBlock - Instantiation with specific values (1) 161raw(BGPCapORFBlock(afi = 1, safi = 1)) == b'\x00\x01\x00\x01\x00' 162 163= BGPCapORFBlock - Instantiation with specific values (2) 164raw(BGPCapORFBlock(afi = 2, safi = 1)) == b'\x00\x02\x00\x01\x00' 165 166= BGPCapORFBlock - Basic dissection 167c = BGPCapORFBlock(b'\x00\x00\x00\x00\x00') 168c.afi == 0 and c.reserved == 0 and c.safi == 0 and c.orf_number == 0 169 170= BGPCapORFBlock - Dissection with specific values 171c = BGPCapORFBlock(b'\x00\x02\x00\x01\x00') 172c.afi == 2 and c.reserved == 0 and c.safi == 1 and c.orf_number == 0 173 174 175############################# BGPCapORFBlock.ORF ############################## 176+ BGPCapORFBlock.ORF class tests 177 178= BGPCapORFBlock.ORF - Instantiation 179raw(BGPCapORFBlock.ORFTuple()) == b'\x00\x00' 180 181= BGPCapORFBlock.ORF - Instantiation with specific values (1) 182raw(BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)) == b'@\x03' 183 184= BGPCapORFBlock.ORF - Basic dissection 185c = BGPCapORFBlock.ORFTuple(b'\x00\x00') 186c.orf_type == 0 and c.send_receive == 0 187 188= BGPCapORFBlock.ORF - Dissection with specific values 189c = BGPCapORFBlock.ORFTuple(b'@\x03') 190c.orf_type == 64 and c.send_receive == 3 191 192 193################################# BGPCapORF ################################### 194+ BGPCapORF class tests 195 196= BGPCapORF - Inheritance 197c = BGPCapORF() 198assert(isinstance(c, BGPCapability)) 199 200= BGPCapORF - Instantiation 201raw(BGPCapORF()) == b'\x03\x00' 202 203= BGPCapORF - Instantiation with specific values (1) 204raw(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == b'\x03\x07\x00\x01\x00\x01\x01@\x03' 205 206= BGPCapORF - Instantiation with specific values (2) 207raw(BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)]), BGPCapORFBlock(afi = 2, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])])) == b'\x03\x0e\x00\x01\x00\x01\x01@\x03\x00\x02\x00\x01\x01@\x03' 208 209= BGPCapORF - Basic dissection 210c = BGPCapORF(b'\x03\x00') 211c.code == 3 and c.length == 0 212 213= BGPCapORF - Dissection with specific values 214c = BGPCapORF(orf = [BGPCapORFBlock(afi = 1, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)]), BGPCapORFBlock(afi = 2, safi = 1, entries = [BGPCapORFBlock.ORFTuple(orf_type = 64, send_receive = 3)])]) 215c.code == 3 and c.orf[0].afi == 1 and c.orf[0].safi == 1 and c.orf[0].entries[0].orf_type == 64 and c.orf[0].entries[0].send_receive == 3 and c.orf[1].afi == 2 and c.orf[1].safi == 1 and c.orf[1].entries[0].orf_type == 64 and c.orf[1].entries[0].send_receive == 3 216 217= BGPCapORF - Dissection 218p = BGPCapORF(b'\x03\x07\x00\x01\x00\x01\x01@\x03') 219assert(len(p.orf) == 1) 220 221 222####################### BGPCapGracefulRestart.GRTuple ######################### 223+ BGPCapGracefulRestart.GRTuple class tests 224 225= BGPCapGracefulRestart.GRTuple - Instantiation 226raw(BGPCapGracefulRestart.GRTuple()) == b'\x00\x00\x00\x00' 227 228= BGPCapGracefulRestart.GRTuple - Instantiation with specific values 229raw(BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)) == b'\x00\x01\x01\x80' 230 231= BGPCapGracefulRestart.GRTuple - Basic dissection 232c = BGPCapGracefulRestart.GRTuple(b'\x00\x00\x00\x00') 233c.afi == 0 and c.safi == 0 and c.flags == 0 234 235= BGPCapGracefulRestart.GRTuple - Dissection with specific values 236c = BGPCapGracefulRestart.GRTuple(b'\x00\x01\x01\x80') 237c.afi == 1 and c.safi == 1 and c.flags == 128 238 239 240########################### BGPCapGracefulRestart ############################# 241+ BGPCapGracefulRestart class tests 242 243= BGPCapGracefulRestart - Inheritance 244c = BGPCapGracefulRestart() 245assert(isinstance(c, BGPCapGracefulRestart)) 246 247= BGPCapGracefulRestart - Instantiation 248raw(BGPCapGracefulRestart()) == b'@\x02\x00\x00' 249 250= BGPCapGracefulRestart - Instantiation with specific values (1) 251raw(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == b'@\x06\x00x\x00\x01\x01\x00' 252 253= BGPCapGracefulRestart - Instantiation with specific values (2) 254raw(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1)])) == b'@\x06\x00x\x00\x01\x01\x00' 255 256= BGPCapGracefulRestart - Instantiation with specific values (3) 257raw(BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == b'@\x06\x00x\x00\x01\x01\x80' 258 259= BGPCapGracefulRestart - Instantiation with specific values (4) 260raw(BGPCapGracefulRestart(restart_time = 120, restart_flags = 0x8, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi = 1, flags = 128)])) == b'@\x06\x80x\x00\x01\x01\x80' 261 262= BGPCapGracefulRestart - Basic dissection 263c = BGPCapGracefulRestart(b'@\x02\x00\x00') 264c.code == 64 and c.restart_flags == 0 and c.restart_time == 0 265 266= BGPCapGracefulRestart - Dissection with specific values 267c = BGPCapGracefulRestart(b'@\x06\x80x\x00\x01\x01\x80') 268c.code == 64 and c.restart_time == 120 and c.restart_flags == 0x8 and c.entries[0].afi == 1 and c.entries[0].safi == 1 and c.entries[0].flags == 128 269 270 271############################ BGPCapFourBytesASN ############################### 272+ BGPCapFourBytesASN class tests 273 274= BGPCapFourBytesASN - Inheritance 275c = BGPCapFourBytesASN() 276assert(isinstance(c, BGPCapFourBytesASN)) 277 278= BGPCapFourBytesASN - Instantiation 279raw(BGPCapFourBytesASN()) == b'A\x04\x00\x00\x00\x00' 280 281= BGPCapFourBytesASN - Instantiation with specific values (1) 282raw(BGPCapFourBytesASN(asn = 6555555)) == b'A\x04\x00d\x07\xa3' 283 284= BGPCapFourBytesASN - Instantiation with specific values (2) 285raw(BGPCapFourBytesASN(asn = 4294967295)) == b'A\x04\xff\xff\xff\xff' 286 287= BGPCapFourBytesASN - Basic dissection 288c = BGPCapFourBytesASN(b'A\x04\x00\x00\x00\x00') 289c.code == 65 and c.length == 4 and c.asn == 0 290 291= BGPCapFourBytesASN - Dissection with specific values 292c = BGPCapFourBytesASN(b'A\x04\xff\xff\xff\xff') 293c.code == 65 and c.length == 4 and c.asn == 4294967295 294 295 296####################### BGPAuthenticationInformation ########################## 297+ BGPAuthenticationInformation class tests 298 299= BGPAuthenticationInformation - Instantiation 300raw(BGPAuthenticationInformation()) == b'\x00' 301 302= BGPAuthenticationInformation - Basic dissection 303c = BGPAuthenticationInformation(b'\x00') 304c.authentication_code == 0 and c.authentication_data == None 305 306 307################################# BGPOptParam ################################# 308+ BGPOptParam class tests 309 310= BGPOptParam - Instantiation 311raw(BGPOptParam()) == b'\x02\x00' 312 313= BGPOptParam - Instantiation with specific values (1) 314raw(BGPOptParam(param_type = 1)) == b'\x01\x00' 315raw(BGPOptParam(param_type = 1, param_value = BGPAuthenticationInformation())) == b'\x01\x00' 316 317= BGPOptParam - Instantiation with specific values (2) 318raw(BGPOptParam(param_type = 2)) == b'\x02\x00' 319 320= BGPOptParam - Instantiation with specific values (3) 321raw(BGPOptParam(param_type = 2, param_value = BGPCapFourBytesASN(asn = 4294967295))) == b'\x02\x06A\x04\xff\xff\xff\xff' 322 323= BGPOptParam - Instantiation with specific values (4) 324raw(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 127))) == b'\x02\x02\x7f\x00' 325 326= BGPOptParam - Instantiation with specific values (5) 327raw(BGPOptParam(param_type = 2, param_value = BGPCapability(code = 255))) == b'\x02\x02\xff\x00' 328 329= BGPOptParam - Basic dissection 330p = BGPOptParam(b'\x02\x00') 331p.param_type == 2 and p.param_length == 0 332 333= BGPOptParam - Dissection with specific values 334p = BGPOptParam(b'\x02\x06A\x04\xff\xff\xff\xff') 335p.param_type == 2 and p.param_length == 6 and p.param_value[0].code == 65 and p.param_value[0].length == 4 and p.param_value[0].asn == 4294967295 336 337 338################################### BGPOpen ################################### 339+ BGPOpen class tests 340 341= BGPOpen - Instantiation 342raw(BGPOpen()) == b'\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00' 343 344= BGPOpen - Instantiation with specific values (1) 345raw(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1")) == b'\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x00' 346 347= BGPOpen - Instantiation with specific values (2) 348opt = BGPOptParam(param_value = BGPCapMultiprotocol(afi = 1, safi = 1)) 349raw(BGPOpen(my_as = 64501, bgp_id = "192.0.2.1", opt_params = [opt])) == b'\x04\xfb\xf5\x00\x00\xc0\x00\x02\x01\x08\x02\x06\x01\x04\x00\x01\x00\x01' 350 351= BGPOpen - Instantiation with specific values (3) 352cap = BGPOptParam(param_value = BGPCapMultiprotocol(afi = 1, safi = 1)) 353capabilities = [cap] 354cap = BGPOptParam(param_value = BGPCapability(code = 128)) 355capabilities.append(cap) 356cap = BGPOptParam(param_value = BGPCapability(code = 2)) 357capabilities.append(cap) 358cap = BGPOptParam(param_value = BGPCapGracefulRestart(restart_time = 120, entries = [BGPCapGracefulRestart.GRTuple(afi = 1, safi= 1, flags = 128)])) 359capabilities.append(cap) 360cap = BGPOptParam(param_value = BGPCapFourBytesASN(asn = 64503)) 361capabilities.append(cap) 362raw(BGPOpen(my_as = 64503, bgp_id = "192.168.100.3", hold_time = 30, opt_params = capabilities)) == b'\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7' 363 364= BGPOpen - Dissection with specific values (1) 365m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00?\x01\x04\xfb\xf7\x00\x1e\xc0\xa8d\x03"\x02\x06\x01\x04\x00\x01\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x08@\x06\x00x\x00\x01\x01\x80\x02\x06A\x04\x00\x00\xfb\xf7') 366assert(BGPHeader in m and BGPOpen in m) 367assert(m.len == 63) 368assert(m.type == BGP.OPEN_TYPE) 369assert(m.version == 4) 370assert(m.my_as == 64503) 371assert(m.hold_time == 30) 372assert(m.bgp_id == "192.168.100.3") 373assert(m.opt_param_len == 34) 374assert(isinstance(m.opt_params[0].param_value, BGPCapMultiprotocol)) 375assert(isinstance(m.opt_params[1].param_value, BGPCapability)) 376assert(isinstance(m.opt_params[2].param_value, BGPCapability)) 377assert(isinstance(m.opt_params[3].param_value, BGPCapGracefulRestart)) 378 379= BGPOpen - Dissection with specific values (2) (followed by a KEEPALIVE) 380messages = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' 381m = BGP(messages) 382raw(m) == b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x01\x04\xfb\xf6\x00\xb4\xc0\xa8ze \x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x02\x00\x01\x02\x02\x80\x00\x02\x02\x02\x00\x02\x06A\x04\x00\x00\xfb\xf6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x13\x04' 383 384= BGPOpen - Dissection with specific values (3) 385m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x01r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x80x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') 386assert(BGPHeader in m and BGPOpen in m) 387 388= BGPOpen - Dissection with specific values (4) 389m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x8f\x01\x04\xfd\xe8\x00\xb4\n\xff\xff\x02r\x02\x06\x01\x04\x00\x01\x00\x84\x02\x06\x01\x04\x00\x19\x00A\x02\x06\x01\x04\x00\x02\x00\x02\x02\x06\x01\x04\x00\x01\x00\x02\x02\x06\x01\x04\x00\x02\x00\x80\x02\x06\x01\x04\x00\x01\x00\x80\x02\x06\x01\x04\x00\x01\x00B\x02\x06\x01\x04\x00\x02\x00\x01\x02\x06\x01\x04\x00\x02\x00\x04\x02\x06\x01\x04\x00\x01\x00\x01\x02\x06\x01\x04\x00\x01\x00\x04\x02\x02\x80\x00\x02\x02\x02\x00\x02\x04@\x02\x00x\x02\x02F\x00\x02\x06A\x04\x00\x00\xfd\xe8') 390assert(BGPHeader in m and BGPOpen in m) 391 392 393################################# BGPPAOrigin ################################# 394+ BGPPAOrigin class tests 395 396= BGPPAOrigin - Instantiation 397raw(BGPPAOrigin()) == b'\x00' 398 399= BGPPAOrigin - Instantiation with specific values 400raw(BGPPAOrigin(origin = 1)) == b'\x01' 401 402= BGPPAOrigin - Dissection 403a = BGPPAOrigin(b'\x00') 404a.origin == 0 405 406 407################################ BGPPAASPath ################################## 408+ BGPPAASPath class tests 409 410= BGPPAASPath - Instantiation 411raw(BGPPAASPath()) == b'' 412 413= BGPPAASPath - Instantiation with specific values (1) 414raw(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64496, 64497, 64498])])) == b'\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2' 415 416= BGPPAASPath - Instantiation with specific values (2) 417raw(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498])])) == b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2' 418 419= BGPPAASPath - Instantiation with specific values (3) 420raw(BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 1, segment_value = [64496, 64497, 64498]), BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64500, 64501, 64502, 64502, 64503])])) == b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7' 421 422= BGPPAASPath - Dissection (1) 423a = BGPPAASPath(b'\x02\x03\xfb\xf0\xfb\xf1\xfb\xf2') 424a.segments[0].segment_type == 2 and a.segments[0].segment_length == 3 and a.segments[0].segment_value == [64496, 64497, 64498] 425 426= BGPPAASPath - Dissection (2) 427a = BGPPAASPath(b'\x01\x03\xfb\xf0\xfb\xf1\xfb\xf2\x02\x05\xfb\xf4\xfb\xf5\xfb\xf6\xfb\xf6\xfb\xf7') 428a.segments[0].segment_type == 1 and a.segments[0].segment_length == 3 and a.segments[0].segment_value == [64496, 64497, 64498] and a.segments[1].segment_type == 2 and a.segments[1].segment_length == 5 and a.segments[1].segment_value == [64500, 64501, 64502, 64502, 64503] 429 430 431############################### BGPPANextHop ################################## 432+ BGPPANextHop class tests 433 434= BGPPANextHop - Instantiation 435raw(BGPPANextHop()) == b'\x00\x00\x00\x00' 436 437= BGPPANextHop - Instantiation with specific values 438raw(BGPPANextHop(next_hop = "192.0.2.1")) == b'\xc0\x00\x02\x01' 439 440= BGPPANextHop - Basic dissection 441a = BGPPANextHop(b'\x00\x00\x00\x00') 442a.next_hop == "0.0.0.0" 443 444= BGPPANextHop - Dissection with specific values 445a = BGPPANextHop(b'\xc0\x00\x02\x01') 446a.next_hop == '192.0.2.1' 447 448 449############################ BGPPAMultiExitDisc ############################## 450+ BGPPAMultiExitDisc class tests 451 452= BGPPAMultiExitDisc - Instantiation 453raw(BGPPAMultiExitDisc()) == b'\x00\x00\x00\x00' 454 455= BGPPAMultiExitDisc - Instantiation with specific values (1) 456raw(BGPPAMultiExitDisc(med = 4)) == b'\x00\x00\x00\x04' 457 458= BGPPAMultiExitDisc - Basic dissection 459a = BGPPAMultiExitDisc(b'\x00\x00\x00\x00') 460a.med == 0 461 462 463############################## BGPPALocalPref ################################ 464+ BGPPALocalPref class tests 465 466= BGPPALocalPref - Instantiation 467raw(BGPPALocalPref()) == b'\x00\x00\x00\x00' 468 469= BGPPALocalPref - Instantiation with specific values (1) 470raw(BGPPALocalPref(local_pref = 110)) == b'\x00\x00\x00n' 471 472= BGPPALocalPref - Basic dissection 473a = BGPPALocalPref(b'\x00\x00\x00n') 474a.local_pref == 110 475 476 477############################## BGPPAAggregator ############################### 478+ BGPPAAggregator class tests 479 480= BGPPAAggregator - Instantiation 481raw(BGPPAAggregator()) == b'\x00\x00\x00\x00\x00\x00' 482 483= BGPPAAggregator - Instantiation with specific values (1) 484raw(BGPPAAggregator(aggregator_asn = 64500, speaker_address = "192.0.2.1")) == b'\xfb\xf4\xc0\x00\x02\x01' 485 486= BGPPAAggregator - Dissection 487a = BGPPAAggregator(b'\xfb\xf4\xc0\x00\x02\x01') 488a.aggregator_asn == 64500 and a.speaker_address == "192.0.2.1" 489 490 491############################## BGPPACommunity ################################ 492+ BGPPACommunity class tests 493 494= BGPPACommunity - Basic instantiation 495raw(BGPPACommunity()) == b'\x00\x00\x00\x00' 496 497= BGPPACommunity - Instantiation with specific value 498raw(BGPPACommunity(community = 0xFFFFFF01)) == b'\xff\xff\xff\x01' 499 500= BGPPACommunity - Dissection 501a = BGPPACommunity(b'\xff\xff\xff\x01') 502a.community == 0xFFFFFF01 503 504 505############################ BGPPAOriginatorID ############################### 506+ BGPPAOriginatorID class tests 507 508= BGPPAOriginatorID - Basic instantiation 509raw(BGPPAOriginatorID()) == b'\x00\x00\x00\x00' 510 511= BGPPAOriginatorID - Instantiation with specific value 512raw(BGPPAOriginatorID(originator_id = '192.0.2.1')) == b'\xc0\x00\x02\x01' 513 514= BGPPAOriginatorID - Dissection 515a = BGPPAOriginatorID(b'\xc0\x00\x02\x01') 516a.originator_id == "192.0.2.1" 517 518 519############################ BGPPAClusterList ################################ 520+ BGPPAClusterList class tests 521 522= BGPPAClusterList - Basic instantiation 523raw(BGPPAClusterList()) == b'' 524 525= BGPPAClusterList - Instantiation with specific values 526raw(BGPPAClusterList(cluster_list = [150000, 165465465, 132132])) == b'\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$' 527 528= BGPPAClusterList - Dissection 529a = BGPPAClusterList(b'\x00\x02I\xf0\t\xdc\xcdy\x00\x02\x04$') 530a.cluster_list[0] == 150000 and a.cluster_list[1] == 165465465 and a.cluster_list[2] == 132132 531 532 533########################### BGPPAMPReachNLRI ############################### 534+ BGPPAMPReachNLRI class tests 535 536= BGPPAMPReachNLRI - Instantiation 537raw(BGPPAMPReachNLRI()) == b'\x00\x00\x00\x00\x00' 538 539= BGPPAMPReachNLRI - Instantiation with specific values (1) 540raw(BGPPAMPReachNLRI(afi=2, safi=1, nh_addr_len=16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")])) == b'\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' 541 542= BGPPAMPReachNLRI - Dissection (1) 543a = BGPPAMPReachNLRI(b'\x00\x02\x01 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xfe\x80\x00\x00\x00\x00\x00\x00\xc0\x02\x0b\xff\xfe~\x00\x00\x00@ \x01\r\xb8\x00\x02\x00\x02@ \x01\r\xb8\x00\x02\x00\x01@ \x01\r\xb8\x00\x02\x00\x00') 544a.afi == 2 and a.safi == 1 and a.nh_addr_len == 32 and a.nh_v6_global == "2001:db8::2" and a.nh_v6_link_local == "fe80::c002:bff:fe7e:0" and a.reserved == 0 and a.nlri[0].prefix == "2001:db8:2:2::/64" and a.nlri[1].prefix == "2001:db8:2:1::/64" and a.nlri[2].prefix == "2001:db8:2::/64" 545 546= BGPPAMPReachNLRI - Dissection (2) 547a = BGPPAMPReachNLRI(b'\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') 548a.afi == 2 and a.safi == 1 and a.nh_addr_len == 32 and a.nh_v6_global == "fe80::fac0:100:15de:1581" and a.nh_v6_link_local == "fe80::fac0:100:15de:1581" and a.reserved == 0 and a.nlri[0].prefix == "400::/6" and a.nlri[1].prefix == "800::/5" and raw(a.nlri[18]) == b'`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff' and a.nlri[35].prefix == "200::/7" 549 550 551############################# BGPPAMPUnreachNLRI ############################# 552+ BGPPAMPUnreachNLRI class tests 553 554= BGPPAMPUnreachNLRI - Instantiation 555raw(BGPPAMPUnreachNLRI()) == b'\x00\x00\x00' 556 557= BGPPAMPUnreachNLRI - Instantiation with specific values (1) 558raw(BGPPAMPUnreachNLRI(afi = 2, safi = 1)) == b'\x00\x02\x01' 559 560= BGPPAMPUnreachNLRI - Instantiation with specific values (2) 561raw(BGPPAMPUnreachNLRI(afi = 2, safi = 1, afi_safi_specific = BGPPAMPUnreachNLRI_IPv6(withdrawn_routes = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == b'\x00\x02\x01@ \x01\r\xb8\x00\x02\x00\x00' 562 563= BGPPAMPUnreachNLRI - Dissection (1) 564a = BGPPAMPUnreachNLRI(b'\x00\x02\x01') 565a.afi == 2 and a.safi == 1 566 567= BGPPAMPUnreachNLRI - Dissection (2) 568a = BGPPAMPUnreachNLRI(b'\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') 569a.afi == 2 and a.safi == 1 and a.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3" and a.afi_safi_specific.withdrawn_routes[11].prefix == "2001::/32" and a.afi_safi_specific.withdrawn_routes[23].prefix == "1000::/4" 570 571 572############################# BGPPAAS4Aggregator ############################# 573+ BGPPAAS4Aggregator class tests 574 575= BGPPAAS4Aggregator - Instantiation 576raw(BGPPAAS4Aggregator()) == b'\x00\x00\x00\x00\x00\x00\x00\x00' 577 578= BGPPAAS4Aggregator - Instantiation with specific values 579raw(BGPPAAS4Aggregator(aggregator_asn = 644566565, speaker_address = "192.0.2.1")) == b'&kN%\xc0\x00\x02\x01' 580 581= BGPPAAS4Aggregator - Dissection 582a = BGPPAAS4Aggregator(b'&kN%\xc0\x00\x02\x01') 583a.aggregator_asn == 644566565 and a.speaker_address == "192.0.2.1" 584 585 586################################ BGPPathAttr ################################# 587+ BGPPathAttr class tests 588 589= BGPPathAttr - Instantiation 590raw(BGPPathAttr()) == b'\x80\x00\x00' 591 592= BGPPathAttr - Instantiation with specific values (1) 593raw(BGPPathAttr(type_code = 1, attribute = BGPPAOrigin(origin = 0))) 594 595= BGPPathAttr - Instantiation with specific values (2) 596raw(BGPPathAttr(type_code = 2, attribute = BGPPAASPath(segments = [BGPPAASPath.ASPathSegment(segment_type = 2, segment_value = [64501, 64501, 64501])]))) == b'\x80\x02\x08\x02\x03\xfb\xf5\xfb\xf5\xfb\xf5' 597 598= BGPPathAttr - Instantiation with specific values (3) 599 600raw(BGPPathAttr(type_code = 14, attribute = BGPPAMPReachNLRI(afi = 2, safi = 1, nh_addr_len = 16, nh_v6_addr = "2001:db8::2", nlri = [BGPNLRI_IPv6(prefix = "2001:db8:2::/64")]))) == b'\x80\x0e\x1e\x00\x02\x01\x10 \x01\r\xb8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00@ \x01\r\xb8\x00\x02\x00\x00' 601 602= BGPPathAttr - Dissection (1) 603a = BGPPathAttr(b'\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') 604a.type_flags == 0x90 and a.type_code == 15 and a.attr_ext_len == 88 and a.attribute.afi == 2 and a.attribute.safi == 1 and a.attribute.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[1].prefix == "8000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[2].prefix == "a000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[3].prefix == "c000::/3" and a.attribute.afi_safi_specific.withdrawn_routes[4].prefix == "e000::/4" and a.attribute.afi_safi_specific.withdrawn_routes[5].prefix == "f000::/5" and a.attribute.afi_safi_specific.withdrawn_routes[23].prefix == "1000::/4" 605 606 607################################# BGPUpdate ################################## 608+ BGPUpdate class tests 609 610= BGPUpdate - Instantiation 611raw(BGPUpdate()) == b'\x00\x00\x00\x00' 612 613= BGPUpdate - Dissection (1) 614bgp_module_conf.use_2_bytes_asn = True 615m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x000\x02\x00\x19\x18\xc0\xa8\x96\x18\x07\x07\x07\x18\xc63d\x18\xc0\xa8\x01\x19\x06\x06\x06\x00\x18\xc0\xa8\x1a\x00\x00') 616assert(BGPHeader in m and BGPUpdate in m) 617assert(m.withdrawn_routes_len == 25) 618assert(m.withdrawn_routes[0].prefix == "192.168.150.0/24") 619assert(m.withdrawn_routes[5].prefix == "192.168.26.0/24") 620assert(m.path_attr_len == 0) 621 622= BGPUpdate - Behave like a NEW speaker (RFC 6793) - Dissection (2) 623bgp_module_conf.use_2_bytes_asn = False 624m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00=\x02\x00\x00\x00"@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xfa@\x03\x04\xc0\xa8\x10\x06\x80\x04\x04\x00\x00\x00\x00\xc0\x08\x04\xff\xff\xff\x01\x18\xc0\xa8\x01') 625assert(BGPHeader in m and BGPUpdate in m) 626assert(m.path_attr[1].attribute.segments[0].segment_value == [64506]) 627assert(m.path_attr[4].attribute.community == 0xFFFFFF01) 628assert(m.nlri[0].prefix == "192.168.1.0/24") 629 630 631 632= BGPUpdate - Dissection (MP_REACH_NLRI) 633m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xd8\x02\x00\x00\x00\xc1@\x01\x01\x00@\x02\x06\x02\x01\x00\x00\xfb\xf6\x90\x0e\x00\xb0\x00\x02\x01 \xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\xfe\x80\x00\x00\x00\x00\x00\x00\xfa\xc0\x01\x00\x15\xde\x15\x81\x00\x06\x04\x05\x08\x04\x10\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\t\xfe\x00\x16 \x01<\x08-\x07.\x040\x10?\xfe\x10 \x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\x1c \x01\x00\x10\x07\xfc\n\xfe\x80\x08\xff\n\xfe\xc0\x03 \x03@\x08_`\x00d\xff\x9b\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x08\x01\x07\x02') 634assert(BGPHeader in m and BGPUpdate in m) 635assert(m.path_attr[2].attribute.afi == 2) 636assert(m.path_attr[2].attribute.safi == 1) 637assert(m.path_attr[2].attribute.nh_addr_len == 32) 638assert(m.path_attr[2].attribute.nh_v6_global == "fe80::fac0:100:15de:1581") 639assert(m.path_attr[2].attribute.nh_v6_link_local == "fe80::fac0:100:15de:1581") 640assert(m.path_attr[2].attribute.nlri[0].prefix == "400::/6") 641assert(m.nlri == []) 642 643= BGPUpdate - Dissection (MP_UNREACH_NLRI) 644m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00s\x02\x00\x00\x00\\\x90\x0f\x00X\x00\x02\x01\x03`\x03\x80\x03\xa0\x03\xc0\x04\xe0\x05\xf0\x06\xf8\x10 \x02`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff@\x01\x00\x00\x00\x00\x00\x00\x00\x17 \x01\x00 \x01\x00\x000 \x01\x00\x02\x00\x00 \x01\r\xb8\n\xfe\xc0\x07\xfc\n\xfe\x80\x1c \x01\x00\x10\x03 \x06\x04\x03@\x08_\x05\x08\x04\x10') 645assert(BGPHeader in m and BGPUpdate in m) 646assert(m.path_attr[0].attribute.afi == 2) 647assert(m.path_attr[0].attribute.safi == 1) 648assert(m.path_attr[0].attribute.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3") 649assert(m.nlri == []) 650 651= BGPUpdate - with BGPHeader 652p = BGP(raw(BGPHeader()/BGPUpdate())) 653assert(BGPHeader in p and BGPUpdate in p) 654 655 656########## BGPNotification Class ################################### 657+ BGPNotification class tests 658 659= BGPNotification - Instantiation 660raw(BGPNotification()) == b'\x00\x00' 661 662= BGPNotification - Dissection (Administratively Reset) 663m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x15\x03\x06\x04') 664m.type == BGP.NOTIFICATION_TYPE and m.error_code == 6 and m.error_subcode == 4 665 666= BGPNotification - Dissection (Bad Peer AS) 667m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x03\x02\x02\x00\x00') 668m.type == BGP.NOTIFICATION_TYPE and m.error_code == 2 and m.error_subcode == 2 669 670= BGPNotification - Dissection (Attribute Flags Error) 671m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x19\x03\x03\x04\x80\x01\x01\x00') 672m.type == BGP.NOTIFICATION_TYPE and m.error_code == 3 and m.error_subcode == 4 673 674 675########## BGPRouteRefresh Class ################################### 676+ BGPRouteRefresh class tests 677 678= BGPRouteRefresh - Instantiation 679raw(BGPRouteRefresh()) == b'\x00\x01\x00\x01' 680 681= BGPRouteRefresh - Instantiation with specific values 682raw(BGPRouteRefresh(afi = 1, safi = 1)) == b'\x00\x01\x00\x01' 683 684= BGPRouteRefresh - Dissection (1) 685m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x17\x05\x00\x02\x00\x01') 686m.type == BGP.ROUTEREFRESH_TYPE and m.len == 23 and m.afi == 2 and m.subtype == 0 and m.safi == 1 687 688 689= BGPRouteRefresh - Dissection (2) - With ORFs 690m = BGP(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00.\x05\x00\x01\x00\x01\x01\x80\x00\x13 \x00\x00\x00\x05\x18\x18\x15\x01\x01\x00\x00\x00\x00\x00\n\x00 \x00') 691assert(m.type == BGP.ROUTEREFRESH_TYPE) 692assert(m.len == 46) 693assert(m.afi == 1) 694assert(m.subtype == 0) 695assert(m.safi == 1) 696assert(m.orf_data[0].when_to_refresh == 1) 697assert(m.orf_data[0].orf_type == 128) 698assert(m.orf_data[0].orf_len == 19) 699assert(len(m.orf_data[0].entries) == 2) 700assert(m.orf_data[0].entries[0].action == 0) 701assert(m.orf_data[0].entries[0].match == 1) 702assert(m.orf_data[0].entries[0].prefix.prefix == "1.1.0.0/21") 703assert(m.orf_data[0].entries[1].action == 0) 704assert(m.orf_data[0].entries[1].match == 0) 705assert(m.orf_data[0].entries[1].prefix.prefix == "0.0.0.0/0") 706 707