本文整理汇总了Python中tests.dell10g.enable函数的典型用法代码示例。如果您正苦于以下问题:Python enable函数的具体用法?Python enable怎么用?Python enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invalid_command
def test_invalid_command(self, t):
enable(t)
t.write("shizzle")
t.readln(" ^")
t.readln("% Invalid input detected at '^' marker.")
t.readln("")
示例2: test_access_vlan_that_doesnt_exist_prints_a_warning_and_config_is_unchanged
def test_access_vlan_that_doesnt_exist_prints_a_warning_and_config_is_unchanged(self, t):
enable(t)
t.write("configure")
t.readln("")
t.read("my_switch(config)#")
t.write("interface tengigabitethernet 0/0/1")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("switchport access vlan 1200")
t.readln("")
t.readln("VLAN ID not found.")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("exit")
t.readln("")
t.read("my_switch(config)#")
t.write("exit")
t.readln("")
t.read("my_switch#")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [""])
示例3: test_show_vlan_with_ports
def test_show_vlan_with_ports(self, t):
enable(t)
add_vlan(t, 10)
add_vlan(t, 11)
configuring_interface(t, "tengigabitethernet 0/0/1", "switchport mode trunk")
configuring_interface(t, "tengigabitethernet 0/0/2", "switchport mode trunk")
configuring_interface(t, "tengigabitethernet 1/0/2", "switchport mode trunk")
configuring_interface(t, "tengigabitethernet 0/0/1", "switchport trunk allowed vlan 10-11")
configuring_interface(t, "tengigabitethernet 0/0/2", "switchport trunk allowed vlan 10")
configuring_interface(t, "tengigabitethernet 1/0/2", "switchport trunk allowed vlan 11")
t.write("show vlan")
t.readln("")
t.readln("VLAN Name Ports Type")
t.readln("----- --------------- ------------- --------------")
t.readln("1 default Default")
t.readln("10 VLAN10 Te0/0/1-2 Static")
t.readln("11 VLAN11 Te0/0/1, Static")
t.readln(" Te1/0/2 ")
t.readln("")
t.read("my_switch#")
configuring_interface(t, "tengigabitethernet 0/0/1", "no switchport mode")
configuring_interface(t, "tengigabitethernet 0/0/2", "no switchport mode")
configuring_interface(t, "tengigabitethernet 1/0/2", "no switchport mode")
configuring_interface(t, "tengigabitethernet 0/0/1", "switchport trunk allowed vlan remove 10,11")
configuring_interface(t, "tengigabitethernet 0/0/2", "switchport trunk allowed vlan remove 10")
configuring_interface(t, "tengigabitethernet 1/0/2", "switchport trunk allowed vlan remove 11")
configuring(t, do="no vlan 10")
configuring(t, do="no vlan 11")
示例4: test_show_vlan
def test_show_vlan(self, t):
enable(t)
add_vlan(t, 10)
add_vlan(t, 11)
add_vlan(t, 12)
configuring_vlan(t, 17, do="name this-name-is-too-long-buddy-budd")
add_vlan(t, 100)
add_vlan(t, 1000)
t.write("show vlan")
t.readln("")
t.readln("VLAN Name Ports Type")
t.readln("----- --------------- ------------- --------------")
t.readln("1 default Default")
t.readln("10 VLAN10 Static")
t.readln("11 VLAN11 Static")
t.readln("12 VLAN12 Static")
t.readln("17 this-name-is-too-long-buddy-budd Static")
t.readln("100 VLAN100 Static")
t.readln("1000 VLAN1000 Static")
t.readln("")
t.read("my_switch#")
configuring(t, do="no vlan 10")
configuring(t, do="no vlan 11")
configuring(t, do="no vlan 12")
configuring(t, do="no vlan 17")
configuring(t, do="no vlan 100")
configuring(t, do="no vlan 1000")
示例5: test_show_vlan_id
def test_show_vlan_id(self, t):
enable(t)
add_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")
t.readln("----- --------------- ------------- --------------")
t.readln("1000 VLAN1000 Static")
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#")
configuring(t, do="no vlan 1000")
示例6: test_10g_does_not_support_mtu_command_on_interface
def test_10g_does_not_support_mtu_command_on_interface(self, t):
enable(t)
t.write("configure")
t.readln("")
t.read("my_switch(config)#")
t.write("interface tengigabitethernet 0/0/1")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("mtu 5000")
t.readln(" ^")
t.readln("% Invalid input detected at '^' marker.")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("no mtu")
t.readln(" ^")
t.readln("% Invalid input detected at '^' marker.")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("exit")
t.readln("")
t.read("my_switch(config)#")
t.write("exit")
t.readln("")
t.read("my_switch#")
示例7: test_lldp_options_defaults_to_enabled
def test_lldp_options_defaults_to_enabled(self, t):
enable(t)
configuring_interface(t, "tengigabitethernet 0/0/1", do="no lldp transmit")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no lldp receive")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no lldp med")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no lldp med transmit-tlv capabilities")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no lldp med transmit-tlv network-policy")
assert_interface_configuration(
t,
"tengigabitethernet 0/0/1",
[
"no lldp transmit",
"no lldp receive",
"no lldp med",
"no lldp med transmit-tlv capabilities",
"no lldp med transmit-tlv network-policy",
],
)
configuring_interface(t, "tengigabitethernet 0/0/1", do="lldp transmit")
configuring_interface(t, "tengigabitethernet 0/0/1", do="lldp receive")
configuring_interface(t, "tengigabitethernet 0/0/1", do="lldp med")
configuring_interface(t, "tengigabitethernet 0/0/1", do="lldp med transmit-tlv capabilities")
configuring_interface(t, "tengigabitethernet 0/0/1", do="lldp med transmit-tlv network-policy")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [""])
示例8: test_show_running_config_on_empty_ethernet_port
def test_show_running_config_on_empty_ethernet_port(self, t):
enable(t)
t.write("show running-config interface tengigabitethernet 0/0/1")
t.readln("")
t.readln("")
t.read("my_switch#")
示例9: test_lldp_options_defaults_to_enabled
def test_lldp_options_defaults_to_enabled(self, t):
enable(t)
configuring_interface(t, "tengigabitethernet 0/0/1", do='no lldp transmit')
configuring_interface(t, "tengigabitethernet 0/0/1", do='no lldp receive')
configuring_interface(t, "tengigabitethernet 0/0/1", do='no lldp med')
configuring_interface(t, "tengigabitethernet 0/0/1", do='no lldp med transmit-tlv capabilities')
configuring_interface(t, "tengigabitethernet 0/0/1", do='no lldp med transmit-tlv network-policy')
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [
'no lldp transmit',
'no lldp receive',
'no lldp med',
'no lldp med transmit-tlv capabilities',
'no lldp med transmit-tlv network-policy',
])
configuring_interface(t, "tengigabitethernet 0/0/1", do='lldp transmit')
configuring_interface(t, "tengigabitethernet 0/0/1", do='lldp receive')
configuring_interface(t, "tengigabitethernet 0/0/1", do='lldp med')
configuring_interface(t, "tengigabitethernet 0/0/1", do='lldp med transmit-tlv capabilities')
configuring_interface(t, "tengigabitethernet 0/0/1", do='lldp med transmit-tlv network-policy')
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [
'',
])
示例10: test_switchport_mode
def test_switchport_mode(self, t):
enable(t)
add_vlan(t, 1264)
add_vlan(t, 1265)
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
""
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode access")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
""
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport access vlan 1264")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport access vlan 1264"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode access")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport access vlan 1264"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode general")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode general",
"switchport access vlan 1264"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport general pvid 1264")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode general",
"switchport access vlan 1264",
"switchport general pvid 1264"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport access vlan")
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport general allowed vlan add 1265")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode general",
"switchport general pvid 1264",
"switchport general allowed vlan add 1265",
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport general pvid")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport general allowed vlan")
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode trunk")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode trunk"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode access")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
""
])
configuring(t, do="no vlan 1265")
configuring(t, do="no vlan 1264")
示例11: test_show_interfaces_status
def test_show_interfaces_status(self, t):
enable(t)
configuring_interface(t, "tengigabitethernet 0/0/1", do='description "longer name than whats allowed"')
create_bond(t, 43)
t.write("show interfaces status")
t.readln("")
t.readln("Port Description Vlan Duplex Speed Neg Link Flow Ctrl")
t.readln(" State Status")
t.readln("--------- ------------------------- ----- ------ ------- ---- ------ ---------")
t.readln("Te0/0/1 longer name than whats al Full 10000 Auto Up Active")
t.readln("Te0/0/2 Full 10000 Auto Up Active")
t.readln("Te1/0/1 Full 10000 Auto Up Active")
t.readln("Te1/0/2 Full 10000 Auto Up Active")
t.readln("")
t.readln("")
t.readln("Port Description Vlan Link")
t.readln("Channel State")
t.readln("------- ------------------------------ ----- -------")
t.readln("Po43 trnk Up")
t.readln("")
t.read("my_switch#")
configuring_interface(t, "tengigabitethernet 0/0/1", do="no description")
remove_bond(t, 43)
示例12: test_show_running_config_on_ethernet_port_that_does_not_exists
def test_show_running_config_on_ethernet_port_that_does_not_exists(self, t):
enable(t)
t.write("show running-config interface tengigabitethernet 99/99/99")
t.readln("")
t.read("An invalid interface has been used for this function")
t.readln("")
t.read("my_switch#")
示例13: test_switchport_general_pvid
def test_switchport_general_pvid(self, t):
enable(t)
add_vlan(t, 1264)
t.write("configure")
t.readln("")
t.read("my_switch(config)#")
t.write("interface tengigabitethernet 0/0/1")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("switchport mode general")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("switchport general pvid 1500")
t.readln("Could not configure pvid.")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("switchport general pvid 1264")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("exit")
t.readln("")
t.read("my_switch(config)#")
t.write("exit")
t.readln("")
t.read("my_switch#")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode general",
"switchport general pvid 1264"
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport general pvid")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport mode general",
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode access")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"",
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport general pvid 1264")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"switchport general pvid 1264",
])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport general pvid")
assert_interface_configuration(t, 'tengigabitethernet 0/0/1', [
"",
])
configuring(t, do="no vlan 1264")
示例14: test_shutting_down
def test_shutting_down(self, t):
enable(t)
configuring_interface(t, "tengigabitethernet 0/0/1", do="shutdown")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", ["shutdown"])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no shutdown")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [""])
示例15: test_switchport_add_trunk_trunk_vlans_special_cases
def test_switchport_add_trunk_trunk_vlans_special_cases(self, t):
enable(t)
add_vlan(t, 1200)
add_vlan(t, 1201)
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport mode trunk")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", ["switchport mode trunk"])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan add 1200")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", ["switchport mode trunk"])
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan 1200")
assert_interface_configuration(
t, "tengigabitethernet 0/0/1", ["switchport mode trunk", "switchport trunk allowed vlan 1200"]
)
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan add 1201")
assert_interface_configuration(
t, "tengigabitethernet 0/0/1", ["switchport mode trunk", "switchport trunk allowed vlan 1200-1201"]
)
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan add 1202")
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan remove 1203")
configuring_interface(t, "tengigabitethernet 0/0/1", do="switchport trunk allowed vlan remove 1200")
assert_interface_configuration(
t, "tengigabitethernet 0/0/1", ["switchport mode trunk", "switchport trunk allowed vlan 1201-1202"]
)
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport trunk allowed vlan")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", ["switchport mode trunk"])
configuring_interface(t, "tengigabitethernet 0/0/1", do="no switchport mode")
assert_interface_configuration(t, "tengigabitethernet 0/0/1", [""])
t.write("configure")
t.readln("")
t.read("my_switch(config)#")
t.write("interface tengigabitethernet 0/0/1")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("switchport trunk allowed vlan add 1202 1201")
t.readln(" ^")
t.readln("% Invalid input detected at '^' marker.")
t.readln("")
t.read("my_switch(config-if-Te0/0/1)#")
t.write("exit")
t.readln("")
t.read("my_switch(config)#")
t.write("exit")
t.readln("")
t.read("my_switch#")
configuring(t, do="no vlan 1200")
configuring(t, do="no vlan 1201")