Module: Alaxala
- Defined in:
- lib/netutils/cli/alaxala.rb,
lib/netutils/cli/alaxala/lldp.rb,
lib/netutils/cli/alaxala/macfib.rb,
lib/netutils/cli/alaxala/showarp.rb,
lib/netutils/cli/alaxala/showvrf.rb,
lib/netutils/cli/alaxala/interface.rb,
lib/netutils/cli/alaxala/showroute.rb
Defined Under Namespace
Classes: Interface, LLDP, MACFIB, ShowARP, ShowRoute, ShowVRF
Constant Summary
collapse
- CONFIG_RE =
/\A((?:#configuration list for [^\n]+|#Last modified [^\n]+)\n.*)\n\Z/m
Instance Method Summary
collapse
Instance Method Details
#acl_definition(type, name) ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/netutils/cli/alaxala.rb', line 74
def acl_definition(type, name)
case type
when 'ip'
when 'mac'
"#{type} access-list extended #{name}"
when 'advance' "#{type} access-list #{name}"
else
raise(ArgumentError, "Unsupported ACL type: #{type}")
end
end
|
#acl_type_to_cmd(type) ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/netutils/cli/alaxala.rb', line 86
def acl_type_to_cmd(type)
case type
when 'ip'
when 'mac'
when 'advance' type = 'mac'
else
raise(ArgumentError, "Unsupported ACL type: #{type}")
end
type
end
|
#disable_logging_console ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/netutils/cli/alaxala.rb', line 11
def disable_logging_console
case @product
when /^AX86[0-9]{2}/
configure
cmd('username default_user logging-console event-level 0')
unconfigure
when /^AX22[0-9]{2}/
when /^AX[23][0-9]{2,3}/
for level in 3..9
cmd("set logging console disable E#{level}")
end
end
end
|
#interface_name(sw, name) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/netutils/cli/alaxala.rb', line 28
def interface_name(sw, name)
if name =~ /^Port\s+(.*)$/i
name = $1
elsif name =~ /^[^\s0-9]/
return name
end
numbers = name.delete(' ').split('/')
sw.ports.each do |port|
return port.name.to_s if port.name.numbers == numbers
if sw.product =~ /^AX3[0-9]{3}/ &&
port.name.numbers.size === 3 &&
numbers.size === 2 &&
port.name.numbers.drop(1) == numbers
return port.name.to_s
end
end
nil
end
|
#interface_name_cli(name) ⇒ Object
47
48
49
|
# File 'lib/netutils/cli/alaxala.rb', line 47
def interface_name_cli(name)
name.split(' ')[1]
end
|
#interface_noshutdown(port) ⇒ Object
70
71
72
|
# File 'lib/netutils/cli/alaxala.rb', line 70
def interface_noshutdown(port)
super(interface_name_interface_command(port))
end
|
#interface_shutdown(port) ⇒ Object
66
67
68
|
# File 'lib/netutils/cli/alaxala.rb', line 66
def interface_shutdown(port)
super(interface_name_interface_command(port))
end
|
#show_running_config ⇒ Object
102
103
104
|
# File 'lib/netutils/cli/alaxala.rb', line 102
def show_running_config
return cmd('show running-config')
end
|
#syslog(host, vrf = 1) ⇒ Object
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/netutils/cli/alaxala.rb', line 106
def syslog(host, vrf = 1)
configure
case @product
when /^AX86[0-9]{2}/
cmd("logging syslog-host #{host} vrf #{vrf} no-date-info")
when /^AX(?:25[0-9]{2}|3[0-9]{3})/
cmd("logging host #{host} no-date-info")
when /^AX22[0-9]{2}/
cmd("logging host #{host}")
end
unconfigure
end
|
51
52
53
54
|
# File 'lib/netutils/cli/alaxala.rb', line 51
def unconfigure
cmd('save')
super
end
|