Skip to content

[YANG][SNMP]: Add YANG model for SNMP_AGENT_ADDRESS_CONFIG table#15587

Merged
qiluo-msft merged 4 commits intosonic-net:masterfrom
SuvarnaMeenakshi:agent_add_yang
Jul 27, 2023
Merged

[YANG][SNMP]: Add YANG model for SNMP_AGENT_ADDRESS_CONFIG table#15587
qiluo-msft merged 4 commits intosonic-net:masterfrom
SuvarnaMeenakshi:agent_add_yang

Conversation

@SuvarnaMeenakshi
Copy link
Contributor

@SuvarnaMeenakshi SuvarnaMeenakshi commented Jun 22, 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.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

  • ❌ The email address for the commit (ea5359503260cccf94884585e08bec6633769cae) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please submit a support request ticket.

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

  • ✅ login: SuvarnaMeenakshi (e31e61203091d93f9fadafd2f73abde7098b6e45)
  • ❌ The email address for the commit (ea5359503260cccf94884585e08bec6633769cae) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please submit a support request ticket.

Signed-off-by: Suvarna Meenakshi <[email protected]>
(cherry picked from commit 14dd2cb17751fcd2ee6f57e4c10d69a721206ca7)
leaf vrf_name {
type union {
type string {
pattern '';
Copy link
Collaborator

@qiluo-msft qiluo-msft Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pattern

@ganglyu @wen587 I find empty string is weird. Is it going to impact gnmi path, impact json representation of ConfigDB? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for empty string is because config CLI adds key in CONFIG_TABLE with empty string for vrf if it is not specified in the CLI argument.
https://github.com/sonic-net/sonic-utilities/blob/49fc3896a0ef907ff337467a3e04d2501ef850fd/config/main.py#L3084

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GNMI path can support it, need GCU to confirm.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCU can support it.

@qiluo-msft qiluo-msft added the YANG YANG model related changes label Jun 23, 2023
@SuvarnaMeenakshi
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 15587 in repo sonic-net/sonic-buildimage

@isabelmsft isabelmsft self-requested a review July 27, 2023 23:46
@qiluo-msft qiluo-msft merged commit c8b2d33 into sonic-net:master Jul 27, 2023
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

YANG YANG model related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants