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

Management vrf snmp cli support #472

Merged
merged 3 commits into from
Oct 29, 2019

Conversation

vharish02
Copy link
Contributor

@vharish02 vharish02 commented Feb 26, 2019

CLI commands for configuring few parameters that are required in snmpd.conf.

  1. "snmpd" daemon (snmp agent) shall use this configured IP address and VRF to listen on the particular IP address on that particular VRF.
  2. "snmpd" daemon shall use the configured TRAP IP address and VRF to send the TRAPs to those servers connected in that particular VRF.
    Requried back end snmpd patches are already applied in sonic-buildimage to handle this additional "VRF" configuration.

Configuration
root@sonic:# config vrf add mgmt
root@sonic:# config snmpagentaddress add 100.104.45.9 -v mgmt
root@sonic:# config snmptrap modify 3 100.94.212.7 -v mgmt
root@sonic:# cat /etc/sonic/snmp.yml
snmp_rocommunity: public
snmp_location: public
v1_trap_dest: NotConfigured
v2_trap_dest: NotConfigured
v3_trap_dest: 100.94.212.7:162%mgmt public
snmp_agent_address_1: 100.104.45.9%mgmt

root@sonic:~# docker exec -it snmp bash
The file /etc/snmp/snmpd.conf inside snmp docker shows the following configuration which will be used by snmpd daemon.
Following %mgmt will be used by snmpd to listen to the IP 100.104.45.9 in "mgmt" vrf.
agentAddress 100.104.45.9%mgmt

Following %mgmt will be used by snmpd to send traps to the server 100.94.212.7 in "mgmt" vrf.
informsink 100.94.212.7:162%mgmt public

This commit adds CLI support for management VRF using l3dev. mVRF can
be enabled using config vrf add mgmt and deleted using config vrf del mgmt.
Show commands for management VRF are added which displays the linux command
output, will update show command display after concluding what would be the
output for the show commands.
Added cli to configure management interface(eth0), config interface ip eth0
add can be used to configure eth0 ip and config ip eth0 remove is used to
remove eth0 ip.

New cli config/show commands:

config vrf add mgmt
config vrf del mgmt
config interface eth0 ip add ip/mask gatewayIP
config interface eth0 ip remove ip/mask

show mgmt-vrf
show mgmt-vrf route
show mgmt-vrf addresses
show mgmt-vrf interfaces

Signed-off-by: Harish Venkatraman <[email protected]>
@vharish02 vharish02 force-pushed the managementVRF_snmp_cli_support branch from f6071a6 to b5647b9 Compare July 17, 2019 21:59
@a-barboza
Copy link
Contributor

Are the changes for SNMP CLI described anywhere ?
Can we add additional folks to review ?

@kannankvs
Copy link
Collaborator

@jleveque : We will resolve conflict for the PR after the main mvrf SNMP PR2608 is merged. Let us wait until then.

@kannankvs
Copy link
Collaborator

@a-barboza : We will be explaining these CLIs in the CLI reference manual. If you need the same information to be filled in this PR, let us know.

@a-barboza
Copy link
Contributor

a-barboza commented Sep 24, 2019

  1. Why restart NTP ? (These changes are for SNMP ?)

  2. clear_mgmt command: There are some new commands common to all mgmt-vrf ?
    MGMT_INTERFACE, MGMT_VRF_CONFIG tables ?

  3. There is a new "--gw" option? Why is this only for eth0 ? Can Front Panel (In-Band) port be part of the mgmt-vrf ?

  4. Is the table Updated natshow script to support DNAT Pool changes #1001 reserved for mgmt-vrf, or is it Table# 1 ?

  5. In snmpagentaddress why is the get_entry() there? Is it a No-OP ?

  6. Is the Curl, Wget, SSH also supported for mgmt-vrf ?

  7. Where is the mgmtvrf_ntpq command ?

@kannankvs
Copy link
Collaborator

@a-barboza : We shall look into this PR after we merge the PR463. Request you to kindly review the 463 and provide the comments.

@kannankvs
Copy link
Collaborator

@a-barboza : Reg Q5 "In snmpagentaddress why is the get_entry() there? Is it a No-OP ?",
I assume u meant the following line that is present before set_entry for SNMP_AGENT_ADDRESS_CONFIG.
config_db.get_entry('SNMP_AGENT_ADDRESS_CONFIG', (agentip, vrf))
This No-OP line shall be removed.

@kannankvs
Copy link
Collaborator

This PR has dependency on PR3586 for handling these config change in the backend. Request you to merge this after the PR3586 is merged.

@kannankvs kannankvs closed this Oct 9, 2019
@kannankvs kannankvs reopened this Oct 10, 2019
@kannankvs
Copy link
Collaborator

Dependent PR3586 is merged. Request the reviewers to review this PR.
One build is failing w.r.t. FRR which is nothing related to this PR. Can it be restarted?

@kannankvs
Copy link
Collaborator

kannankvs commented Oct 14, 2019

retest this please

1 similar comment
@kannankvs
Copy link
Collaborator

retest this please

@kannankvs
Copy link
Collaborator

@jleveque, @prsunny : Now that the code freeze deadline is nearing, can you review this and provide comments?

@lguohan lguohan merged commit 8218b09 into sonic-net:master Oct 29, 2019
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jul 27, 2023
)

#### Why I did it
sonic-net/sonic-utilities#472 Added SNMP_AGENT_ADDRESS_CONFIG table in config db.
This PR is to add corresponding YANG model for that table.
##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it
Added YANG modesl for SNMP_AGENT_ADDRESS_CONFIG.

keys: agent_ip, port number, vrf.
CLI implementaion checks if agent_ip, port number already exists in CONFIG_DB table, if it does, then new entry is not added.
So added another condition to ensure combination of agent_ip and port is unique.
Below is an example of how data looks like in DB:
```
127.0.0.1:6379[4]> HGETALL  "SNMP_AGENT_ADDRESS_CONFIG|10.1.1.1|161|foo"
1) "NULL"
2) "NULL"
127.0.0.1:6379[4]> HGETALL "SNMP_AGENT_ADDRESS_CONFIG|10.1.0.32|161|"
1) "NULL"
2) "NULL"
```
#### How to verify it
Added unit-test for various combinations and ensures that it passes.
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
…ic-net#15587)

#### Why I did it
sonic-net/sonic-utilities#472 Added SNMP_AGENT_ADDRESS_CONFIG table in config db.
This PR is to add corresponding YANG model for that table.
##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it
Added YANG modesl for SNMP_AGENT_ADDRESS_CONFIG.

keys: agent_ip, port number, vrf.
CLI implementaion checks if agent_ip, port number already exists in CONFIG_DB table, if it does, then new entry is not added.
So added another condition to ensure combination of agent_ip and port is unique.
Below is an example of how data looks like in DB:
```
127.0.0.1:6379[4]> HGETALL  "SNMP_AGENT_ADDRESS_CONFIG|10.1.1.1|161|foo"
1) "NULL"
2) "NULL"
127.0.0.1:6379[4]> HGETALL "SNMP_AGENT_ADDRESS_CONFIG|10.1.0.32|161|"
1) "NULL"
2) "NULL"
```
#### How to verify it
Added unit-test for various combinations and ensures that it passes.
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.

4 participants