Method: Cisco::SnmpCommunity#initialize
- Defined in:
- lib/cisco_node_utils/snmpcommunity.rb
#initialize(name, group, instantiate = true) ⇒ SnmpCommunity
Returns a new instance of SnmpCommunity.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cisco_node_utils/snmpcommunity.rb', line 24 def initialize(name, group, instantiate=true) fail TypeError unless name.is_a?(String) fail TypeError unless group.is_a?(String) @name = name return unless instantiate if platform == :nexus config_set('snmp_community', 'community', state: '', name: @name, group: group) else config_set('snmp_community', 'community', state: '', name: @name) # create the mapping for group config_set('snmp_community', 'group_simple', state: '', group: group) config_set('snmp_community', 'group_community_mapping', name: @name, group: group) # rubocop:disable Metrics/LineLength end end |