trehn / hnmp

High-level Python SNMP library
ISC License
49 stars 16 forks source link

Make hnmp.Table._rows an OrderedDict if possible (Python 2.7+) #7

Closed mjuenema closed 9 years ago

mjuenema commented 9 years ago

This change ensures that SNMP.table.columns are in the same order as returned by the SNMP query. The difference is shown below:

Without OrderedDict:

>>> ifEntry = '1.3.6.1.2.1.2.2.1'
>>> snmp.table(ifEntry).columns[1]
(11, 13, 12, 16, 18, 1, 3, 2, 5, 4, 7, 6, 9, 8)

With OrderedDict:

>>> snmp.table(ifEntry).columns[1]
(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 16, 18)
trehn commented 9 years ago

Thanks! hnmp doesn't support Python <2.7 at all, so I'll remove that compatibility check.