Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbemmel/srl-snmp-set
Using Perl to extend the SRLinux net-snmp module with SET commands to enable/disable interfaces
https://github.com/jbemmel/srl-snmp-set
Last synced: 2 months ago
JSON representation
Using Perl to extend the SRLinux net-snmp module with SET commands to enable/disable interfaces
- Host: GitHub
- URL: https://github.com/jbemmel/srl-snmp-set
- Owner: jbemmel
- License: apache-2.0
- Created: 2021-03-12T02:01:20.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-15T14:37:07.000Z (6 months ago)
- Last Synced: 2024-10-05T17:23:47.994Z (3 months ago)
- Language: Python
- Size: 123 KB
- Stars: 2
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NOTE: !! This code now requires SR Linux 23.10 or later, older versions no longer supported !!
# How to use Perl and gNMIc to extend the SR Linux net-snmp module with SET commands to enable/disable interfaces
Nokia SR Linux comes with an SNMP module based on https://github.com/net-snmp/net-snmp. However, the default configuration only supports read access to a small set of OIDs, and sometimes that is not enough.
Some people have a use case for enabling and disabling interfaces via SNMP. net-snmp has support for various extensions to do this, in this example we will be using a custom Perl module.
# Prerequisites
Enable SNMP in SR Linux:
````
enter candidate
/system snmp
community private
network-instance mgmt admin-state enable source-address [172.20.20.2]
commit stay
````
# Agent
In order to overcome the limitations of manual configuration and to make things manageable through a single configuration file, a sample Python agent is included.
This agent performs the necessary SNMP configuration as described above, when enabled:
```
A:leaf1# /system snmp
--{ + running }--[ system snmp ]--
A:leaf1# info
community $aes$73MtC3Nkc1zg=$hxMfoH62G7g5IgBMzT46vg==
network-instance mgmt {
admin-state enable
enable-set-interface true !!! Agent enabled
source-address [
172.20.20.2
]
}
```# Usage
The following examples assume interface lo0 has index 1073758206:## Admin Enable
```
snmpset -v 2c -c private 172.20.20.2 .1.3.6.1.2.1.2.2.1.7.1073758206 i 1
```
You may be able to use 'ifAdminStatus' instead of the OID '.1.3.6.1.2.1.2.2.1.7' when the corresponding SNMP MIBs are installed## Admin Disable
```
snmpset -v 2c -c private 172.20.20.2 .1.3.6.1.2.1.2.2.1.7.1073758206 i 2
````## Limitations
When done manually, the configuration is not persisted across rebootsThe lab setup includes a minimal complete config file for a "leaf" node, and a delta config file (with only changes relative to the default system configuration) for the "spine"