-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* swig - adding basic swig * working snmpwalk - okay this is a working copy of snmpwalk :). Happy test cases so far. * Remove main from name - removed main from the function name. Trying to make it more "pythonic". * Update README.md - yay it runs :), why right more code when we can reused what has already been done in the net-snmp/apps code space. Obviously, it isn't very pythonic at the moment, but thats okay for now. * ReOrg - moving stuff into sub folders - pulling in other apps from net-snmp/apps * Interface .i files - adding more inferface i files. one for each c file. * Rename - starting to rename items in src and headers plus interface files. * Single Interface File - making a single entry for all the modules. * Compile & Readme - updating the readme to compile - made one interface to pull in the other modules * Tweaks - changing where we dump the py file - updating the readme * Return string vector - attempt at having snmpwalk return a string vector instead of just printing to stdout. * Compile - getting closer to compilation. * Python Package - attempt to convert into a python package via setup.py * MacOS - this compile on mac os * Compiles On MacOS - this compiles on macos with clang, but not linux with gcc. * Py Module - success, this now works and I can use it inside a python3 terminal * snmpwalk - snmpwalk has been vectorized. * Docs - updating readme with new steps - cleaning up the interface file for snmpwalk. * Update snmpwalk.cpp - no more go to out * snmpget - working on snmpget now :) * Patches - making a dir for patches - doc the cmd that was used - this will be the starting point of pulling in upstream changes and applying the patches on it. * Patch for snmpget - making patch for snmpget. - last few tweaks to the snmpget source code. * snmpbulkwalk - done, with snmpbulkwak * Create snmpbulkwalk.patch - made the snmpbulkwalk patch file * Black - ran black * snmpbulkget - snmpbulkget updated to match rest of interface to return vectors. * Opts - optimizing the c++ wrapper for speed. - reading more swig docs. * autodoc - adding support for python3 type hints - removing/fixing swig alerts * Fix - fixing print of retval * add_first_arg - using the cpp add_first_arg helper to always add the program name to the first argv[0] element. This reduces down what the user has to pass in via higher level languages like python3 * V2.0.0a1 - reworked the directory to have only one copy of "ezsnmp". I removed the old one in favor of the new swig one. As it stands this version is not backwards compatible API wise with the old V1.X.X versions. * Update README.md - I need to move these too the README.rst file. * Workflows - updating workflows to run on new dev branch. * Rename Fixes - fixing some things that missed in the rename from ezsnmp_swig to ezsnmp. * outdir - updated the outdir in the readme file. * packaging - attempting to fix the python module packaging. * Update __init__.py - let's leave __init__ empty for now. * swig Version 4.2.1 - use Version 4.2.1 * Update __init__.py - shorten namespace imports * Docs - saving some notes - updating the readme * Readme - a few tweaks prep for first alpha release.
- Loading branch information
1 parent
c8a6790
commit e5a6134
Showing
41 changed files
with
12,821 additions
and
5,931 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,6 @@ dev/ | |
*/*.log | ||
*.log | ||
wheelhouse/** | ||
.DS_Store | ||
*.o | ||
**.DS_Store** | ||
**venv** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Making the swig interface files | ||
|
||
One look for the netsnmp app file under <https://github.com/net-snmp/net-snmp/tree/5e691a85bcd95a42872933515698309e57832cfc/apps> | ||
|
||
Two copy the c file over, for example `snmpwalk.c`. Then rename to change the extension to `.cpp`. | ||
|
||
Three make a header file for it `snmpwalk.h` and extract methods/functions from the source code. | ||
|
||
Four run the command below to generate the wrap file. | ||
|
||
```bash | ||
swig -c++ -python -builtin -outdir ezsnmp/. -o ezsnmp/src/ezsnmp_wrap.cpp ezsnmp/interface/ezsnmp.i | ||
``` | ||
|
||
* `-c++` to force generation of a `.cpp` file | ||
* `-python` to build a python module | ||
* `-builtin` to build with native python data types. [Python_builtin_types](https://swig.org/Doc4.0/Python.html#Python_builtin_types) | ||
|
||
Five run | ||
|
||
```python3 | ||
clear && rm -drf build ezsnmp.egg-info && python3 -m pip install . | ||
``` | ||
|
||
Six run it in python3 | ||
|
||
```bash | ||
python3 | ||
>>> import ezsnmp | ||
>>> args = ["-v" , "3", "-u", "secondary_sha_aes", "-a", "SHA", "-A", "auth_second", "-x", "AES", "-X" ,"priv_second", "-l", "authPriv", "localhost:11161"] | ||
>>> retval = ezsnmp.snmpwalk(args) | ||
>>> print(retval) | ||
``` | ||
|
||
## Making the patch files | ||
|
||
Within the patches directory run the following command. | ||
|
||
```bash | ||
diff -Naurw ~/Downloads/net-snmp-master/apps/snmpwalk.c ../src/snmpwalk.cpp > snmpwalk.patch | ||
``` | ||
|
||
consider the following names for the api. | ||
`snmp` is redundant in the name since the module `ezsnmp` already has it in its' name. | ||
snmpwalk --> ezsnmp.walk | ||
snmpbulkwalk --> ezsnmp.bulk_walk | ||
snmpget --> ezsnmp.get | ||
snmpbulkget --> ezsnmp.bulk_get | ||
etc... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from .ez import ( # noqa | ||
snmp_get, | ||
snmp_set, | ||
snmp_set_multiple, | ||
snmp_get_next, | ||
snmp_get_bulk, | ||
snmp_walk, | ||
snmp_bulkwalk, | ||
) | ||
from .exceptions import ( # noqa | ||
EzSNMPError, | ||
EzSNMPConnectionError, | ||
EzSNMPTimeoutError, | ||
EzSNMPUnknownObjectIDError, | ||
EzSNMPNoSuchObjectError, | ||
EzSNMPNoSuchInstanceError, | ||
EzSNMPUndeterminedTypeError, | ||
) | ||
from .session import Session # noqa | ||
from .variables import SNMPVariable # noqa | ||
from .ezsnmp import snmpbulkget, snmpget, snmpbulkwalk, snmpwalk |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.