예제 #1
0
def test_bug_639():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=639
    BGP and STATIC install the same route, this route also resolved
    the nexthop. The introduction of the policy to redistribute static
    triggers the problem in the RIB. This emulates the order of events
    when the router is being configured and a peering comes up.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")
    
    delay(2)

    coord("peer1 assert established");

    incomplete = "2"
    
    packet = "packet update \
    nexthop %s \
    origin " + incomplete + "\
    aspath 65001 \
    med 0 \
    nlri %s"

    if not config.conf_add_static_route4(builddir(1), "192.168.0.0/16"):
        return False

    delay(2)

    coord("peer1 send %s" % (packet % ("192.168.0.1", "192.168.0.0/16")))

    if not config.conf_redist_static(builddir(1), False):
        return False

    delay(5)

    coord("peer1 assert established");

    return True
예제 #2
0
def test_bug_639():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=639
    BGP and STATIC install the same route, this route also resolved
    the nexthop. The introduction of the policy to redistribute static
    triggers the problem in the RIB. This emulates the order of events
    when the router is being configured and a peering comes up.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")

    delay(2)

    coord("peer1 assert established")

    incomplete = "2"

    packet = "packet update \
    nexthop %s \
    origin " + incomplete + "\
    aspath 65001 \
    med 0 \
    nlri %s"

    if not config.conf_add_static_route4(builddir(1), "192.168.0.0/16"):
        return False

    delay(2)

    coord("peer1 send %s" % (packet % ("192.168.0.1", "192.168.0.0/16")))

    if not config.conf_redist_static(builddir(1), False):
        return False

    delay(5)

    coord("peer1 assert established")

    return True
예제 #3
0
파일: test_main.py 프로젝트: zagura/xorp.ct
def pending():
    """
    Check the previous command has completed
    """

    status, message = call_xrl(builddir(1), "finder://coord/coord/0.1/pending")
    if message == "pending:bool=false\n":
        return False
    else:
        return True
예제 #4
0
def pending():
    """
    Check the previous command has completed
    """

    status, message = call_xrl(builddir(1), "finder://coord/coord/0.1/pending")
    if message == "pending:bool=false\n":
        return False
    else:
        return True
예제 #5
0
def status(peer):
    """
    Get the status of a test peer.
    """

    status, message = call_xrl(builddir(1), "finder://coord/coord/0.1/status?peer:txt=" + peer)

    message = re.sub('^status:txt=', '', message)
    message = re.sub('\+', ' ', message)

    return message
예제 #6
0
파일: test_main.py 프로젝트: zagura/xorp.ct
def status(peer):
    """
    Get the status of a test peer.
    """

    status, message = call_xrl(
        builddir(1), "finder://coord/coord/0.1/status?peer:txt=" + peer)

    message = re.sub('^status:txt=', '', message)
    message = re.sub('\+', ' ', message)

    return message
예제 #7
0
def test1_4_C():
    """
    Set the holdtime to an illegal value of 2 seconds
    """

    # Try and set the holdtime to 2 seconds which is illegal.
    try:
        if not config.conf_set_holdtime(builddir(1), "127.0.0.1", 2):
            return True
    except Exception, (ErrorMessage):
        print ErrorMessage
        return True
예제 #8
0
def test1_4_C():
    """
    Set the holdtime to an illegal value of 2 seconds
    """

    # Try and set the holdtime to 2 seconds which is illegal.
    try:
        if not config.conf_set_holdtime(builddir(1), "127.0.0.1", 2):
            return True
    except Exception, (ErrorMessage):
        print ErrorMessage
        return True
예제 #9
0
파일: test_stop.py 프로젝트: zagura/xorp.ct
def stop():
    """
    Stop all the rtrmgr subprocesses by loading an empty configuration
    """

    xorpsh_commands = \
"""configure
load empty.boot
commit
"""

    if not xorpsh(builddir(), xorpsh_commands, 'templates'):
        return False

    return True
예제 #10
0
def stop():
    """
    Stop all the rtrmgr subprocesses by loading an empty configuration
    """

    xorpsh_commands = \
"""configure
load empty.boot
commit
"""

    if not xorpsh(builddir(), xorpsh_commands, 'templates'):
        return False

    return True
