Exemple #1
0
    def test_no_switchport_mode_in_general_mode(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport mode general")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport general pvid 1264")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1264")

        t.readln(
            "Warning: The use of large numbers of VLANs or interfaces may cause significant"
        )
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general pvid 1264",
            "switchport general allowed vlan add 1264",
        ])

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("no switchport mode")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "",
        ])

        unconfigure_vlan(t, 1264)
Exemple #2
0
    def test_show_running_config_on_empty_ethernet_port(self, t):
        enable(t)

        t.write("show running-config interface ethernet 1/g1")
        t.readln("")
        t.readln("")
        t.read("my_switch#")
Exemple #3
0
    def test_invalid_command(self, t):
        enable(t)

        t.write("shizzle")
        t.readln("          ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
Exemple #4
0
    def test_show_version(self, t):
        enable(t)

        t.write("show version")

        t.readln("")
        t.readln("Image Descriptions")
        t.readln("")
        t.readln(" image1 : default image")
        t.readln(" image2 :")
        t.readln("")
        t.readln("")
        t.readln(" Images currently available on Flash")
        t.readln("")
        t.readln(
            "--------------------------------------------------------------------"
        )
        t.readln(
            " unit      image1      image2     current-active        next-active"
        )
        t.readln(
            "--------------------------------------------------------------------"
        )
        t.readln("")
        t.readln(
            "    1     3.3.7.3     3.3.7.3             image1             image1"
        )
        t.readln(
            "    2     3.3.7.3    3.3.13.1             image1             image1"
        )
        t.readln("")

        t.read("my_switch#")
    def test_access_vlan_that_doesnt_exist_prints_a_warning_and_config_is_unchanged(self, t):
        enable(t)
        configure(t)

        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport access vlan 1200")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("VLAN ID not found.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            ""
        ])
