Class: Cisco::NtpConfig
- Defined in:
- lib/cisco_node_utils/ntp_config.rb
Overview
NtpConfig - node utility class for NTP Config configuration management
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name) ⇒ NtpConfig
constructor
A new instance of NtpConfig.
- #source_interface ⇒ Object
- #source_interface=(val) ⇒ Object
Methods inherited from NodeUtil
client, #client, config_get, #config_get, #config_get_default, config_get_default, config_set, #config_set, #get, #ios_xr?, #nexus?, #node, node, platform, #platform, supports?, #supports?
Constructor Details
#initialize(name) ⇒ NtpConfig
Returns a new instance of NtpConfig.
26 27 28 29 30 31 32 |
# File 'lib/cisco_node_utils/ntp_config.rb', line 26 def initialize(name) fail TypeError unless name.is_a?(String) fail ArgumentError, "This provider only accepts an id of 'default'" \ unless name.eql?('default') @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/cisco_node_utils/ntp_config.rb', line 24 def name @name end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/cisco_node_utils/ntp_config.rb', line 40 def ==(other) name == other.name end |
#source_interface ⇒ Object
44 45 46 47 48 49 |
# File 'lib/cisco_node_utils/ntp_config.rb', line 44 def source_interface source_interface = config_get('ntp_config', 'source_interface') source_interface = source_interface.downcase \ unless source_interface.nil? source_interface end |
#source_interface=(val) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cisco_node_utils/ntp_config.rb', line 51 def source_interface=(val) if val.nil? && !source_interface.nil? config_set('ntp_config', 'source_interface', state: 'no', source_interface: source_interface) elsif !val.nil? config_set('ntp_config', 'source_interface', state: '', source_interface: val) end end |