예제 #1
0
def ConfigureIpv6StaticRoutes(sw1, sw2, ipv6_route_list, step):
    sw1_interfaces = []

    # IPv4 addresses to cnfigure on switch
    sw1_if_ip = "8421:8421::1"
    sw1_mask = 64
    sw1_interface = sw1.ports["if0{}".format(1)]

    step("Configuring interface and IPv6 on SW1")

    # COnfiguring interfaces with its respective addresses and enables
    sw1("configure terminal")

    sw1("interface {}".format(sw1_interface))
    sw1("ipv6 address {}/{}".format(sw1_if_ip, sw1_mask))
    sw1("no shutdown")
    sw1("exit")

    output = sw1("do show running-config")
    assert "interface {}".format(sw1_interface) in output
    assert "ipv6 address {}/{}".format(sw1_if_ip, sw1_mask) in output

    step('### Configuration on sw1 and sw2 complete ###\n')

    # Stop ops-zebra process on sw1
    sw1(zebra_stop_command_string, shell='bash')

    for route in ipv6_route_list:
        sw1("ipv6 route {} {}".format(route['Prefix'], route['Nexthop']))

    sw1("exit")

    step('### Static routes configured on sw1 ###\n')

    # Start ops-zebra process on sw1
    sw1(zebra_start_command_string, shell='bash')

    sleep(TRIGGER_SLEEP)

    perf_stats_dict = capture_output_samples_and_generate_perf_stats(
        sw1, ipv6_route_list, "Config", False, TOTAL_TIME, SAMPLING_TIME,
        SNAPSHOT_TIME)

    assert perf_stats_dict is not None, "No perf stat captured \
           at " + str(SNAPSHOT_TIME) + "seconds"

    assert perf_stats_dict['TotalShowIpRoute'] == MAX_IPV6_ROUTE, "The \
           show ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalShowIpRoute'])

    assert perf_stats_dict['TotalKernelIpRoute'] == MAX_IPV6_ROUTE, "The \
           kernel ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalKernelIpRoute'])

    assert perf_stats_dict['TotalShowRunning'] == MAX_IPV6_ROUTE, "The \
           show running captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalShowRunning'])
예제 #2
0
def InterfaceAddrRestore(sw1, sw2, ipv6_route_list, step):
    step(
        '### Test selection of static routes on interface address restore ###')

    sw1_interface = sw1.ports["if0{}".format(1)]

    sw1("configure terminal")

    sw1("interface {}".format(sw1_interface))
    sw1("ipv6 address {}/{}".format("8421:8421::1", "64"))
    sw1("exit")

    sw1("exit")

    sleep(TRIGGER_SLEEP)

    perf_stats_dict = capture_output_samples_and_generate_perf_stats(
        sw1, ipv6_route_list, "Interface address restore", False, TOTAL_TIME,
        SAMPLING_TIME, SNAPSHOT_TIME)

    assert perf_stats_dict is not None, "No perf stat captured \
           at " + str(SNAPSHOT_TIME) + "seconds"

    assert perf_stats_dict['TotalShowIpRoute'] == MAX_IPV6_ROUTE, "The \
           show ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalShowIpRoute'])

    assert perf_stats_dict['TotalKernelIpRoute'] == MAX_IPV6_ROUTE, "The \
           kernel ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalKernelIpRoute'])

    assert perf_stats_dict['TotalShowRunning'] == MAX_IPV6_ROUTE, "The \
           show running captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(MAX_IPV6_ROUTE) + " \
           actual: " + str(perf_stats_dict['TotalShowRunning'])
예제 #3
0
def InterfaceNoRouting(sw1, sw2, ipv4_route_list, step):
    step('### Test selection of static routes on interface no routing ###')

    sw1_interface = sw1.ports["if0{}".format(1)]

    sw1("configure terminal")

    sw1("interface {}".format(sw1_interface))
    sw1("no routing")
    sw1("exit")

    sw1("exit")

    sleep(TRIGGER_SLEEP)

    perf_stats_dict = capture_output_samples_and_generate_perf_stats(
        sw1, ipv4_route_list, "Interface no routing", True, TOTAL_TIME,
        SAMPLING_TIME, SNAPSHOT_TIME)

    assert perf_stats_dict is not None, "No perf stat captured \
           at " + str(SNAPSHOT_TIME) + "seconds"

    assert perf_stats_dict['TotalShowIpRoute'] == 0, "The \
           show ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(0) + " \
           actual: " + str(perf_stats_dict['TotalShowIpRoute'])

    assert perf_stats_dict['TotalKernelIpRoute'] == 0, "The \
           kernel ip route captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(0) + " \
           actual: " + str(perf_stats_dict['TotalKernelIpRoute'])

    assert perf_stats_dict['TotalShowRunning'] == 0, "The \
           show running captured at " + str(SNAPSHOT_TIME) + " seconds \
           are not same expected: " + str(0) + " \
           actual: " + str(perf_stats_dict['TotalShowRunning'])