Ejemplo n.º 1
0
def test_mgmt_cli_modes_show_check_2():
    vars = st.get_testbed_vars()

    st.show(vars.D1, "show platform summary")
    st.cli_show(vars.D1, "show interface counters", "mgmt-user", skip_tmpl=True)
    st.cli_show(vars.D1, "show interface status", "mgmt-config", skip_tmpl=True)
    st.cli_show(vars.D1, "show interface counters", "mgmt-intf-config", interface="Ethernet40", skip_tmpl=True)
    st.cli_show(vars.D1, "do show interface status", "mgmt-intf-config", interface="Ethernet4", skip_tmpl=True)
    st.cli_show(vars.D1, "show ip access-lists", "mgmt-ipv4-acl-config", aclname="MyACL", skip_tmpl=True)

    st.show(vars.D1, "show vlan config")
    st.report_pass("operation_successful")
Ejemplo n.º 2
0
def test_vtysh_prompt_modes_show_check_1():
    vars = st.get_testbed_vars()

    st.show(vars.D1, "show platform summary")

    st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet40")
    st.cli_show(vars.D1, "show ip route")

    st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet4")
    st.cli_show(vars.D1, "do show ip route", skip_tmpl=True)

    st.change_prompt(vars.D1, "vtysh-router-config", router="bgp", instance="1")
    st.cli_show(vars.D1, "show route-map", skip_tmpl=True)

    st.change_prompt(vars.D1, "normal-user")
    st.cli_show(vars.D1, "show ip route")

    st.change_prompt(vars.D1, "vtysh-user")
    st.cli_show(vars.D1, "show ip route")

    st.show(vars.D1, "show vlan config")
    st.report_pass("operation_successful")
Ejemplo n.º 3
0
def test_mgmt_cli_modes_show_check_1():
    vars = st.get_testbed_vars()

    # from sonic to mgmt-cli mode
    st.show(vars.D1, "show ip interfaces")
    st.change_prompt(vars.D1, "mgmt-user")
    st.cli_show(vars.D1, "show interface counters", skip_tmpl=True)

    st.change_prompt(vars.D1, "mgmt-config")
    st.cli_show(vars.D1, "show interface status", skip_tmpl=True)

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40")
    st.cli_show(vars.D1, "show interface counters", skip_tmpl=True)

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.cli_show(vars.D1, "do show interface status", skip_tmpl=True)

    st.change_prompt(vars.D1, "mgmt-ipv4-acl-config", aclname="MyACL")
    st.cli_show(vars.D1, "show ip access-lists", skip_tmpl=True)

    st.show(vars.D1, "show vlan config")
    st.report_pass("operation_successful")
Ejemplo n.º 4
0
def test_vtysh_mgmt_prompt_modes_check_2():
    vars = st.get_testbed_vars()

    st.show(vars.D1, "show platform summary")

    st.change_prompt(vars.D1, "vtysh-user")
    st.cli_show(vars.D1, "show ip route")
    st.change_prompt(vars.D1, "mgmt-user")
    st.cli_show(vars.D1, "show interface counters", skip_tmpl=True)
    st.change_prompt(vars.D1, "vtysh-user")
    st.cli_show(vars.D1, "show ip route")

    st.change_prompt(vars.D1, "normal-user")

    st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet40")
    st.cli_config(vars.D1, "shutdown")
    st.cli_config(vars.D1, "no shutdown")
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.cli_config(vars.D1, "shutdown")
    st.cli_config(vars.D1, "no shutdown")
    st.cli_show(vars.D1, "show interface counters", skip_tmpl=True)
    st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet40")
    st.cli_config(vars.D1, "shutdown")
    st.cli_config(vars.D1, "no shutdown")

    st.change_prompt(vars.D1, "normal-user")

    st.change_prompt(vars.D1, "vtysh-router-config", router="bgp", instance="1")
    st.cli_config(vars.D1, "aggregate-address 1.2.3.4/24")
    st.change_prompt(vars.D1, "mgmt-ipv4-acl-config", aclname="MyACL")
    st.cli_config(vars.D1, "seq 2 permit udp any any")
    st.cli_config(vars.D1, "no seq 2")
    st.cli_show(vars.D1, "show interface counters", skip_tmpl=True)
    st.change_prompt(vars.D1, "vtysh-router-config", router="bgp", instance="1")
    st.cli_config(vars.D1, "aggregate-address 1.2.3.4/24")

    st.show(vars.D1, "show vlan config")
    st.report_pass("operation_successful")
