def test_bvlc_register_fd(udp): bvlc = udp / BVLC(function=BvlcFunction.REGISTER_FD, time_to_live=60) bvlc.show2() send(bvlc) bvlc = bvlc.__class__(str(bvlc)) assert bvlc.length == 6
def test_bvlc_read_bdt(udp): bvlc = udp / BVLC(function=BvlcFunction.READ_BDT) bvlc.show2() send(bvlc) log.debug(bvlc) bvlc = bvlc.__class__(str(bvlc)) assert bvlc.length == 4
def test_npdu_i_am_router_to_network(udp): bind_layers(BVLC, NPDU) bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10000000, message_type=NetworkLayerMessageType.I_AM_ROUTER_TO_NETWORK, networks=[1, 2]) npdu.show2() send(npdu) assert True == False
def test_npdu_who_is_router_to_network_with_net(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10000000, message_type=NetworkLayerMessageType.WHO_IS_ROUTER_TO_NETWORK, network=1) npdu.show2() send(npdu) npdu = npdu.__class__(str(npdu)) assert npdu['BVLC'].length == 9 assert npdu['NPDU'].network == 1
def test_npdu_who_is_router_to_network_no_net(udp): bvlc = BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) pkt = udp / bvlc npdu = NPDU(nlpci=0b10000000, message_type=NetworkLayerMessageType.WHO_IS_ROUTER_TO_NETWORK) pkt = pkt / npdu pkt.show2() send(pkt) pkt = pkt.__class__(str(pkt)) assert pkt['BVLC'].length == 7 assert pkt['NPDU'].network == None
def test_npdu_i_am_router_to_network(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10000000, message_type=NetworkLayerMessageType.I_AM_ROUTER_TO_NETWORK, networks=[1, 2, 3]) npdu.show2() send(npdu) npdu = npdu.__class__(str(npdu)) assert npdu['BVLC'].length == 13 assert npdu['NPDU']
def test_npdu_who_is_router_to_network(udp): bind_layers(BVLC, NPDU, function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10000000, message_type=NetworkLayerMessageType.WHO_IS_ROUTER_TO_NETWORK, network=1) npdu.show2() send(npdu) print npdu['BVLC'].length assert npdu['BVLC'].length == 9 assert True == False
def test_npdu_who_is_router_to_network_with_net_with_source(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10001000, message_type=NetworkLayerMessageType.WHO_IS_ROUTER_TO_NETWORK, sadr=hexStringToIntList('FFFF'), snet=80, network=3) npdu.show2() send(npdu) npdu = npdu.__class__(str(npdu)) assert npdu['BVLC'].length == 14 assert npdu['NPDU'].network == 3
def test_npdu_who_is_router_to_network_no_net_with_dest(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10100000, message_type=NetworkLayerMessageType.WHO_IS_ROUTER_TO_NETWORK, dadr=hexStringToIntList('01'), dnet=99, hop_count=255) npdu.show2() send(npdu) npdu = npdu.__class__(str(npdu)) assert npdu['BVLC'].length == 12 assert npdu['NPDU'].network == None
def test_npdu_i_am_router_to_network_global_broadcast(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU( nlpci=0b10100000, dlen=0, dnet=0xFFFF, hop_count=255, message_type=NetworkLayerMessageType.I_AM_ROUTER_TO_NETWORK, networks=[1, 2, 3]) npdu.show2() send(npdu) npdu = npdu.__class__(str(npdu)) assert npdu['BVLC'].length == 17 assert npdu['NPDU']
def npdu_distribute_broadcast(udp): bvlc = udp / BVLC(function=BvlcFunction.DISTRIBUTE_BROADCAST_TO_NETWORK) npdu = bvlc / NPDU(nlpci=0b00000000) return npdu
def npdu_global_broadcast(udp): bvlc = udp / BVLC(function=BvlcFunction.ORIGINAL_BROADCAST_NPDU) npdu = bvlc / NPDU(nlpci=0b00100000, dlen=0, dnet=0xFFFF, hop_count=255) return npdu
def test_bvlc_register_fd(udp): bvlc = udp / BVLC(function=BvlcFunction.REGISTER_FD, time_to_live=60) bvlc.show2() send(bvlc) assert True == False
def test_bvlc_read_bdt(udp): bvlc = udp / BVLC(function=BvlcFunction.READ_BDT) bvlc.show2() send(bvlc) assert True == False