コード例 #1
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)
コード例 #2
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)
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
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", [
            ""
        ])
コード例 #6
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", [
            ""
        ])
コード例 #7
0
    def test_mtu(self, t):
        enable(t)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        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-1/g1)#")
        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-1/g1)#")
        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-1/g1)#")
        t.write("mtu 5000 lol")
        t.readln("                                  ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("mtu 5000")
        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", [
            "mtu 5000"
        ])

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

        assert_interface_configuration(t, "ethernet 1/g1", [
            ""
        ])
コード例 #8
0
    def test_mtu(self, t):
        enable(t)

        configure(t)
        t.write("interface ethernet 1/g1")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        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-1/g1)#")
        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-1/g1)#")
        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-1/g1)#")
        t.write("mtu 5000 lol")
        t.readln("                                  ^")
        t.readln("% Invalid input detected at '^' marker.")
        t.readln("")
        t.read("my_switch(config-if-1/g1)#")
        t.write("mtu 5000")
        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", [
            "mtu 5000"
        ])

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

        assert_interface_configuration(t, "ethernet 1/g1", [
            ""
        ])
コード例 #9
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")))
コード例 #10
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")))
コード例 #11
0
    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", [
            ''
        ])
コード例 #12
0
    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", [
            ''
        ])
コード例 #13
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", [""])
コード例 #14
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", [
            ""
        ])
コード例 #15
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)
コード例 #16
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)
コード例 #17
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", [
            '',
        ])
コード例 #18
0
ファイル: test_enabled.py プロジェクト: emmurd/fake-switches
    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)
コード例 #19
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", [
            '',
        ])
コード例 #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)