Class: Rbeapi::Api::System
Overview
The System class configures the node system services such as hostname and domain name.
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#get ⇒ Hash
Returns the system settings for hostname, iprouting, and banners.
-
#initialize(node) ⇒ System
constructor
A new instance of System.
-
#set_banner(banner_type, opts = {}) ⇒ Boolean
Configures system banners.
-
#set_hostname(opts = {}) ⇒ Boolean
Configures the system hostname value in the running-config.
-
#set_iprouting(opts = {}) ⇒ Boolean
Configures the state of global ip routing.
Methods inherited from Entity
#command_builder, #configure, #configure_interface, #get_block, instance
Constructor Details
#initialize(node) ⇒ System
Returns a new instance of System.
44 45 46 47 |
# File 'lib/rbeapi/api/system.rb', line 44 def initialize(node) super(node) = Regexp.new(/^banner\s+(login|motd)\s?$\n(.*?)$\nEOF$\n/m) end |
Instance Method Details
#get ⇒ Hash
Returns the system settings for hostname, iprouting, and banners.
62 63 64 65 66 67 68 |
# File 'lib/rbeapi/api/system.rb', line 62 def get response = {} response.merge!(parse_hostname(config)) response.merge!(parse_iprouting(config)) response.merge!((config)) response end |
#set_banner(banner_type, opts = {}) ⇒ Boolean
Configures system banners.
178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/rbeapi/api/system.rb', line 178 def (, opts = {}) value = opts[:value] cmd_string = "banner #{banner_type}" if value value += "\n" if value[-1, 1] != "\n" cmd = [{ cmd: cmd_string, input: value }] else cmd = command_builder(cmd_string, opts) end configure(cmd) end |
#set_hostname(opts = {}) ⇒ Boolean
Configures the system hostname value in the running-config.
139 140 141 142 |
# File 'lib/rbeapi/api/system.rb', line 139 def set_hostname(opts = {}) cmd = command_builder('hostname', opts) configure(cmd) end |
#set_iprouting(opts = {}) ⇒ Boolean
Configures the state of global ip routing.
156 157 158 159 |
# File 'lib/rbeapi/api/system.rb', line 156 def set_iprouting(opts = {}) cmd = command_builder('ip routing', opts) configure(cmd) end |