Exemple #6
0
    def test_lldp_options_defaults_to_enabled(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do='no lldp transmit')
        configuring_interface(t, "ethernet 1/g1", do='no lldp receive')
        configuring_interface(t,
                              "ethernet 1/g1",
                              do='no lldp med transmit-tlv capabilities')
        configuring_interface(t,
                              "ethernet 1/g1",
                              do='no lldp med transmit-tlv network-policy')

        assert_interface_configuration(t, "ethernet 1/g1", [
            'no lldp transmit',
            'no lldp receive',
            'no lldp med transmit-tlv capabilities',
            'no lldp med transmit-tlv network-policy',
        ])

        configuring_interface(t, "ethernet 1/g1", do='lldp transmit')
        configuring_interface(t, "ethernet 1/g1", do='lldp receive')
        configuring_interface(t,
                              "ethernet 1/g1",
                              do='lldp med transmit-tlv capabilities')
        configuring_interface(t,
                              "ethernet 1/g1",
                              do='lldp med transmit-tlv network-policy')

        assert_interface_configuration(t, "ethernet 1/g1", [
            '',
        ])
    def test_unconfiguring_a_vlan_failing(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("vlan database")
        t.readln("")
        t.read("my_switch(config-vlan)#")

        t.write("no vlan 3899")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("These VLANs do not exist:  3899.")
        t.readln("")

        t.read("my_switch(config-vlan)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #8
0
    def test_editing_vlan(self, t):
        enable(t)
        configure(t)

        t.write("interface vlan 1260")
        t.readln("VLAN ID not found.")
        t.readln("")

        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        configuring_vlan(t, 1260)

        configure(t)
        t.write("interface vlan 1260")
        t.readln("")
        t.read("my_switch(config-if-vlan1260)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        unconfigure_vlan(t, 1260)
Exemple #9
0
    def test_invalid_command(self, t):
        enable(t)

        t.write("shizzle")
        t.readln("          ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
Exemple #10
0
    def test_show_running_config_on_empty_ethernet_port(self, t):
        enable(t)

        t.write("show running-config interface ethernet 1/g1")
        t.readln("")
        t.readln("")
        t.read("my_switch#")
    def test_unconfiguring_a_vlan_failing(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("vlan database")
        t.readln("")
        t.read("my_switch(config-vlan)#")

        t.write("no vlan 3899")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("These VLANs do not exist:  3899.")
        t.readln("")

        t.read("my_switch(config-vlan)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")
    def test_editing_vlan(self, t):
        enable(t)
        configure(t)

        t.write("interface vlan 1260")
        t.readln("VLAN ID not found.")
        t.readln("")

        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        configuring_vlan(t, 1260)

        configure(t)
        t.write("interface vlan 1260")
        t.readln("")
        t.read("my_switch(config-if-vlan1260)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        unconfigure_vlan(t, 1260)
Exemple #13
0
    def test_show_vlan_id(self, t):
        enable(t)

        configuring_vlan(t, 1000)

        t.write("show vlan id 500")
        t.readln("")
        t.readln("ERROR: This VLAN does not exist.")
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id 1000")
        t.readln("")
        t.readln("VLAN       Name                         Ports          Type      Authorization")
        t.readln("-----  ---------------                  -------------  -----     -------------")
        t.readln("1000                                                   Static    Required     ")
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id bleh")
        t.readln("                     ^")
        t.readln("Invalid input. Please specify an integer in the range 1 to 4093.")
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id")
        t.readln("")
        t.readln("Command not found / Incomplete command. Use ? to list commands.")
        t.readln("")
        t.read("my_switch#")

        unconfigure_vlan(t, 1000)
Exemple #14
0
    def test_access_vlan_that_doesnt_exist_prints_a_warning_and_config_is_unchanged(
            self, t):
        enable(t)
        configure(t)

        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport access vlan 1200")
        t.readln(
            "Warning: The use of large numbers of VLANs or interfaces may cause significant"
        )
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("VLAN ID not found.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [""])
    def test_no_switchport_mode_in_general_mode(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport mode general")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport general pvid 1264")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1264")

        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general pvid 1264",
            "switchport general allowed vlan add 1264",
        ])

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("no switchport mode")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "",
        ])

        unconfigure_vlan(t, 1264)
    def test_show_interfaces_status(self, t):
        enable(t)

        create_bond(t, 1)
        create_bond(t, 2)
        create_bond(t, 3)
        create_bond(t, 4)
        create_bond(t, 5)
        create_bond(t, 6)
        create_bond(t, 7)
        create_bond(t, 8)
        create_bond(t, 9)
        create_bond(t, 10)

        t.write("show interfaces status")
        t.readln("")
        t.readln("Port   Type                            Duplex  Speed    Neg  Link  Flow Control")
        t.readln("                                                             State Status")
        t.readln("-----  ------------------------------  ------  -------  ---- --------- ------------")
        t.readln("1/g1   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("1/g2   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("1/xg1  10G - Level                     Full    Unknown  Auto Down      Inactive")
        t.readln("2/g1   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("2/g2   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("2/xg1  10G - Level                     Full    Unknown  Auto Down      Inactive")
        t.readln("")
        t.readln("")
        t.readln("Ch   Type                            Link")
        t.readln("                                     State")
        t.readln("---  ------------------------------  -----")
        t.readln("ch1  Link Aggregate                  Down")
        t.readln("ch2  Link Aggregate                  Down")
        t.readln("ch3  Link Aggregate                  Down")
        t.readln("ch4  Link Aggregate                  Down")
        t.readln("ch5  Link Aggregate                  Down")
        t.readln("ch6  Link Aggregate                  Down")
        t.readln("ch7  Link Aggregate                  Down")
        t.readln("ch8  Link Aggregate                  Down")
        t.read("--More-- or (q)uit")
        t.write_raw("m")
        t.readln("")
        t.readln("ch9  Link Aggregate                  Down")
        t.readln("ch10 Link Aggregate                  Down")
        t.readln("")
        t.readln("Flow Control:Enabled")
        t.readln("")
        t.read("my_switch#")

        remove_bond(t, 1)
        remove_bond(t, 2)
        remove_bond(t, 3)
        remove_bond(t, 4)
        remove_bond(t, 5)
        remove_bond(t, 6)
        remove_bond(t, 7)
        remove_bond(t, 8)
        remove_bond(t, 9)
        remove_bond(t, 10)
    def test_show_interfaces_status(self, t):
        enable(t)

        create_bond(t, 1)
        create_bond(t, 2)
        create_bond(t, 3)
        create_bond(t, 4)
        create_bond(t, 5)
        create_bond(t, 6)
        create_bond(t, 7)
        create_bond(t, 8)
        create_bond(t, 9)
        create_bond(t, 10)

        t.write("show interfaces status")
        t.readln("")
        t.readln("Port   Type                            Duplex  Speed    Neg  Link  Flow Control")
        t.readln("                                                             State Status")
        t.readln("-----  ------------------------------  ------  -------  ---- --------- ------------")
        t.readln("1/g1   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("1/g2   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("1/xg1  10G - Level                     Full    Unknown  Auto Down      Inactive")
        t.readln("2/g1   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("2/g2   Gigabit - Level                 Full    Unknown  Auto Down      Inactive")
        t.readln("2/xg1  10G - Level                     Full    Unknown  Auto Down      Inactive")
        t.readln("")
        t.readln("")
        t.readln("Ch   Type                            Link")
        t.readln("                                     State")
        t.readln("---  ------------------------------  -----")
        t.readln("ch1  Link Aggregate                  Down")
        t.readln("ch2  Link Aggregate                  Down")
        t.readln("ch3  Link Aggregate                  Down")
        t.readln("ch4  Link Aggregate                  Down")
        t.readln("ch5  Link Aggregate                  Down")
        t.readln("ch6  Link Aggregate                  Down")
        t.readln("ch7  Link Aggregate                  Down")
        t.readln("ch8  Link Aggregate                  Down")
        t.read("--More-- or (q)uit")
        t.write_raw("m")
        t.readln("")
        t.readln("ch9  Link Aggregate                  Down")
        t.readln("ch10 Link Aggregate                  Down")
        t.readln("")
        t.readln("Flow Control:Enabled")
        t.readln("")
        t.read("my_switch#")

        remove_bond(t, 1)
        remove_bond(t, 2)
        remove_bond(t, 3)
        remove_bond(t, 4)
        remove_bond(t, 5)
        remove_bond(t, 6)
        remove_bond(t, 7)
        remove_bond(t, 8)
        remove_bond(t, 9)
        remove_bond(t, 10)
Exemple #18
0
    def test_shutting_down(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do="shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", ["shutdown"])

        configuring_interface(t, "ethernet 1/g1", do="no shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", [""])
Exemple #19
0
    def test_show_running_config_on_ethernet_port_that_does_not_exists(self, t):
        enable(t)

        t.write("show running-config interface ethernet 4/g8")
        t.readln("")
        t.read("ERROR: Invalid input!")
        t.readln("")
        t.readln("")
        t.read("my_switch#")
Exemple #20
0
    def test_switchport_mode(self, t):
        enable(t)

        configuring_vlan(t, 1264)
        configuring_vlan(t, 1265)

        assert_interface_configuration(t, 'ethernet 1/g1', [""])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        assert_interface_configuration(t, 'ethernet 1/g1', [""])

        configuring_a_vlan_on_interface(t,
                                        "ethernet 1/g1",
                                        do="switchport access vlan 1264")
        assert_interface_configuration(t, 'ethernet 1/g1',
                                       ["switchport access vlan 1264"])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        assert_interface_configuration(t, 'ethernet 1/g1',
                                       ["switchport access vlan 1264"])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode general")
        assert_interface_configuration(t, 'ethernet 1/g1',
                                       ["switchport mode general"])

        configuring_interface(t,
                              "ethernet 1/g1",
                              do="switchport general pvid 1264")
        assert_interface_configuration(
            t, 'ethernet 1/g1',
            ["switchport mode general", "switchport general pvid 1264"])

        configuring_a_vlan_on_interface(
            t, "ethernet 1/g1", do="switchport general allowed vlan add 1265")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general pvid 1264",
            "switchport general allowed vlan add 1265",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode trunk")
        assert_interface_configuration(t, 'ethernet 1/g1',
                                       ["switchport mode trunk"])

        configuring_a_vlan_on_interface(
            t, "ethernet 1/g1", do="switchport trunk allowed vlan add 1265")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode trunk",
            "switchport trunk allowed vlan add 1265",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        assert_interface_configuration(t, 'ethernet 1/g1', [""])

        unconfigure_vlan(t, 1265)
        unconfigure_vlan(t, 1264)
Exemple #21
0
    def test_entering_configure_mode(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #22
0
    def test_entering_configure_mode(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #23
0
 def test_show_running_config_displays_header(self, t):
     enable(t)
     assert_running_config_contains_in_order(t, [
         '!Current Configuration:',
         '!System Description "PowerConnect 6224P, 3.3.7.3, VxWorks 6.5"',
         '!System Software Version 3.3.7.3',
         '!Cut-through mode is configured as disabled',
         '!',
         'configure',
     ])
Exemple #24
0
    def test_show_running_config_on_ethernet_port_that_does_not_exists(
            self, t):
        enable(t)

        t.write("show running-config interface ethernet 4/g8")
        t.readln("")
        t.read("ERROR: Invalid input!")
        t.readln("")
        t.readln("")
        t.read("my_switch#")
Exemple #25
0
 def test_show_running_config_displays_header(self, t):
     enable(t)
     assert_running_config_contains_in_order(t, [
         '!Current Configuration:',
         '!System Description "PowerConnect 6224P, 3.3.7.3, VxWorks 6.5"',
         '!System Software Version 3.3.7.3',
         '!Cut-through mode is configured as disabled',
         '!',
         'configure',
     ])
Exemple #26
0
    def test_switchport_general_pvid(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1264")
        t.readln("")
        t.readln("Port is not general port.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode general")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1500")
        t.readln("Could not configure pvid.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1264")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(
            t, 'ethernet 1/g1',
            ["switchport mode general", "switchport general pvid 1264"])

        configuring_interface(t,
                              "ethernet 1/g1",
                              do="no switchport general pvid")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "",
        ])

        unconfigure_vlan(t, 1264)
    def test_switchport_general_pvid(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1264")
        t.readln("")
        t.readln("Port is not general port.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode general")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1500")
        t.readln("Could not configure pvid.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general pvid 1264")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general pvid 1264"
        ])

        configuring_interface(t, "ethernet 1/g1", do="no switchport general pvid")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "",
        ])

        unconfigure_vlan(t, 1264)
Exemple #28
0
    def test_configuring_a_vlan(self, t):
        enable(t)

        configuring_vlan(t, 1234)

        assert_running_config_contains_in_order(
            t, ["vlan database", "vlan 1,1234", "exit"])

        unconfigure_vlan(t, 1234)

        assert_running_config_contains_in_order(
            t, ["vlan database", "vlan 1", "exit"])
    def test_switchport_add_remove_general_trunk_vlans(self, t):
        enable(t)

        configuring_vlan(t, 1200)
        configuring_vlan(t, 1201)
        configuring_vlan(t, 1202)
        configuring_vlan(t, 1203)
        configuring_vlan(t, 1205)

        configuring_interface(t, "ethernet 1/g1", do="switchport mode general")
        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1200")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1200,1201")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1201-1203,1205")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1203,1205",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1202")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201,1203,1205",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1203,1205")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1200-1203")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")

        unconfigure_vlan(t, 1200)
        unconfigure_vlan(t, 1201)
        unconfigure_vlan(t, 1202)
        unconfigure_vlan(t, 1203)
        unconfigure_vlan(t, 1205)
    def test_switchport_add_remove_general_trunk_vlans(self, t):
        enable(t)

        configuring_vlan(t, 1200)
        configuring_vlan(t, 1201)
        configuring_vlan(t, 1202)
        configuring_vlan(t, 1203)
        configuring_vlan(t, 1205)

        configuring_interface(t, "ethernet 1/g1", do="switchport mode general")
        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1200")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1200,1201")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan add 1201-1203,1205")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1203,1205",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1202")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201,1203,1205",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1203,1205")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
            "switchport general allowed vlan add 1200-1201",
        ])

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport general allowed vlan remove 1200-1203")
        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport mode general",
        ])

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")

        unconfigure_vlan(t, 1200)
        unconfigure_vlan(t, 1201)
        unconfigure_vlan(t, 1202)
        unconfigure_vlan(t, 1203)
        unconfigure_vlan(t, 1205)
