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', [
            ""
        ])
예제 #2
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)
예제 #3
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)
예제 #4
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', [""])
예제 #5
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)
    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)
예제 #7
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_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)
예제 #11
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#")
예제 #12
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#")
예제 #13
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#")
예제 #14
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#")