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

feat(api): add SNMP configuration #36

Merged
merged 1 commit into from
Jul 1, 2024
Merged

feat(api): add SNMP configuration #36

merged 1 commit into from
Jul 1, 2024

Conversation

cpaillet
Copy link
Collaborator

@cpaillet cpaillet commented Jun 18, 2024

As OpenConfig doesn't have SNMP configuration, we use the IETF YANG model defined in RFC 7407: https://datatracker.ietf.org/doc/rfc7407/

This review includes:

  • An ingestor from the NetBox-Network-CMDB SNMP API endpoint.
    netbox endpoint:
{
            "device": {
                "id": 60335,
                "name": "ra19.05.jp2.pnet.crto.io"
            },
            "community_list": [
                {
                    "name": "global_ro",
                    "community": "mufdqsdfqsdf",
                    "type": "readonly"
                },
                {
                    "name": "globalrw",
                    "community": "qsdfqsfqsfqsdfdqsdf",
                    "type": "readwrite"
                }
            ],
            "location": "loc1",
            "contact": "cc2"
}
  • Generate IETF Go code from the YANG model.
  • A converter to map NetBox-Network-CMDB to the YANG model.
  • Create new endpoints:
    • /v1/devices/:hostname/ietfconfig
{
   "snmp":{
      "community":[
         {
            "index":"global_ro",
            "security-name":"readonly",
            "text-name":"mufdqsdfqsdf"
         },
         {
            "index":"globalrw",
            "security-name":"readwrite",
            "text-name":"qsdfqsfqsfqsdfdqsdf"
         }
      ]
   },
   "system":{
      "contact":"cc2",
      "location":"loc1"
   }
}
  • /v1/devices/:hostname/config
  {
   "ietf":{
      "snmp":{
         "community":[
            {
               "index":"global_ro",
               "security-name":"readonly",
               "text-name":"mufdqsdfqsdf"
            },
            {
               "index":"globalrw",
               "security-name":"readwrite",
               "text-name":"qsdfqsfqsfqsdfdqsdf"
            }
         ]
      },
      "system":{
         "contact":"cc2",
         "location":"loc1"
      }
   },
   "openconfig":{ <..curent openconfig..>

internal/convertor/snmp/snmp.go Show resolved Hide resolved
internal/convertor/snmp/snmp.go Show resolved Hide resolved
@cpaillet cpaillet requested a review from a team June 19, 2024 14:06
internal/convertor/device/device.go Outdated Show resolved Hide resolved
internal/convertor/device/device.go Outdated Show resolved Hide resolved
internal/convertor/device/device.go Outdated Show resolved Hide resolved
internal/convertor/device/serializer.go Outdated Show resolved Hide resolved
internal/convertor/device/device.go Outdated Show resolved Hide resolved
As OpenConfig doesn't have SNMP configuration, we use the IETF YANG model defined in
RFC 7407: https://datatracker.ietf.org/doc/rfc7407/

This review includes:
- An ingestor from the NetBox-Network-CMDB SNMP API endpoint.
- Generate IETF Go code from the YANG model.
- A converter to map NetBox-Network-CMDB to the YANG model.
- Create new endpoints:
  - /v1/devices/:hostname/ietfconfig
  - /v1/devices/:hostname/config
@cpaillet cpaillet merged commit 45d4207 into criteo:main Jul 1, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants