Esempio n. 1
0
def verify_rpvst_intf_config_db(dut, ifname):

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "edge_port", "true"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "link_type", "point-to-point"):
    return False

  return True
Esempio n. 2
0
def ecn_verify():
    st.log("verifying ecn config in running config - FtOpSoQosEcnCfg002")
    if not sconf_obj.verify_running_config(vars.D1, "WRED_PROFILE", "WRED",
                                           "ecn", "ecn_all"):
        st.report_fail("ecn_config_not_updated_in_config_db")
    else:
        st.log("ecn configuration successful")
def tacacs_config_verify():
    st.log("Checking whether config is loaded to running config from config_db after save-reboot")
    if not switchconf.verify_running_config(vars.D1, "TACPLUS_SERVER", security_data.tacacs_host_ip, "priority", "1"):
        st.report_fail("running_config_failed", vars.D1, "TACPLUS_SERVER", security_data.tacacs_host_ip, "priority",
                       "1")
    else:
        st.log("tacacs server configuration is successful")
Esempio n. 4
0
def mirror_action_config():
    mirror_args = {
        "session_name": data.session_name,
        "gre_type": data.gre_type,
        "dscp": data.dscp,
        "ttl": data.ttl,
        "queue": data.queue,
        "src_ip": data.source_ip,
        "dst_ip": data.destination_ip
    }
    retval = mirror.create_session_table(vars.D1, **mirror_args)
    if not retval:
        st.log("Failed to create mirror session using json file.")
        st.report_fail("operation_failed")
        acl_dscp.config_policy_table(vars.D1,
                                     enable='create',
                                     policy_name=data.acl_table_name,
                                     policy_type=data.type)
        acl_dscp.config_service_policy_table(
            vars.D1,
            policy_kind='bind',
            policy_type=data.type,
            stage='in',
            interface_name=vars.D1T1P1,
            service_policy_name=data.acl_table_name)
    if not sconf_obj.verify_running_config(vars.D1, "MIRROR_SESSION",
                                           "Mirror_Ses", "dst_ip", "15.1.1.2"):
        st.log("Failed to show mirror session details in running config.")
        st.report_fail("operation_failed")
Esempio n. 5
0
def mtu_verify():
    st.log("Verifying mtu configuration on interface - FtOpSoSysMTUCmFn003")
    if not sconf_obj.verify_running_config(vars.D1, "PORT", data.eth_name,
                                           data.property, data.mtu):
        st.report_fail("fail_to_configure_mtu_on_Device", 1)
    else:
        st.log("mtu config verification on interface successful")
Esempio n. 6
0
def tacacs_config_verify():
    st.log("verifying whether configuring tacacs server is successful or not - FtOpSoScTaCm004")
    tacacs_params = st.get_service_info(vars.D1, "tacacs")
    if not sconf_obj.verify_running_config(vars.D1, "TACPLUS_SERVER", tacacs_params.hosts[0].ip, "priority", "1"):
        st.report_fail("running_config_failed", vars.D1, "TACPLUS_SERVER", tacacs_params.hosts[0].ip, "priority","1")
    else:
        st.log("tacacs server configuration is successful")
Esempio n. 7
0
def wred_running_config():
    if not sconf_obj.verify_running_config(
            vars.D1,
            "WRED_PROFILE",
            "WRED",
            "green_max_threshold",
            "900000",
    ):
        st.report_fail("wred_config_not_updated_in_config_db")
Esempio n. 8
0
def verify_rpvst_intf_config(dut, ifname):

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "enable"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "bpdu_guard"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "root_guard"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "priority"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_PORT", ifname, "cost"):
    return False

  return True
Esempio n. 9
0
def verify_rpvst_global_config(dut):

  if not sconf_obj.verify_running_config(dut, "STP", "GLOBAL", "mode"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP", "GLOBAL", "forward_delay"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP", "GLOBAL", "hello_time"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP", "GLOBAL", "max_age"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP", "GLOBAL", "priority"):
    return False

  return True
Esempio n. 10
0
def ecn_verify():
    st.log(
        "verifying ecn config in running config - ft_ecn_config_db_to_running_config_after_save_and_reload, ft_ecn_config_to_config_db_json_after_save_and_reboot, FtOpSoQosEcnCfg001"
    )
    if not sconf_obj.verify_running_config(vars.D1, "WRED_PROFILE", "WRED",
                                           "ecn", "ecn_all"):
        st.report_fail("ecn_config_not_updated_in_config_db")
    else:
        st.log("ecn configuration successful")
