pysmi-lextudio


Namepysmi-lextudio JSON
Version 1.4.3 PyPI version JSON
download
home_pagehttps://github.com/lextudio/pysmi
SummaryA pure-Python implementation of SNMP/SMI MIB parsing and conversion library.
upload_time2024-04-03 15:32:57
maintainerNone
docs_urlNone
authorIlya Etingof
requires_python<4.0,>=3.8
licenseBSD-2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
SNMP MIB Compiler
-----------------

[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-lextudio-orange.svg?style=for-readme)](https://github.com/sponsors/lextudio)
[![PyPI](https://img.shields.io/pypi/v/pysmi-lextudio.svg?maxAge=2592000)](https://pypi.org/project/pysmi-lextudio)
[![PyPI Downloads](https://img.shields.io/pypi/dd/pysmi-lextudio)](https://pypi.python.org/pypi/pysmi-lextudio/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pysmi-lextudio.svg)](https://pypi.org/project/pysmi-lextudio/)
[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/lextudio/pysmi/master/LICENSE.rst)

PySMI is a pure-Python implementation of
[SNMP SMI](https://en.wikipedia.org/wiki/Management_information_base) MIB parser.
This tool is designed to turn ASN.1 MIBs into various formats. As of this moment,
JSON and [PySNMP](https://github.com/lextudio/pysnmp) modules can be generated
from ASN.1 MIBs.

Features
--------

* Understands SMIv1, SMIv2 and de-facto SMI dialects
* Turns MIBs into PySNMP classes and JSON documents
* Maintains an index of MIB objects over many MIB modules
* Automatically pulls ASN.1 MIBs from local directories, ZIP archives,
  and HTTP servers
* 100% Python, works with Python 3.8+

Rendered PySMI documentation can be found at [PySMI site](https://www.pysnmp.com/pysmi).

How to use PySMI
----------------

If you are using PySNMP, you might never notice PySMI presence - PySNMP
calls PySMI for MIB download and compilation behind the scenes (you can
still can do that manually by invoking *mibdump* tool).

To turn ASN.1 MIB into a JSON document, call *mibdump* tool like this:

```
$ mibdump --generate-mib-texts  --destination-format json IF-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, https://mibs.pysnmp.com/asn1/@mib@
Borrow missing/failed MIBs from: https://mibs.pysnmp.com/json/fulltexts/@mib@
Existing/compiled MIB locations:
Compiled MIBs destination directory: .
MIBs excluded from code generation: RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI,
RFC1158-MIB, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM
MIBs to compile: IF-MIB
Destination format: json
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: yes
Do not create/update MIBs: no
Byte-compile Python modules: no (optimization level no)
Ignore compilation errors: no
Generate OID->MIB index: no
Generate texts in MIBs: yes
Keep original texts layout: no
Try various filenames while searching for MIB module: yes
Created/updated MIBs: IANAifType-MIB, IF-MIB, SNMPv2-MIB
Pre-compiled MIBs borrowed:
Up to date MIBs: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
```

JSON document build from
[IF-MIB module](https://mibs.pysnmp.com/asn1/IF-MIB)
would hold information such as:

``` json
   {
      "ifMIB": {
          "name": "ifMIB",
          "oid": "1.3.6.1.2.1.31",
          "class": "moduleidentity",
          "revisions": [
            "2007-02-15 00:00",
            "1996-02-28 21:55",
            "1993-11-08 21:55"
          ]
        },
      // ...
      "ifTestTable": {
        "name": "ifTestTable",
        "oid": "1.3.6.1.2.1.31.1.3",
        "nodetype": "table",
        "class": "objecttype",
        "maxaccess": "not-accessible"
      },
      "ifTestEntry": {
        "name": "ifTestEntry",
        "oid": "1.3.6.1.2.1.31.1.3.1",
        "nodetype": "row",
        "class": "objecttype",
        "maxaccess": "not-accessible",
        "augmention": {
          "name": "ifTestEntry",
          "module": "IF-MIB",
          "object": "ifEntry"
        }
      },
      "ifTestId": {
        "name": "ifTestId",
        "oid": "1.3.6.1.2.1.31.1.3.1.1",
        "nodetype": "column",
        "class": "objecttype",
        "syntax": {
          "type": "TestAndIncr",
          "class": "type"
        },
        "maxaccess": "read-write"
      },
      // ...
   }
```

In general, converted MIBs capture all aspects of original (ASN.1) MIB contents
and layout. The snippet above is just a partial example, but here is the
complete [IF-MIB.json](https://mibs.pysnmp.com/json/fulltexts/IF-MIB.json)
file.

Besides one-to-one MIB conversion, PySMI library can produce JSON index to
facilitate fast MIB information lookup across large collection of MIB files.

For example, JSON index for
[IP-MIB.json](https://mibs.pysnmp.com/json/asn1/IP-MIB),
[TCP-MIB.json](https://mibs.pysnmp.com/json/asn1/TCP-MIB) and
[UDP-MIB.json](https://mibs.pysnmp.com/json/asn1/UDP-MIB)
modules would keep information like this:

``` json
   {
      "compliance": {
         "1.3.6.1.2.1.48.2.1.1": [
           "IP-MIB"
         ],
         "1.3.6.1.2.1.49.2.1.1": [
           "TCP-MIB"
         ],
         "1.3.6.1.2.1.50.2.1.1": [
           "UDP-MIB"
         ]
      },
      "identity": {
          "1.3.6.1.2.1.48": [
            "IP-MIB"
          ],
          "1.3.6.1.2.1.49": [
            "TCP-MIB"
          ],
          "1.3.6.1.2.1.50": [
            "UDP-MIB"
          ]
      },
      "oids": {
          "1.3.6.1.2.1.4": [
            "IP-MIB"
          ],
          "1.3.6.1.2.1.5": [
            "IP-MIB"
          ],
          "1.3.6.1.2.1.6": [
            "TCP-MIB"
          ],
          "1.3.6.1.2.1.7": [
            "UDP-MIB"
          ],
          "1.3.6.1.2.1.49": [
            "TCP-MIB"
          ],
          "1.3.6.1.2.1.50": [
            "UDP-MIB"
          ]
      }
   }
```

With this example, *compliance* and *identity* keys point to
*MODULE-COMPLIANCE* and *MODULE-IDENTITY* MIB objects, *oids*
list top-level OIDs branches defined in MIB modules. Full index
build over thousands of MIBs could be seen
[here](https://mibs.pysnmp.com/json/index.json).

The PySMI library can automatically fetch required MIBs from HTTP sites
or local directories. You could configure any MIB source available to you (including
[https://mibs.pysnmp.com/asn1/](https://mibs.pysnmp.com/asn1/)) for that purpose.

How to get PySMI
----------------

The pysmi package is distributed under terms and conditions of 2-clause
BSD [license](https://www.pysnmp.com/pysmi/license.html). Source code is freely
available as a GitHub [repo](https://github.com/lextudio/pysmi).

You could `pip install pysmi-lextudio` or download it from [PyPI](https://pypi.org/project/pysmi-lextudio/).

If something does not work as expected,
[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub or
post your question [on Stack Overflow](https://stackoverflow.com/questions/ask).

Copyright (c) 2015-2020, [Ilya Etingof](mailto:etingof@gmail.com).
Copyright (c) 2022-2024, [LeXtudio Inc.](mailto:support@lextudio.com).
All rights reserved.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lextudio/pysmi",
    "name": "pysmi-lextudio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ilya Etingof",
    "author_email": "etingof@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/0c/bec628167236bfea4bdf780f573f9c16f8977d1fe1e9123100abb1e7b683/pysmi_lextudio-1.4.3.tar.gz",
    "platform": null,
    "description": "\nSNMP MIB Compiler\n-----------------\n\n[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-lextudio-orange.svg?style=for-readme)](https://github.com/sponsors/lextudio)\n[![PyPI](https://img.shields.io/pypi/v/pysmi-lextudio.svg?maxAge=2592000)](https://pypi.org/project/pysmi-lextudio)\n[![PyPI Downloads](https://img.shields.io/pypi/dd/pysmi-lextudio)](https://pypi.python.org/pypi/pysmi-lextudio/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pysmi-lextudio.svg)](https://pypi.org/project/pysmi-lextudio/)\n[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/lextudio/pysmi/master/LICENSE.rst)\n\nPySMI is a pure-Python implementation of\n[SNMP SMI](https://en.wikipedia.org/wiki/Management_information_base) MIB parser.\nThis tool is designed to turn ASN.1 MIBs into various formats. As of this moment,\nJSON and [PySNMP](https://github.com/lextudio/pysnmp) modules can be generated\nfrom ASN.1 MIBs.\n\nFeatures\n--------\n\n* Understands SMIv1, SMIv2 and de-facto SMI dialects\n* Turns MIBs into PySNMP classes and JSON documents\n* Maintains an index of MIB objects over many MIB modules\n* Automatically pulls ASN.1 MIBs from local directories, ZIP archives,\n  and HTTP servers\n* 100% Python, works with Python 3.8+\n\nRendered PySMI documentation can be found at [PySMI site](https://www.pysnmp.com/pysmi).\n\nHow to use PySMI\n----------------\n\nIf you are using PySNMP, you might never notice PySMI presence - PySNMP\ncalls PySMI for MIB download and compilation behind the scenes (you can\nstill can do that manually by invoking *mibdump* tool).\n\nTo turn ASN.1 MIB into a JSON document, call *mibdump* tool like this:\n\n```\n$ mibdump --generate-mib-texts  --destination-format json IF-MIB\nSource MIB repositories: file:///usr/share/snmp/mibs, https://mibs.pysnmp.com/asn1/@mib@\nBorrow missing/failed MIBs from: https://mibs.pysnmp.com/json/fulltexts/@mib@\nExisting/compiled MIB locations:\nCompiled MIBs destination directory: .\nMIBs excluded from code generation: RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI,\nRFC1158-MIB, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM\nMIBs to compile: IF-MIB\nDestination format: json\nParser grammar cache directory: not used\nAlso compile all relevant MIBs: yes\nRebuild MIBs regardless of age: yes\nDo not create/update MIBs: no\nByte-compile Python modules: no (optimization level no)\nIgnore compilation errors: no\nGenerate OID->MIB index: no\nGenerate texts in MIBs: yes\nKeep original texts layout: no\nTry various filenames while searching for MIB module: yes\nCreated/updated MIBs: IANAifType-MIB, IF-MIB, SNMPv2-MIB\nPre-compiled MIBs borrowed:\nUp to date MIBs: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC\nMissing source MIBs:\nIgnored MIBs:\nFailed MIBs:\n```\n\nJSON document build from\n[IF-MIB module](https://mibs.pysnmp.com/asn1/IF-MIB)\nwould hold information such as:\n\n``` json\n   {\n      \"ifMIB\": {\n          \"name\": \"ifMIB\",\n          \"oid\": \"1.3.6.1.2.1.31\",\n          \"class\": \"moduleidentity\",\n          \"revisions\": [\n            \"2007-02-15 00:00\",\n            \"1996-02-28 21:55\",\n            \"1993-11-08 21:55\"\n          ]\n        },\n      // ...\n      \"ifTestTable\": {\n        \"name\": \"ifTestTable\",\n        \"oid\": \"1.3.6.1.2.1.31.1.3\",\n        \"nodetype\": \"table\",\n        \"class\": \"objecttype\",\n        \"maxaccess\": \"not-accessible\"\n      },\n      \"ifTestEntry\": {\n        \"name\": \"ifTestEntry\",\n        \"oid\": \"1.3.6.1.2.1.31.1.3.1\",\n        \"nodetype\": \"row\",\n        \"class\": \"objecttype\",\n        \"maxaccess\": \"not-accessible\",\n        \"augmention\": {\n          \"name\": \"ifTestEntry\",\n          \"module\": \"IF-MIB\",\n          \"object\": \"ifEntry\"\n        }\n      },\n      \"ifTestId\": {\n        \"name\": \"ifTestId\",\n        \"oid\": \"1.3.6.1.2.1.31.1.3.1.1\",\n        \"nodetype\": \"column\",\n        \"class\": \"objecttype\",\n        \"syntax\": {\n          \"type\": \"TestAndIncr\",\n          \"class\": \"type\"\n        },\n        \"maxaccess\": \"read-write\"\n      },\n      // ...\n   }\n```\n\nIn general, converted MIBs capture all aspects of original (ASN.1) MIB contents\nand layout. The snippet above is just a partial example, but here is the\ncomplete [IF-MIB.json](https://mibs.pysnmp.com/json/fulltexts/IF-MIB.json)\nfile.\n\nBesides one-to-one MIB conversion, PySMI library can produce JSON index to\nfacilitate fast MIB information lookup across large collection of MIB files.\n\nFor example, JSON index for\n[IP-MIB.json](https://mibs.pysnmp.com/json/asn1/IP-MIB),\n[TCP-MIB.json](https://mibs.pysnmp.com/json/asn1/TCP-MIB) and\n[UDP-MIB.json](https://mibs.pysnmp.com/json/asn1/UDP-MIB)\nmodules would keep information like this:\n\n``` json\n   {\n      \"compliance\": {\n         \"1.3.6.1.2.1.48.2.1.1\": [\n           \"IP-MIB\"\n         ],\n         \"1.3.6.1.2.1.49.2.1.1\": [\n           \"TCP-MIB\"\n         ],\n         \"1.3.6.1.2.1.50.2.1.1\": [\n           \"UDP-MIB\"\n         ]\n      },\n      \"identity\": {\n          \"1.3.6.1.2.1.48\": [\n            \"IP-MIB\"\n          ],\n          \"1.3.6.1.2.1.49\": [\n            \"TCP-MIB\"\n          ],\n          \"1.3.6.1.2.1.50\": [\n            \"UDP-MIB\"\n          ]\n      },\n      \"oids\": {\n          \"1.3.6.1.2.1.4\": [\n            \"IP-MIB\"\n          ],\n          \"1.3.6.1.2.1.5\": [\n            \"IP-MIB\"\n          ],\n          \"1.3.6.1.2.1.6\": [\n            \"TCP-MIB\"\n          ],\n          \"1.3.6.1.2.1.7\": [\n            \"UDP-MIB\"\n          ],\n          \"1.3.6.1.2.1.49\": [\n            \"TCP-MIB\"\n          ],\n          \"1.3.6.1.2.1.50\": [\n            \"UDP-MIB\"\n          ]\n      }\n   }\n```\n\nWith this example, *compliance* and *identity* keys point to\n*MODULE-COMPLIANCE* and *MODULE-IDENTITY* MIB objects, *oids*\nlist top-level OIDs branches defined in MIB modules. Full index\nbuild over thousands of MIBs could be seen\n[here](https://mibs.pysnmp.com/json/index.json).\n\nThe PySMI library can automatically fetch required MIBs from HTTP sites\nor local directories. You could configure any MIB source available to you (including\n[https://mibs.pysnmp.com/asn1/](https://mibs.pysnmp.com/asn1/)) for that purpose.\n\nHow to get PySMI\n----------------\n\nThe pysmi package is distributed under terms and conditions of 2-clause\nBSD [license](https://www.pysnmp.com/pysmi/license.html). Source code is freely\navailable as a GitHub [repo](https://github.com/lextudio/pysmi).\n\nYou could `pip install pysmi-lextudio` or download it from [PyPI](https://pypi.org/project/pysmi-lextudio/).\n\nIf something does not work as expected,\n[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub or\npost your question [on Stack Overflow](https://stackoverflow.com/questions/ask).\n\nCopyright (c) 2015-2020, [Ilya Etingof](mailto:etingof@gmail.com).\nCopyright (c) 2022-2024, [LeXtudio Inc.](mailto:support@lextudio.com).\nAll rights reserved.\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "A pure-Python implementation of SNMP/SMI MIB parsing and conversion library.",
    "version": "1.4.3",
    "project_urls": {
        "Homepage": "https://github.com/lextudio/pysmi",
        "Repository": "https://github.com/lextudio/pysmi"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ef48a64590456991348c99b526aec421ced5d0b4e7c1f05baf02a8338be4464",
                "md5": "4f2160670e62fc5a1dc2d5c5eed2bbb5",
                "sha256": "cb629c6386a30c976f83c29fc71e53b06d60f15094d0c0114cf8d095351b76e5"
            },
            "downloads": -1,
            "filename": "pysmi_lextudio-1.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4f2160670e62fc5a1dc2d5c5eed2bbb5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 83711,
            "upload_time": "2024-04-03T15:32:56",
            "upload_time_iso_8601": "2024-04-03T15:32:56.140240Z",
            "url": "https://files.pythonhosted.org/packages/0e/f4/8a64590456991348c99b526aec421ced5d0b4e7c1f05baf02a8338be4464/pysmi_lextudio-1.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c80cbec628167236bfea4bdf780f573f9c16f8977d1fe1e9123100abb1e7b683",
                "md5": "64c721cfe25497a60b252c2f554700c0",
                "sha256": "7d255fb38669410835acf6c2e8ab41975a6d8e64593b119552e36ecba004054f"
            },
            "downloads": -1,
            "filename": "pysmi_lextudio-1.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "64c721cfe25497a60b252c2f554700c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 108710,
            "upload_time": "2024-04-03T15:32:57",
            "upload_time_iso_8601": "2024-04-03T15:32:57.799606Z",
            "url": "https://files.pythonhosted.org/packages/c8/0c/bec628167236bfea4bdf780f573f9c16f8977d1fe1e9123100abb1e7b683/pysmi_lextudio-1.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 15:32:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lextudio",
    "github_project": "pysmi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pysmi-lextudio"
}
        
Elapsed time: 0.52531s