Ejemplo n.º 5
0
def show_config(dut, search_string="", cli_type="klish"):
    '''
    API to show the configured radius parameters
    Author: Chaitanya Vella ([email protected])
    :param dut:
    :return:
    {'globals': [{global_auth_type': 'pap (default)','global_source_ip': '10.25.36.25','global_passkey': 'abcd (default)',
     'global_timeout': '5 (default)'}],
     'servers': [{'auth_type': '', 'passkey': '', 'auth_port': '1815', 'priority': '1', 'timeout': '', 'address': '1.1.1.5'},
      {'auth_type': '', 'passkey': '', 'auth_port': '1812', 'priority': '1', 'timeout': '', 'address': '1.1.1.1'}]}
    '''
    st.log("Showing radius configuration ...")
    result = {"globals": [], "servers": []}
    if cli_type == "klish":
        command = "show radius-server"
        output = st.cli_show(dut, command, "mgmt-user")
        global_out = dict()
        for k, v in output[0].items():
            if "global" in k:
                global_out[k] = v
        if global_out and utils.check_empty_values_in_dict(global_out):
            result["globals"].append(global_out)
        for d in output[1:]:
            server_out = dict()
            for k, v in d.items():
                if not "global" in k:
                    server_out[k] = v
            if server_out and utils.check_empty_values_in_dict(server_out):
                result["servers"].append(server_out)
    elif cli_type == "click":
        command = "show radius | grep -w {}".format(
            search_string) if search_string else "show radius"
        output = st.show(dut, command)
        for d in output:
            global_out = dict()
            server_out = dict()
            for k, v in d.items():
                if "global" in k:
                    global_out[k] = v
                else:
                    server_out[k] = v
            if global_out and not utils.check_empty_values_in_dict(global_out):
                result["globals"].append(global_out)
            if server_out and not utils.check_empty_values_in_dict(server_out):
                result["servers"].append(server_out)
    return result
Ejemplo n.º 6
0
def show(dut, interface_name=None, cli_type="click"):
    """
        API to show storm control configuration
        Author : Chaitanya Vella ([email protected])
        :param dut:
        :param interface_name:
        :param type:
        :param bits_per_sec:
        :return:
    """
    if not interface_name:
        command = "show storm-control" if cli_type != "click" else "show storm-control all"
    else:
        command = "show storm-control interface {}".format(interface_name)
    if cli_type != "click":
        return st.cli_show(dut, command, "mgmt-user")
    else:
        return st.show(dut, command)
Ejemplo n.º 7
0
def test_all_modes_check_1():
    vars = st.get_testbed_vars()

    # from sonic to mgmt-cli mode
    st.show(vars.D1, "show ip interfaces")
    st.change_prompt(vars.D1, "mgmt-user")
    st.cli_show(vars.D1, "show interface status", skip_tmpl=True)

    # from mgmt-cli to sonic mode
    st.change_prompt(vars.D1, "normal-user")

    # from sonic to mgmt-cli interface mode
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")

    # from sonic to mgmt-cli interface mode with different interface
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40")
    st.cli_show(vars.D1, "show interface status", skip_tmpl=True)
    st.cli_show(vars.D1, "show interface status | no-more ", skip_tmpl=True)

    # from mgmt-cli interface to sonic mode
    st.change_prompt(vars.D1, "normal-user")

    # from mgmt-cli interface mode to mgmt-cli acl mode and commands after mode change
    st.change_prompt(vars.D1, "mgmt-ipv4-acl-config", aclname="MyACL")

    # from sonic to mgmt-cli interface mode with different interface
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40")

    # from mgmt-cli Config to various different modes and vice versa
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.show(vars.D1, "show neighbors", type="lldp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.show(vars.D1, "show interfaces status")

    # from mgmt-cli normal mode to various different modes and vice versa
    st.change_prompt(vars.D1, "mgmt-user")
    st.show(vars.D1, "show neighbors", type="lldp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.show(vars.D1, "show interfaces status")

    # from lldp mode to remaining modes and vice versa
    st.show(vars.D1, "show neighbors", type="lldp")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.show(vars.D1, "show neighbors", type="lldp")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.show(vars.D1, "show neighbors", type="lldp")
    st.show(vars.D1, "show interfaces status")

    # from vtysh config mode to remaining modes and vice versa
    st.vtysh_config(vars.D1, "do show ip bgp")
    st.vtysh_show(vars.D1, "show ip route")

    st.vtysh_config(vars.D1, "do show ip bgp")
    st.show(vars.D1, "show interfaces status")

    # from vtysh mode to remaining modes and vice versa
    st.vtysh_show(vars.D1, "show ip bgp")
    st.show(vars.D1, "show interfaces status")

    st.report_pass("operation_successful")