1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445
|
Changes from v0.5.3 to v0.6.0
=============================
* Wed Apr 5 22:15:18 2017 +0100 - Radu - Eosif Mihailescu <radu.mihailescu@linux360.ro>
Fix packaging of examples - the proper destination is
%{_defaultdocdir}/%{name}-%{version} ... - ... but why bother when %doc
can magically take care of it?
(Git commit ab4657b276f804552399681634f5e024555b76c9)
* Sun Mar 12 15:51:38 2017 +0100 - Pieter Hollants <pieter@hollants.com>
Correct RFC number that describes the AgentX protocol
Fixes #29.
(Git commit 101cc3d88d48d77b8b5260cc7479a3a238628431)
* Tue Nov 1 20:37:40 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Update module docstring
Hooray, we're not under heavy development anymore!
(Git commit f543df2195867662dc72e61989e25798fcad1765)
* Tue Nov 1 20:35:59 2016 +0100 - Pieter Hollants <pieter@hollants.com>
Update README and setup.py.in to indicate Python 3 compatibility
(Git commit 3c662434549de36cffbdaff0f6de97a7a52ad0e3)
* Tue Nov 1 14:54:28 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Code formatting
(Git commit 639619802d880b90d22b0492a93a51dd8bcb2f64)
* Tue Nov 1 14:54:11 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Correct some comments
(Git commit 9e22370ba002b134543d24c4d28b007e8d828c9b)
* Tue Nov 1 14:50:41 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Remove superfluous double assignment of self._cvar.value
We already assigned it a few lines above and also didn't modify it
inbetween.
(Git commit cb9af33107b21db6f75514e9ba13a7b0991a2a35)
* Tue Nov 1 14:06:10 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Convert between byte and unicode strings if necessary
This change addresses the major issue that prevented python-netsnmpagent
from running under Python 3 so far.
Under Python 2.x, a string that gets declared is of the "str" type, which
is implemented as a byte string. Unicode strings have to be explicitly
declared:
>>> a = "Metallica"
>>> type(a)
<type 'str'>
>>> isinstance(a, bytes)
True
>>> b = u"Motörhead"
>>> type(b)
<type 'unicode'>
We were prettily using "str" strings everywhere, which, being byte
strings, perfectly aligned with the C-style strings exposed through the
ctypes module.
Now under Python 3.x, however, a string that gets declared is an instance
of a class that is still called "str" but is implemented as a collection
of Unicode code points. There is no »u"Foo"« notation anymore, instead
byte strings have to be explicitly declared with a "b" prefix:
>>> a = "Motörhead"
>>> type(a)
<class 'str'>
>>> isinstance(a, bytes)
False
>>> b = b"Metallica"
>>> type(b)
<class 'bytes'>
Following the paradigma of enforcing a stricter distinction between
Unicode and byte strings in code, the ctypes module in Python 3.x removed
automatic conversions. Thus we now need to explicitly encode Unicode
strings to byte strings before passing them to net-snmp. Likewise we need
to decode received strings before returning them to Python code. In both
cases we use the encoding retrieved from locale.getpreferredencoding().
Note that this changed behavior affects running under Python 3.x ONLY, in
an attempt to provide the "natural" behavior expected under the Python
version used. Under Python 2.x, the interface to your Python code remains
UNCHANGED, expecting and returning "str" byte strings.
This also means that if your agent code is running under Python 2.x and
you want to pass or receive Unicode strings to python-netsnmpagent and
net-snmp, you will have to keep encoding/decoding them yourself.
(Git commit 003fcb2724cfbaf22b876ab604b1914303a7e10d)
* Tue Nov 1 15:27:55 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Use long() under Python 2.x and int() otherwise
Python 3.x does not need the "long" type anymore because "int" numbers
have no limit anymore.
(Git commit 79b3a35c7f06f250fd447b2bd8b1a5465b135870)
* Tue Nov 1 15:17:14 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Always return numbers through int(), ignoring sys.maxint
Actually I'm not sure what I tried to achieve with the sys.maxint check
as we can safely rely on int() under Python 2.x to automatically return a
"long" typed number if "int" doesn't suffice. Under Python 3.x "int"
doesn't have a limit anymore, anyway.
(Git commit 919c47dc53048204b11b22597954bafc3f5f2065)
* Tue Nov 1 19:34:30 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Decode snmpcmd output to Unicode if necessary
Python 3 strings are Unicode strings, not byte strings.
(Git commit f6b988ac08a4afba112eec0c84368ec8c5d9b540)
* Tue Nov 1 20:16:25 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Hardcode temporary directory name
As the tests are now no longer run through the nosetests wrapper script,
sys.argv[0] doesn't contain reasonable data anymore.
(Git commit 80f9a698504f346f77a80be3e303b550e90d27f4)
* Tue Nov 1 19:28:33 2016 +0100 - Pieter Hollants <pieter@hollants.com>
Makefile: Run tests with both Python 2 and 3
This makes "make tests" run all tests with both Python 2 and Python 3,
thereby allowing to identify code that behaves differently under either
Python version.
Because (at least on my system) there are no "nosetests2" and
"nosetests3" links but "python2" and "python3" links do exist, we now run
the tests via 'python2 -c "import nose; nose.main()' statements
(likewise for python3).
(Git commit a9cd9bdc71d667d491a5829a7f25f4399933db02)
* Tue Nov 1 20:14:36 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Call shutdown() via atexit instead of __del__()
Lesson learned: don't do cleanup stuff in __del__() or you'll get
exceptions printed on stdout and possibly incomplete cleanup when running
under Python 3.
(Git commit 93cd55a97f0db3b407454e1cd90143decd744fc6)
* Tue Nov 1 15:34:24 2016 +0100 - Pieter Hollants <pieter@hollants.com>
test_02_netsnmpagent_init: Drop unused imports
(Git commit 8ffc1c76ad4cb6be00fe8575bc89ebd9bd71411f)
* Tue Nov 1 20:19:10 2016 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Add/revise some comments
(Git commit dd7fd8046d2b3d0c33f64c32d0464b4873dfbdd9)
* Mon Oct 31 19:16:27 2016 +0100 - Pieter Hollants <pieter@hollants.com>
Code formatting fixes
(Git commit 9975c3a539a9cf6b278cd8904ad0efb3346c7e4e)
* Thu Oct 27 21:11:11 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Python 3 support: Use items() when iteritems() is not available
(Git commit a6f837e06f2d68cbc1cf74fc075d2fe1403ab140)
* Thu Oct 27 21:06:46 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Python 3 support: Use print(foo) instead of print foo
(Git commit a670331c7e126cf4d39ef6a73b61cd92686f2b41)
* Mon Aug 29 23:06:24 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Update README to give credit where credit is due
(Git commit 5122583d4d0f7a1a90a9127f76550b5f37ec2f56)
* Mon Aug 29 23:01:07 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Trivial description fixes in SIMPLE-MIB.txt
(Git commit d26c73a028af9e3df8e3c74653e6f280d3988a01)
* Fri Aug 19 08:53:19 2016 +0200 - Tobias Deiminger <tobias.deiminger@gmail.com>
Fixes for using IpAddress objects as table indices
This incorporates a number of fixes for using IpAddress objects as table
indices: 1. Add missing attributes to IpAddress class' __init__() method
2. Due to an unfixed Net-SNMP issue related to byte order (see
https://sourceforge.net/p/net-snmp/bugs/2136/), we have to pass
IpAddress values in host byte order when used as table indices and
in network byte order otherwise. 3. Improve string representation of
IpAddress in Table.value().
Note: In IpAddress.cref() we don't store a reference to _cidx in "self".
This is only safe if _cidx is consumed by a Net-SNMP function that copies
the value (eg. snmp_varlist_add_variable). If it were used by Net-SNMP as
raw pointer, Pythons reference counting could delete the object while
Net-SNMP still wants to access it.
These changes have been tested on x86_64 (little endian) and mips64 (big
endian) architecture.
(Git commit 519b0e8f3b500c10e5ec57dd3eadaebf09329146)
* Sat May 28 11:45:51 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Bump copyright year
(Git commit 9a5b4e6f94874d3797fba5c21a1401684e0bc1fa)
* Sat May 28 11:35:53 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Relicense under the Lesser GNU Public License (LGPL), version 3.
I've decided to relicense python-netsnmpagent under the LGPL instead of
the GPL to facilitate integration with LGPL-licensed as well as
proprietary software. Ie. using python-netsnmpagent in your proprietary
subagent does not mean that you have to license your subagent under
python-netsnmpagent's license as well.
(Git commit d19b91131353c19cf408f2208bdf5384941a47d6)
* Wed May 27 14:00:30 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
netsnmpagent: Fix Table's value() cutting off ASN_COUNTER64 table values
When returning a table row's data, we accessed ASN_COUNTER64 values via a
32-bit pointer, effectively cutting off the other 32 bits. Using the
"data" union's "counter64" pointer fixes this.
(Git commit 1fb1abb33a5eccc172b0279b099172a5230e4118)
* Fri Apr 17 10:47:54 2015 +0200 - Pieter Hollants <pieter@hollants.com>
Update README with extended credits
(Git commit 9f7ad1cb2563c4d91948265cf85015bd67c1dea3)
* Wed Apr 15 15:19:54 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
Fix format string in threading_agent example's logging
Python 2.6 requires positional argument specifiers, omitting them only
works on Python 2.7 and later.
Cf. https://docs.python.org/2/library/string.html#formatstrings
(Git commit d547d9fc162c64db35b46ef75593534002cf5c6a)
* Wed Apr 15 15:25:55 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
examples/run_* scripts: Trap additional signals for cleanup
In some cases the tempdirs were left because we seem to have missed some
signals.
(Git commit 6bc2e8753f38e872ab8815bc4186b314869993eb)
* Sun Mar 22 13:49:46 2015 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Drop special string handling in Table's init()/setRowCell()
Because of issues with strings inside tables, we used to implement some
special handling for (what we thought were) the trailing zero byte in C
strings in Table's init() and setRowCell() methods, passing size+1 to
netsnmp_set_row_column().
However, while this seemed to work on older net-snmp versions, with newer
net-snmp versions we suddently had different issues, with irregular dot
chars appearing at the end of strings.
Turns out, we had a bug, but fixed it at the wrong place: right here,
passing size (not size+1) appears to be correct. a8181ddb fixes the real
culprit in Table's value() method.
(Git commit 74fac74547eb9a344852c06fc7ca6c78476a4cbd)
* Sun Mar 22 13:35:58 2015 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Make Table's value() method regard string lengths
When creating the dictionary returned by the Table class's value()
method, we so far assumed that the strings referenced through the "data"
field in netsnmp_table_data_set_storage structures would be zero
byte-terminated, as all C strings. However, this does not seem to be the
case, as eg. netsnmp_set_row_column() uses memcpy(), not strcpy(), ie.
when setting a string it is NOT zero byte-terminated. We thus need to
regard "data_len" when returning data to the Python world.
Strangely, this does not seem to be necessary with the simple scalar
types such as OctetString and DisplayString which are basically
ctypes.c_char_p objects as well...
(Git commit a8181ddbd1c2ba633b0e6bd651b32612ae42b117)
* Wed Nov 12 18:05:00 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Add test cases for OctetString scalar type
(Git commit e01291200f16460f08af994866113e548db234cf)
* Wed Nov 12 18:00:59 2014 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Handle strings without datatype and remove double quotes
Sometimes, snmpget might return data without an explicit datatype. We'll
handle it as strings, then, and remove any heading and trailing double
quotes.
(Git commit 8b8681e7f3c2c24bd3233b360c2454dc458a493c)
* Wed Nov 12 13:38:22 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Add test cases for TimeTicks scalar type
(Git commit dd1be2cb264957cc45bceb568bd820f5244be38d)
* Wed Nov 12 13:36:12 2014 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Fix splitting in snmpget() for output with multiple ":"
chars
(Git commit ceb3c12327eedccfe2896182def2725dd5e4dc95)
* Wed Nov 12 13:28:37 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Smaller fixes for Counter32/Counter64 integration tests
"Oops".
(Git commit eb48301e194dd3f03000cd8e5e9a75c457275d6b)
* Wed Nov 12 11:20:53 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Add test cases for Counter32 and Counter64 scalar types
(Git commit 68a7a7263f565e533d9caa6a2bc0bd539b78ce55)
* Wed Nov 12 11:09:09 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Smaller fixes for Unsigned32 integration tests
(Git commit 13924941b9932401be2434a3937a6d174292a44a)
* Tue Nov 11 20:47:38 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Add test cases for Integer32 variable type and rework those for
Unsigned32
(Git commit 52c9e82f493da197e1d31e343eb419347595b480)
* Tue Nov 11 15:51:53 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Just some small fixes to unify source code style
(Git commit fb5265611ef6ce94890678a9c432d719aa1fafb2)
* Tue Nov 11 15:05:47 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Construct packager email from user- and hostname if not set through git
config
The included RPM .spec file always needs a packager name or email
address, otherwise rpmbuild will complain. In properly configured git
repos, the email address configured with "git config user.email" would
have been used so far, but it should be possible to issue a "make rpms"
without this requirement.
Thus we now fall back to constructing a most probably bogus email address
by combining the username and the hostname. This will allow to build RPMs
for personal purposes, however, for redistribution purposes one should
always explicitly configure a proper email address through "git config"
beforehand.
(Git commit 2bef55cd908e8cf05bac02e65cb705294607f39d)
* Thu Jul 31 16:10:34 2014 +0200 - Jacobo de Vera <devel@jacobodevera.com>
Rename as suggested in review
(Git commit bdbb299c428d1f936433cbff9086490dc37f39b6)
* Mon Jul 21 14:25:40 2014 +0200 - Jacobo de Vera <devel@jacobodevera.com>
Make the use of MIB files completely optional
(Git commit b2baaa3b3097546603c8b082395d3c27cceb4467)
* Sat May 17 00:28:57 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Update README
(Git commit 9f9de13efffe9be0b1b9ea24a91046a96e383b40)
* Sat May 17 00:27:48 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add "tests" target to Makefile and README explaining why to use it
net-snmp's broken shutdown semantics force use to wrap nosetests so that
it spawns a new Python process for each test case file.
(Git commit 5dd4001379e676d0772ca6f7bfe37458b1fadc15)
* Sat May 17 00:27:06 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Rename test case files to guarantee a meaningful execution order
(Git commit 4126fbba217b76babc9b41dba3038dcda5600ac7)
* Fri May 16 23:41:43 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Adapt test_netsnmptestenv.py to the snmpget() changes from 63414520
(Git commit bc4fff3aa72d19ef097c5d6ae740eb5f6fa92faa)
* Fri May 16 23:28:16 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Do not call net-snmp's shutdown_agent() anymore
Unfortunately, the situation is even worse than described in 9c6c5560 so
that we'll have to revert that change. Calling shutdown_agent() will
cause trouble if SNMP objects have been registered (double free()s).
(Git commit ea4796fadff7f7d3c2f3481e112423bdb0f0681e)
* Fri May 16 23:07:07 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add first test cases for netsnmpagent SNMP objects (Unsigned32)
This first set of test cases tests
- SNMPGET on a read/write Unsigned32 object without initval returns 0
- SNMPSET of that object to 42 raises no exception
- SNMPGET on that object then returns 42
- SNMPGET on a Unsigned32 object with initval 0 returns 0
- SNMPGET on a Unsigned32 object with initval -1 returns 4294967295
- SNMPGET on a Unsigned32 object with initval 4294967295 returns
4294967295
- SNMPGET on a read-only Unsigned32 object without initval returns 0
- SNMPSET on that object raises a NotWritableError exception
(Git commit d8de7ee1f5ee38c0b8c602efa8bd0ae5d890e83b)
* Fri May 16 22:24:59 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Add snmpset() method to set values
(Git commit f5323fe486cf907281084f5adacf9f205595a5f6)
* Fri May 16 21:36:21 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Make snmpget() extract and return data and datatype
Calling functions will have no interest in extracting the data
themselves.
(Git commit 63414520f6278ff59d477cd35e312173828d6769)
* Fri May 16 15:54:52 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Update TEST-MIB.txt to offer OIDs for more diverse testing
(Git commit b3b2572ed91f7369cfa67f63fa34526a8f2af7e4)
* Fri May 16 15:50:36 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Re-import os and time once more in netsnmptestenv's shutdown() method
Especially "os" may have been __del__'d when shutdown() gets called a
second time by netsnmptestenv's own __del__() method.
(Git commit 10f1c011f13aedca2db48ba1f2807fe56fa66092)
* Fri May 16 15:19:40 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Use __file__ instead of sys.argv[0] to find path to TEST-MIB
If run through the "nosetests" script, sys.argv will be
/usr/bin/nosetests, not the path of test_netsnmpagent_init.py. We have to
use __file__ instead.
(Git commit 377dc15e5d2efbc7103e1dc0cb5a0ff7bc4a6dc2)
* Fri May 16 15:10:53 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Rename test_netsnmpagent.py to test_netsnmpagent_init.py
We can only test the init behavior of the netsnmpagent module in this
file as, among other things, we explicitly test that calling
agent.start() without registering any SNMP objects does not make them
available. So we can't at the same time register and test SNMP objects --
calling shutdown() and instantiating a new netsnmpAgent instance wouldn't
work for the reasons laid down in 9c6c5560.
(Git commit f352558d5f57bc34abef297ec3f359fdac528c52)
* Fri May 16 00:45:27 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add first test cases for netsnmpagent module itself
These test cases so far yet deal with rather low level issues of the
module only, such as the expected behavior after instance creation,
whether a connection to a master snmpd agent inside a net-snmp test
environment set up with the netsnmptestenv module could be successfully
established etc.
More important tests such as the behavior of the different types of SNMP
objects are yet to follow. For this reason, the included new TEST-MIB.txt
so far gets used only indirectly (to test when it becomes available to
the test environment's snmpd).
(Git commit 12a7097def7ddc3963a683b0dc0b873c19265ca3)
* Thu May 15 20:47:30 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add test cases for snmpcmd() exceptions to test_netsnmptestenv.py
These test cases cover the changes done in 706ecb06.
(Git commit 931b27f2cdf3489ba94dd3f59e94b8c1d364e632)
* Thu May 15 20:42:51 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Fix snmpcmd() error detection/exceptions
For one thing, we used re.match() to search for matches at the end of the
output, thus exceptions were never raid. Second, we only caught the case
where a MIB (and thus the OID) was basically known, but not available
(ie. because there was no subagent connected serving it) and reported it
with the wrong exception name. Third, we didn't catch the case when an
unknown OID was specified (eg. an unknown MIB or a known MIB but an
invalid OID within that MIB).
(Git commit 73f63d0b6d1168853525059b1ff650601f110734)
* Thu May 15 19:29:38 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Reorder imports in test_netsnmptestenv to be more logical
(Git commit 706ecb06e56b39758696bb11c1f338c32732b511)
* Thu May 15 16:36:12 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Use slightly more intelligent process killing in netsnmptestenv module
Instead of hammering the process to be killed with signals continously,
sleep small amounts of time and check procfs. This is obviously
Linux-specific, but so far I have not heard of anyone trying to use
python-netsnmpagent with net-snmp on different platforms.
(Git commit d638fe963a2372cfc4b9abcf2b72619a91079248)
* Thu May 15 15:32:35 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add more tests for complete and clean shutdown() in
test_netsnmptestenv.py
Tests that
- check that the snmpd has really exited by killing it's remembered PID
- check that the tmpdir used by the testenv has been removed
(Git commit a97ef42a87633ad65c509b6006ef2e20176b74ca)
* Thu May 15 15:28:38 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Test that snmpget really fails again after netsnmptestenv shutdown
(Git commit 194d87f50a733e871ce9fd17a91ff141f3cd4558)
* Thu May 15 15:26:06 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Make use of nicer/more effective nose tools in test_netsnmptestenv.py
(Git commit a5aff2547ed35f4f062f685c208cbb8585b40526)
* Thu May 15 15:15:05 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Use @timed decorator to test the time test_netsnmptestenv functions use
(Git commit eecf982a941339416b6481829a40a16712342c90)
* Thu May 15 15:12:37 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Have test_netsnmptestenv.py also test shutdown(), not just call it
(Git commit a4ccbb60f93604122131e1652cbef0af33e5398a)
* Thu May 15 15:09:49 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add docstrings to test cases in test_netsnmptestenv.py
(Git commit 8e73e9dc40f6306931d5cd7ffea3ed4bb7f53d5d)
* Wed May 14 14:42:42 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Use nose as testing framework
The advantages over unittest are quite well-known (eg. not having to
create test classes, test discovery etc.), so I won't elaborate in much
detail here.
(Git commit 66dad7b2493237e754547797619a801fe5a5ac1a)
* Wed May 14 13:28:41 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Have snmpcmd() raise exceptions in timeout/"no such OID"
cases
The SNMP commands executed might hit a timeout (no running snmpd, wrong
community string etc.) or a "no such OID" condition (no subagent
running). These cases must be detectable by tests without having to check
the output.
(Git commit a0d17da836b6a5c84c187857fc5bd53bd81318e4)
* Wed May 14 13:52:42 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Move shutdown()'s process killing into own function
Sooner or later our net-snmp test environment will consist of more than
snmpd (eg. snmptrapd), so it makes sense to generalize the process
killing.
(Git commit cb426775a957cfb1eaffb1fec684707909e82cf3)
* Wed May 14 13:45:37 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Rename __del__ to shutdown
As done for netsnmpagent in e7d9144c and for the same reasons.
(Git commit 2b94e8c9359942eeff404f3b10a99ac92ca5290d)
* Wed May 14 13:26:55 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Always strip() SNMP command's output immediately
(Git commit 38c3945dfeea2fd4545f77277a8d63ad6149ac11)
* Wed May 14 13:19:41 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmptestenv: Explicitly remember used TCP ports in instance variables
This way test_netsnmptestenv.py can inspect in a future-safe manner
whether the net-snmp daemons are still running and occupy the TCP ports
or have exited properly. Currently the ports are still hard-coded but
might become dynamic in a future commit.
(Git commit 129778cc3b7fa165ce0f63f7487569822570b72e)
* Fri May 2 01:22:20 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Call net-snmp's shutdown_agent() in shutdown() method
Properly written agents should call shutdown_agent() in addition to
snmp_shutdown() as we did a init_agent() before the init_snmp() call.
Note: with ALL net-snmp versions up to and including the current 5.7.3
beta this will still NOT allow for proper cleanup in such a way that you
could
"del" the netsnmpAgent instance, create a new one and have that one
connect to the master agent successfully. Even with 5.7.x's code cleanups
and the subsequent removal of "#ifdef SHUTDOWN_AGENT_CLEANLY" in snmpd.c,
it still seems to be necessary to exit the process (or thread) and have
the OS do additional cleanup work if a substantially different
netsnmpAgent instance (eg. with a different MasterSocket) is to be
created. Unfortunately this also affects test cases where one wants to
run each test in a defined, clean and reproducible environment.
(Git commit 9c6c556005838f67232a0f70a6a299968713e31a)
* Fri May 2 01:19:11 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Rename __del__ to shutdown()
I ran into the common "In Python __del__ is no destructor" trap. The
cleanup code called there was possibly never executed at all. Rename the
method to
"shutdown" to give agents a chance to explicitly call it at their own
shutdown.
(Git commit e7d9144c87199fb5f245020c8c99b3a886fb8901)
* Thu May 1 13:07:51 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpapi: define netsnmp_init_mib() instead of unused init_mib()
In netsnmpapi we defined init_mib() but in netsnmpagent we called
netsnmp_init_mib() which was undefined in netsnmpapi. That didn't cause
trouble because a.) ctypes implicitly treated it as being "void
netsnmp_init_mib(void)" and b.) by coincidence that matched the function
signature.
The confusion stemmed from a function rename in the net-snmp project, see
https://www.mail-archive.com/net-snmp-coders%40lists.sourceforge.net/msg08417.html
(Git commit fa383b70495dac6977c83cc9857f5aa41c8ecc59)
* Wed Apr 30 22:56:19 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Add netsnmptestenv Python module
python-netsnmpagent needs test cases, integration tests with net-snmp to
be precise. These tests will need the same temporary net-snmp test
environments as the example agents, so it makes sense to unify such code
into a new Python module "netsnmptestenv".
Initially this module will be used by netsnmpagent tests, later on we'll
modify the example agents so that they can use it, too, obsoleting the
need for shell script wrappers. For this reason and because the example
agents end up in /usr/share/doc/packages/python-netsnmpagent/examples/ in
binary distributions, netsnmptestenv will be installed into the system
along with the two existing Python modules netsnmpapi and netsnmpagent.
For now, only one test environment can be created at the same time
because we hardcode the TCP ports used by net-snmp. We'll replace this
with random port assignment/port in-use detection code later.
And of course the new module gets test cases itself, too :-)
(Git commit 3a6a90f99aa3cca2a912a6fab6dfde59c8fc3acd)
Changes from v0.5.2 to v0.5.3
=============================
* Mon Aug 29 23:06:24 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Update README to give credit where credit is due
(Git commit de4d76adbc5e54f0ae4536e0a661eb466251484d)
* Mon Aug 29 23:01:07 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Trivial description fixes in SIMPLE-MIB.txt
(Git commit d2797ef699590b4601f584db3168c23e046b2b4e)
* Fri Aug 19 08:53:19 2016 +0200 - Tobias Deiminger <tobias.deiminger@gmail.com>
Fixes for using IpAddress objects as table indices
This incorporates a number of fixes for using IpAddress objects as table
indices: 1. Add missing attributes to IpAddress class' __init__() method
2. Due to an unfixed Net-SNMP issue related to byte order (see
https://sourceforge.net/p/net-snmp/bugs/2136/), we have to pass
IpAddress values in host byte order when used as table indices and
in network byte order otherwise. 3. Improve string representation of
IpAddress in Table.value().
Note: In IpAddress.cref() we don't store a reference to _cidx in "self".
This is only safe if _cidx is consumed by a Net-SNMP function that copies
the value (eg. snmp_varlist_add_variable). If it were used by Net-SNMP as
raw pointer, Pythons reference counting could delete the object while
Net-SNMP still wants to access it.
These changes have been tested on x86_64 (little endian) and mips64 (big
endian) architecture.
(Git commit d0941efe26cccd3adf48c337ada9b7eb1a78802b)
Changes from v0.5.1 to v0.5.2
=============================
* Sat May 28 11:45:51 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Bump copyright year
(Git commit d6edbe4db74c886bc6e69af7452982d143c9f186)
* Sat May 28 11:35:53 2016 +0200 - Pieter Hollants <pieter@hollants.com>
Relicense under the Lesser GNU Public License (LGPL), version 3.
I've decided to relicense python-netsnmpagent under the LGPL instead of
the GPL to facilitate integration with LGPL-licensed as well as
proprietary software. Ie. using python-netsnmpagent in your proprietary
subagent does not mean that you have to license your subagent under
python-netsnmpagent's license as well.
(Git commit f815239c4d76d82d7c620ace1398240f49ad6f83)
Changes from v0.5.0 to v0.5.1
=============================
* Wed May 27 14:00:30 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
netsnmpagent: Fix Table's value() cutting off ASN_COUNTER64 table values
When returning a table row's data, we accessed ASN_COUNTER64 values via a
32-bit pointer, effectively cutting off the other 32 bits. Using the
"data" union's "counter64" pointer fixes this.
(Git commit 3863552a9b9b4d6ef3b1fe79d3659a42a4311b5f)
* Fri Apr 17 10:47:54 2015 +0200 - Pieter Hollants <pieter@hollants.com>
Update README with extended credits
(Git commit 21fd9866f6b4ffedda5234e3d3fedfe46694a907)
* Wed Apr 15 15:19:54 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
Fix format string in threading_agent example's logging
Python 2.6 requires positional argument specifiers, omitting them only
works on Python 2.7 and later.
Cf. https://docs.python.org/2/library/string.html#formatstrings
(Git commit 5e3b6a01b149af160025c932ab91d39f6bb664e6)
* Wed Apr 15 15:25:55 2015 +0300 - Anton Todorov <a.todorov@storpool.com>
examples/run_* scripts: Trap additional signals for cleanup
In some cases the tempdirs were left because we seem to have missed some
signals.
(Git commit 41efac1224b073e3dfbe892da943febbce8cd0ca)
* Sun Mar 22 13:49:46 2015 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Drop special string handling in Table's init()/setRowCell()
Because of issues with strings inside tables, we used to implement some
special handling for (what we thought were) the trailing zero byte in C
strings in Table's init() and setRowCell() methods, passing size+1 to
netsnmp_set_row_column().
However, while this seemed to work on older net-snmp versions, with newer
net-snmp versions we suddently had different issues, with irregular dot
chars appearing at the end of strings.
Turns out, we had a bug, but fixed it at the wrong place: right here,
passing size (not size+1) appears to be correct. a8181ddb fixes the real
culprit in Table's value() method.
(Git commit 84de336dbd3f27814c698659d8bc4c0106d2ce97)
* Sun Mar 22 13:35:58 2015 +0100 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Make Table's value() method regard string lengths
When creating the dictionary returned by the Table class's value()
method, we so far assumed that the strings referenced through the "data"
field in netsnmp_table_data_set_storage structures would be zero
byte-terminated, as all C strings. However, this does not seem to be the
case, as eg. netsnmp_set_row_column() uses memcpy(), not strcpy(), ie.
when setting a string it is NOT zero byte-terminated. We thus need to
regard "data_len" when returning data to the Python world.
Strangely, this does not seem to be necessary with the simple scalar
types such as OctetString and DisplayString which are basically
ctypes.c_char_p objects as well...
(Git commit b70d6cd3cc9ecee55cdb4bed0a246d6782fa7c42)
* Tue Nov 11 15:51:53 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Just some small fixes to unify source code style
(Git commit 24e9b89cb5148f52ba032c5b5b13e1de05aecb15)
* Thu Jul 31 16:10:34 2014 +0200 - Jacobo de Vera <devel@jacobodevera.com>
Rename as suggested in review
(Git commit ccc443fb68fd927ca235c5021716ec4aed158fc3)
* Mon Jul 21 14:25:40 2014 +0200 - Jacobo de Vera <devel@jacobodevera.com>
Make the use of MIB files completely optional
(Git commit a760a4325512771da65f1c6030e9a17ee9ac1d84)
* Mon Jun 1 22:31:45 2015 +0200 - Pieter Hollants <pieter@hollants.com>
Update README
(Git commit d3dfa854e79cbe7ae2c7c05a21c2aa9eed5e3877)
* Fri May 16 23:28:16 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Do not call net-snmp's shutdown_agent() anymore
Unfortunately, the situation is even worse than described in 9c6c5560 so
that we'll have to revert that change. Calling shutdown_agent() will
cause trouble if SNMP objects have been registered (double free()s).
(Git commit 9618ab334f56dbc1fd5d523862bb8355a2a72d8a)
* Fri May 2 01:22:20 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Call net-snmp's shutdown_agent() in shutdown() method
Properly written agents should call shutdown_agent() in addition to
snmp_shutdown() as we did a init_agent() before the init_snmp() call.
Note: with ALL net-snmp versions up to and including the current 5.7.3
beta this will still NOT allow for proper cleanup in such a way that you
could
"del" the netsnmpAgent instance, create a new one and have that one
connect to the master agent successfully. Even with 5.7.x's code cleanups
and the subsequent removal of "#ifdef SHUTDOWN_AGENT_CLEANLY" in snmpd.c,
it still seems to be necessary to exit the process (or thread) and have
the OS do additional cleanup work if a substantially different
netsnmpAgent instance (eg. with a different MasterSocket) is to be
created. Unfortunately this also affects test cases where one wants to
run each test in a defined, clean and reproducible environment.
(Git commit b579a0212f619d76b2e6d2ddbfa06db58f6db27a)
* Fri May 2 01:19:11 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpagent: Rename __del__ to shutdown()
I ran into the common "In Python __del__ is no destructor" trap. The
cleanup code called there was possibly never executed at all. Rename the
method to
"shutdown" to give agents a chance to explicitly call it at their own
shutdown.
(Git commit 7bfac319adc259394c117974a8b539fcc2c80170)
* Thu May 1 13:07:51 2014 +0200 - Pieter Hollants <pieter@hollants.com>
netsnmpapi: define netsnmp_init_mib() instead of unused init_mib()
In netsnmpapi we defined init_mib() but in netsnmpagent we called
netsnmp_init_mib() which was undefined in netsnmpapi. That didn't cause
trouble because a.) ctypes implicitly treated it as being "void
netsnmp_init_mib(void)" and b.) by coincidence that matched the function
signature.
The confusion stemmed from a function rename in the net-snmp project, see
https://www.mail-archive.com/net-snmp-coders%40lists.sourceforge.net/msg08417.html
(Git commit 301a0e8a4b9f319dcf4ed63c9c90ee6064db64ba)
* Sat Apr 19 11:24:05 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Cosmetics
(Git commit 5845f8adc9b21d3497156b71e26ae120364c8a9f)
* Fri Apr 18 14:20:24 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Revert c77f52aaa and c20a48f89 (do not define __version__ ourselves)
c77f52aaa aimed at making a __version__ attribute available inside the
netsnmpagent module by using pkg_resources to retrieve our version
number. c20a48f89 consequently added a RPM spec file dependency on
python-setuptools.
This was clearly wrong, not only because it made running the examples
from within a git clone or a source distribution impossible until "make
install" got executed. It is just not the netsnmpagent module's job to
have any knowledge about its (externally assigned) version number.
Instead of using pkg_resources ourselves, production quality agents that
use our module can
(and should) use pkg_resources if they require a specific
python-netsnmpagent version. After all, they need a installed copy of
python-netsnmpagent anyway, so pkg_resources DOES know its version. This
could look like this:
[...]
Finally, the example agents in the source distribution are always
designed for the corrosponding version of the module, so no need to
express explicit version requirements here that are implicit.
(Git commit 5715e77f2f8e792a0732b1934e9eebefc2e8ee6a)
* Fri Apr 18 00:10:36 2014 +0200 - Pieter Hollants <pieter@hollants.com>
Fix indenting style in setup.py.in
Yes, one could discuss Tabs and Space usage and Tab size and the meaning
of life and all, but for the time being the code style should at least be
consistent.
(Git commit fd42a511844afb0b7c1cb47276b4be547c824508)
* Sat Feb 22 14:32:22 2014 +0100 - Pieter Hollants <pieter@hollants.com>
Add slides from the FOSDEM 2014 lightning talk on python-netsnmpagent
(Git commit 7574563d5d86361032522299fef492277a6023d4)
* Sun Feb 2 10:24:30 2014 +0100 - Daniele Sluijters <github@daenney.net>
setup: Add classifiers, link to Github repo.
(Git commit 0d6452e4fd57f5ad0e7caa3760117f9da121c1c5)
Changes from v0.4.6 to v0.5.0
=============================
* Mon Oct 28 15:14:22 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add RPM spec file dependency on python-setuptools
At least in SLES 11 SP2, the pkg_resources module is only available if
the python-setuptools RPM has been installed. In newer openSUSE versions,
installation python-distribute will satisfy this dependency as well.
(Git commit c20a48f8978fa4cfee9b0a3e0acc9e9ce8a4c705)
* Mon Oct 28 14:33:01 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix Makefile's "install" target
(Git commit a8dad4a36c8358ccff92a38641bc5a5f8bd6db17)
* Sun Oct 27 18:01:43 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Export module's version as obtained from setuptools to enable version
checks
Seeing that python-netsnmpagent keeps gaining features in newer versions,
I thought that it makes sense to make its version number available for
version checks in agent code. Especially since some changes such as those
to logging behavior in 61e9c4aa can not really be tested for.
(Git commit c77f52aaa00fa41352406f9410e61813eefc0183)
* Sun Oct 27 17:44:06 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Distinguish connect failure between first attempt and reconnecting
On the one hand, it does not make sense to BOTH raise a
netsnmpAgentException for connection failure that will undoubtedly be
printed to stderr or logged in some kind of way by agents AND pass on
net-snmp's "Warning" log message to be printed/logged as well.
On the other hand, we can not unconditionally intercept and surpress the
"Warning" log message as there is not only the scenario of connection
failure at startup but also when we got disconnected by the AgentX
master. In the latter case we would get and print/log an "Info" log
message that we were disconnected and net-snmp will retry in, say, 15
seconds and another "Info" when we'd be connected again, but see no log
message for ongoing connection failure.
Thus, this change reworks the netsnmpAgentStatus cases to move away from
a generic DISCONNECTED status to two distinguished FIRSTCONNECT and
RECONNECTING cases: the connection failure log message will be surpressed
and an exception be raised in the FIRSTCONNECT state only.
And while we're at it, ECONNECT was inspired by <errno.h>, of course, but
as I can't imagine other EWHATEVER conditions, I felt CONNECTFAILED to be
a more self-explainatory name.
(Git commit 61e9c4aa81e583d8d21a1d6dbb71c70ac8da0f46)
* Sun Oct 27 13:59:18 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Explicitly document the possible "msgprio" strings
As client code might opt to not just print/log the priority but apply
filtering to it.
(Git commit b9ec11a51a7f89e5cde301a11514f55c2ed894d5)
* Sun Oct 27 13:56:59 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Write out priority levels LOG_EMERG as "Emergency" and LOG_CRIT as
"Critical"
Since we most probably write these to stderr or a logfile, they should be
verbose and unambiguous enough for the user.
(Git commit 1fdcf5637cbab1c2ea548b9377edc7c548cdc24d)
* Sun Oct 27 12:48:58 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add support for custom log handlers
Change b68a9775 implemented detection of connection establishment and
failure by accessing the log messages net-snmp generates. Log messages
were still printed to stderr.
This change allows agents using python-netsnmpagent to define their own
custom log handler function by setting the new "LogHandler" property when
creating the "netsnmpAgent" object. The function will then be called
whenever the net-snmp code generates a log message with two parameters:
1. a string describing the message's priority 2. the text of the message
itself
If "LogHandler" is None, error message will continue to be printed to
stderr, as can be seen in simple_agent.py. Whereas threading_agent.py,
being a step towards a more real-life agent, has been updated to use a
custom "LogHandler" to integrate net-snmp messages in its output more
nicely.
In your own agents, you will instead most likely define a custom log
handler to write the messages to your agent's logfile.
(Git commit f14b919664b7418ed56e0cd3fdf86531501c7c64)
* Fri Oct 25 18:31:58 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Support detecting connection establishment/failure
So far we just relied on net-snmp resp. its init_snmp() function to
establish the AgentX connection to the master snmpd instance and neither
knew nor cared about whether a connection could be established at all. A
mistake in the
"MasterSocket" option would only cause a warning on stderr, emitted by
net-snmp itself, only. Likewise, indication of a successful connection
was through log messages on stderr only, too.
This change introduces support for explicit detection of connection
establishment and failure. To this end, the netsnmpAgent class' internal
"_started" flag was replaced with a "_status" property that can take on
the values defined in the new "netsnmpAgentStatus" enumeration. Your code
should however NOT access this property -- just make sure to catch the
new netsnmpAgentExceptions (implemented in the example agents in
cd4ee23b).
The change is quite large due to the fact that net-snmp itself in neither
the 5.4.x nor 5.7.x versions actually returns status information:
init_snmp() is defined as "void", lending due to the fact that it will
actually trigger a sequence of function calls including callback
functions that return "void" themselves. Unfortunately there is also no
dedicated callback mechanism for client code such as python-netsnmpagent
that gets called on connection status changes. So we had to invent it on
our own, using two callback functions as more or less ugly workarounds: a
custom log handler and, for net-snmp 5.4.x support, another callback
function that abuses a callback hook originally intended for different
purposes. See the sources for details, they are well commented.
In this version, our custom log handler writes all log messages it
receives to stderr, resembling previous behavior with the difference that
we also log a message's priority level as defined by net-snmp, eg.
"[Info] Foo.".
(Git commit b68a977562d3afa05d38044fd12e5e12390c8c64)
* Thu Oct 24 18:05:54 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Add support for catching netsnmpAgentException in example agents
Up to now netsnmpAgent objects were created and their start() methods
called without any error handling. But an upcoming change will introduce
a new netsnmpAgentException that will be raised for error conditions, so
the example agents need to know about them.
(Git commit 436d754db8afbc4e728e5903b155cdefa38ddb6e)
* Thu Oct 24 15:17:01 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Explicitly advertise simple_agent.py's support for state dumping with
SIGHUP
Sending simple_agent.py a SIGHUP signal causes its current variable state
to be dumped again. This is worth a more explicit advertising at agent
startup.
(Git commit 26f971fe48a50b629a5cad57a6f0a8f47811e20d)
* Fri Oct 25 19:23:05 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Fix netsnmpagent.py's docstring (forgot a word)
(Git commit 5cdd84c153449781d17d92e6c38d41cec2a8550f)
Changes from v0.4.5 to v0.4.6
=============================
* Thu Oct 17 22:02:12 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Advertise support for alternative AgentX transports more explicitly
We did already support alternative transports for the AgentX
communication between subagents and master snmpd instances, that is, not
just UNIX domain sockets but eg. also TCP ports. These are specified
through transport specifications that follow the format described in the
"LISTENING ADDRESSES" section in the snmpd(8) manpage.
This change modifies wording that would suggest we supported alternative
UNIX domain socket paths only. It also adds a new script to run
simple_agent.py against a snmpd instance over a TCP port, surprisingly
named
"run_simple_agent_over_tcpsocket.sh".
(Git commit 1cc011ee12ba78dab6eeec25890e15767c55ea07)
* Thu Oct 17 21:43:50 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Move documentation on examples into own README in the examples directory
To put the information closer to where you would be looking for it.
(Git commit 3da5411e9cf7e9233d4ca0443dc1c529c94c0d7e)
* Tue Oct 8 17:55:31 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Update README with new credits
(Git commit 3a0bd17d0934dd6620f30f177a286d821bfd51fc)
* Tue Oct 8 17:53:52 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Update README with net-snmp compatibility remarks
(Git commit 9b4f81efc05c23f11f7689fcb7e71c39a9fcb4a9)
* Tue Oct 8 17:42:05 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Use WATCHER_MAX_SIZE instead of WATCHER_SIZE_STRLEN for 5.4.x
compatibility
We used to rely on net-snmp >= 5.5 behavior by setting a
WATCHER_SIZE_STRLEN flag that didn't exist in net-snmp 5.4.x yet. For
backwards compatibility we now use WATCHER_MAX_SIZE and update the used
netsnmp_watcher_info structure's
"data_size" field ourselves.
Reported by Max "mk23" Kalika <max.kalika+projects@gmail.com>.
(Git commit b15066fb9cd481c24ece736a68b2e22c2e483a67)
* Tue Oct 8 17:27:35 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Fix comment added in 60d51c93
(Git commit 06fa1ded69269d5cc5798ec7f4057aacfa6c58b4)
* Tue Oct 8 17:24:22 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Deref watcher before trying to its max_size property
The netsnmp_watcher_info structure returned by
netsnmp_create_watcher_info is a pointer, so it must be de-referenced
with ctypes' "contents" attribute before any of its properties can be
set.
Reported by Max "mk23" Kalika <max.kalika+projects@gmail.com>.
(Git commit f2078fdabb022aeac48fd676433a0e381047c004)
* Tue Oct 8 16:30:17 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Add missing netsnmp_watcher_info fields definition to netsnmpapi
Basically we do not need fields definitions for net-snmp structures that
we never modify ourselves. However in this case we actually tried setting
netsnmp_watcher_info's "max_size" field which resulted in a no-op.
Reported by Max "mk23" Kalika <max.kalika+projects@gmail.com>.
(Git commit 464d058c24008623fe7e6b4c0d9043fe19ac8151)
* Tue Oct 8 16:21:52 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Explicitly comment why we set watcher_info struct's max_size manually
(Git commit 60d51c9324e1aae8964cb7d46cb1136e0e772d22)
* Fri Jul 19 18:20:24 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Adapt the Makefile's srcdist and rpms targets to the new examples dir
(Git commit e96fd75fe905d2c922da4dacdf110082f50ba4bb)
* Thu Jul 18 17:16:02 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Undo part of fa6e2d9723 (much longer string in simple_agent.py)
That line was intended for debugging only.
(Git commit e194a756b6ca368d0984b2bbea8e420dccb91f14)
* Thu Jul 18 17:13:16 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Use local copy of netsnmpagent module for example agents
So you don't have to "make install" first.
(Git commit fa6e2d9723de724bf619713ad41097b79616d41b)
* Wed Jul 17 23:41:31 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Fix more overseen references to "example" in run_simple_agent.sh
(Git commit 29f77605c12e839a755c122445789bc1f0706823)
* Fri Jul 12 00:05:19 2013 +0200 - Pieter Hollants <pieter@hollants.com>
simple_agent.py: Remove the caret that shouldn't be
Narf...
(Git commit 0e4aa6163a4555e846a0dc6b2a0221782a98d59f)
* Fri Jul 12 00:01:55 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Fix overseen references to "example" that should be "simple"
Thanks to mjs7231 for reporting.
(Git commit 3cb813f430a6d3ba4b3f3508f8f7801957b777de)
* Sun Jul 7 22:38:48 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Small update to the README
- Phrase missing API stability less dramatically
- Add TODO of SNMP notifications/traps
(Git commit ca1f9ce7994a8db6a66efbd4729e8c814d6177f2)
* Sun Jul 7 22:36:51 2013 +0200 - Pieter Hollants <pieter@hollants.com>
New example threading_agent.py demonstrating asynchronous data updates
The default simple_agent.py always blocked until certain events occured,
eg. SNMP requests had to be processed, and only updated its SNMP objects
inbetween. Also SNMP requests couldn't be handled while data was in the
process of being updated. Thus here's a more real life-usable example
that outsources data updating into a separate thread. It does however not
address possible locking issues.
(Git commit c8d08523d707a62d85205b5a0f0260340d38d9ea)
* Sun Jul 7 20:03:43 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Non-functional improvements to the simple agent
simple_agent.py's heading comment block:
- Add note on running the run_simple_agent.sh script
- Add note on using sudo when starting the agent directly
- Encourage user to use own <rosecret> instead of "public"
simple_agent.py's counters code:
- Prettify sort order of code blocks
- Explain initialization value
- Document that increment() is a counter object's method more explicitly
run_simple_agent.sh:
- Mention snmpget as well
(Git commit dff681469369bb61145d0a814e6921d507eec33c)
* Sun Jul 7 14:59:13 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Rename example agent to simple agent
We're going to have other example agents in the examples/ subdirectory as
well, therefore the name "example agent" would be ambiguous. The MIB and
its contents have been renamed, too.
(Git commit 4fadc259ded94736bfd8dd665577fa5877d00faf)
* Sun Jul 7 14:49:05 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Move example agent into new subdir examples/
(Git commit 53f47da9ae4fe1a7b462e57ddb7b6e36abd72931)
Changes from v0.4.4 to v0.4.5
=============================
* Mon Apr 29 15:05:26 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Makefile/RPM spec file: Cosmetics and smaller cleanups
(Git commit b3e7d35531f2f5c983798e15f237a18b59a5233b)
* Mon Apr 29 12:57:57 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Use $@ instead of explicit filename references in ChangeLog Makefile
target
(Git commit 01abbd6e525a8f05fd7bdc2881be8be750c6ef42)
Changes from v0.4.3 to v0.4.4
=============================
* Sun Apr 28 00:51:19 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Use more accurate variable name $PKGREMAIL when building RPM spec file's
%changelog section
The one who uses the .spec file is not necessarily the $AUTHOR of
python-netsnmpagent.
(Git commit 1fc4d6c743dd5827592c594882d264a754753681)
* Sun Apr 28 00:49:42 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Use C locale to generate dates for RPM spec file's %changelog section
RPM might otherwise complain about an "invalid date format" when building
the package..
(Git commit 3e2623d78cd326b1ec87a3d768e871c245b9a8e7)
* Sat Apr 27 19:16:50 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Automatically generate %changelog section for RPM spec file
The spec file uses a different changelog style than the ChangeLog file,
which would be too verbose for this purpose. Usually package maintainers
note changes to the spec file itself here as well and often give a more
high-level summary of changes of the software being packaged. Our
automatically generated changelog will not be of the same quality as we
only indicate the timestamps a version was tagged and an "Update to
version x.y.z"-style message. But until now we didn't use the ChangeLog
section at all. And package maintainers can still replace it with a more
detailed, manually maintained version.
(Git commit e4a21d8fe50e1a86c558101a5f5e1e55015c58e8)
* Sat Apr 27 16:37:25 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Collect RPMs built in dist/ and clean up RPM build dirs
(Git commit d184c128c339846fe2188f36fc94b338745b31d1)
* Sat Apr 27 16:34:41 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Generate RPM spec file along with source distribution archive
Utility of the spec file is increased if it has python-netsnmpagent's
version number already specified -- the old way of requiring a RPM
"--define" only worked when the Git repo was available. Now one can take
the generated dist/python-netsnmpagent.spec along with the source archive
and simply copy it some build host and build.
(Git commit 5a8f0e5afa12e1bb67df45531dd51b47ab33935c)
Changes from v0.4.2 to v0.4.3
=============================
* Wed Apr 24 11:57:29 2013 +0200 - Pieter Hollants <pieter@hollants.com>
Clear counter variable also when a Table object is cleared
(Git commit b4e19f42fa587e135c74785a39090df7a7c7bf83)
Changes from v0.4.1 to v0.4.2
=============================
* Tue Mar 26 19:16:13 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix specfile so it builds on SLES11 and SLES11SP1, too
(Git commit 8e186e646b6fb8cfe53882b930f3a3a5b028f138)
Changes from v0.4 to v0.4.1
===========================
* Tue Mar 26 15:55:24 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fixes to the spec file so it builds for openSUSE, SLES11 and RHEL6
(Git commit b1b1cfe4b746b32142c36fd159b2bbabe0454d18)
Changes from v0.3 to v0.4
=========================
* Sat Mar 23 14:30:04 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add missing prototypes for init_mib() and
netsnmp_table_dataset_remove_and_delete_row()
(Git commit 5c4618526f4def25479503853a67c77d72dfc8ae)
* Sat Mar 23 14:16:47 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add prototype for netsnmp_table_dataset_remove_and_delete_row
(Git commit 8ec11c314dde071ad073dd8ae08c5b67883b2298)
* Sat Mar 23 14:15:23 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Abstract netsnmp_table_dataset_remove_and_delete_row from actual library
as well
Another function that used to be in libnetsnmphelpers in net-snmp <5.6
and now is part of libnetsnmpagent.
(Git commit c068cace7f3aba096705cdc923ca99442bfb1e4e)
* Tue Mar 5 23:30:31 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Update README to reflect commit activity
This is more and more getting fun :-)
(Git commit a6777f189618f413c991d456fb27fe4ba8fbdbb1)
* Tue Mar 5 23:29:38 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Formatting for consistent code style
(Git commit 92385a159bc7249c0c508fc068292b088c652541)
* Tue Mar 5 22:03:37 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Add increment method to asntypes COUNTER and COUNTER64
(Git commit 7d3d7058c01d09086b8ecc85f443cd709f1b1ec3)
* Wed Feb 27 00:50:56 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix ChangeLog generation for the case when we're on a tag
The mechanism erroneously tried to generate a changelog "between vX.Y and
vX.Y" when we're on that very tag.
(Git commit da08641c0ccfe1b43038f3bd840bbc3b2d5253f5)
* Wed Feb 27 00:46:13 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Include documentation and example files in built RPM
Seeing that the module will be installed on many plattforms in form of an
RPM, it is wise to have the documentation files and also the example
agent and its files included.
(Git commit ccf0a05b60ae7a4efa7468e1a3ae7fd2b7cb00ed)
* Tue Mar 5 18:21:15 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Add optional argument to check_and_process as to whether to block
(Git commit eb2d9b8822a4aed6bf10be55b510429049c94122)
Changes from v0.2 to v0.3
=========================
* Wed Feb 27 00:50:56 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix ChangeLog generation for the case when we're on a tag
The mechanism erroneously tried to generate a changelog "between vX.Y and
vX.Y" when we're on that very tag.
(Git commit 78ebb0940c6de00a008e2e2321e9bcf362a90514)
* Wed Feb 27 00:46:13 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Include documentation and example files in built RPM
Seeing that the module will be installed on many plattforms in form of an
RPM, it is wise to have the documentation files and also the example
agent and its files included.
(Git commit c3c9456cd330c99f6bcc6d69c7e1ad0c433fd4a1)
* Tue Feb 26 11:51:08 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Automatically generate ChangeLog from git commits
We now have a ChangeLog automatically generated from the Git history, so
users who do not follow the proceedings in the Git repository itself can
see what has changed between each version. The ChangeLog is built
whenever a source distribution archive is generated. It can also be
explicitly built by using "make ChangeLog".
(Git commit c54fc95c4f7ba3f26c776871d418df54abe704d7)
* Tue Feb 26 11:33:39 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add MANIFEST.in file so source distributions include necessary files
distutils by default expects LICENSE.txt, not LICENSE. It also needs to
be explicitly told about our example agent and associated files.
(Git commit b394bdeaf55c2ad5903c3fbd90409cd2017780bf)
* Mon Feb 25 20:30:20 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Replace hardcoded version number with latest Git tag
With this change, the version number is no longer hard-coded inside
setup.py. Instead, the version number is derived from the latest git tag
using "git describe". The Makefile (which is now more than a pure
convenience Makefile) will generate setup.py from setup.py.in
(which has been renamed accordingly), so that a source distribution
(.tar.gz) will have the correct version number inside.
As a special rule, whenever the Git checkout is not at a tag, "git
describe" will generate a string similar to "0.2-21-g0e10fca", indicating
that there have been 21 commits since the last tag "0.2" and the latest
commit is g0e10fca. We translate this to "0.2_next21_g0e10fca" so a.) RPM
does not complain about the dashes (it doesn't allow them in its
"Version" field) and b.) the "next" indicates that this is a forthcoming
version.
(Git commit 7e920bb4e372f29cc3e0167224689e15bed14104)
* Mon Feb 25 18:52:22 2013 +0100 - Pieter Hollants <pieter@hollants.com>
API change: swap "oidstr" and "initval" arguments for scalar variables
The function signature for create_vartype_class() has changed and as such
the constructor method signature for all classes using the @VarTypeClass
decorator, that is, all classes representing SNMP scalar variables, eg.
Integer32(), Unsigned32() etc. "initval" now comes first so that in
scenarios where we just a SNMP variable without the intent of registering
it we can simply write
agent.Integer32(20)
instead of
agent.Integer32(initval=20)
which, of course, implies "oidstr" == None. The former construct is of
much more use when being interpreted as "initval" instead of "oidstr" as
in
agent.Integer32("EXAMPLE-MIB::exampleInteger32")
which continues requiring an "oidstr=" prefix to work.
This means that if you have already written agents using
python-netsnmpagent and you did not follow the style in example_agent.py
with explicit "initval=" and "oidstr=" qualifiers, you WILL have to adapt
your code.
(Git commit 0e10fca0ce6c34cd6730d3fc73158fe40386e14d)
* Mon Feb 25 18:51:50 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix typo in README (SNMP contents, eh?...)
(Git commit 77dce9d7c43fe2ad68fcdd44917f0e2af73ce56f)
* Fri Feb 22 19:58:43 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Fix counter64 incorrectly setting low and high in c structure
(Git commit 809193cb1d4549f9849164aa7126972894b99e76)
* Fri Feb 22 18:18:48 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Handle wrap of 32bit and 64bit counters
(Git commit 9a2c4430e8011bdd6f2662bef90d63909c6d8003)
* Fri Feb 22 14:06:47 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Distinguish libraries when errors in library loading occur
(Git commit 5c61efa9ef337641bfd26dc98e8600a8afba74d4)
* Fri Feb 22 13:54:16 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Update README with credits
(Git commit 7b5fd128712073343a5c69025c6972dde53f1e02)
* Fri Feb 22 13:52:43 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix example agent's working with SNMP contexts
(Git commit 1d9b0bbc92f02d99c86b2106c5a00598250ba73e)
* Fri Feb 22 13:12:04 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Abstract certain functions from actual library for compatibility with
net-snmp <5.6
From net-snmp 5.5 to 5.6, all code from libnetsnmphelpers.so got
integrated into libnetsnmpagent.so. While this doesn't break C programs
since ld-linux.so will take care of dynamically resolving referenced
symbols, with ctypes all prototype definitions and functions calls always
depend on a particular libX handle.
Therefore we now test using netsnmp_create_watcher_info whether that
function is available in libnetsnmpagent and fall back to
libnetsnmphelpers otherwise. The remaining code now uses libnsX to
abstract from the actual library used.
(Git commit 7f8ec59e26cd2ada809410b053d29a59f0efb3e3)
* Fri Feb 22 13:05:03 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Make comment about net-snmp 5.4.x workaround more verbose
(Git commit d9388eeae15119ff4c5bd3e87578e4ff83b682e3)
* Fri Feb 22 12:15:51 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Work around unresolved dependencies bug in net-snmp 5.4.x libraries
(Git commit 792977b5657e200a13794257bd12622b8d127021)
* Thu Feb 21 23:43:24 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Added context argument to getRegistered and getContexts method
(Git commit 830835b82bb7b976d8e57a28b2e0cbb1157aa2ff)
* Fri Feb 15 13:37:45 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Throw out SuSE-specific python macros from RPM specfile
First of all, this module is noarch by definition. Second, SuSE macros
won't be available on RHEL et al.
(Git commit 9c0409d27624decaa309c998e56787f45ae29b51)
* Fri Feb 15 13:20:50 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Create BUILD directory during RPM build (required for SLES11SP2)
(Git commit 6e66f11ff16e44ae686803980f00bf9121a60f78)
* Thu Feb 14 10:42:48 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Initialize variable so we can detect missing snmpd correctly
(Git commit 53960d8547fdb648c86e5948a2a4db27d2470394)
* Sun Feb 10 12:00:37 2013 +0000 - Steven Hiscocks <steven@hiscocks.me.uk>
Added ability to set context name for SNMP variables
(Git commit ef457b1ea98cdf1a09bfaf705d7f7b5c6f7a6ffd)
* Mon Jan 21 14:41:16 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Rename "PersistentDir" option to "PersistenceDir" and streamline options
in example agent
(Git commit fe0d6b44964b8973f0dc0dc6f6b723d5630b3557)
* Mon Jan 21 13:33:29 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Bump year in copyright notices
(Git commit f3d99ec7b4c36f145cfcc28cbf3bc5d163462f64)
* Mon Jan 21 12:14:28 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix Makefile targets and RPM building
(Git commit 8b25ca9ced0997626a6eb25851c209e4e0f479b7)
Changes from v0.1.1 to v0.2
===========================
* Mon Jan 21 12:13:06 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Increase version number to 0.2
(Git commit 1ba10cab7be6389d65c208df7a5c52c0bebb4f51)
* Mon Jan 21 12:12:32 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add local .spec file and Makefile target for RPM building
(Git commit 116f4b4a9f184764bf3fea0dfc8cc4b9c2b6d668)
* Mon Jan 21 11:02:06 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Synchronize Makefile style with my other projects
(Git commit 446a70cfa71457b463d70e834241600f58e9965c)
* Mon Jan 21 10:55:49 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Fix cleanup of *.pyc files
(Git commit fc66e3ef6ba1b0374c81d9060cfa8a8bd47cee4d)
* Mon Jan 21 10:30:10 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Remove duplicate error handling statements
set -e = set -o errexit
(Git commit cde7b4908fca46ade88eed199d0d9f05c06d7a4d)
* Mon Jan 21 10:29:39 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Synchronize heading comment block style with my other projects
(Git commit 32045ecd31ef39accdebaa46d0b620b82fe61e1e)
* Fri Jan 18 18:49:36 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add missing .0 index for scalar variables
Scalar variables must be registered with register_watched_scalar(), which
automatically adds the ".0" suffix required by the SNMP standards.
(Git commit 0dedf78627ccd9fd6f32361dd1fc82150e5b6a20)
* Wed Jan 16 14:13:50 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add a function to clear the table (ie. remove all table rows)
(Git commit fc2ba0976ec85bc92cd29c71abd348976270d7d8)
* Mon Jan 14 14:39:25 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Support auto-update of row counter variable for tables
A SNMP variable of an integer type can be created and passed in to the
Table() constructor in the "counterobj" property. netsnmpagent will then
auto-increase this variable's value whenever a new row is added with
addRow(). Naturally the variable should be exposed read-only.
(Git commit f607142140200a0acb16bb442332e8d3013fd74c)
* Mon Jan 14 14:38:27 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Make the return value of integer variables types ordinary integers unless
absolutely necessary
(Git commit 8489ea8998b653af3f6df3367f4aa59ca9c38ddb)
* Mon Jan 14 14:13:43 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Rename poll() to check_and_process() for consistency with net-snmp API
The name "poll" wasn't really intuitive, anyway.
(Git commit f2558fee86bd1711893f93f429bb6ea642d21dfb)
* Fri Jan 11 14:54:57 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Update README
(Git commit a2ae83446fb90d2d50080ac2d6f9b1a30bf41940)
* Fri Jan 11 14:50:53 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Make Makefile clean up *.pyc files as well
(Git commit 7f9763d3cc835c56005a204f3a6c3ac4946a2a04)
* Fri Jan 11 14:49:36 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Correct dist target in convenience Makefile
(Git commit 49524931c09337b0d8bc279d20e480d46e4421a9)
* Fri Jan 11 13:44:03 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add dist directory generated by distutils to .gitignore
(Git commit 1e6610b72a81fc291cb7e9e52d69e660cb919ac7)
* Fri Jan 11 13:43:41 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add MANIFEST generated by distutils to .gitignore
(Git commit 8e21655794de6f466b3d7152ae70903a12d4ad04)
Initial version 0.1.1
=====================
* Fri Jan 11 13:36:35 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Bump version number to 0.1.1
(Git commit 34158a2751b42764559930a03e6e4a1328f03709)
* Fri Jan 11 13:35:43 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Modify License specification to conform with openSUSE guidelines
(Git commit 87f978986c9e466cae82e9bb6c4e2231c27888f0)
* Fri Jan 11 13:34:30 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Remove the she-bang from netsnmpagent.py and netsnmpapi.py
These are Python modules not supposed to be called directly.
(Git commit 2a482be4b5f2b4b58867660f20f98e13086ac020)
* Fri Jan 11 13:26:10 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Clean up dist directory as well
(Git commit b0ea63d4658eeca4a69051e5cae63678e2af6024)
* Fri Jan 11 11:22:02 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add convenience Makefile
(Git commit d0ac759c8f1bee0dbf5044023d1b1fd526e59189)
* Fri Jan 11 11:21:16 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Remove python- prefix from package name
(Git commit 8f4fb7377abf39669245506d3b0020e7bfffdee8)
* Thu Jan 10 17:19:10 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Update README
(Git commit 37be34d9cf4cd95ae08c084c9b0c91dd8aa9b202)
* Thu Jan 10 17:08:42 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add distutils-style setup.py script
(Git commit b8f015747f6bcd9413bd1094e9dd88628825e011)
* Thu Jan 10 16:50:39 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add own class for IpAddress to offer more natural Python interface
IP addresses are stored as unsigned integers, but the Python interface
should use strings so that IP addresses can be given in their natural
form, ie. 127.0.0.1.
(Git commit 86cc5a3bed54991eafa171becf30175c1efb451f)
* Thu Jan 10 15:42:54 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Make Table value() method return integer-style values for integers, not
strings
(Git commit 0419cb46d68ab0358babb5af2fbcfed87947fe7c)
* Thu Jan 10 15:36:27 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Let pprint module do the variable dumping in example agent
(Git commit 6af9e9677e243e7601fba0a6e3ac0c40607e83d9)
* Thu Jan 10 15:23:54 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Improve Table value() output
Row indices were returned incorrectly. Also make the returned object a
dictionary containing dictionaries that match the value() output for
Integer32 etc.
(Git commit db79e071de38623ef4acb01e96fdf7293ed526cd)
* Thu Jan 10 15:22:24 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Of course one should use existing data types first...
(Git commit c0fab40bb4c934fada5821c9952e9113274f70d2)
* Thu Jan 10 15:21:03 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add a second example table to demonstrate different index types
(Git commit 628cb7b9a5d4dce83e9938806b28947a2dc62380)
* Thu Jan 10 15:09:08 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetics in example agent's DumpRegistered() output
(Git commit 305d0240414f8e3b8dac35b9132a8ce5e5cc68e5)
* Mon Jan 7 11:51:38 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Make run_example_agent.sh find snmpd within /usr/local as well
(Git commit a5cbdc7bde9a5f323cb28c4678efd78cced77ce1)
* Fri Jan 4 14:54:35 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetics
(Git commit b5eb7c4bdca5957f1e863953730541a2060a79ed)
* Fri Jan 4 14:49:39 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add first implementation of value() method for tables
(Git commit 2e204946984db2b3ad65b662229d82e4e84b955e)
* Fri Jan 4 14:47:09 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add more error handling for netsnmp_ds_set_* calls
(Git commit 7e6f8eddfb8b71f2d60690136df0b52a709e7a62)
* Thu Jan 3 16:18:31 2013 +0100 - Pieter Hollants <pieter@hollants.com>
Add support for Counter64 data type
This one requires actually some help since inheriting from
ctypes.Structure alone does not work. net-snmp uses a C structure of two
long variables internally to store the Counter64 value, so we need to
provide wrapper functions for that.
(Git commit a49b3a6a60e54aa632fca390a3d3afe16534adfd)
* Wed Dec 26 15:08:18 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Update README
(Git commit cca2b90091e1bbf533c7a6cb34d6dbeacef24e74)
* Wed Dec 26 14:58:45 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Fix typos in README
(Git commit f515bafa980673a3353308c2dc69402bcbf49157)
* Wed Dec 26 14:46:25 2012 +0100 - Pieter Hollants <pieter@hollants.com>
First implementation of table support
Among the existing scalar variables, netsnmpagent now supports SNMP
tables. Table objects are defined in terms of the types of the row
indexes, the number of columns, their types and their default row values
and whether they are extendable or not (ie. whether new rows can be added
through snmpset). After creation (and registration), rows can be added
and individual cell contents set.
This implementation does not support the value() method for tables yet.
(Git commit e3c2b42e344544145b2e1335d12327247bf03544)
* Wed Dec 26 14:40:47 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Use a string index type for the exampleTable
In preparation for the upcoming table support, the index type for
exampleTable (exampleTableIndex) was changed to a string type since it'll
make for a more advanced example than an integer type.
(Git commit f696b7fe11e60345130b5e53068c3206691f8c01)
* Wed Dec 26 00:07:04 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Move net-snmp API stuff into own file and define C function prototypes
Everything ctypes and libnetsnmpagent-related has been moved into the new
file netsnmpapi.py that gets imported by netsnmpagent.py. All netsnmp
functions called are now also defined in terms of argument and result
types, similar to C prototypes. To achieve this, the libnetsnmpagent
handle is now defined globally instead of being part of the netsnmpAgent
class.
(Git commit f9114e0cc22665afd37abf224ab9f10861e5c03e)
* Sun Dec 23 22:34:06 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add DISPLAY-HINT for exampleOctetString so UTF-8 encoded strings can be
set properly
(Git commit 44713eb7aba8a80a5747d73775bd427e64a3bd61)
* Sun Dec 23 22:27:21 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Correct max_size calculation for scalar SNMP objects
(Git commit 77b9fb048e2ed477b654475247f952acdef6b439)
* Sun Dec 23 22:24:03 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetical optimization of SNMP object's cref() method
(Git commit a25799afe631c2689e775e7c167263a69a7b6a2f)
* Sun Dec 23 22:20:59 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Reunify SNMP object creation and registration again
It turned out to be unnecessarily complex to maintain consistency with
the seperation of SNMP object creation and registration as introduced in
0f7a4cdbf4677ebae52e0abee2acacd148c50491. Yet, that change is not
literally undone:
- Registration of an SNMP object must now be specified at object creation
time by passing an "oidstr", if desired. If left off, the return object
will remain unbound to the MIB and can be used mostly for object property
inspection. As a consequence, register() was removed again. The new
"writable" parameter to the object's creation method replaces
register()'s "allow_set".
- Previously, objects were created and if register() was called on them,
it called a defined callback method. Now, the object's creation method
calls the renamed _prepareRegistration() method instead and incorporates
_registerWatcher() functionality.
- The variable type's props array no longer needs a "register_func"
member.
(Git commit cb0bb0d44eb4be5c6f9e98920f269020bae2e145)
* Sun Dec 23 21:48:05 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Improve comment for DisplayString method
(Git commit 5a85195fa56046f50d1114ba2ef5ab5e537b6fb7)
* Sun Dec 23 21:39:38 2012 +0100 - Pieter Hollants <pieter@hollants.com>
example_agent.py cosmetics: move agent.start() call before handler
definition
(Git commit 5270e9653eaa5fcc002429b4402aa1fbe197d1c5)
* Sun Dec 23 21:28:14 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add Python shebangs for netsnmpagent.py and example_agent.py
(Git commit 7172cd2edc3aa38be50c5f4c4fe689ae1d4d8031)
* Thu Dec 20 12:22:32 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Fix wrong table column number in EXAMPLE-MIB.txt
(Git commit f12e5c9ff298493ffab58a27f9702485a4b6e4e1)
* Tue Dec 18 14:50:00 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Generalize for SNMP tables, separate SNMP object creation and
registration
This change generalizes netsnmpagent in that we now deal with "SNMP
objects" instead of just SNMP variables. This is in preparation of the
upcoming support of SNMP tables.
Because of the semantics associated with how we will wrap tables, SNMP
object creation and registration under a certain OID are now separate
tasks. SNMP objects now must be explicitly registered (see
example_agent.py).
Further details of the changes:
- Because registering a certain SNMP object is object-dependent, the
VarTypeClass() decorator now expects a new member "register_func" that
specifies the callback function that will be called by the new generic
register() method.
- register() incorporates the former oidstr2oid() method
- The VarTypeClass() decorator's variable registration code went into
register() and the new callback function _registerWatcher() as well.
- Variable type class instances now possess most of the atttributes from
their props[] array such as "asntype" and "flags"
- _data_size and _max_size were not always set correctly
- Variable type class instances now possess a new cref() method which
always returns the correct pointer to the enclosed _cvar, depending on
the variable type
(Git commit 0f7a4cdbf4677ebae52e0abee2acacd148c50491)
* Wed Nov 28 13:30:04 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add run_example_agent.sh script to make running example_agent.py easier
example_agent.py has now learned two command line options:
-m/--master-socket allows specifying the Unix domain socket that
python-netsnmpagent will use to connect to the master snmpd agent and
speak AgentX. -p/--persistent-dir is passed on the net-snmp library and
sets the directory the library will use to store persistance information.
Both parameters are used by the new run_example_agent.sh script to be
able to setup a net-snmp instance running under the current user and
independent from a eventually running system-level snmpd service. They
will also be used by upcoming automatic tests.
run_example_agent takes care of
- creating a temporary directory
- creating a minimal snmpd configuration that especially places all
system file/directory references into the temporary directory instead
- running snmpd with additional necessary parameters
- giving the user guidance as to the right net-snmp CLI utility commands
- running example_agent.py with suitable parameters
- cleanup of the temporary dir upon exit
(Git commit c54e1a67f32fcc086aa0ee4ab8b567bab2391db3)
* Wed Nov 28 12:55:57 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Rename example.py to example_agent.py
(Git commit 6db1ac747835f512aaa1783b1a5a7350429a99c9)
* Wed Nov 28 11:58:25 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add support to modify persistance directory
(Git commit 92388737919b9eb2b6bdc170c41e1c13c06fc21b)
* Wed Nov 28 00:45:06 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Minor cosmetics
(Git commit ee5245d45ff319e30b8f2b8ed4c63463e1b14b62)
* Wed Nov 28 00:41:37 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Fix and expand EXAMPLE-MIB
- Rename IPAddress to IpAddress
- Replace exampleString with exampleOctetString and exampleDisplayString
- Add missing IMPORTs for Counter32, TimeTicks and IpAddress to IpAddress
- Add exampleCounter, exampleTimeTicks, exampleIpAddress,
exampleOctetString and
exampleDisplayString to exampleMIBScalarsGroup conformance group
EXAMPLE-MIB.txt should always be validated with smilint.
(Git commit 3798704e9b4633ebf4a398251e89881b3986dffd)
* Wed Nov 28 00:29:12 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Use single C variable reference and mutable string buffer
String handling was broken. We must use ctypes.create_string_buffer with
a defined MAX_STR_SIZE instead of ctypes.c_char_p because the latter
creates a buffer which a.) Python considered immutable while "snmpset"
would happily write into it and b.) had an implicit maximum size
depending on the initial creation string, causing possible memory
corruption when "snmpset" would be used with a larger string.
It also didn't make much sense to re-create a new ctypes.* instance upon
each SNMP variable update from within the Python agent, because the
integer types were mutable before and strings have become so.
We fill out netsnmp_watcher_info's "max_size" properly now. Required for
string types.
Also discarded the special handling for strings, special handling now
depends on props["flags"] only.
Reordered things in define_and_register() and accordingly renamed it to
register_and_define().
Added more verbose comments about the process of SNMP variable
registration.
(Git commit 65ba9c1223f347eaa5d347c334aa646e61102326)
* Wed Nov 28 00:00:38 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Make example.py dump vars when SIGHUP is received
Also give exampleString a friendlier default value.
(Git commit 98d567461f4ae3f4479bbbabfd4b3e02431ae05a)
* Tue Nov 27 12:45:11 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Implement special handling for c_char_p variable types more explicitly
We need a special case distinction for c_char_p (char *) variables during
variable creation anyway (doesn't use ctypes.byref()), so no need for
props["flags"], which was different for c_char_p only.
Also fix watcher info's max_size as 0 as it is only used if the
WATCHER_MAX_SIZE flag is set which we don't use.
(Git commit 9b4297f4c87b3c16b1e8beaa4aa9010b96985316)
* Mon Nov 26 14:30:54 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Fix check that vars can't be added after agent start
(Git commit ade8000db69ed9520676af6fa6f886ec76ed4f61)
* Mon Nov 26 14:29:38 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetics to make line lengths <= 80 chars
(Git commit 14f8afa4e82c9adb2f52eaf240385453b8606993)
* Mon Nov 26 14:20:31 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetics
(Git commit f328fbe1459bf9d8609bc4bdb84a5a580de794c6)
* Mon Nov 26 14:18:52 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Streamline SNMP variable class definition
Before, there was a netsnmpVariable class and Integer32, Unsigned32,
DisplayString32 etc. classes deriving from it (and an intermediate class
netsnmpIntegerVariable). The variables carried the SNMP registration
intelligence. In addition, netsnmpAgent had an addVar() method and proxy
methods named liked the classes, taking care of creating variable
instance and adding them to an agent's internal variable registry.
Now, netsnmpAgent features a VarTypeClass decorator method that gets
applied to methods Integer32, Unsigned32, DisplayString32 etc. which do
nothing but return a dictionary with variable type properties. The
decorator transforms these functions so that they a.) define the suitable
class b.) create an instance and c.) register that instance with
net-snmp. The classes themselves are now nothing but wrappers for the
ctypes variables. So the registration intelligence (and oidstr2oid()) is
back in netsnmpAgent itself again.-
(Git commit b2e4c4d50c53e070e6635e2051873f1e2104516d)
* Mon Nov 26 13:50:36 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Let example.py print the registered vars for debugging and ease of use
(Git commit 3aa9ac50fd3255fbf5695a1aaab61fd1b818c300)
* Sun Nov 25 23:49:19 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Major rewrite of SNMP variable handling and exposed API
Before, the code using the module (eg. example.py) had to own
ctypes-style variables and deal with conversions etc. netsnmpAgent just
provided a registration function.
Now, netsnmpAgent offers methods that return classes inheriting from a
base class, netsnmpVariable, one class for each variable type. Class
creation requires specification of the OID to register for and indication
whether the variable should be writable using SNMP requests. Each class
obtained this way offers value() and update() methods, called by the
client at its decretion. See example.py how much shorter and nicer this
looks.
The interface is not quite polished yet, currently netsnmpVariable and
deriving classes share the same namespace as netsnmpAgent and require an
"agentlib" argument to get access to netsnmpAgent's libnetsnmpagent
handle. This is currently provided by an addVar method for which there
are in turn wrapper functions named after each variable type. This could
need some improvement, probably using a factory method and/or decorators.
In other news:
- Moved net-snmp constants to the module level to avoid accessibility
problems from within the new netsnmpVariable class and inheriting
classes.
- Removed debug-style print statement that spit out the name of each
loaded MIB upon agent startup
- Simplified library loading code since it looks like libnetsnmpagent
alone will suffice.
(Git commit e4fc68bfdf93998fd622d96d326443ef87a124d6)
* Sat Nov 24 02:05:54 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add support for IPAddress variables
(Git commit 4ffe76d0e967332994ea1da1d5b0c6ee6237bae3)
* Sat Nov 24 00:56:22 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add support for TimeTicks variables
(Git commit fbe5e01239396c7924816bf831e8e78dabc826e2)
* Fri Nov 23 23:42:53 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmectic fix for correct size of Unsigned32 variables
(Git commit 1e6973be62966a0cb4ae6703d9a612d40d863e47)
* Fri Nov 23 23:32:46 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add support for Counter32 variables
(Git commit 7563a6c16491efc86484426218b355ef9236fcf0)
* Fri Nov 23 17:51:54 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Added TODOs
(Git commit e1c7400bbfe951523f15139e6c4c3f85e0942410)
* Fri Nov 23 17:41:00 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add LICENSE
(Git commit 2eb7fb848c1cede41018a340b656feadcd131fbf)
* Fri Nov 23 17:40:15 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add a first version of a README
(Git commit 609ee8edc197914ff0fb1b7d6b955f273ac080db)
* Fri Nov 23 16:28:32 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Added .gitignore to ignore *.pyc files
(Git commit 62574958cf3ff02497bfb07bd9e10a17709947fb)
* Fri Nov 23 16:10:31 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Cosmetics
(Git commit c06ba86f1df7d515b0567559e5ff6483cb302a3b)
* Fri Nov 23 16:10:31 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Add read-only variables support
(Git commit f2def554a8cb54b0ea593da42ffec4daddb97a25)
* Thu Nov 22 22:58:24 2012 +0100 - Pieter Hollants <pieter@hollants.com>
Initial commit
(Git commit ff76a9d3fb6148ed4a6d588358840984eee14e24)
|