예제 #11
0
def test1_10_C():
    """
    To verify that a BGP router properly generates the ORIGIN attribute
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("target 127.0.0.1 10003")
    coord("initialise attach peer3")

    coord("peer1 establish AS 65001 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 65000 holdtime 0 id 10.0.0.2 keepalive false")
    coord("peer3 establish AS 65000 holdtime 0 id 10.0.0.3 keepalive false")
    
    delay(2)

    coord("peer1 assert established");
    coord("peer2 assert established");
    coord("peer3 assert established");

    delay(2)

    incomplete = 2
    coord("peer1 expect packet update \
    nexthop 127.0.0.1 \
    origin %s \
    aspath 65000 \
    med 0 nlri \
    172.16.0.0/16" % incomplete)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")
    coord("peer3 assert established")

    coord("peer1 assert queue 0")

    return True
예제 #12
0
def run_test(test, single, configure, TESTS, config_module, test_module):
    """
    Run the provided test
    """

    bdir = builddir(1)

    # First find the test if it exists
    test_func = ''
    conf_funcs = []
    for i in TESTS:
        if test == i[0]:
            test_func = i[1]
            if i[3] != '' and i[4] != '':
                print "Both fields should not be set"
                return False
            if i[3] != '':
                conf_funcs.append("UNKNOWN")
                test_func +=  '(bdir,conf)'
            if i[4] != '':
                print "debug", i[4]
                for f in i[4]:
                    conf_funcs.append(f + '(bdir)')
                test_func +=  '()'

    if not single:
        print "------ START PROGRAMS ------"

    conf_mod = __import__(config_module)
    test_mod = __import__(test_module)
    
    print conf_funcs

    try: 
        if configure:
            for i in conf_funcs:
                if not eval('conf_mod' + '.' + i):
                    print i, "FAILED"
                    return False
        if not eval('test_mod' + '.' + test_func):
            print test, "FAILED"
            return False
        else:
            print test, "SUCCEEDED"
    except Exception, (ErrorMessage):
        print ErrorMessage
        print test, "FAILED"
        return False
예제 #13
0
def test_bug_649():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=649
    Trigger a problem caused by BGP receiving the "route_info_changed" XRL.

    1) A default static route is required with a metric of 1
    2) Add a route that does not cover the nexthop the route should
    reduce the coverage of the default route. Causing the RIB to send
    an "route_info_invalid" XRL to sent to BGP.
    3) Install a route that exactly matches the range covered by the RIB
    causing a "route_info_changed" XRL to be sent to BGP. Note that at the time
    of writing BGP installed all routes with a metric of 0 and the static route
    has a metric of 1. Only if the routes match and the metric changes should
    there be an upcall.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")

    delay(2)

    coord("peer1 assert established")

    # Install the default route.
    if not config.conf_add_static_route4(builddir(1), "0.0.0.0/0"):
        return False

    delay(2)

    packet = "packet update \
    nexthop 10.0.0.1\
    origin 0 \
    aspath 65001 \
    nlri %s"

    # Send in a route that does not cover the nexthop.
    coord("peer1 send %s" % (packet % ("10.1.0.0/20")))
    # Send in a route that covers the nexthop and matches the next hop resolver
    # value.
    coord("peer1 send %s" % (packet % ("10.0.0.0/16")))

    coord("peer1 assert established")

    return True
예제 #14
0
def test1_10_C():
    """
    To verify that a BGP router properly generates the ORIGIN attribute
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("target 127.0.0.1 10003")
    coord("initialise attach peer3")

    coord("peer1 establish AS 65001 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 65000 holdtime 0 id 10.0.0.2 keepalive false")
    coord("peer3 establish AS 65000 holdtime 0 id 10.0.0.3 keepalive false")

    delay(2)

    coord("peer1 assert established")
    coord("peer2 assert established")
    coord("peer3 assert established")

    delay(2)

    incomplete = 2
    coord("peer1 expect packet update \
    nexthop 127.0.0.1 \
    origin %s \
    aspath 65000 \
    med 0 nlri \
    172.16.0.0/16" % incomplete)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")
    coord("peer3 assert established")

    coord("peer1 assert queue 0")

    return True
