Method: Rbeapi::Api::Switchports#set_mode
- Defined in:
- lib/rbeapi/api/switchports.rb
#set_mode(name, opts = {}) ⇒ Boolean
Configures the switchport mode for the specified interafce. Valid modes are access (default) or trunk
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/rbeapi/api/switchports.rb', line 156 def set_mode(name, opts = {}) value = opts[:value] default = opts[:default] || false cmds = ["interface #{name}"] case default when true cmds << 'default switchport mode' when false cmds << (value.nil? ? 'no switchport mode' : \ "switchport mode #{value}") end configure(cmds) end |