Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejs and typescript #53

Open
yboujraf opened this issue Dec 10, 2019 · 6 comments
Open

Nodejs and typescript #53

yboujraf opened this issue Dec 10, 2019 · 6 comments

Comments

@yboujraf
Copy link

Dear

any chance to have your mib parser in nodejs and typescript or javascript?

Best Regards
Youssef

@etingof
Copy link
Owner

etingof commented Dec 10, 2019

Do you mean MIBs transformed into JSON objects (which is already done) or the entire code base rewritten in some other language (which is unlikely)?

@yboujraf
Copy link
Author

yboujraf commented Dec 10, 2019

Dear @etingof

Thanks for your quick answer.

Topic 1 : Node.js & typescript or javascript

Yes I am looking for a Mib parser where all dependencies are included in a folder and with the parser to check if no dependency is missing , if not , need to be transformed into json object into a file in Node.js and typescript or javascript ?

I read your documentation and it 's exactly what I am looking for but can't use because only supporting node.js and typescript.

This tools for us is more to look for parameters to control a device are available. You know most of the time the sale guy sell more than the device can do or could do ;-)

This is the example I have found in github but for example when it is a sequence, it is not clear and missing the all definition of the asn structure :

mib.zip

Sample where some index in a parameter are incorrect or could not be parsed

Could you try if you could parse and create the json file ?

TT1260-MIBS.zip
RX1290_MIBs.zip

Thanks in advance if you could help me or share some links ?

Best Regards,
Youssef

@etingof
Copy link
Owner

etingof commented Dec 10, 2019

I am still confused, I am not sure I understand what you need.

If you have MIB in JSON form, can't it be readily consumed by JS code?

PySMI parser will fail on unresolved dependencies between MIB modules. So JSONs it produces are always valid in that regard.

If you are looking for some other structure of JSON document, PySMI is entirely driven by Jinja2 templates - you can create your own and render some other JSON.

@yboujraf
Copy link
Author

Dear @etingof

Sorry to confusing you.

I have only Mib files with dependencies sometime missing and need to google to download it.

Now I need to parse the Mib files with the dependencies and to transform them into json object and look like we have a mib browser.

the picture is just to showing the structure expected but we don't want to create a mib browser.

image

We have a gateway that needs to exchange data between snmp and proprietary protocol.

Then If I could parse the mibs , generate with success the json object file, I am saved ;-)

Again Best regards
Youssef

@etingof
Copy link
Owner

etingof commented Dec 10, 2019

PySMI's mibdump tool can generate a JSON like this from any given MIB. The tool will attempt to download dependencies from mibs.snmplabs.com. If the dependency is missing, the whole compilation will fail.

If JSON structure referenced above does not suit your needs, you can probably reshape it with common JSON manipulation tools.

@lextm
Copy link

lextm commented Nov 14, 2022

Writing a MIB parser is nothing new than applying lex & yacc to the ASN.1 and SMI based grammar. So, if this project can do it for Python, you can also do the same for JavaScript/TypeScript.

Writing parsers/compilers is not a trivial topic even for computer science students. Therefore, rarely you see an open source one if clearly there is value in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants