snmp 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +179 -0
- data/Rakefile +34 -39
- data/data/ruby/snmp/mibs/ACCOUNTING-CONTROL-MIB.yaml +33 -32
- data/data/ruby/snmp/mibs/ADSL-LINE-EXT-MIB.yaml +57 -56
- data/data/ruby/snmp/mibs/ADSL-LINE-MIB.yaml +224 -223
- data/data/ruby/snmp/mibs/ADSL-TC-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/ADSL2-LINE-MIB.yaml +321 -0
- data/data/ruby/snmp/mibs/ADSL2-LINE-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/AGENTX-MIB.yaml +25 -24
- data/data/ruby/snmp/mibs/AGGREGATE-MIB.yaml +28 -0
- data/data/ruby/snmp/mibs/ALARM-MIB.yaml +77 -0
- data/data/ruby/snmp/mibs/APM-MIB.yaml +75 -74
- data/data/ruby/snmp/mibs/APPC-MIB.yaml +261 -260
- data/data/ruby/snmp/mibs/APPLETALK-MIB.yaml +255 -254
- data/data/ruby/snmp/mibs/APPLICATION-MIB.yaml +138 -137
- data/data/ruby/snmp/mibs/APPN-DLUR-MIB.yaml +30 -29
- data/data/ruby/snmp/mibs/APPN-MIB.yaml +325 -324
- data/data/ruby/snmp/mibs/APPN-TRAP-MIB.yaml +10 -9
- data/data/ruby/snmp/mibs/APS-MIB.yaml +50 -49
- data/data/ruby/snmp/mibs/ARC-MIB.yaml +19 -0
- data/data/ruby/snmp/mibs/ATM-ACCOUNTING-INFORMATION-MIB.yaml +22 -21
- data/data/ruby/snmp/mibs/ATM-MIB.yaml +94 -93
- data/data/ruby/snmp/mibs/ATM-TC-MIB.yaml +12 -11
- data/data/ruby/snmp/mibs/ATM2-MIB.yaml +156 -155
- data/data/ruby/snmp/mibs/BGP4-MIB.yaml +48 -41
- data/data/ruby/snmp/mibs/BLDG-HVAC-MIB.yaml +25 -24
- data/data/ruby/snmp/mibs/BRIDGE-MIB.yaml +50 -44
- data/data/ruby/snmp/mibs/CHARACTER-MIB.yaml +35 -34
- data/data/ruby/snmp/mibs/CIRCUIT-IF-MIB.yaml +13 -12
- data/data/ruby/snmp/mibs/CLNS-MIB.yaml +98 -97
- data/data/ruby/snmp/mibs/COFFEE-POT-MIB.yaml +8 -7
- data/data/ruby/snmp/mibs/COPS-CLIENT-MIB.yaml +38 -37
- data/data/ruby/snmp/mibs/DECNET-PHIV-MIB.yaml +209 -208
- data/data/ruby/snmp/mibs/DIAL-CONTROL-MIB.yaml +72 -71
- data/data/ruby/snmp/mibs/DIFFSERV-CONFIG-MIB.yaml +11 -10
- data/data/ruby/snmp/mibs/DIFFSERV-DSCP-TC.yaml +1 -0
- data/data/ruby/snmp/mibs/DIFFSERV-MIB.yaml +151 -150
- data/data/ruby/snmp/mibs/DIRECTORY-SERVER-MIB.yaml +35 -34
- data/data/ruby/snmp/mibs/DISMAN-EVENT-MIB.yaml +95 -94
- data/data/ruby/snmp/mibs/DISMAN-EXPRESSION-MIB.yaml +37 -36
- data/data/ruby/snmp/mibs/DISMAN-NSLOOKUP-MIB.yaml +15 -14
- data/data/ruby/snmp/mibs/DISMAN-PING-MIB.yaml +43 -42
- data/data/ruby/snmp/mibs/DISMAN-SCHEDULE-MIB.yaml +22 -21
- data/data/ruby/snmp/mibs/DISMAN-SCRIPT-MIB.yaml +64 -63
- data/data/ruby/snmp/mibs/DISMAN-TRACEROUTE-MIB.yaml +59 -58
- data/data/ruby/snmp/mibs/DLSW-MIB.yaml +172 -171
- data/data/ruby/snmp/mibs/DNS-RESOLVER-MIB.yaml +70 -69
- data/data/ruby/snmp/mibs/DNS-SERVER-MIB.yaml +57 -56
- data/data/ruby/snmp/mibs/DOCS-BPI-MIB.yaml +81 -80
- data/data/ruby/snmp/mibs/DOCS-CABLE-DEVICE-MIB.yaml +114 -89
- data/data/ruby/snmp/mibs/DOCS-IETF-BPI2-MIB.yaml +187 -0
- data/data/ruby/snmp/mibs/DOCS-IETF-CABLE-DEVICE-NOTIFICATION-MIB.yaml +39 -0
- data/data/ruby/snmp/mibs/DOCS-IETF-QOS-MIB.yaml +166 -0
- data/data/ruby/snmp/mibs/DOCS-IETF-SUBMGT-MIB.yaml +32 -0
- data/data/ruby/snmp/mibs/DOCS-IF-MIB.yaml +208 -119
- data/data/ruby/snmp/mibs/DOT12-IF-MIB.yaml +21 -20
- data/data/ruby/snmp/mibs/DOT3-EPON-MIB.yaml +101 -0
- data/data/ruby/snmp/mibs/DOT3-OAM-MIB.yaml +82 -0
- data/data/ruby/snmp/mibs/DS0-MIB.yaml +11 -10
- data/data/ruby/snmp/mibs/DS0BUNDLE-MIB.yaml +9 -8
- data/data/ruby/snmp/mibs/DS1-MIB.yaml +102 -98
- data/data/ruby/snmp/mibs/DS3-MIB.yaml +84 -83
- data/data/ruby/snmp/mibs/DSA-MIB.yaml +31 -30
- data/data/ruby/snmp/mibs/DSMON-MIB.yaml +193 -192
- data/data/ruby/snmp/mibs/EBN-MIB.yaml +32 -31
- data/data/ruby/snmp/mibs/EFM-CU-MIB.yaml +113 -0
- data/data/ruby/snmp/mibs/ENTITY-MIB.yaml +41 -38
- data/data/ruby/snmp/mibs/ENTITY-SENSOR-MIB.yaml +8 -7
- data/data/ruby/snmp/mibs/ENTITY-STATE-MIB.yaml +18 -0
- data/data/ruby/snmp/mibs/ENTITY-STATE-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/ETHER-CHIPSET-MIB.yaml +61 -60
- data/data/ruby/snmp/mibs/ETHER-WIS.yaml +16 -15
- data/data/ruby/snmp/mibs/EtherLike-MIB.yaml +43 -42
- data/data/ruby/snmp/mibs/FC-MGMT-MIB.yaml +154 -0
- data/data/ruby/snmp/mibs/FCIP-MGMT-MIB.yaml +68 -0
- data/data/ruby/snmp/mibs/FDDI-SMT73-MIB.yaml +107 -106
- data/data/ruby/snmp/mibs/FIBRE-CHANNEL-FE-MIB.yaml +100 -99
- data/data/ruby/snmp/mibs/FLOW-METER-MIB.yaml +92 -91
- data/data/ruby/snmp/mibs/FR-ATM-PVC-SERVICE-IWF-MIB.yaml +33 -32
- data/data/ruby/snmp/mibs/FR-MFR-MIB.yaml +38 -37
- data/data/ruby/snmp/mibs/FRAME-RELAY-DTE-MIB.yaml +41 -40
- data/data/ruby/snmp/mibs/FRNETSERV-MIB.yaml +92 -91
- data/data/ruby/snmp/mibs/FRSLD-MIB.yaml +66 -65
- data/data/ruby/snmp/mibs/Finisher-MIB.yaml +38 -37
- data/data/ruby/snmp/mibs/GMPLS-LABEL-STD-MIB.yaml +27 -0
- data/data/ruby/snmp/mibs/GMPLS-LSR-STD-MIB.yaml +20 -0
- data/data/ruby/snmp/mibs/GMPLS-TC-STD-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/GMPLS-TE-STD-MIB.yaml +72 -0
- data/data/ruby/snmp/mibs/GSMP-MIB.yaml +75 -74
- data/data/ruby/snmp/mibs/HC-ALARM-MIB.yaml +26 -25
- data/data/ruby/snmp/mibs/HC-PerfHist-TC-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/HC-RMON-MIB.yaml +164 -163
- data/data/ruby/snmp/mibs/HCNUM-TC.yaml +1 -0
- data/data/ruby/snmp/mibs/HDSL2-SHDSL-LINE-MIB.yaml +117 -112
- data/data/ruby/snmp/mibs/HOST-RESOURCES-MIB.yaml +82 -81
- data/data/ruby/snmp/mibs/HOST-RESOURCES-TYPES.yaml +40 -39
- data/data/ruby/snmp/mibs/HPR-IP-MIB.yaml +17 -16
- data/data/ruby/snmp/mibs/HPR-MIB.yaml +64 -63
- data/data/ruby/snmp/mibs/IANA-ITU-ALARM-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/IF-CAP-STACK-MIB.yaml +13 -0
- data/data/ruby/snmp/mibs/IF-INVERTED-STACK-MIB.yaml +6 -5
- data/data/ruby/snmp/mibs/IF-MIB.yaml +57 -56
- data/data/ruby/snmp/mibs/IFCP-MGMT-MIB.yaml +65 -0
- data/data/ruby/snmp/mibs/IGMP-STD-MIB.yaml +24 -23
- data/data/ruby/snmp/mibs/INET-ADDRESS-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/INTEGRATED-SERVICES-GUARANTEED-MIB.yaml +6 -5
- data/data/ruby/snmp/mibs/INTEGRATED-SERVICES-MIB.yaml +29 -28
- data/data/ruby/snmp/mibs/INTERFACETOPN-MIB.yaml +21 -20
- data/data/ruby/snmp/mibs/IP-FORWARD-MIB.yaml +49 -27
- data/data/ruby/snmp/mibs/IP-MIB.yaml +243 -40
- data/data/ruby/snmp/mibs/IPATM-IPMC-MIB.yaml +179 -178
- data/data/ruby/snmp/mibs/IPMCAST-MIB.yaml +105 -0
- data/data/ruby/snmp/mibs/IPMROUTE-STD-MIB.yaml +49 -48
- data/data/ruby/snmp/mibs/IPOA-MIB.yaml +74 -73
- data/data/ruby/snmp/mibs/IPS-AUTH-MIB.yaml +68 -0
- data/data/ruby/snmp/mibs/IPSEC-SPD-MIB.yaml +121 -0
- data/data/ruby/snmp/mibs/IPV6-FLOW-LABEL-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/IPV6-ICMP-MIB.yaml +27 -26
- data/data/ruby/snmp/mibs/IPV6-MIB.yaml +70 -69
- data/data/ruby/snmp/mibs/IPV6-MLD-MIB.yaml +18 -17
- data/data/ruby/snmp/mibs/IPV6-TCP-MIB.yaml +7 -6
- data/data/ruby/snmp/mibs/IPV6-UDP-MIB.yaml +6 -5
- data/data/ruby/snmp/mibs/ISCSI-MIB.yaml +199 -0
- data/data/ruby/snmp/mibs/ISDN-MIB.yaml +57 -56
- data/data/ruby/snmp/mibs/ISIS-MIB.yaml +247 -0
- data/data/ruby/snmp/mibs/ISNS-MIB.yaml +179 -0
- data/data/ruby/snmp/mibs/ITU-ALARM-MIB.yaml +34 -0
- data/data/ruby/snmp/mibs/ITU-ALARM-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/Job-Monitoring-MIB.yaml +26 -27
- data/data/ruby/snmp/mibs/L2TP-MIB.yaml +138 -137
- data/data/ruby/snmp/mibs/LANGTAG-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/LMP-MIB.yaml +202 -0
- data/data/ruby/snmp/mibs/MALLOC-MIB.yaml +66 -65
- data/data/ruby/snmp/mibs/MAU-MIB.yaml +55 -95
- data/data/ruby/snmp/mibs/MIDCOM-MIB.yaml +83 -0
- data/data/ruby/snmp/mibs/MIOX25-MIB.yaml +28 -27
- data/data/ruby/snmp/mibs/MIP-MIB.yaml +157 -156
- data/data/ruby/snmp/mibs/MOBILEIPV6-MIB.yaml +189 -0
- data/data/ruby/snmp/mibs/MPLS-FTN-STD-MIB.yaml +29 -28
- data/data/ruby/snmp/mibs/MPLS-L3VPN-STD-MIB.yaml +88 -0
- data/data/ruby/snmp/mibs/MPLS-LC-ATM-STD-MIB.yaml +19 -0
- data/data/ruby/snmp/mibs/MPLS-LC-FR-STD-MIB.yaml +16 -0
- data/data/ruby/snmp/mibs/MPLS-LDP-ATM-STD-MIB.yaml +23 -22
- data/data/ruby/snmp/mibs/MPLS-LDP-FRAME-RELAY-STD-MIB.yaml +17 -16
- data/data/ruby/snmp/mibs/MPLS-LDP-GENERIC-STD-MIB.yaml +9 -8
- data/data/ruby/snmp/mibs/MPLS-LDP-STD-MIB.yaml +103 -102
- data/data/ruby/snmp/mibs/MPLS-LSR-STD-MIB.yaml +85 -84
- data/data/ruby/snmp/mibs/MPLS-TC-STD-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/MPLS-TE-STD-MIB.yaml +106 -105
- data/data/ruby/snmp/mibs/MSDP-MIB.yaml +71 -0
- data/data/ruby/snmp/mibs/MTA-MIB.yaml +42 -41
- data/data/ruby/snmp/mibs/Modem-MIB.yaml +87 -86
- data/data/ruby/snmp/mibs/NAT-MIB.yaml +116 -0
- data/data/ruby/snmp/mibs/NETWORK-SERVICES-MIB.yaml +18 -17
- data/data/ruby/snmp/mibs/NHRP-MIB.yaml +140 -139
- data/data/ruby/snmp/mibs/NOTIFICATION-LOG-MIB.yaml +37 -36
- data/data/ruby/snmp/mibs/OPT-IF-MIB.yaml +394 -393
- data/data/ruby/snmp/mibs/OSPF-MIB.yaml +192 -123
- data/data/ruby/snmp/mibs/OSPF-TRAP-MIB.yaml +24 -19
- data/data/ruby/snmp/mibs/P-BRIDGE-MIB.yaml +37 -35
- data/data/ruby/snmp/mibs/PARALLEL-MIB.yaml +16 -15
- data/data/ruby/snmp/mibs/PIM-MIB.yaml +47 -46
- data/data/ruby/snmp/mibs/PIM-STD-MIB.yaml +235 -0
- data/data/ruby/snmp/mibs/PINT-MIB.yaml +38 -37
- data/data/ruby/snmp/mibs/PKTC-IETF-MTA-MIB.yaml +81 -0
- data/data/ruby/snmp/mibs/PKTC-IETF-SIG-MIB.yaml +128 -0
- data/data/ruby/snmp/mibs/POLICY-BASED-MANAGEMENT-MIB.yaml +94 -0
- data/data/ruby/snmp/mibs/POWER-ETHERNET-MIB.yaml +27 -26
- data/data/ruby/snmp/mibs/PPP-BRIDGE-NCP-MIB.yaml +16 -15
- data/data/ruby/snmp/mibs/PPP-IP-NCP-MIB.yaml +7 -6
- data/data/ruby/snmp/mibs/PPP-LCP-MIB.yaml +33 -32
- data/data/ruby/snmp/mibs/PPP-SEC-MIB.yaml +13 -12
- data/data/ruby/snmp/mibs/PTOPO-MIB.yaml +29 -28
- data/data/ruby/snmp/mibs/PerfHist-TC-MIB.yaml +1 -0
- data/data/ruby/snmp/mibs/Printer-MIB.yaml +185 -184
- data/data/ruby/snmp/mibs/Q-BRIDGE-MIB.yaml +96 -82
- data/data/ruby/snmp/mibs/RADIUS-ACC-CLIENT-MIB.yaml +34 -16
- data/data/ruby/snmp/mibs/RADIUS-ACC-SERVER-MIB.yaml +40 -24
- data/data/ruby/snmp/mibs/RADIUS-AUTH-CLIENT-MIB.yaml +38 -18
- data/data/ruby/snmp/mibs/RADIUS-AUTH-SERVER-MIB.yaml +40 -23
- data/data/ruby/snmp/mibs/RADIUS-DYNAUTH-CLIENT-MIB.yaml +44 -0
- data/data/ruby/snmp/mibs/RADIUS-DYNAUTH-SERVER-MIB.yaml +40 -0
- data/data/ruby/snmp/mibs/RAQMON-MIB.yaml +90 -0
- data/data/ruby/snmp/mibs/RDBMS-MIB.yaml +69 -68
- data/data/ruby/snmp/mibs/RFC1065-SMI.yaml +4 -5
- data/data/ruby/snmp/mibs/RFC1155-SMI.yaml +4 -5
- data/data/ruby/snmp/mibs/RFC1158-MIB.yaml +174 -173
- data/data/ruby/snmp/mibs/RFC1213-MIB.yaml +173 -172
- data/data/ruby/snmp/mibs/RFC1269-MIB.yaml +20 -19
- data/data/ruby/snmp/mibs/RFC1271-MIB.yaml +185 -184
- data/data/ruby/snmp/mibs/RFC1285-MIB.yaml +85 -84
- data/data/ruby/snmp/mibs/RFC1316-MIB.yaml +30 -29
- data/data/ruby/snmp/mibs/RFC1381-MIB.yaml +40 -39
- data/data/ruby/snmp/mibs/RFC1382-MIB.yaml +149 -148
- data/data/ruby/snmp/mibs/RFC1414-MIB.yaml +4 -3
- data/data/ruby/snmp/mibs/RIPv2-MIB.yaml +25 -24
- data/data/ruby/snmp/mibs/RMON-MIB.yaml +192 -191
- data/data/ruby/snmp/mibs/RMON2-MIB.yaml +253 -252
- data/data/ruby/snmp/mibs/ROHC-MIB.yaml +49 -48
- data/data/ruby/snmp/mibs/ROHC-RTP-MIB.yaml +19 -18
- data/data/ruby/snmp/mibs/ROHC-UNCOMPRESSED-MIB.yaml +6 -5
- data/data/ruby/snmp/mibs/RS-232-MIB.yaml +36 -35
- data/data/ruby/snmp/mibs/RSTP-MIB.yaml +18 -0
- data/data/ruby/snmp/mibs/RSVP-MIB.yaml +137 -136
- data/data/ruby/snmp/mibs/RTP-MIB.yaml +42 -41
- data/data/ruby/snmp/mibs/SCSI-MIB.yaml +160 -0
- data/data/ruby/snmp/mibs/SCTP-MIB.yaml +83 -0
- data/data/ruby/snmp/mibs/SFLOW-MIB.yaml +15 -14
- data/data/ruby/snmp/mibs/SIP-COMMON-MIB.yaml +112 -0
- data/data/ruby/snmp/mibs/SIP-MIB.yaml +56 -55
- data/data/ruby/snmp/mibs/SIP-SERVER-MIB.yaml +52 -0
- data/data/ruby/snmp/mibs/SIP-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/SIP-UA-MIB.yaml +14 -0
- data/data/ruby/snmp/mibs/SLAPM-MIB.yaml +134 -133
- data/data/ruby/snmp/mibs/SMON-MIB.yaml +47 -46
- data/data/ruby/snmp/mibs/SNA-NAU-MIB.yaml +117 -116
- data/data/ruby/snmp/mibs/SNA-SDLC-MIB.yaml +126 -125
- data/data/ruby/snmp/mibs/SNMP-COMMUNITY-MIB.yaml +12 -11
- data/data/ruby/snmp/mibs/SNMP-FRAMEWORK-MIB.yaml +8 -7
- data/data/ruby/snmp/mibs/SNMP-MPD-MIB.yaml +6 -5
- data/data/ruby/snmp/mibs/SNMP-NOTIFICATION-MIB.yaml +16 -15
- data/data/ruby/snmp/mibs/SNMP-PROXY-MIB.yaml +10 -9
- data/data/ruby/snmp/mibs/SNMP-REPEATER-MIB.yaml +120 -119
- data/data/ruby/snmp/mibs/SNMP-TARGET-MIB.yaml +19 -18
- data/data/ruby/snmp/mibs/SNMP-USER-BASED-SM-MIB.yaml +26 -25
- data/data/ruby/snmp/mibs/SNMP-USM-AES-MIB.yaml +4 -0
- data/data/ruby/snmp/mibs/SNMP-USM-DH-OBJECTS-MIB.yaml +10 -9
- data/data/ruby/snmp/mibs/SNMP-VIEW-BASED-ACM-MIB.yaml +26 -25
- data/data/ruby/snmp/mibs/SNMPv2-MIB.yaml +46 -45
- data/data/ruby/snmp/mibs/SNMPv2-SMI.yaml +12 -11
- data/data/ruby/snmp/mibs/SNMPv2-TM.yaml +5 -4
- data/data/ruby/snmp/mibs/SNMPv2-USEC-MIB.yaml +10 -9
- data/data/ruby/snmp/mibs/SONET-MIB.yaml +110 -109
- data/data/ruby/snmp/mibs/SOURCE-ROUTING-MIB.yaml +18 -17
- data/data/ruby/snmp/mibs/SSPM-MIB.yaml +67 -0
- data/data/ruby/snmp/mibs/SYSAPPL-MIB.yaml +65 -64
- data/data/ruby/snmp/mibs/T11-FC-FABRIC-ADDR-MGR-MIB.yaml +63 -0
- data/data/ruby/snmp/mibs/T11-FC-FABRIC-CONFIG-SERVER-MIB.yaml +100 -0
- data/data/ruby/snmp/mibs/T11-FC-FABRIC-LOCK-MIB.yaml +22 -0
- data/data/ruby/snmp/mibs/T11-FC-FSPF-MIB.yaml +70 -0
- data/data/ruby/snmp/mibs/T11-FC-NAME-SERVER-MIB.yaml +56 -0
- data/data/ruby/snmp/mibs/T11-FC-ROUTE-MIB.yaml +27 -0
- data/data/ruby/snmp/mibs/T11-FC-RSCN-MIB.yaml +47 -0
- data/data/ruby/snmp/mibs/T11-FC-VIRTUAL-FABRIC-MIB.yaml +31 -0
- data/data/ruby/snmp/mibs/T11-FC-ZONE-SERVER-MIB.yaml +124 -0
- data/data/ruby/snmp/mibs/T11-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/TCP-ESTATS-MIB.yaml +167 -0
- data/data/ruby/snmp/mibs/TCP-MIB.yaml +37 -18
- data/data/ruby/snmp/mibs/TCPIPX-MIB.yaml +16 -15
- data/data/ruby/snmp/mibs/TE-LINK-STD-MIB.yaml +82 -0
- data/data/ruby/snmp/mibs/TE-MIB.yaml +81 -0
- data/data/ruby/snmp/mibs/TIME-AGGREGATE-MIB.yaml +22 -0
- data/data/ruby/snmp/mibs/TN3270E-MIB.yaml +85 -84
- data/data/ruby/snmp/mibs/TN3270E-RT-MIB.yaml +33 -32
- data/data/ruby/snmp/mibs/TOKEN-RING-RMON-MIB.yaml +159 -158
- data/data/ruby/snmp/mibs/TOKENRING-MIB.yaml +42 -41
- data/data/ruby/snmp/mibs/TOKENRING-STATION-SR-MIB.yaml +8 -7
- data/data/ruby/snmp/mibs/TRANSPORT-ADDRESS-MIB.yaml +13 -12
- data/data/ruby/snmp/mibs/TRIP-MIB.yaml +118 -0
- data/data/ruby/snmp/mibs/TRIP-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/TUNNEL-MIB.yaml +29 -13
- data/data/ruby/snmp/mibs/UDP-MIB.yaml +19 -6
- data/data/ruby/snmp/mibs/UDPLITE-MIB.yaml +26 -0
- data/data/ruby/snmp/mibs/UPS-MIB.yaml +100 -99
- data/data/ruby/snmp/mibs/URI-TC-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/VDSL-LINE-EXT-MCM-MIB.yaml +42 -0
- data/data/ruby/snmp/mibs/VDSL-LINE-EXT-SCM-MIB.yaml +27 -0
- data/data/ruby/snmp/mibs/VDSL-LINE-MIB.yaml +162 -161
- data/data/ruby/snmp/mibs/VPN-TC-STD-MIB.yaml +3 -0
- data/data/ruby/snmp/mibs/VRRP-MIB.yaml +39 -38
- data/data/ruby/snmp/mibs/WWW-MIB.yaml +75 -74
- data/examples/dump.rb +5 -5
- data/examples/iftable.rb +4 -4
- data/examples/link_down.rb +18 -18
- data/examples/log_traps.rb +9 -9
- data/examples/walk.rb +4 -4
- data/lib/snmp/agent.rb +42 -43
- data/lib/snmp/ber.rb +155 -156
- data/lib/snmp/manager.rb +412 -372
- data/lib/snmp/mib.rb +172 -182
- data/lib/snmp/options.rb +64 -0
- data/lib/snmp/pdu.rb +245 -245
- data/lib/snmp/varbind.rb +346 -341
- data/lib/snmp/version.rb +3 -0
- data/test/test_ber.rb +232 -233
- data/test/test_manager.rb +277 -238
- data/test/test_mib.rb +57 -57
- data/test/test_pdu.rb +172 -172
- data/test/test_retry.rb +54 -54
- data/test/test_smi.rb +10 -10
- data/test/test_varbind.rb +342 -331
- data/test/test_walk.rb +150 -150
- metadata +103 -45
- data/README +0 -252
- data/setup.rb +0 -1360
data/test/test_retry.rb
CHANGED
@@ -3,80 +3,80 @@ require 'snmp'
|
|
3
3
|
|
4
4
|
class TimeoutManager < SNMP::Manager
|
5
5
|
attr_accessor :response_count
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(config)
|
8
8
|
super(config)
|
9
9
|
@response_count = 0
|
10
10
|
@raise_on_send = false
|
11
11
|
@raise_on_get = false
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def raise_send_error
|
15
|
-
|
15
|
+
@raise_on_send = true
|
16
16
|
end
|
17
17
|
|
18
18
|
def raise_get_error
|
19
|
-
|
19
|
+
@raise_on_get = true
|
20
20
|
end
|
21
|
-
|
22
|
-
def send_request(request, community, host, port)
|
23
|
-
|
21
|
+
|
22
|
+
def send_request(request, community, host, port)
|
23
|
+
raise RuntimeError if @raise_on_send
|
24
24
|
end
|
25
25
|
|
26
|
-
def get_response(request)
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def get_response(request)
|
27
|
+
@response_count += 1
|
28
|
+
raise RuntimeError if @raise_on_get
|
29
|
+
raise Timeout::Error, "testing retry count"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
class MismatchIdTransport
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
34
|
+
def initialize
|
35
|
+
@data = []
|
36
|
+
end
|
37
|
+
|
38
|
+
def close
|
39
|
+
end
|
40
|
+
|
41
|
+
def send(data, host, port)
|
42
|
+
bad_id_data = data.dup
|
43
|
+
bad_msg = SNMP::Message.decode(data)
|
44
|
+
bad_msg.pdu.request_id -= 3 # corrupt request_id
|
45
|
+
@data << bad_msg.encode # insert corrupted PDU before real data
|
46
|
+
@data << data
|
47
|
+
end
|
48
|
+
|
49
|
+
def recv(max_bytes)
|
50
|
+
raise "receive queue is empty" unless @data.first
|
51
|
+
SNMP::Message.decode(@data.shift).response.encode[0,max_bytes]
|
52
|
+
end
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
class TestRetry < Test::Unit::TestCase
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
class TestRetry < Test::Unit::TestCase
|
57
|
+
def test_retry_count
|
58
|
+
assert_response_count(0, 1, SNMP::RequestTimeout)
|
59
|
+
assert_response_count(1, 2, SNMP::RequestTimeout)
|
60
|
+
assert_response_count(5, 6, SNMP::RequestTimeout)
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
def test_retry_on_error
|
64
|
+
assert_response_count(5, 0, RuntimeError) { |m| m.raise_send_error }
|
65
|
+
old_verbose = $VERBOSE
|
66
|
+
$VERBOSE = nil
|
67
|
+
assert_response_count(5, 6, SNMP::RequestTimeout) { |m| m.raise_get_error }
|
68
|
+
$VERBOSE = old_verbose
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
def assert_response_count(retry_count, response_count, exception)
|
72
|
+
m = TimeoutManager.new( :Retries => retry_count )
|
73
|
+
yield m if block_given?
|
74
|
+
assert_raise(exception) { m.get("1.2.3.4") }
|
75
|
+
assert_equal(response_count, m.response_count)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_drop_mismatched_id
|
79
|
+
m = SNMP::Manager.new(:Transport => MismatchIdTransport.new)
|
80
|
+
m.get("1.2.3.4")
|
81
|
+
end
|
82
82
|
end
|
data/test/test_smi.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
3
|
begin
|
4
|
-
|
4
|
+
require 'smi'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
include SNMP::SMI
|
6
|
+
class TestSmi < Test::Unit::TestCase
|
9
7
|
|
10
|
-
|
11
|
-
name, oid_hash = load_smi_module('test/mibs/IF-MIB')
|
12
|
-
assert_equal("IF-MIB", name)
|
13
|
-
assert_equal("1.3.6.1.2.1.2.2", oid_hash["ifTable"])
|
14
|
-
end
|
8
|
+
include SNMP::SMI
|
15
9
|
|
10
|
+
def test_load
|
11
|
+
name, oid_hash = load_smi_module('test/mibs/IF-MIB')
|
12
|
+
assert_equal("IF-MIB", name)
|
13
|
+
assert_equal("1.3.6.1.2.1.2.2", oid_hash["ifTable"])
|
16
14
|
end
|
15
|
+
|
16
|
+
end
|
17
17
|
rescue LoadError
|
18
|
-
|
18
|
+
# snmp/smi may not always be available because it is a C extention
|
19
19
|
end
|
data/test/test_varbind.rb
CHANGED
@@ -2,341 +2,352 @@ require 'snmp/varbind'
|
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
4
|
class TestVarBind < Test::Unit::TestCase
|
5
|
-
|
6
|
-
include SNMP
|
7
|
-
|
8
|
-
def test_varbind_encode
|
9
|
-
v = VarBind.new([1,3,6,1], OctetString.new("test"))
|
10
|
-
assert_equal("0\v\006\003+\006\001\004\004test", v.encode)
|
11
|
-
assert_not_nil(v.asn1_type)
|
12
|
-
assert_equal("[name=1.3.6.1, value=test (OCTET STRING)]", v.to_s)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_varbind_decode
|
16
|
-
varbind, remainder = VarBind.decode("0\f\006\010+\006\001\002\001\001\001\000\005\000")
|
17
|
-
assert_equal(Null, varbind.value)
|
18
|
-
assert_equal("", remainder)
|
19
|
-
|
20
|
-
varbind, remainder = VarBind.decode("0\f\006\010+\006\001\002\001\001\001\000\005\0000\f\006\010+\006\001\002\001\001\002\000\005\000")
|
21
|
-
assert_equal(Null, varbind.value)
|
22
|
-
assert_equal("0\f\006\010+\006\001\002\001\001\002\000\005\000", remainder)
|
23
|
-
end
|
24
5
|
|
25
|
-
|
26
|
-
vb = VarBind.new("1.2.3.4", OctetString.new("blah"))
|
27
|
-
assert(ObjectId.new("1.2.3.4"), vb.name)
|
28
|
-
assert(ObjectId.new("1.2.3.4"), vb.oid)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_varbind_list_create
|
32
|
-
list = VarBindList.new
|
33
|
-
assert_equal(0, list.length)
|
34
|
-
|
35
|
-
check_varbind_list_create(VarBindList.new(["1.2.3.4.5"]))
|
36
|
-
check_varbind_list_create(VarBindList.new([ObjectId.new("1.2.3.4.5")]))
|
37
|
-
check_varbind_list_create(VarBindList.new([VarBind.new("1.2.3.4.5", Null)]))
|
38
|
-
|
39
|
-
check_varbind_list_create(VarBindList.new(
|
40
|
-
["1.2.3.4.5", "1.2.3.4.6"]), 2)
|
41
|
-
|
42
|
-
check_varbind_list_create(VarBindList.new(
|
43
|
-
[ObjectId.new("1.2.3.4.5"),
|
44
|
-
ObjectId.new("1.2.3.4.6")]
|
45
|
-
), 2)
|
46
|
-
|
47
|
-
check_varbind_list_create(VarBindList.new(
|
48
|
-
[VarBind.new("1.2.3.4.5", Null),
|
49
|
-
VarBind.new("1.2.3.4.6", Integer.new(123)),
|
50
|
-
ObjectId.new("1.2.3.4.7")]
|
51
|
-
), 3)
|
52
|
-
|
53
|
-
list = VarBindList.new([VarBind.new("1.3.6.2", Integer.new(1))])
|
54
|
-
assert_equal(1, list.length)
|
55
|
-
assert_equal("1.3.6.2", list.first.name.to_s)
|
56
|
-
assert_equal(1, list.first.value.to_i)
|
57
|
-
end
|
6
|
+
include SNMP
|
58
7
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
def test_varbind_list_encode
|
66
|
-
list = VarBindList.new
|
67
|
-
assert_equal("0\000", list.encode)
|
68
|
-
assert_not_nil(list.asn1_type)
|
69
|
-
|
70
|
-
list << VarBind.new([1,3,6,1], OctetString.new("test"))
|
71
|
-
assert_equal("0\r0\v\006\003+\006\001\004\004test", list.encode)
|
72
|
-
|
73
|
-
list << VarBind.new([1,3,6,1], OctetString.new("blah"))
|
74
|
-
assert_equal("0\0320\v\006\003+\006\001\004\004test0\v\006\003+\006\001\004\004blah", list.encode)
|
75
|
-
end
|
8
|
+
def test_varbind_encode
|
9
|
+
v = VarBind.new([1,3,6,1], OctetString.new("test"))
|
10
|
+
assert_equal("0\v\006\003+\006\001\004\004test", v.encode)
|
11
|
+
assert_not_nil(v.asn1_type)
|
12
|
+
assert_equal("[name=1.3.6.1, value=test (OCTET STRING)]", v.to_s)
|
13
|
+
end
|
76
14
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
list, remainder = VarBindList.decode("0\0320\v\006\003+\006\001\004\004test0\v\006\003+\006\001\004\004blah")
|
83
|
-
assert_equal(2, list.length)
|
84
|
-
assert_equal("", remainder)
|
85
|
-
|
86
|
-
list, remainder = VarBindList.decode("0\000")
|
87
|
-
assert_equal(0, list.length)
|
88
|
-
assert_equal("", remainder)
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_octet_string
|
92
|
-
string = OctetString.new("test")
|
93
|
-
assert_equal("test", string.to_s)
|
94
|
-
assert_equal("\004\004test", string.encode)
|
95
|
-
assert_not_nil(string.asn1_type)
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_octet_string_equals
|
99
|
-
s1 = OctetString.new("test")
|
100
|
-
s2 = "test"
|
101
|
-
s3 = OctetString.new("test")
|
102
|
-
assert_equal(s1, s2)
|
103
|
-
assert(s1 == s2)
|
104
|
-
assert_not_same(s1, s3)
|
105
|
-
assert_equal(s1, s3)
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_octet_string_to_oid
|
109
|
-
s = OctetString.new("test")
|
110
|
-
assert_equal(ObjectId.new([116, 101, 115, 116]), s.to_oid)
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_object_id
|
114
|
-
id = ObjectId.new([1,3,6,1])
|
115
|
-
assert_equal("1.3.6.1", id.to_s)
|
116
|
-
assert_equal("\006\003+\006\001", id.encode)
|
117
|
-
assert_not_nil(id.asn1_type)
|
118
|
-
assert_equal("1.3.6.1", id.to_varbind.name.to_s)
|
119
|
-
|
120
|
-
assert_raise(ArgumentError) {
|
121
|
-
ObjectId.new("xyzzy")
|
122
|
-
}
|
123
|
-
|
124
|
-
assert_equal("", ObjectId.new.to_s)
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_object_id_create
|
128
|
-
assert_equal("1.3.6.1", ObjectId.new("1.3.6.1").to_s)
|
129
|
-
assert_equal("1.3.6.1", ObjectId.new([1,3,6,1]).to_s)
|
130
|
-
assert_equal("1.3.6.1", ObjectId.new(ObjectId.new("1.3.6.1")).to_s)
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_object_id_equals
|
134
|
-
id1 = ObjectId.new("1.3.3.4")
|
135
|
-
id2 = ObjectId.new([1,3,3,4])
|
136
|
-
assert_not_same(id1, id2)
|
137
|
-
assert(id1 == id2)
|
138
|
-
assert_equal(id1, id2)
|
139
|
-
end
|
140
|
-
|
141
|
-
def test_object_id_comparable
|
142
|
-
id1 = ObjectId.new("1.3.3.4")
|
143
|
-
id2 = ObjectId.new("1.3.3.4.1")
|
144
|
-
id3 = ObjectId.new("1.3.3.4.5")
|
145
|
-
id4 = ObjectId.new("1.3.3.5")
|
146
|
-
assert(id1 < id2)
|
147
|
-
assert(id2 > id1)
|
148
|
-
assert(id2 < id3)
|
149
|
-
assert(id3 > id2)
|
150
|
-
assert(id3 < id4)
|
151
|
-
assert(id4 > id3)
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_object_id_subtree
|
155
|
-
id1 = ObjectId.new("1.3.3.4")
|
156
|
-
id2 = ObjectId.new("1.3.3.4.1")
|
157
|
-
id3 = ObjectId.new("1.3.3.4.5")
|
158
|
-
id4 = ObjectId.new("1.3.3.5")
|
159
|
-
assert(id2.subtree_of?(id1))
|
160
|
-
assert(id3.subtree_of?(id1))
|
161
|
-
assert(!id3.subtree_of?(id2))
|
162
|
-
assert(!id1.subtree_of?(id2))
|
163
|
-
assert(!id4.subtree_of?(id1))
|
164
|
-
assert(!id4.subtree_of?(id3))
|
165
|
-
assert(id1.subtree_of?("1.3.3.4"))
|
166
|
-
assert(!id4.subtree_of?("1.3.3.4"))
|
167
|
-
end
|
15
|
+
def test_varbind_decode
|
16
|
+
varbind, remainder = VarBind.decode("0\f\006\010+\006\001\002\001\001\001\000\005\000")
|
17
|
+
assert_equal(Null, varbind.value)
|
18
|
+
assert_equal("", remainder)
|
168
19
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
assert(ObjectId.new("1"), id2.index(id1))
|
174
|
-
assert(ObjectId.new("1.2"), id3.index(id1))
|
175
|
-
assert(ObjectId.new("1.2"), id3.index("1.3.3.4"))
|
176
|
-
assert_raise(ArgumentError) { id1.index(id3) }
|
177
|
-
assert_raise(ArgumentError) { id1.index(id1) }
|
178
|
-
end
|
179
|
-
|
180
|
-
def test_object_name_from_string
|
181
|
-
id = ObjectName.new("1.3.4.5.6")
|
182
|
-
assert_equal("1.3.4.5.6", id.to_s)
|
183
|
-
assert_equal("\006\004+\004\005\006", id.encode)
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_integer_create
|
187
|
-
i = Integer.new(12345)
|
188
|
-
assert_equal("12345", i.to_s)
|
189
|
-
assert_equal(12345, i.to_i)
|
190
|
-
assert_equal("\002\00209", i.encode)
|
191
|
-
assert_not_nil(i.asn1_type)
|
192
|
-
end
|
193
|
-
|
194
|
-
def test_integer_decode
|
195
|
-
i = Integer.decode("09")
|
196
|
-
assert_equal(12345, i.to_i)
|
197
|
-
end
|
198
|
-
|
199
|
-
def test_integer_equal
|
200
|
-
i1 = Integer.new(12345)
|
201
|
-
i2 = Integer.new(12345)
|
202
|
-
i3 = 12345.2
|
203
|
-
i4 = 12345
|
204
|
-
assert_not_same(i1, i2)
|
205
|
-
assert_equal(i1, i2)
|
206
|
-
assert_equal(i4, i1)
|
207
|
-
assert_equal(i1, i4)
|
208
|
-
assert_equal(i1, i3)
|
209
|
-
end
|
210
|
-
|
211
|
-
def test_integer_comparable
|
212
|
-
i1 = Integer.new(12345)
|
213
|
-
i2 = Integer.new(54321.0)
|
214
|
-
assert(i1 < i2)
|
215
|
-
assert(i2 > i1)
|
216
|
-
assert(123 < i1)
|
217
|
-
assert(123.0 < i1)
|
218
|
-
assert(i2 > 54000)
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_integer_to_oid
|
222
|
-
assert(ObjectId.new("123"), Integer.new(123).to_oid)
|
223
|
-
assert(ObjectId.new("0"), Integer.new(0).to_oid)
|
224
|
-
|
225
|
-
i = Integer.new(-1)
|
226
|
-
assert_raise(RangeError) { i.to_oid }
|
227
|
-
end
|
228
|
-
|
229
|
-
def test_ip_address_from_string
|
230
|
-
ip = IpAddress.new("10.0.255.1")
|
231
|
-
assert_equal("10.0.255.1", ip.to_s)
|
232
|
-
assert_raise(InvalidIpAddress) { IpAddress.new("1233.2.3.4") }
|
233
|
-
assert_raise(InvalidIpAddress) { IpAddress.new("1.2.3.-1") }
|
234
|
-
assert_raise(InvalidIpAddress) { IpAddress.new("1.2.3") }
|
235
|
-
end
|
20
|
+
varbind, remainder = VarBind.decode("0\f\006\010+\006\001\002\001\001\001\000\005\0000\f\006\010+\006\001\002\001\001\002\000\005\000")
|
21
|
+
assert_equal(Null, varbind.value)
|
22
|
+
assert_equal("0\f\006\010+\006\001\002\001\001\002\000\005\000", remainder)
|
23
|
+
end
|
236
24
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
def test_ip_address_create
|
244
|
-
ip = IpAddress.new("\001\002\003\004")
|
245
|
-
assert_equal("1.2.3.4", ip.to_s)
|
246
|
-
assert_equal("\001\002\003\004", ip.to_str)
|
247
|
-
assert_equal("@\004\001\002\003\004", ip.encode)
|
248
|
-
assert_not_nil(ip.asn1_type)
|
249
|
-
end
|
250
|
-
|
251
|
-
def test_ip_address_decode
|
252
|
-
ip = IpAddress.decode("\001\002\003\004")
|
253
|
-
assert_equal("1.2.3.4", ip.to_s)
|
254
|
-
end
|
25
|
+
def test_varbind_name_alias_oid
|
26
|
+
vb = VarBind.new("1.2.3.4", OctetString.new("blah"))
|
27
|
+
assert_equal(ObjectId.new("1.2.3.4"), vb.name)
|
28
|
+
assert_equal(ObjectId.new("1.2.3.4"), vb.oid)
|
29
|
+
end
|
255
30
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
ip3 = IpAddress.new("10.2.3.4")
|
260
|
-
assert(ip1 == ip2)
|
261
|
-
assert(ip1.eql?(ip2))
|
262
|
-
assert(!ip1.equal?(ip2))
|
263
|
-
assert(ip1 != ip3)
|
264
|
-
assert(ip1.hash == ip2.hash)
|
265
|
-
assert(ip1.hash != ip3.hash)
|
266
|
-
assert(!ip1.eql?(12))
|
267
|
-
end
|
268
|
-
|
269
|
-
def test_ip_address_to_oid
|
270
|
-
ip = IpAddress.new("1.2.3.4")
|
271
|
-
assert_equal(ObjectId.new("1.2.3.4"), ip.to_oid)
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_counter32_create
|
275
|
-
i = Counter32.new(12345)
|
276
|
-
assert_equal("12345", i.to_s)
|
277
|
-
assert_equal(12345, i.to_i)
|
278
|
-
assert_equal("\x41\00209", i.encode)
|
279
|
-
assert_not_nil(i.asn1_type)
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_counter32_decode
|
283
|
-
i = Counter32.decode("09")
|
284
|
-
assert_equal(12345, i.to_i)
|
285
|
-
end
|
286
|
-
|
287
|
-
# Decode as a positive number even though high bit is set.
|
288
|
-
# Not strict ASN.1, but implemented in some agents.
|
289
|
-
def test_unsigned_decode
|
290
|
-
i = Counter32.decode("\201\264\353\331")
|
291
|
-
assert_equal(2176117721, i.to_i)
|
292
|
-
|
293
|
-
i = TimeTicks.decode("\201\264\353\331")
|
294
|
-
assert_equal(2176117721, i.to_i)
|
295
|
-
end
|
296
|
-
|
297
|
-
def test_counter64
|
298
|
-
i = Counter64.new(18446744073709551615)
|
299
|
-
assert_equal(18446744073709551615, i.to_i)
|
300
|
-
assert_equal("18446744073709551615", i.to_s)
|
301
|
-
assert_equal("F\t\000\377\377\377\377\377\377\377\377", i.encode)
|
302
|
-
assert_equal(i, Counter64.decode("\000\377\377\377\377\377\377\377\377"))
|
303
|
-
assert_not_nil(i.asn1_type)
|
304
|
-
end
|
305
|
-
|
306
|
-
def test_opaque
|
307
|
-
q = Opaque.new("test")
|
308
|
-
assert_equal("D\004test", q.encode)
|
309
|
-
assert_equal("test", Opaque.decode("test"))
|
310
|
-
assert_equal("test", q.to_s)
|
311
|
-
assert_not_nil(q.asn1_type)
|
312
|
-
end
|
313
|
-
|
314
|
-
def test_exception_methods
|
315
|
-
exception_types = [NoSuchObject, NoSuchInstance, EndOfMibView]
|
316
|
-
exception_types.each do |type|
|
317
|
-
assert(type.respond_to?(:decode))
|
318
|
-
assert(type.respond_to?(:encode))
|
319
|
-
assert_equal(type.asn1_type, type.to_s)
|
320
|
-
end
|
321
|
-
end
|
31
|
+
def test_varbind_list_create
|
32
|
+
list = VarBindList.new
|
33
|
+
assert_equal(0, list.length)
|
322
34
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
35
|
+
check_varbind_list_create(VarBindList.new(["1.2.3.4.5"]))
|
36
|
+
check_varbind_list_create(VarBindList.new([ObjectId.new("1.2.3.4.5")]))
|
37
|
+
check_varbind_list_create(VarBindList.new([VarBind.new("1.2.3.4.5", Null)]))
|
38
|
+
|
39
|
+
check_varbind_list_create(VarBindList.new(
|
40
|
+
["1.2.3.4.5", "1.2.3.4.6"]), 2)
|
41
|
+
|
42
|
+
check_varbind_list_create(VarBindList.new(
|
43
|
+
[ObjectId.new("1.2.3.4.5"),
|
44
|
+
ObjectId.new("1.2.3.4.6")]
|
45
|
+
), 2)
|
46
|
+
|
47
|
+
check_varbind_list_create(VarBindList.new(
|
48
|
+
[VarBind.new("1.2.3.4.5", Null),
|
49
|
+
VarBind.new("1.2.3.4.6", Integer.new(123)),
|
50
|
+
ObjectId.new("1.2.3.4.7")]
|
51
|
+
), 3)
|
52
|
+
|
53
|
+
list = VarBindList.new([VarBind.new("1.3.6.2", Integer.new(1))])
|
54
|
+
assert_equal(1, list.length)
|
55
|
+
assert_equal("1.3.6.2", list.first.name.to_s)
|
56
|
+
assert_equal(1, list.first.value.to_i)
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_varbind_list_create(list, n=1)
|
60
|
+
assert_equal(n, list.length)
|
61
|
+
assert_equal("1.2.3.4.5", list.first.name.to_s)
|
62
|
+
assert_equal(Null, list.first.value)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_varbind_list_encode
|
66
|
+
list = VarBindList.new
|
67
|
+
assert_equal("0\000", list.encode)
|
68
|
+
assert_not_nil(list.asn1_type)
|
69
|
+
|
70
|
+
list << VarBind.new([1,3,6,1], OctetString.new("test"))
|
71
|
+
assert_equal("0\r0\v\006\003+\006\001\004\004test", list.encode)
|
72
|
+
|
73
|
+
list << VarBind.new([1,3,6,1], OctetString.new("blah"))
|
74
|
+
assert_equal("0\0320\v\006\003+\006\001\004\004test0\v\006\003+\006\001\004\004blah", list.encode)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_varbind_list_decode
|
78
|
+
list, remainder = VarBindList.decode("0\r0\v\006\003+\006\001\004\004test")
|
79
|
+
assert_equal(1, list.length)
|
80
|
+
assert_equal("", remainder)
|
81
|
+
|
82
|
+
list, remainder = VarBindList.decode("0\0320\v\006\003+\006\001\004\004test0\v\006\003+\006\001\004\004blah")
|
83
|
+
assert_equal(2, list.length)
|
84
|
+
assert_equal("", remainder)
|
85
|
+
|
86
|
+
list, remainder = VarBindList.decode("0\000")
|
87
|
+
assert_equal(0, list.length)
|
88
|
+
assert_equal("", remainder)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_octet_string
|
92
|
+
string = OctetString.new("test")
|
93
|
+
assert_equal("test", string.to_s)
|
94
|
+
assert_equal("\004\004test", string.encode)
|
95
|
+
assert_not_nil(string.asn1_type)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_octet_string_equals
|
99
|
+
s1 = OctetString.new("test")
|
100
|
+
s2 = "test"
|
101
|
+
s3 = OctetString.new("test")
|
102
|
+
assert_equal(s1, s2)
|
103
|
+
assert(s1 == s2)
|
104
|
+
assert_not_same(s1, s3)
|
105
|
+
assert_equal(s1, s3)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_octet_string_to_oid
|
109
|
+
s = OctetString.new("test")
|
110
|
+
assert_equal(ObjectId.new([116, 101, 115, 116]), s.to_oid)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_object_id
|
114
|
+
id = ObjectId.new([1,3,6,1])
|
115
|
+
assert_equal("1.3.6.1", id.to_s)
|
116
|
+
assert_equal("\006\003+\006\001", id.encode)
|
117
|
+
assert_not_nil(id.asn1_type)
|
118
|
+
assert_equal("1.3.6.1", id.to_varbind.name.to_s)
|
119
|
+
|
120
|
+
assert_raise(ArgumentError) {
|
121
|
+
ObjectId.new("xyzzy")
|
122
|
+
}
|
123
|
+
|
124
|
+
assert_equal("", ObjectId.new.to_s)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_object_id_create
|
128
|
+
assert_equal("1.3.6.1", ObjectId.new("1.3.6.1").to_s)
|
129
|
+
assert_equal("1.3.6.1", ObjectId.new([1,3,6,1]).to_s)
|
130
|
+
assert_equal("1.3.6.1", ObjectId.new(ObjectId.new("1.3.6.1")).to_s)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_object_id_equals
|
134
|
+
id1 = ObjectId.new("1.3.3.4")
|
135
|
+
id2 = ObjectId.new([1,3,3,4])
|
136
|
+
assert_not_same(id1, id2)
|
137
|
+
assert(id1 == id2)
|
138
|
+
assert_equal(id1, id2)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_object_id_comparable
|
142
|
+
id1 = ObjectId.new("1.3.3.4")
|
143
|
+
id2 = ObjectId.new("1.3.3.4.1")
|
144
|
+
id3 = ObjectId.new("1.3.3.4.5")
|
145
|
+
id4 = ObjectId.new("1.3.3.5")
|
146
|
+
assert(id1 < id2)
|
147
|
+
assert(id2 > id1)
|
148
|
+
assert(id2 < id3)
|
149
|
+
assert(id3 > id2)
|
150
|
+
assert(id3 < id4)
|
151
|
+
assert(id4 > id3)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_object_id_subtree
|
155
|
+
id1 = ObjectId.new("1.3.3.4")
|
156
|
+
id2 = ObjectId.new("1.3.3.4.1")
|
157
|
+
id3 = ObjectId.new("1.3.3.4.5")
|
158
|
+
id4 = ObjectId.new("1.3.3.5")
|
159
|
+
assert(id2.subtree_of?(id1))
|
160
|
+
assert(id3.subtree_of?(id1))
|
161
|
+
assert(!id3.subtree_of?(id2))
|
162
|
+
assert(!id1.subtree_of?(id2))
|
163
|
+
assert(!id4.subtree_of?(id1))
|
164
|
+
assert(!id4.subtree_of?(id3))
|
165
|
+
assert(id1.subtree_of?("1.3.3.4"))
|
166
|
+
assert(!id4.subtree_of?("1.3.3.4"))
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_object_id_index
|
170
|
+
id1 = ObjectId.new("1.3.3.4")
|
171
|
+
id2 = ObjectId.new("1.3.3.4.1")
|
172
|
+
id3 = ObjectId.new("1.3.3.4.1.2")
|
173
|
+
assert_equal(ObjectId.new("1"), id2.index(id1))
|
174
|
+
assert_equal(ObjectId.new("1.2"), id3.index(id1))
|
175
|
+
assert_equal(ObjectId.new("1.2"), id3.index("1.3.3.4"))
|
176
|
+
assert_raise(ArgumentError) { id1.index(id3) }
|
177
|
+
assert_raise(ArgumentError) { id1.index(id1) }
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_object_name_from_string
|
181
|
+
id = ObjectName.new("1.3.4.5.6")
|
182
|
+
assert_equal("1.3.4.5.6", id.to_s)
|
183
|
+
assert_equal("\006\004+\004\005\006", id.encode)
|
184
|
+
end
|
185
|
+
|
186
|
+
def test_integer_create
|
187
|
+
i = Integer.new(12345)
|
188
|
+
assert_equal("12345", i.to_s)
|
189
|
+
assert_equal(12345, i.to_i)
|
190
|
+
assert_equal("\002\00209", i.encode)
|
191
|
+
assert_not_nil(i.asn1_type)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_integer_decode
|
195
|
+
i = Integer.decode("09")
|
196
|
+
assert_equal(12345, i.to_i)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_integer_equal
|
200
|
+
i1 = Integer.new(12345)
|
201
|
+
i2 = Integer.new(12345)
|
202
|
+
i3 = 12345.2
|
203
|
+
i4 = 12345
|
204
|
+
assert_not_same(i1, i2)
|
205
|
+
assert_equal(i1, i2)
|
206
|
+
assert_equal(i4, i1)
|
207
|
+
assert_equal(i1, i4)
|
208
|
+
assert_equal(i1, i3)
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_integer_comparable
|
212
|
+
i1 = Integer.new(12345)
|
213
|
+
i2 = Integer.new(54321.0)
|
214
|
+
assert(i1 < i2)
|
215
|
+
assert(i2 > i1)
|
216
|
+
assert(123 < i1)
|
217
|
+
assert(123.0 < i1)
|
218
|
+
assert(i2 > 54000)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_integer_to_oid
|
222
|
+
assert_equal(ObjectId.new("123"), Integer.new(123).to_oid)
|
223
|
+
assert_equal(ObjectId.new("0"), Integer.new(0).to_oid)
|
224
|
+
|
225
|
+
i = Integer.new(-1)
|
226
|
+
assert_raise(RangeError) { i.to_oid }
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_ip_address_from_string
|
230
|
+
ip = IpAddress.new("10.0.255.1")
|
231
|
+
assert_equal("10.0.255.1", ip.to_s)
|
232
|
+
assert_raise(InvalidIpAddress) { IpAddress.new("1233.2.3.4") }
|
233
|
+
assert_raise(InvalidIpAddress) { IpAddress.new("1.2.3.-1") }
|
234
|
+
assert_raise(InvalidIpAddress) { IpAddress.new("1.2.3") }
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_ip_address_from_self
|
238
|
+
ip1 = IpAddress.new("1.2.3.4")
|
239
|
+
ip2 = IpAddress.new(ip1)
|
240
|
+
assert_equal(ip1, ip2)
|
241
|
+
end
|
242
|
+
|
243
|
+
def test_ip_address_create
|
244
|
+
ip = IpAddress.new("\001\002\003\004")
|
245
|
+
assert_equal("1.2.3.4", ip.to_s)
|
246
|
+
assert_equal("\001\002\003\004", ip.to_str)
|
247
|
+
assert_equal("@\004\001\002\003\004", ip.encode)
|
248
|
+
assert_not_nil(ip.asn1_type)
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_ip_address_decode
|
252
|
+
ip = IpAddress.decode("\001\002\003\004")
|
253
|
+
assert_equal("1.2.3.4", ip.to_s)
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_ip_address_decode_extra_octets
|
257
|
+
ip = IpAddress.decode("\000\000\000\000\000\000\000\000")
|
258
|
+
assert_equal("0.0.0.0.0.0.0.0", ip.to_s)
|
259
|
+
|
260
|
+
ip = IpAddress.decode("\001\002\003")
|
261
|
+
assert_equal("1.2.3", ip.to_s)
|
262
|
+
|
263
|
+
ip = IpAddress.decode("\001\002\003\004\005")
|
264
|
+
assert_equal("1.2.3.4.5", ip.to_s)
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_ip_address_equals
|
268
|
+
ip1 = IpAddress.new("1.2.3.4")
|
269
|
+
ip2 = IpAddress.new("1.2.3.4")
|
270
|
+
ip3 = IpAddress.new("10.2.3.4")
|
271
|
+
assert(ip1 == ip2)
|
272
|
+
assert(ip1.eql?(ip2))
|
273
|
+
assert(!ip1.equal?(ip2))
|
274
|
+
assert(ip1 != ip3)
|
275
|
+
assert(ip1.hash == ip2.hash)
|
276
|
+
assert(ip1.hash != ip3.hash)
|
277
|
+
assert(!ip1.eql?(12))
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_ip_address_to_oid
|
281
|
+
ip = IpAddress.new("1.2.3.4")
|
282
|
+
assert_equal(ObjectId.new("1.2.3.4"), ip.to_oid)
|
283
|
+
end
|
284
|
+
|
285
|
+
def test_counter32_create
|
286
|
+
i = Counter32.new(12345)
|
287
|
+
assert_equal("12345", i.to_s)
|
288
|
+
assert_equal(12345, i.to_i)
|
289
|
+
assert_equal("\x41\00209", i.encode)
|
290
|
+
assert_not_nil(i.asn1_type)
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_counter32_decode
|
294
|
+
i = Counter32.decode("09")
|
295
|
+
assert_equal(12345, i.to_i)
|
296
|
+
end
|
297
|
+
|
298
|
+
# Decode as a positive number even though high bit is set.
|
299
|
+
# Not strict ASN.1, but implemented in some agents.
|
300
|
+
def test_unsigned_decode
|
301
|
+
i = Counter32.decode("\201\264\353\331")
|
302
|
+
assert_equal(2176117721, i.to_i)
|
303
|
+
|
304
|
+
i = TimeTicks.decode("\201\264\353\331")
|
305
|
+
assert_equal(2176117721, i.to_i)
|
306
|
+
end
|
307
|
+
|
308
|
+
def test_counter64
|
309
|
+
i = Counter64.new(18446744073709551615)
|
310
|
+
assert_equal(18446744073709551615, i.to_i)
|
311
|
+
assert_equal("18446744073709551615", i.to_s)
|
312
|
+
assert_equal("F\t\000\377\377\377\377\377\377\377\377", i.encode)
|
313
|
+
assert_equal(i, Counter64.decode("\000\377\377\377\377\377\377\377\377"))
|
314
|
+
assert_not_nil(i.asn1_type)
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_opaque
|
318
|
+
q = Opaque.new("test")
|
319
|
+
assert_equal("D\004test", q.encode)
|
320
|
+
assert_equal("test", Opaque.decode("test"))
|
321
|
+
assert_equal("test", q.to_s)
|
322
|
+
assert_not_nil(q.asn1_type)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_exception_methods
|
326
|
+
exception_types = [NoSuchObject, NoSuchInstance, EndOfMibView]
|
327
|
+
exception_types.each do |type|
|
328
|
+
assert(type.respond_to?(:decode))
|
329
|
+
assert(type.respond_to?(:encode))
|
330
|
+
assert_equal(type.asn1_type, type.to_s)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
def test_timeticks
|
335
|
+
assert_equal("00:00:00.00", TimeTicks.new(0).to_s)
|
336
|
+
assert_equal("00:00:00.01", TimeTicks.new(1).to_s)
|
337
|
+
assert_equal("00:00:01.00", TimeTicks.new(100).to_s)
|
338
|
+
assert_equal("00:01:00.00", TimeTicks.new(60 * 100).to_s)
|
339
|
+
assert_equal("01:00:00.00", TimeTicks.new(60 * 60 * 100).to_s)
|
340
|
+
assert_equal("23:59:59.99", TimeTicks.new(24 * 60 * 60 * 100 - 1).to_s)
|
341
|
+
assert_equal("1 day, 00:00:00.00", TimeTicks.new(24 * 60 * 60 * 100).to_s)
|
342
|
+
assert_equal("1 day, 23:59:59.99", TimeTicks.new(48 * 60 * 60 * 100 - 1).to_s)
|
343
|
+
assert_equal("2 days, 00:00:00.00", TimeTicks.new(48 * 60 * 60 * 100).to_s)
|
344
|
+
assert_equal("497 days, 02:27:52.95", TimeTicks.new(4294967295).to_s)
|
345
|
+
assert_equal(4294967295, TimeTicks.new(4294967295).to_i)
|
346
|
+
assert_raise(ArgumentError) {
|
347
|
+
TimeTicks.new(4294967296)
|
348
|
+
}
|
349
|
+
assert_raise(ArgumentError) {
|
350
|
+
TimeTicks.new(-1)
|
351
|
+
}
|
352
|
+
end
|
353
|
+
end
|