Class: Cisco::SnmpServer
- Inherits:
-
Object
- Object
- Cisco::SnmpServer
- Defined in:
- lib/cisco_node_utils/snmpserver.rb
Constant Summary collapse
- @@node =
Cisco::Node.instance
Instance Method Summary collapse
- #aaa_user_cache_timeout ⇒ Object
- #aaa_user_cache_timeout=(timeout) ⇒ Object
- #contact ⇒ Object
- #contact=(contact) ⇒ Object
- #default_aaa_user_cache_timeout ⇒ Object
- #default_contact ⇒ Object
- #default_global_enforce_priv ⇒ Object
- #default_location ⇒ Object
- #default_packet_size ⇒ Object
- #default_protocol ⇒ Object
- #default_tcp_session_auth ⇒ Object
- #global_enforce_priv=(enforce) ⇒ Object
- #global_enforce_priv? ⇒ Boolean
- #location ⇒ Object
- #location=(location) ⇒ Object
- #packet_size ⇒ Object
- #packet_size=(size) ⇒ Object
- #protocol=(enable) ⇒ Object
- #protocol? ⇒ Boolean
- #tcp_session_auth=(enable) ⇒ Object
- #tcp_session_auth? ⇒ Boolean
Instance Method Details
#aaa_user_cache_timeout ⇒ Object
26 27 28 29 30 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 26 def aaa_user_cache_timeout match = @@node.config_get("snmp_server", "aaa_user_cache_timeout") # regex in yaml returns an array result, use .first to get match match.nil? ? default_aaa_user_cache_timeout : match.first.to_i end |
#aaa_user_cache_timeout=(timeout) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 32 def aaa_user_cache_timeout=(timeout) if timeout == default_aaa_user_cache_timeout @@node.config_set("snmp_server", "aaa_user_cache_timeout", "no", aaa_user_cache_timeout) else @@node.config_set("snmp_server", "aaa_user_cache_timeout", "", timeout) end end |
#contact ⇒ Object
63 64 65 66 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 63 def contact match = @@node.config_get("snmp_server", "contact") match.nil? ? default_contact : match end |
#contact=(contact) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 68 def contact=(contact) raise TypeError unless contact.is_a?(String) if contact.empty? @@node.config_set("snmp_server", "contact", "no", "") else @@node.config_set("snmp_server", "contact", "", contact) end end |
#default_aaa_user_cache_timeout ⇒ Object
41 42 43 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 41 def default_aaa_user_cache_timeout @@node.config_get_default("snmp_server", "aaa_user_cache_timeout") end |
#default_contact ⇒ Object
77 78 79 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 77 def default_contact @@node.config_get_default("snmp_server", "contact") end |
#default_global_enforce_priv ⇒ Object
112 113 114 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 112 def default_global_enforce_priv @@node.config_get_default("snmp_server", "global_enforce_priv") end |
#default_location ⇒ Object
59 60 61 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 59 def default_location @@node.config_get_default("snmp_server", "location") end |
#default_packet_size ⇒ Object
96 97 98 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 96 def default_packet_size @@node.config_get_default("snmp_server", "packet_size") end |
#default_protocol ⇒ Object
129 130 131 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 129 def default_protocol @@node.config_get_default("snmp_server", "protocol") end |
#default_tcp_session_auth ⇒ Object
146 147 148 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 146 def default_tcp_session_auth @@node.config_get_default("snmp_server", "tcp_session_auth") end |
#global_enforce_priv=(enforce) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 104 def global_enforce_priv=(enforce) if enforce @@node.config_set("snmp_server", "global_enforce_priv", "") else @@node.config_set("snmp_server", "global_enforce_priv", "no") end end |
#global_enforce_priv? ⇒ Boolean
100 101 102 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 100 def global_enforce_priv? not @@node.config_get("snmp_server", "global_enforce_priv").nil? end |
#location ⇒ Object
45 46 47 48 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 45 def location match = @@node.config_get("snmp_server", "location") match.nil? ? default_location : match end |
#location=(location) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 50 def location=(location) raise TypeError unless location.is_a?(String) if location.empty? @@node.config_set("snmp_server", "location", "no", "") else @@node.config_set("snmp_server", "location", "", location) end end |
#packet_size ⇒ Object
81 82 83 84 85 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 81 def packet_size match = @@node.config_get("snmp_server", "packet_size") # regex in yaml returns an array result, use .first to get match match.nil? ? default_packet_size : match.first.to_i end |
#packet_size=(size) ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 87 def packet_size=(size) if size == 0 ps = packet_size @@node.config_set("snmp_server", "packet_size", "no", ps) unless ps == 0 else @@node.config_set("snmp_server", "packet_size", "", size) end end |
#protocol=(enable) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 121 def protocol=(enable) if enable @@node.config_set("snmp_server", "protocol", "") else @@node.config_set("snmp_server", "protocol", "no") end end |
#protocol? ⇒ Boolean
116 117 118 119 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 116 def protocol? match = @@node.config_get("snmp_server", "protocol") not match.nil? and match.include?("Enable") end |
#tcp_session_auth=(enable) ⇒ Object
138 139 140 141 142 143 144 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 138 def tcp_session_auth=(enable) if enable @@node.config_set("snmp_server", "tcp_session_auth", "", "auth") else @@node.config_set("snmp_server", "tcp_session_auth", "no", "") end end |
#tcp_session_auth? ⇒ Boolean
133 134 135 136 |
# File 'lib/cisco_node_utils/snmpserver.rb', line 133 def tcp_session_auth? match = @@node.config_get("snmp_server", "tcp_session_auth") not match.nil? and match.include?("Enabled") end |