예제 #15
0
def test_bug_649():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=649
    Trigger a problem caused by BGP receiving the "route_info_changed" XRL.

    1) A default static route is required with a metric of 1
    2) Add a route that does not cover the nexthop the route should
    reduce the coverage of the default route. Causing the RIB to send
    an "route_info_invalid" XRL to sent to BGP.
    3) Install a route that exactly matches the range covered by the RIB
    causing a "route_info_changed" XRL to be sent to BGP. Note that at the time
    of writing BGP installed all routes with a metric of 0 and the static route
    has a metric of 1. Only if the routes match and the metric changes should
    there be an upcall.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")
    
    delay(2)

    coord("peer1 assert established");

    # Install the default route.
    if not config.conf_add_static_route4(builddir(1), "0.0.0.0/0"):
        return False

    delay(2)

    packet = "packet update \
    nexthop 10.0.0.1\
    origin 0 \
    aspath 65001 \
    nlri %s"

    # Send in a route that does not cover the nexthop.
    coord("peer1 send %s" % (packet % ("10.1.0.0/20")))
    # Send in a route that covers the nexthop and matches the next hop resolver
    # value.
    coord("peer1 send %s" % (packet % ("10.0.0.0/16")))

    coord("peer1 assert established");

    return True
예제 #16
0
파일: test_main.py 프로젝트: zagura/xorp.ct
def run_test(test, single, configure, TESTS, config_module, test_module):
    """
    Run the provided test
    """

    bdir = builddir(1)

    # First find the test if it exists
    test_func = ''
    conf_funcs = []
    for i in TESTS:
        if test == i[0]:
            test_func = i[1]
            if i[3] != '' and i[4] != '':
                print "Both fields should not be set"
                return False
            if i[3] != '':
                conf_funcs.append("UNKNOWN")
                test_func += '(bdir,conf)'
            if i[4] != '':
                print "debug", i[4]
                for f in i[4]:
                    conf_funcs.append(f + '(bdir)')
                test_func += '()'

    if not single:
        print "------ START PROGRAMS ------"

    conf_mod = __import__(config_module)
    test_mod = __import__(test_module)

    print conf_funcs

    try:
        if configure:
            for i in conf_funcs:
                if not eval('conf_mod' + '.' + i):
                    print i, "FAILED"
                    return False
        if not eval('test_mod' + '.' + test_func):
            print test, "FAILED"
            return False
        else:
            print test, "SUCCEEDED"
    except Exception, (ErrorMessage):
        print ErrorMessage
        print test, "FAILED"
        return False
예제 #17
0
def test4_6_A():
    """
    Verify that the NO_EXPORT community can be set on a redistributed route
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 65001 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 65002 holdtime 0 id 10.0.0.2 keepalive false")

    delay(2)

    coord("peer1 assert established")
    coord("peer2 assert established")

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath 65000 \
    med 0 \
    nlri 172.16.0.0/16 \
    community NO_EXPORT"

    coord("peer1 expect %s" % packet)
    coord("peer2 expect %s" % packet)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #18
0
def test4_6_A():
    """
    Verify that the NO_EXPORT community can be set on a redistributed route
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 65001 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 65002 holdtime 0 id 10.0.0.2 keepalive false")
    
    delay(2)

    coord("peer1 assert established");
    coord("peer2 assert established");

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath 65000 \
    med 0 \
    nlri 172.16.0.0/16 \
    community NO_EXPORT"

    coord("peer1 expect %s" % packet)
    coord("peer2 expect %s" % packet)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #19