Esempio n. 11
0
def verify_rpvst_vlan_config(dut, vlan_id):
  cmd = "Vlan" + str(vlan_id)

  if not sconf_obj.verify_running_config(dut, "STP_VLAN", cmd, "enable"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_VLAN", cmd, "forward_delay"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_VLAN", cmd, "hello_time"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_VLAN", cmd, "max_age"):
    return False

  if not sconf_obj.verify_running_config(dut, "STP_VLAN", cmd, "priority"):
    return False

  return True
Esempio n. 12
0
def wred_verify():
    st.log("verifying wred config in running config - FtOpSoQosWredCfg001")
    if not sconf_obj.verify_running_config(
            vars.D1,
            "WRED_PROFILE",
            "WRED",
            "green_max_threshold",
            "900000",
    ):
        st.report_fail("wred_config_not_updated_in_config_db")
    else:
        st.log("wred configuration successful")
Esempio n. 13
0
def test_ft_erspan_config_upload_save_reload_reboot():
    """
    Author: Prudviraj kristipati ([email protected])
    Verify that ERSPAN configuration is stored to config_db file, after config save & reload and save & reboot.
    :return:
    """
    mirror.delete_session(vars.D1, data.session_name)
    mirror_args = {"session_name": data.session_name, "src_ip": data.ip_D1T1P1, "dst_ip": data.ip_T1D2P1,
                   "gre_type": data.gre_type, "dscp": data.dscp, "ttl": data.ttl, "queue": data.queue}
    retval = mirror.create_session_table(vars.D1, **mirror_args)

    if not retval:
        st.log("Failed to create mirror session using json file.")
        st.report_fail("mirror_session_fail", data.session_name)
    if not sconf.verify_running_config(vars.D1, "MIRROR_SESSION", "Mirror_Ses", "dst_ip", "15.1.1.2"):
        st.log("Failed to show mirror session details in running config.")
        st.report_fail("test_case_failure_message", "Failed to display mirror session details in running-config.")
    reboot_obj.config_save_reload(vars.D1)

    if not mirror.verify_session(vars.D1, **mirror_args):
        st.log("Failed to show mirror session details after reload.")
        st.report_fail("mirror_session_fail", data.session_name + "after config save and reload")
    if not sconf.verify_running_config(vars.D1, "MIRROR_SESSION", "Mirror_Ses", "dst_ip", "15.1.1.2"):
        st.log("Failed to show mirror session details in running config after reload.")
        st.report_fail("test_case_failure_message",
                       "Failed to display mirror session details in running-config after config save and reload")

    st.reboot(vars.D1)

    if not mirror.verify_session(vars.D1, **mirror_args):
        st.log("failed to show mirror session details after reboot.")
        st.report_fail("mirror_session_fail", data.session_name + "after save and reboot")
    if not sconf.verify_running_config(vars.D1, "MIRROR_SESSION", "Mirror_Ses", "dst_ip", "15.1.1.2"):
        st.log("failed to show mirror session details in running config after reboot.")
        st.report_fail("test_case_failure_message",
                       "Failed to display mirror session details in running-config after save and reboot")

    st.report_pass("test_case_passed")
Esempio n. 14
0
def test_ft_config_mgmt_verifying_config_with_save_reboot():
    st.log("Configuring DUT with supported feature with CLI")
    vlan_obj.delete_all_vlan(vars.D1)
    vlan_obj.verify_vlan_config(vars.D1, data.vlan)
    vlan_obj.create_vlan(vars.D1, data.vlan)
    st.log("Configuring supported QoS features with CLI")
    st.log("Configuring IPV4 ACL with rule")
    ipv4_acl_config()
    st.log("Configuring IPV6 ACL with rule")
    ipv6_acl_config()
    st.log("Configuring COS")
    cos_config()
    st.log("Configuring WRED")
    config_ecn()
    st.log("Configuring CRM")
    crm_config()
    st.log("Configuring MTU on interface")
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu)
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing Reboot")
    st.reboot(vars.D1, 'fast')
    st.log(
        "Checking whether config is loaded to running config from config_db after reboot"
    )
    if not vlan_obj.verify_vlan_config(vars.D1, data.vlan):
        st.report_fail("Config_not_loaded_from_config_db_json")
    st.log("Checking for IPV4 ACL config")
    ipv4_acl_run_config()
    st.log("Checking for IPV6 ACL config")
    ipv6_acl_run_config()
    st.log("Checking for COS config")
    cos_run_config()
    st.log("Checking for WRED config")
    if not ecn_obj.show_ecn_config(vars.D1):
        st.report_fail("Config_not_loaded_from_config_db_json")
    st.log("Checking CRM config after save and reload")
    crm_config_verify()
    st.log("Checking the configured MTU value after save and reload")
    if not sconf_obj.verify_running_config(vars.D1, "PORT", data.eth,
                                           data.property, data.mtu):
        st.report_fail("fail_to_configure_mtu_on_Device", 1)
    st.log(
        "configuration  is successfully stored to config_db file after save and reboot"
    )
    st.report_pass("test_case_passed")
