diff --git a/scapy/contrib/bgp.uts b/scapy/contrib/bgp.uts index 3a2997df2..5ccdf9ff2 100644 --- a/scapy/contrib/bgp.uts +++ b/scapy/contrib/bgp.uts @@ -97,6 +97,20 @@ str(BGPCapability()) == b'\x00\x00' c = BGPCapability(code = 70) assert(str(c) == b'F\x00') += BGPCapability - Check exception +from scapy.contrib.bgp import _BGPInvalidDataException +try: + BGPCapability("\x00") + False +except _BGPInvalidDataException: + True + += BGPCapability - Test haslayer() +BGPCapFourBytesASN().haslayer(BGPCapability) == True + += BGPCapability - Test getlayer() +isinstance(BGPCapFourBytesASN().getlayer(BGPCapability), BGPCapFourBytesASN) + ############################ BGPCapMultiprotocol ############################## + BGPCapMultiprotocol class tests @@ -185,6 +199,10 @@ c.code == 3 and c.length == 0 c = 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)])]) c.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 += BGPCapORF - Dissection +p = BGPCapORF(b'\x03\x07\x00\x01\x00\x01\x01@\x03') +assert(len(p.orf) == 1) + ####################### BGPCapGracefulRestart.GRTuple ######################### + BGPCapGracefulRestart.GRTuple class tests @@ -615,6 +633,10 @@ assert(m.path_attr[0].attribute.safi == 1) assert(m.path_attr[0].attribute.afi_safi_specific.withdrawn_routes[0].prefix == "6000::/3") assert(m.nlri == []) += BGPUpdate - with BGPHeader +p = BGP(str(BGPHeader()/BGPUpdate())) +assert(BGPHeader in p and BGPUpdate in p) + ########## BGPNotification Class ################################### + BGPNotification class tests diff --git a/test/regression.uts b/test/regression.uts index 843088aba..a4bd3bb66 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -331,6 +331,7 @@ if not WINDOWS: ~ manufdb assert(MANUFDB._resolve_MAC("00:00:0F:01:02:03") == "Next:01:02:03") assert(MANUFDB._get_short_manuf("00:00:0F:01:02:03") == "Next") +assert(in6_addrtovendor("fe80::0200:0fff:fe01:0203").lower().startswith("next")) = Test utility functions - network related ~ netaccess