0
def test1_13_A():
    """
    MULTI_EXIT_DISC Attribute
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 2 holdtime 0 id 10.0.0.2 keepalive false")

    packet1 = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath 2 \
    med 42 \
    nlri 172.16.0.0/16"

    packet2 = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath empty \
    localpref 100 \
    nlri 172.16.0.0/16"

    coord("peer1 expect %s" % packet1)
    coord("peer2 expect %s" % packet2)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #20
0
def test1_13_A():
    """
    MULTI_EXIT_DISC Attribute
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 2 holdtime 0 id 10.0.0.2 keepalive false")

    packet1 = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath 2 \
    med 42 \
    nlri 172.16.0.0/16"

    packet2 = "packet update \
    nexthop 127.0.0.1 \
    origin 0 \
    aspath empty \
    localpref 100 \
    nlri 172.16.0.0/16"

    coord("peer1 expect %s" % packet1)
    coord("peer2 expect %s" % packet2)

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #21
0
def test1_12_AB():
    """
    Check the rewriting of the NEXT_HOP attribute.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 2 holdtime 0 id 10.0.0.2 keepalive false")

    delay(2)

    coord("peer1 assert established")
    coord("peer2 assert established")

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin 0 \
    nlri 172.16.0.0/16 %s"

    coord("peer1 expect %s" % (packet % "aspath 2 med 0"))
    coord("peer2 expect %s" % (packet % "aspath empty localpref 100"))

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16",
                                         "127.0.0.2"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #22
0
def test1_12_AB():
    """
    Check the rewriting of the NEXT_HOP attribute.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("target 127.0.0.1 10002")
    coord("initialise attach peer2")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")
    coord("peer2 establish AS 2 holdtime 0 id 10.0.0.2 keepalive false")
    
    delay(2)

    coord("peer1 assert established");
    coord("peer2 assert established");

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin 0 \
    nlri 172.16.0.0/16 %s"
    
    coord("peer1 expect %s" % (packet % "aspath 2 med 0"))
    coord("peer2 expect %s" % (packet % "aspath empty localpref 100"))

    if not config.conf_add_static_route4(builddir(1), "172.16.0.0/16", "127.0.0.2"):
        return False

    delay(10)

    coord("peer1 assert established")
    coord("peer2 assert established")

    coord("peer1 assert queue 0")
    coord("peer2 assert queue 0")

    return True
예제 #23
0
def test1_6_B():
    """
    Cease notification message
    """

    # Set the prefix limit to 3
    config.conf_set_prefix_limit(builddir(1), "peer1", 3)

    coord("reset")
    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")
    
    delay(2)

    coord("peer1 assert established");

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin 0 \
    aspath 65001 \
    med 0\
    nlri %s"

    cease = 6
    coord("peer1 expect packet notify %s" % cease)

    # Send four NRLIs to trigger a cease

    coord("peer1 send %s" % (packet % "172.16.0.0/16"))
    coord("peer1 send %s" % (packet % "172.16.0.0/17"))
    coord("peer1 send %s" % (packet % "172.16.0.0/18"))
    coord("peer1 send %s" % (packet % "172.16.0.0/19"))

    delay(2)

    coord("peer1 assert idle")

    coord("peer1 assert queue 0")

    return True
예제 #24
0
def test1_6_B():
    """
    Cease notification message
    """

    # Set the prefix limit to 3
    config.conf_set_prefix_limit(builddir(1), "peer1", 3)

    coord("reset")
    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 65001 holdtime 0 id 1.2.3.4 keepalive false")

    delay(2)

    coord("peer1 assert established")

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin 0 \
    aspath 65001 \
    med 0\
    nlri %s"

    cease = 6
    coord("peer1 expect packet notify %s" % cease)

    # Send four NRLIs to trigger a cease

    coord("peer1 send %s" % (packet % "172.16.0.0/16"))
    coord("peer1 send %s" % (packet % "172.16.0.0/17"))
    coord("peer1 send %s" % (packet % "172.16.0.0/18"))
    coord("peer1 send %s" % (packet % "172.16.0.0/19"))

    delay(2)

    coord("peer1 assert idle")

    coord("peer1 assert queue 0")

    return True
예제 #25
0
def coord(command, noblock=False):
    """
    Send a command to the coordinator
    """

    print command
    status, message = call_xrl(builddir(1), "finder://coord/coord/0.1/command?command:txt=%s" % command)
    if 0 != status:
        if noblock:
            print message
            return
        raise Exception, message

    # Wait up to five seconds for this command to complete
    for i in range(5):
        if pending() == False:
            return
        delay(1)

    print >> sys.stderr, "Still pending"
예제 #26
0
파일: test_main.py 프로젝트: zagura/xorp.ct
def coord(command, noblock=False):
    """
    Send a command to the coordinator
    """

    print command
    status, message = call_xrl(
        builddir(1),
        "finder://coord/coord/0.1/command?command:txt=%s" % command)
    if 0 != status:
        if noblock:
            print message
            return
        raise Exception, message

    # Wait up to five seconds for this command to complete
    for i in range(5):
        if pending() == False:
            return
        delay(1)

    print >> sys.stderr, "Still pending"
