예제 #1
0
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
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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
예제 #6
0
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']
예제 #7
0
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
예제 #8
0
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
예제 #9
0
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
예제 #10
0
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']
예제 #11
0
def npdu_distribute_broadcast(udp):
    bvlc = udp / BVLC(function=BvlcFunction.DISTRIBUTE_BROADCAST_TO_NETWORK)
    npdu = bvlc / NPDU(nlpci=0b00000000)
    return npdu
예제 #12
0
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
예제 #13
0
def test_bvlc_register_fd(udp):
    bvlc = udp / BVLC(function=BvlcFunction.REGISTER_FD, time_to_live=60)
    bvlc.show2()
    send(bvlc)
    assert True == False
예제 #14
0
def test_bvlc_read_bdt(udp):
    bvlc = udp / BVLC(function=BvlcFunction.READ_BDT)
    bvlc.show2()
    send(bvlc)
    assert True == False