Exemple #31
0
    def test_access_vlan(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport access vlan 1264")
        t.readln(
            "Warning: The use of large numbers of VLANs or interfaces may cause significant"
        )
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport access vlan 1264",
        ])

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("no switchport access vlan")
        t.readln(
            "Warning: The use of large numbers of VLANs or interfaces may cause significant"
        )
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [""])

        unconfigure_vlan(t, 1264)
    def test_shutting_down(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do="shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", [
            "shutdown"
        ])

        configuring_interface(t, "ethernet 1/g1", do="no shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", [
            ""
        ])
Exemple #33
0
    def test_show_vlan_id_with_ports(self, t):
        enable(t)

        configuring_vlan(t, 1000)
        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport access vlan 1000")

        t.write("show vlan id 1000")
        t.readln("")
        t.readln("VLAN       Name                         Ports          Type      Authorization")
        t.readln("-----  ---------------                  -------------  -----     -------------")
        t.readln("1000                                    1/g1           Static    Required     ")
        t.readln("")
        t.read("my_switch#")

        configuring_interface(t, "ethernet 1/g1", do="switchport mode trunk")
        t.write("show vlan id 1000")
        t.readln("")
        t.readln("VLAN       Name                         Ports          Type      Authorization")
        t.readln("-----  ---------------                  -------------  -----     -------------")
        t.readln("1000                                                   Static    Required     ")
        t.readln("")
        t.read("my_switch#")

        configuring_a_vlan_on_interface(t, "ethernet 1/g1", do="switchport trunk allowed vlan add 1000")
        configuring_interface(t, "ethernet 1/g2", do="switchport mode trunk")
        configuring_a_vlan_on_interface(t, "ethernet 1/g2", do="switchport trunk allowed vlan add 1000")
        t.write("show vlan id 1000")
        t.readln("")
        t.readln("VLAN       Name                         Ports          Type      Authorization")
        t.readln("-----  ---------------                  -------------  -----     -------------")
        t.readln("1000                                    1/g1-1/g2      Static    Required     ")
        t.readln("")
        t.read("my_switch#")

        configuring_interface(t, "ethernet 1/xg1", do="switchport mode trunk")
        configuring_a_vlan_on_interface(t, "ethernet 1/xg1", do="switchport trunk allowed vlan add 1000")
        t.write("show vlan id 1000")
        t.readln("")
        t.readln("VLAN       Name                         Ports          Type      Authorization")
        t.readln("-----  ---------------                  -------------  -----     -------------")
        t.readln("1000                                    1/g1-1/g2,     Static    Required     ")
        t.readln("                                        1/xg1                                 ")
        t.readln("")
        t.read("my_switch#")

        configuring_interface(t, "ethernet 1/g1", do="switchport mode access")
        configuring_interface(t, "ethernet 1/g2", do="switchport mode access")
        configuring_interface(t, "ethernet 1/xg1", do="switchport mode access")

        unconfigure_vlan(t, 1000)
    def test_access_vlan(self, t):
        enable(t)

        configuring_vlan(t, 1264)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("switchport access vlan 1264")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            "switchport access vlan 1264",
        ])

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("no switchport access vlan")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, 'ethernet 1/g1', [
            ""
        ])

        unconfigure_vlan(t, 1264)
    def test_mtu_on_bond(self, t):
        enable(t)

        create_bond(t, 1)

        configure(t)
        t.write("interface port-channel 1")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu what")
        t.readln("                            ^")
        t.readln("Invalid input. Please specify an integer in the range 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 1517")
        t.readln("                            ^")
        t.readln("Value is out of range. The valid range is 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 9217")
        t.readln("                            ^")
        t.readln("Value is out of range. The valid range is 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 5000 lol")
        t.readln("                                  ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 5000")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, "port-channel 1", [
            "mtu 5000"
        ])

        configuring_bond(t, "port-channel 1", do="no mtu")

        assert_interface_configuration(t, "port-channel 1", [
            ""
        ])

        remove_bond(t, 1)
    def test_mtu_on_bond(self, t):
        enable(t)

        create_bond(t, 1)

        configure(t)
        t.write("interface port-channel 1")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu what")
        t.readln("                            ^")
        t.readln("Invalid input. Please specify an integer in the range 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 1517")
        t.readln("                            ^")
        t.readln("Value is out of range. The valid range is 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 9217")
        t.readln("                            ^")
        t.readln("Value is out of range. The valid range is 1518 to 9216.")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 5000 lol")
        t.readln("                                  ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")
        t.write("mtu 5000")
        t.readln("")
        t.read("my_switch(config-if-ch1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, "port-channel 1", [
            "mtu 5000"
        ])

        configuring_bond(t, "port-channel 1", do="no mtu")

        assert_interface_configuration(t, "port-channel 1", [
            ""
        ])

        remove_bond(t, 1)