예제 #27
0
def test4_8_A():
    """
    Verify correct operation of the multiprotocol extension
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")

    delay(2)

    coord("peer1 assert established")

    delay(2)

    #    packet = "packet update \
    #    nexthop 127.0.0.1 \
    #    origin 0 \
    #    aspath 65000 \
    #    med 0 \
    #    nlri 172.16.0.0/16 \
    #    community NO_EXPORT"

    #    coord("peer1 expect %s" % packet)

    if not config.conf_add_static_route4(builddir(1), "16.0.0.0/4"):
        return False

    delay(10)

    coord("peer1 assert established")

    coord("peer1 assert queue 0")

    return True
예제 #28
0
def test4_8_A():
    """
    Verify correct operation of the multiprotocol extension
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 1 holdtime 0 id 10.0.0.1 keepalive false")
    
    delay(2)

    coord("peer1 assert established");

    delay(2)

#    packet = "packet update \
#    nexthop 127.0.0.1 \
#    origin 0 \
#    aspath 65000 \
#    med 0 \
#    nlri 172.16.0.0/16 \
#    community NO_EXPORT"

#    coord("peer1 expect %s" % packet)

    if not config.conf_add_static_route4(builddir(1), "16.0.0.0/4"):
        return False

    delay(10)

    coord("peer1 assert established")

    coord("peer1 assert queue 0")

    return True
예제 #29
0
                                    "verbose", \
                                    ])
    except getopt.GetoptError:
        usage()
        sys.exit(-1)

    verbose = False

    for o, a in opts:
        if o in ("-h", "--help"):
            usage()
            sys.exit()
        if o in ("-v", "--verbose"):
            verbose = True

    s = Start(builddir=builddir(), verbose=verbose)
    s.start()
    if not s.check():
        print "Processes did not start"
        s.terminate()
        sys.exit(-1)
    print "Hit return to kill processes"
    sys.stdin.readline()
    print "About to terminate processes"
    if not s.check():
        print "Processes no longer running"
        s.terminate()
        sys.exit(-1)
    s.terminate()
    sys.exit(0)
예제 #30
0
def test_bug_360():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=360
    The bug report stated that the output from the bgp show route
    command can vary. This test populates the routing table with
    similar values and repeats the show command a number of times.
    NOTE: No problem was ever found.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 75 holdtime 0 id 75.75.75.75 keepalive false")

    delay(2)

    coord("peer1 assert established")

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin %s \
    aspath %s \
    nlri %s"

    incomplete = "2"

    coord("peer1 send %s" % (packet %
                             (incomplete, "75,50,25", "25.25.25.0/24")))
    coord("peer1 send %s" % (packet %
                             (incomplete, "75,50,25", "25.25.0.0/16")))
    coord("peer1 send %s" % (packet % (incomplete, "75,50,25", "25.0.0.0/8")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.75.75.0/24")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.75.0.0/16")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.70.0.0/8")))

    if not config.conf_add_static_route4(builddir(1), "100.100.100.0/24"):
        return False

    if not config.conf_add_static_route4(builddir(1), "100.100.0.0/16"):
        return False

    if not config.conf_add_static_route4(builddir(1), "100.0.0.0/8"):
        return False

    reference_output = \
"""*> 100.100.100.0/24      127.0.0.1                  0.0.0.0        i
*> 100.100.0.0/16        127.0.0.1                  0.0.0.0        i
*> 100.0.0.0/8           127.0.0.1                  0.0.0.0        i
*> 25.25.25.0/24         127.0.0.2                  75.75.75.75   75 50 25 ?
*> 25.25.0.0/16          127.0.0.2                  75.75.75.75   75 50 25 ?
*> 25.0.0.0/8            127.0.0.2                  75.75.75.75   75 50 25 ?
*> 75.75.75.0/24         127.0.0.2                  75.75.75.75   75 ?
*> 75.75.0.0/16          127.0.0.2                  75.75.75.75   75 ?
*> 75.0.0.0/8            127.0.0.2                  75.75.75.75   75 ?
"""

    for l in range(100):

        result, output = config.show_bgp_routes(builddir(1))

        import string

        # Looks like the xorpsh inserts carriage returns.
        output = output.replace('\r', '')
        # XXX
        # This might be a problem on windows, in later installations of python
        # we can use splitlines.
        lines = string.split(output, '\n')
        output = ""
        for i in lines:
            if i and i[0] == '*':
                output += i + '\n'

        if reference_output != output:
            reference = '/tmp/reference'
            actual = '/tmp/actual'
            print 'Output did now match check %s and %s' % (reference, actual)

            file = open(reference, 'w')
            file.write(reference_output)
            file.close()

            file = open(actual, 'w')
            file.write(output)
            file.close()

            print '<@' + reference_output + '@>'
            print "==="
            print '<@' + output + '@>'
            return False

    return True
예제 #31
0
def test_bug_360():
    """
    http://www.xorp.org/bugzilla/show_bug.cgi?id=360
    The bug report stated that the output from the bgp show route
    command can vary. This test populates the routing table with
    similar values and repeats the show command a number of times.
    NOTE: No problem was ever found.
    """

    coord("reset")

    coord("target 127.0.0.1 10001")
    coord("initialise attach peer1")

    coord("peer1 establish AS 75 holdtime 0 id 75.75.75.75 keepalive false")
    
    delay(2)

    coord("peer1 assert established");

    delay(2)

    packet = "packet update \
    nexthop 127.0.0.2 \
    origin %s \
    aspath %s \
    nlri %s"

    incomplete = "2"
    
    coord("peer1 send %s" % (packet % (incomplete,
                                       "75,50,25", "25.25.25.0/24")))
    coord("peer1 send %s" % (packet % (incomplete,
                                       "75,50,25", "25.25.0.0/16")))
    coord("peer1 send %s" % (packet % (incomplete,
                                       "75,50,25", "25.0.0.0/8")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.75.75.0/24")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.75.0.0/16")))
    coord("peer1 send %s" % (packet % (incomplete, "75", "75.70.0.0/8")))

    if not config.conf_add_static_route4(builddir(1), "100.100.100.0/24"):
        return False

    if not config.conf_add_static_route4(builddir(1), "100.100.0.0/16"):
        return False

    if not config.conf_add_static_route4(builddir(1), "100.0.0.0/8"):
        return False

    reference_output = \
