Class: Cisco::SnmpServer

Inherits:
NodeUtil show all
Defined in:
lib/cisco_node_utils/snmpserver.rb

Overview

SnmpServer - node utility class for SNMP server management

Instance Method Summary collapse

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?

Instance Method Details

#aaa_user_cache_timeoutObject


22
23
24
# File 'lib/cisco_node_utils/snmpserver.rb', line 22

def aaa_user_cache_timeout
  config_get('snmp_server', 'aaa_user_cache_timeout')
end

#aaa_user_cache_timeout=(timeout) ⇒ Object


26
27
28
# File 'lib/cisco_node_utils/snmpserver.rb', line 26

def aaa_user_cache_timeout=(timeout)
  config_set('snmp_server', 'aaa_user_cache_timeout', '', timeout)
end

#contactObject


52
53
54
55
# File 'lib/cisco_node_utils/snmpserver.rb', line 52

def contact
  match = config_get('snmp_server', 'contact')
  match.nil? ? default_contact : match
end

#contact=(contact) ⇒ Object


57
58
59
60
61
62
63
64
# File 'lib/cisco_node_utils/snmpserver.rb', line 57

def contact=(contact)
  fail TypeError unless contact.is_a?(String)
  if contact.empty?
    config_set('snmp_server', 'contact', state: 'no', contact: '')
  else
    config_set('snmp_server', 'contact', state: '', contact: contact)
  end
end

#default_aaa_user_cache_timeoutObject


30
31
32
# File 'lib/cisco_node_utils/snmpserver.rb', line 30

def default_aaa_user_cache_timeout
  config_get_default('snmp_server', 'aaa_user_cache_timeout')
end

#default_contactObject


66
67
68
# File 'lib/cisco_node_utils/snmpserver.rb', line 66

def default_contact
  config_get_default('snmp_server', 'contact')
end

#default_global_enforce_privObject


99
100
101
# File 'lib/cisco_node_utils/snmpserver.rb', line 99

def default_global_enforce_priv
  config_get_default('snmp_server', 'global_enforce_priv')
end

#default_locationObject


48
49
50
# File 'lib/cisco_node_utils/snmpserver.rb', line 48

def default_location
  config_get_default('snmp_server', 'location')
end

#default_packet_sizeObject


83
84
85
# File 'lib/cisco_node_utils/snmpserver.rb', line 83

def default_packet_size
  config_get_default('snmp_server', 'packet_size')
end

#default_protocolObject


112
113
114
# File 'lib/cisco_node_utils/snmpserver.rb', line 112

def default_protocol
  config_get_default('snmp_server', 'protocol')
end

#default_tcp_session_authObject


128
129
130
# File 'lib/cisco_node_utils/snmpserver.rb', line 128

def default_tcp_session_auth
  config_get_default('snmp_server', 'tcp_session_auth')
end

#global_enforce_priv=(enforce) ⇒ Object


91
92
93
94
95
96
97
# File 'lib/cisco_node_utils/snmpserver.rb', line 91

def global_enforce_priv=(enforce)
  if enforce
    config_set('snmp_server', 'global_enforce_priv', '')
  else
    config_set('snmp_server', 'global_enforce_priv', 'no')
  end
end

#global_enforce_priv?Boolean


87
88
89
# File 'lib/cisco_node_utils/snmpserver.rb', line 87

def global_enforce_priv?
  config_get('snmp_server', 'global_enforce_priv')
end

#locationObject


34
35
36
37
# File 'lib/cisco_node_utils/snmpserver.rb', line 34

def location
  match = config_get('snmp_server', 'location')
  match.nil? ? default_location : match
end

#location=(location) ⇒ Object


39
40
41
42
43
44
45
46
# File 'lib/cisco_node_utils/snmpserver.rb', line 39

def location=(location)
  fail TypeError unless location.is_a?(String)
  if location.empty?
    config_set('snmp_server', 'location', state: 'no', location: '')
  else
    config_set('snmp_server', 'location', state: '', location: location)
  end
end

#packet_sizeObject


70
71
72
# File 'lib/cisco_node_utils/snmpserver.rb', line 70

def packet_size
  config_get('snmp_server', 'packet_size')
end

#packet_size=(size) ⇒ Object


74
75
76
77
78
79
80
81
# File 'lib/cisco_node_utils/snmpserver.rb', line 74

def packet_size=(size)
  if size == 0
    ps = packet_size
    config_set('snmp_server', 'packet_size', 'no', ps) unless ps == 0
  else
    config_set('snmp_server', 'packet_size', '', size)
  end
end

#protocol=(enable) ⇒ Object


107
108
109
110
# File 'lib/cisco_node_utils/snmpserver.rb', line 107

def protocol=(enable)
  no_cmd = (enable ? '' : 'no')
  config_set('snmp_server', 'protocol', no_cmd)
end

#protocol?Boolean


103
104
105
# File 'lib/cisco_node_utils/snmpserver.rb', line 103

def protocol?
  config_get('snmp_server', 'protocol')
end

#tcp_session_auth=(enable) ⇒ Object


120
121
122
123
124
125
126
# File 'lib/cisco_node_utils/snmpserver.rb', line 120

def tcp_session_auth=(enable)
  if enable
    config_set('snmp_server', 'tcp_session_auth', '', 'auth')
  else
    config_set('snmp_server', 'tcp_session_auth', 'no', '')
  end
end

#tcp_session_auth?Boolean


116
117
118
# File 'lib/cisco_node_utils/snmpserver.rb', line 116

def tcp_session_auth?
  config_get('snmp_server', 'tcp_session_auth')
end