Esempio n. 15
0
def cos_config_verify():
    st.log(
        "verifying cos config is present in running-config - FtFpSoQoSCoSCfg001"
    )
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "0", "0"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '0' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "1", "1"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '1' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "2", "2"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '2' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "3", "3"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '3' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "4", "4"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '4' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "5", "5"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '5' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "6", "6"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '6' is successful")
    if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                           data.cos_name, "7", "7"):
        st.report_fail("content_not_found")
    else:
        st.log("configuring cos queue mapping '7' is successful")
Esempio n. 16
0
def mirror_action_verify():
    mirror_args = {
        "session_name": data.session_name,
        "gre_type": data.gre_type,
        "dscp": data.dscp,
        "ttl": data.ttl,
        "queue": data.queue,
        "src_ip": data.source_ip,
        "dst_ip": data.destination_ip
    }
    if not mirror.verify_session(vars.D1, **mirror_args):
        st.log("failed to show mirror session details after reboot.")
        st.report_fail("operation_failed")
    if not sconf_obj.verify_running_config(vars.D1, "MIRROR_SESSION",
                                           "Mirror_Ses", "dst_ip", "15.1.1.2"):
        st.log(
            "failed to show mirror session details in running config after reboot."
        )
        st.report_fail("operation_failed")
def test_ft_qos_scheduling_functionality():
    '''
     Author: Sai Durga <*****@*****.**>
	 This test script covers below scenarios

     FtOpSoQsDwrrFn001: Verify that traffic is forwarded based on the ratio calculated with configured weight when scheduling is enabled on egress port when congestion is happened

    Setup:
    =======
    2 TGen(IX1 and IX2)====DUT1-----DUT2=====2 TGen(IX3 and IX4)

    Procedure:
    ============
    1) Create a VLAN 555 in both the devices and include all the TGen and back to back interfaces to the VLAN
    2) Create a DWRR profiles with weights 50 and 40 and apply them on back to back interface on 1st device with queus 5 and 2
    3) Learn the MAC entries of 2 TGen connected ports on DUT2
    4) Start sending traffic from IX1 to IX3 and IX2 to IX4 with VLAN user priority 5 and 2 respectively

    Expected Result:
    ================
    1) Verify that VLAN created and all the ports included in that VLAN
    2) VLAN that strict priority is applied
    3) Verify that FDB table updated with the MAC entries
    4) Verify that traffic is forwarded  based on the ratio calsulated with configured weight

    In this case 55.5% IX1 and 44.5% from IX2

	 FtOpSoQsStPrFn001 : Verify that traffic is forwarded from highest prority queue when strict priority and DWRR is enabled on egress port when congestion is happened

    Setup:
    =======
    2 TGen(IX1 and IX2)====DUT1-----DUT2=====2 TGen(IX3 and IX4)

    Procedure:
    ============
    1) Create a VLAN 555 in both the devices and include all the TGen and back to back interfaces to the VLAN
    2) Create a strict priority profilewith one strict and weight 40(DWRR) and apply them on back to back interface on 1st device with queus 1 and 3 respectively
    3) Learn the MAC entries of 2 TGen connected ports on DUT2
    4) Start sending traffic from IX1 to IX3 and IX2 to IX4 with VLAN user priority 1 and 2 respectively

    Expected Result:
    ================
    1) Verify that VLAN created and all the ports included in that VLAN
    2) VLAN that strict priority is applied
    3) Verify that FDB table updated with the MAC entries
    4) Verify that traffic is forwarded from highest priority queue i.e., from IX1 to IX3 and also verify that IX4 receives very mimimal traffic or 0 traffic from IX2
    '''
    st.debug(
        "Applying and verifying DWRR and strict config reflecting in running config or not"
    )
    if not apply_queue_shcheduling_config(vars.D1,
                                          scheduling_data.json_content):
        get_debug_info()
        st.report_fail("msg", "Failed to configure scheduler")
    if not sconf_obj.verify_running_config(
            vars.D1, "SCHEDULER", "{}@{}".format(scheduling_data.policy_name,
                                                 scheduling_data.dwrr_queue2),
            "type", "DWRR"):
        get_debug_info()
        st.report_fail("content_not_found")
    if not sconf_obj.verify_running_config(
            vars.D1, "SCHEDULER", "{}@{}".format(scheduling_data.policy_name,
                                                 scheduling_data.strict_queue),
            "type", "STRICT"):
        get_debug_info()
        st.report_fail("content_not_found")
    mac_learning()
    exceptions = exec_all(True, [[clear_interface_counters, vars.D1],
                                 [clear_interface_counters, vars.D2]])[1]
    ensure_no_exception(exceptions)
    st.debug("Sending traffic from ingress ports")
    scheduling_data.tg.tg_traffic_control(
        action='run',
        stream_handle=[
            scheduling_data.streams['scheduling_port_dwrr_ingress1'],
            scheduling_data.streams['scheduling_port_dwrr_ingress2']
        ],
        enable_arp=0)
    if not sched_verify_queue_rate_ratio_dwrr(
            scheduling_data.dwrr_queue1,
            scheduling_data.get_percent(scheduling_data.weight_1),
            scheduling_data.dwrr_queue2,
            scheduling_data.get_percent(scheduling_data.weight_2)):
        get_debug_info()
        st.report_fail("msg", "Traffic is not schedules as configured")
    scheduling_data.tg.tg_traffic_control(
        action='stop', stream_handle=scheduling_data.streams.values())

    st.debug("Checking strict priority functionality")
    scheduling_data.tg.tg_traffic_config(
        mode='modify',
        stream_id=scheduling_data.streams['scheduling_port_dwrr_ingress1'],
        vlan_user_priority=scheduling_data.strict_queue)
    exceptions = exec_all(True, [[clear_interface_counters, vars.D1],
                                 [clear_interface_counters, vars.D2]])[1]
    ensure_no_exception(exceptions)
    st.debug("Sending traffic from ingress ports")
    scheduling_data.tg.tg_traffic_control(
        action='run',
        stream_handle=[
            scheduling_data.streams['scheduling_port_dwrr_ingress1'],
            scheduling_data.streams['scheduling_port_dwrr_ingress2']
        ],
        enable_arp=0)
    st.wait(5, "Sending traffic for 5 seconds")
    scheduling_data.tg.tg_traffic_control(
        action='stop', stream_handle=scheduling_data.streams.values())
    st.wait(2, "Waiting to stabilize the interface counters")
    [output, exceptions] = exec_all(True,
                                    [[show_interface_counters_all, vars.D1],
                                     [show_interface_counters_all, vars.D2]])
    ensure_no_exception(exceptions)
    if not all(output):
        get_debug_info()
        st.report_fail("msg", "Failed to get interface counters")
    dut1_counters, dut2_counters = output
    ingress_rx_cnt = filter_and_select(dut1_counters, ['rx_ok'],
                                       {'iface': vars.D1T1P1})
    egress_tx_cnt = filter_and_select(dut2_counters, ['tx_ok'],
                                      {'iface': vars.D2T1P1})
    if not (ingress_rx_cnt and egress_tx_cnt):
        get_debug_info()
        st.report_fail("msg", "Failed to get interface counters")
    ingress_rx_cnt = ingress_rx_cnt[0]['rx_ok']
    egress_tx_cnt = egress_tx_cnt[0]['tx_ok']
    if not ((0.99 * int(ingress_rx_cnt.replace(',', ''))) <= int(
            egress_tx_cnt.replace(',', ''))):
        st.debug("Traffic sent: {} and Traffic received: {}".format(
            ingress_rx_cnt.replace(',', ''), egress_tx_cnt.replace(',', '')))
        get_debug_info()
        st.report_fail("msg",
                       "Traffic is not scheduled as per strict priority")
    st.report_pass('test_case_passed')
Esempio n. 18
0
def cos_run_config():
    for queue in range(0, 8):
        if not sconf_obj.verify_running_config(vars.D1, "TC_TO_QUEUE_MAP",
                                               data.cos_name, queue, queue):
            st.log("Queue {} mapping not found".format(queue))
            st.report_fail("queue_map_not_found", queue)