"""*> 100.100.100.0/24      127.0.0.1                  0.0.0.0        i
*> 100.100.0.0/16        127.0.0.1                  0.0.0.0        i
*> 100.0.0.0/8           127.0.0.1                  0.0.0.0        i
*> 25.25.25.0/24         127.0.0.2                  75.75.75.75   75 50 25 ?
*> 25.25.0.0/16          127.0.0.2                  75.75.75.75   75 50 25 ?
*> 25.0.0.0/8            127.0.0.2                  75.75.75.75   75 50 25 ?
*> 75.75.75.0/24         127.0.0.2                  75.75.75.75   75 ?
*> 75.75.0.0/16          127.0.0.2                  75.75.75.75   75 ?
*> 75.0.0.0/8            127.0.0.2                  75.75.75.75   75 ?
"""

    for l in range(100):

        result, output = config.show_bgp_routes(builddir(1))

        import string

        # Looks like the xorpsh inserts carriage returns.
        output = output.replace('\r', '')
        # XXX
        # This might be a problem on windows, in later installations of python
        # we can use splitlines.
        lines = string.split(output, '\n')
        output = ""
        for i in lines:
            if i and i[0] == '*':
                output += i + '\n'
        
        if reference_output != output:
            reference = '/tmp/reference'
            actual = '/tmp/actual'
            print 'Output did now match check %s and %s' % (reference, actual)

            file = open(reference, 'w')
            file.write(reference_output)
            file.close()
    
            file = open(actual, 'w')
            file.write(output)
            file.close()
            
            print '<@' + reference_output + '@>'
            print "==="
            print '<@' + output + '@>'
            return False
    
    return True
예제 #32
0
                                    "verbose", \
                                    ])
    except getopt.GetoptError:
        usage()
        sys.exit(-1)

    verbose = False
    
    for o, a in opts:
	if o in ("-h", "--help"):
	    usage()
	    sys.exit()
        if o in ("-v", "--verbose"):
            verbose = True
    
    s = Start(builddir=builddir(), verbose=verbose)
    s.start()
    if not s.check():
        print "Processes did not start"
        s.terminate()
        sys.exit(-1)
    print "Hit return to kill processes"
    sys.stdin.readline()
    print "About to terminate processes"
    if not s.check():
        print "Processes no longer running"
        s.terminate()
        sys.exit(-1)
    s.terminate()
    sys.exit(0)