Exemple #37
0
    def test_entering_configure_interface_mode(self, t):
        enable(t)
        configure(t)

        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
    def test_entering_configure_interface_mode(self, t):
        enable(t)
        configure(t)

        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #39
0
    def test_entering_vlan_database_mode(self, t):
        enable(t)
        configure(t)

        t.write("vlan database")
        t.readln("")
        t.read("my_switch(config-vlan)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
    def test_entering_vlan_database_mode(self, t):
        enable(t)
        configure(t)

        t.write("vlan database")
        t.readln("")
        t.read("my_switch(config-vlan)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #41
0
    def test_write_memory_any_other_key_aborts(self, t):
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln("Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("p")
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        t.read("my_switch#")
    def test_spanning_tree(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do='spanning-tree disable')
        configuring_interface(t, "ethernet 1/g1", do='spanning-tree portfast')

        assert_interface_configuration(t, "ethernet 1/g1", [
            'spanning-tree disable',
            'spanning-tree portfast',
        ])

        configuring_interface(t, "ethernet 1/g1", do='no spanning-tree disable')
        configuring_interface(t, "ethernet 1/g1", do='no spanning-tree portfast')

        assert_interface_configuration(t, "ethernet 1/g1", [
            ''
        ])
Exemple #43
0
    def test_write_memory_any_other_key_aborts(self, t):
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln(
            "Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("p")
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        t.read("my_switch#")
    def test_spanning_tree(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do='spanning-tree disable')
        configuring_interface(t, "ethernet 1/g1", do='spanning-tree portfast')

        assert_interface_configuration(t, "ethernet 1/g1", [
            'spanning-tree disable',
            'spanning-tree portfast',
        ])

        configuring_interface(t, "ethernet 1/g1", do='no spanning-tree disable')
        configuring_interface(t, "ethernet 1/g1", do='no spanning-tree portfast')

        assert_interface_configuration(t, "ethernet 1/g1", [
            ''
        ])
Exemple #45
0
    def test_show_run_vs_show_run_interface_same_output(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do="shutdown")
        assert_interface_configuration(t, "ethernet 1/g1", ["shutdown"])

        assert_running_config_contains_in_order(t, [
            "interface ethernet 1/g1",
            "shutdown",
            "exit",
            "!",
        ])

        configuring_interface(t, "ethernet 1/g1", do="no shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", [""])

        config = get_running_config(t)
        assert_that(config, is_not(has_item("interface ethernet 1/g1")))
    def test_configuring_a_vlan(self, t):
        enable(t)

        configuring_vlan(t, 1234)

        assert_running_config_contains_in_order(t, [
            "vlan database",
            "vlan 1,1234",
            "exit"
        ])

        unconfigure_vlan(t, 1234)

        assert_running_config_contains_in_order(t, [
            "vlan database",
            "vlan 1",
            "exit"
        ])
Exemple #47
0
    def test_configuring_a_vlan_name(self, t):
        enable(t)

        configuring_vlan(t, 1234)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface vlan 1234")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name")
        t.readln("")
        t.readln(
            "Command not found / Incomplete command. Use ? to list commands.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name one two")
        t.readln("                                     ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name this-name-is-too-long-buddy-buddy")
        t.readln("Name must be 32 characters or less.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name this-name-is-too-long-buddy-budd")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, "vlan 1234", [
            "interface vlan 1234",
            "name \"this-name-is-too-long-buddy-budd\"",
            "exit",
        ])

        unconfigure_vlan(t, 1234)
    def test_configuring_a_vlan_name(self, t):
        enable(t)

        configuring_vlan(t, 1234)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface vlan 1234")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name")
        t.readln("")
        t.readln("Command not found / Incomplete command. Use ? to list commands.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name one two")
        t.readln("                                     ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name this-name-is-too-long-buddy-buddy")
        t.readln("Name must be 32 characters or less.")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("name this-name-is-too-long-buddy-budd")
        t.readln("")
        t.read("my_switch(config-if-vlan1234)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        assert_interface_configuration(t, "vlan 1234", [
            "interface vlan 1234",
            "name \"this-name-is-too-long-buddy-budd\"",
            "exit",
        ])

        unconfigure_vlan(t, 1234)
