Method: Cisco::Client#get
- Defined in:
- lib/cisco_node_utils/client/client.rb
#get(data_format: :cli, command: nil, context: nil, value: nil, **_kwargs) ⇒ String, ...
Get the given state from the device.
Unlike set() this will not clear the CLI cache; multiple calls with the same parameters may return cached data rather than querying the device repeatedly.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/cisco_node_utils/client/client.rb', line 202 def get(data_format: :cli, command: nil, context: nil, value: nil, **_kwargs) # subclasses will generally want to call Client.munge_to_array() # on context and/or value before calling super() fail Cisco::RequestNotSupported unless self.supports?(data_format) Cisco::Logger.debug("Get state using data format '#{data_format}'") Cisco::Logger.debug(" executing command:\n #{command}") \ unless command.nil? || command.empty? Cisco::Logger.debug(" with context:\n #{context.join("\n ")}") \ unless context.nil? || context.empty? Cisco::Logger.debug(" to get value: #{value}") \ unless value.nil? # to be implemented by subclasses end |