cherry-picked snmp sonic-yang file from 2bb8306d8e (#13896)

This commit is contained in:
suresh-rupanagudi 2023-02-21 22:01:50 +05:30 committed by GitHub
parent 25ead73d10
commit d1d5bce4f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 204 additions and 1 deletions

View File

@ -127,6 +127,7 @@ setup(
'./yang-models/sonic-route-map.yang',
'./yang-models/sonic-routing-policy-sets.yang',
'./yang-models/sonic-sflow.yang',
'./yang-models/sonic-snmp.yang',
'./yang-models/sonic-syslog.yang',
'./yang-models/sonic-system-aaa.yang',
'./yang-models/sonic-system-tacacs.yang',
@ -189,6 +190,7 @@ setup(
'./cvlyang-models/sonic-route-map.yang',
'./cvlyang-models/sonic-routing-policy-sets.yang',
'./cvlyang-models/sonic-sflow.yang',
'./cvlyang-models/sonic-snmp.yang',
'./cvlyang-models/sonic-system-aaa.yang',
'./cvlyang-models/sonic-system-tacacs.yang',
'./cvlyang-models/sonic-telemetry.yang',

View File

@ -1908,8 +1908,24 @@
"LAG"
]
}
},
},
"SNMP": {
"CONTACT": {
"Contact": "testuser@contoso.com"
},
"LOCATION": {
"Location": "SNMP Server Location"
}
},
"SNMP_COMMUNITY": {
"public": {
"TYPE": "RO"
},
"private": {
"TYPE": "RW"
}
},
"LOSSLESS_TRAFFIC_PATTERN": {
"AZURE": {
"mtu": "1024",

View File

@ -0,0 +1,28 @@
{
"SNMP_SYSTEM_TEST": {
"desc": "Load SNMP sysContact and sysLocation."
},
"SNMP_SYSTEM_CONTACT_NEG_TEST": {
"desc": "Load SNMP sysContact with empty string",
"eStrKey": "Range"
},
"SNMP_SYSTEM_LOCATION_NEG_TEST": {
"desc": "Load SNMP sysContact with empty string",
"eStrKey": "Range"
},
"SNMP_COMMUNITY_TEST": {
"desc": "Load SNMP community string."
},
"SNMP_COMMUNITY_MIN_NEG_TEST": {
"desc": "Load SNMP community string of length < 3.",
"eStrKey": "Range"
},
"SNMP_COMMUNITY_MAX_NEG_TEST": {
"desc": "Load SNMP community string of lenth > 32.",
"eStrKey": "Range"
},
"SNMP_COMMUNITY_WRONG_TYPE_TEST": {
"desc": "Load SNMP community string with un supported type.",
"eStrKey": "InvalidValue"
}
}

View File

@ -0,0 +1,83 @@
{
"SNMP_SYSTEM_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP": {
"CONTACT": {
"Contact": "support@xyz.com"
},
"LOCATION": {
"Location": "Test location"
}
}
}
},
"SNMP_SYSTEM_CONTACT_NEG_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP": {
"CONTACT": {
"Contact": ""
}
}
}
},
"SNMP_SYSTEM_LOCATION_NEG_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP": {
"LOCATION": {
"Location": ""
}
}
}
},
"SNMP_COMMUNITY_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP_COMMUNITY": {
"SNMP_COMMUNITY_LIST": [
{
"name": "sonicSnmp",
"TYPE": "RO"
},
{
"name": "sonicSnmpRW",
"TYPE": "RW"
}
]
}
}
},
"SNMP_COMMUNITY_MIN_NEG_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP_COMMUNITY": {
"SNMP_COMMUNITY_LIST": [
{
"name": "abc"
}
]
}
}
},
"SNMP_COMMUNITY_MAX_NEG_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP_COMMUNITY": {
"SNMP_COMMUNITY_LIST": [
{
"name": "01234567890123456789012345678901234"
}
]
}
}
},
"SNMP_COMMUNITY_WRONG_TYPE_TEST": {
"sonic-snmp:sonic-snmp": {
"sonic-snmp:SNMP_COMMUNITY": {
"SNMP_COMMUNITY_LIST": [
{
"name": "sonicSnmp",
"TYPE": "RR"
}
]
}
}
}
}

View File

@ -0,0 +1,74 @@
module sonic-snmp {
namespace "http://github.com/Azure/sonic-snmp";
prefix ssnmp;
yang-version 1.1;
organization
"SONiC";
contact
"SONiC";
description
"SONIC SNMP";
revision 2022-05-13 {
description
"Initial revision.";
}
container sonic-snmp {
container SNMP {
container CONTACT {
leaf Contact {
type string {
length "1..255";
}
description
"SNMP System Contact.";
}
}
container LOCATION {
leaf Location {
type string {
length "1..255";
}
description
"SNMP System Location.";
}
}
}
container SNMP_COMMUNITY {
list SNMP_COMMUNITY_LIST {
key name;
description
"List of communities.";
leaf name {
type string {
length "4..32";
pattern '[^ @,\\' +"']*" {
error-message 'Invalid snmp community string (Valid chars are ASCII printable except SPACE, single quote,"@", "," and "\")';
}
}
description
"Index into the community list which must be the community name.";
}
leaf TYPE {
type enumeration {
enum RO;
enum RW;
}
description
"Type of community, read-only or read-write.";
}
}
}
}
}