Exemple #49
0
    def test_description(self, t):
        enable(t)
        configuring_interface(t,
                              "ethernet 1/g1",
                              do='description "hello WORLD"')
        assert_interface_configuration(t, "ethernet 1/g1",
                                       ["description 'hello WORLD'"])

        configuring_interface(t,
                              "ethernet 1/g1",
                              do="description 'We dont know yet'")
        assert_interface_configuration(t, "ethernet 1/g1",
                                       ["description 'We dont know yet'"])

        configuring_interface(t, "ethernet 1/g1", do='description YEEEAH')
        assert_interface_configuration(t, "ethernet 1/g1",
                                       ["description 'YEEEAH'"])

        configuring_interface(t, "ethernet 1/g1", do='no description')
        assert_interface_configuration(t, "ethernet 1/g1", [""])
    def test_write_memory_abort_does_not_call_commit_delay(self, t):
        t.child.timeout = 10
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln("Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("n")
        start_time = time()
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        end_time = time()
        t.read("my_switch#")

        assert_that((end_time - start_time), less_than(COMMIT_DELAY))
    def test_switchport_mode_failure(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode shizzle")
        t.readln("                                         ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")
    def test_description(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do='description "hello WORLD"')
        assert_interface_configuration(t, "ethernet 1/g1", [
            "description 'hello WORLD'"
        ])

        configuring_interface(t, "ethernet 1/g1", do="description 'We dont know yet'")
        assert_interface_configuration(t, "ethernet 1/g1", [
            "description 'We dont know yet'"
        ])

        configuring_interface(t, "ethernet 1/g1", do='description YEEEAH')
        assert_interface_configuration(t, "ethernet 1/g1", [
            "description 'YEEEAH'"
        ])

        configuring_interface(t, "ethernet 1/g1", do='no description')
        assert_interface_configuration(t, "ethernet 1/g1", [
            ""
        ])
Exemple #53
0
    def test_write_memory_abort_does_not_call_commit_delay(self, t):
        t.child.timeout = 10
        enable(t)

        t.write("copy running-config startup-config")

        t.readln("")
        t.readln("This operation may take a few minutes.")
        t.readln(
            "Management interfaces will not be available during this time.")
        t.readln("")
        t.read("Are you sure you want to save? (y/n) ")
        t.write_raw("n")
        start_time = time()
        t.readln("")
        t.readln("")
        t.readln("Configuration Not Saved!")
        end_time = time()
        t.read("my_switch#")

        assert_that((end_time - start_time), less_than(COMMIT_DELAY))
Exemple #54
0
    def test_switchport_mode_failure(self, t):
        enable(t)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode shizzle")
        t.readln("                                         ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")
Exemple #55
0
    def test_show_vlan_id(self, t):
        enable(t)

        configuring_vlan(t, 1000)

        t.write("show vlan id 500")
        t.readln("")
        t.readln("ERROR: This VLAN does not exist.")
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id 1000")
        t.readln("")
        t.readln(
            "VLAN       Name                         Ports          Type      Authorization"
        )
        t.readln(
            "-----  ---------------                  -------------  -----     -------------"
        )
        t.readln(
            "1000                                                   Static    Required     "
        )
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id bleh")
        t.readln("                     ^")
        t.readln(
            "Invalid input. Please specify an integer in the range 1 to 4093.")
        t.readln("")
        t.read("my_switch#")

        t.write("show vlan id")
        t.readln("")
        t.readln(
            "Command not found / Incomplete command. Use ? to list commands.")
        t.readln("")
        t.read("my_switch#")

        unconfigure_vlan(t, 1000)
    def test_show_run_vs_show_run_interface_same_output(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do="shutdown")
        assert_interface_configuration(t, "ethernet 1/g1", [
            "shutdown"
        ])

        assert_running_config_contains_in_order(t, [
            "interface ethernet 1/g1",
            "shutdown",
            "exit",
            "!",
        ])

        configuring_interface(t, "ethernet 1/g1", do="no shutdown")

        assert_interface_configuration(t, "ethernet 1/g1", [
            ""
        ])

        config = get_running_config(t)
        assert_that(config, is_not(has_item("interface ethernet 1/g1")))
    def test_lldp_options_defaults_to_enabled(self, t):
        enable(t)
        configuring_interface(t, "ethernet 1/g1", do='no lldp transmit')
        configuring_interface(t, "ethernet 1/g1", do='no lldp receive')
        configuring_interface(t, "ethernet 1/g1", do='no lldp med transmit-tlv capabilities')
        configuring_interface(t, "ethernet 1/g1", do='no lldp med transmit-tlv network-policy')

        assert_interface_configuration(t, "ethernet 1/g1", [
            'no lldp transmit',
            'no lldp receive',
            'no lldp med transmit-tlv capabilities',
            'no lldp med transmit-tlv network-policy',
        ])

        configuring_interface(t, "ethernet 1/g1", do='lldp transmit')
        configuring_interface(t, "ethernet 1/g1", do='lldp receive')
        configuring_interface(t, "ethernet 1/g1", do='lldp med transmit-tlv capabilities')
        configuring_interface(t, "ethernet 1/g1", do='lldp med transmit-tlv network-policy')

        assert_interface_configuration(t, "ethernet 1/g1", [
            '',
        ])
Exemple #58
0
    def test_show_version(self, t):
        enable(t)

        t.write("show version")

        t.readln("")
        t.readln("Image Descriptions")
        t.readln("")
        t.readln(" image1 : default image")
        t.readln(" image2 :")
        t.readln("")
        t.readln("")
        t.readln(" Images currently available on Flash")
        t.readln("")
        t.readln("--------------------------------------------------------------------")
        t.readln(" unit      image1      image2     current-active        next-active")
        t.readln("--------------------------------------------------------------------")
        t.readln("")
        t.readln("    1     3.3.7.3     3.3.7.3             image1             image1")
        t.readln("    2     3.3.7.3    3.3.13.1             image1             image1")
        t.readln("")

        t.read("my_switch#")
    def test_switchport_add_general_trunk_vlans_special_cases(self, t):
        enable(t)

        configuring_vlan(t, 1201)

        t.write("configure")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1200")
        t.readln("Interface not in General Mode.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode general")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1200")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("          Failure Information")
        t.readln("---------------------------------------")
        t.readln("   VLANs failed to be configured : 1")
        t.readln("---------------------------------------")
        t.readln("   VLAN             Error")
        t.readln("---------------------------------------")
        t.readln("VLAN      1200 ERROR: This VLAN does not exist.")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1200-1202")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("          Failure Information")
        t.readln("---------------------------------------")
        t.readln("   VLANs failed to be configured : 2")
        t.readln("---------------------------------------")
        t.readln("   VLAN             Error")
        t.readln("---------------------------------------")
        t.readln("VLAN      1200 ERROR: This VLAN does not exist.")
        t.readln("VLAN      1202 ERROR: This VLAN does not exist.")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan remove 1200")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("          Failure Information")
        t.readln("---------------------------------------")
        t.readln("   VLANs failed to be configured : 1")
        t.readln("---------------------------------------")
        t.readln("   VLAN             Error")
        t.readln("---------------------------------------")
        t.readln("VLAN      1200 ERROR: This VLAN does not exist.")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan remove 1200-1202")
        t.readln("Warning: The use of large numbers of VLANs or interfaces may cause significant")
        t.readln("delays in applying the configuration.")
        t.readln("")
        t.readln("")
        t.readln("          Failure Information")
        t.readln("---------------------------------------")
        t.readln("   VLANs failed to be configured : 2")
        t.readln("---------------------------------------")
        t.readln("   VLAN             Error")
        t.readln("---------------------------------------")
        t.readln("VLAN      1200 ERROR: This VLAN does not exist.")
        t.readln("VLAN      1202 ERROR: This VLAN does not exist.")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1202-1201")
        t.readln("VLAN range - separate non-consecutive IDs with ',' and no spaces.  Use '-' for range.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport general allowed vlan add 1202 1201")
        t.readln("                                                                 ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("switchport mode access")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")

        t.write("exit")
        t.readln("")
        t.read("my_switch(config)#")
        t.write("exit")
        t.readln("")
        t.read("my_switch#")

        unconfigure_vlan(t, 1201)
Exemple #60
0
 def test_quit_disconnects(self, t):
     enable(t)
     t.write("quit")
     t.read_eof()