[yang-models]: Add YANG model for SNMP_USER table (#14103)
#### Why I did it Add YANG model for SNMP_USER table defined in the document: https://github.com/sonic-net/SONiC/blob/master/doc/snmp/snmp-schema-addition.md #### How to verify it Passed unit-test
This commit is contained in:
parent
3cf50ca7fc
commit
53ae6a0bf8
@ -2259,7 +2259,33 @@
|
||||
"TYPE": "RW"
|
||||
}
|
||||
},
|
||||
"SNMP_USER": {
|
||||
"testuser": {
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encr_pass"
|
||||
},
|
||||
"testuser_noAuthNoPriv": {
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
},
|
||||
"testuser_AuthNoPriv": {
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
|
||||
},
|
||||
"SYSTEM_DEFAULTS": {
|
||||
"tunnel_qos_remap": {
|
||||
"status": "enabled"
|
||||
|
@ -24,5 +24,94 @@
|
||||
"SNMP_COMMUNITY_WRONG_TYPE_TEST": {
|
||||
"desc": "Load SNMP community string with un supported type.",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SNMP_RO_USER_NAME_TEST": {
|
||||
"desc": "Load valid RO SNMP user"
|
||||
},
|
||||
"SNMP_RW_USER_NAME_TEST": {
|
||||
"desc": "Load valid RW SNMP user"
|
||||
},
|
||||
"SNMP_USER_NAME_MIN_NEG_TEST": {
|
||||
"desc": "Load SNMP user with name < 4",
|
||||
"eStrKey": "Range"
|
||||
},
|
||||
"SNMP_USER_NAME_INVALID_NEG_TEST": {
|
||||
"desc": "Load SNMP user with invalid value",
|
||||
"eStr": "Invalid snmp user string (Valid chars are ASCII printable except SPACE, single quote,\"@\", \",\", \"\\\" and \":\")"
|
||||
},
|
||||
"SNMP_USER_NAME_INVALID_NEG_TEST_2": {
|
||||
"desc": "Load SNMP user with invalid value",
|
||||
"eStr": "Invalid snmp user string (Valid chars are ASCII printable except SPACE, single quote,\"@\", \",\", \"\\\" and \":\")"
|
||||
},
|
||||
"SNMP_USER_NO_USER_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with no user type",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_INVALID_USER_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with invalid user type",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SNMP_USER_NO_USER_PERM_NEG_TEST": {
|
||||
"desc": "Load SNMP user with no user permission",
|
||||
"eStrKey": "Mandatory"
|
||||
},
|
||||
"SNMP_USER_INVALID_USER_TYPE_NEG_TEST": {
|
||||
"desc": "Load valid SNMP user with no user permission",
|
||||
"eStrKey": "InvalidValue"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST": {
|
||||
"desc": "Load valid SNMP user with user type AuthNoPriv with SHA auth type"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST_2": {
|
||||
"desc": "Load valid SNMP user with user type AuthNoPriv with MD5 auth type"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST_3": {
|
||||
"desc": "Load valid SNMP user with user type AuthNoPriv with HMAC-SHA-2 auth type"
|
||||
},
|
||||
"SNMP_USER_NO_AUTH_NO_PRIV_AUTH_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type noAuthNoPriv with auth type",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_NO_AUTH_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type AuthNoPriv without auth password",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_NO_AUTH_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type AuthNoPriv without auth type",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_INVALID_AUTH_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type AuthNoPriv with invalid auth password",
|
||||
"eStr": "Invalid snmp user authentication password (Valid chars are ASCII printable except \":\" and\"@\")"
|
||||
},
|
||||
"SNMP_USER_PRIV_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with AES encryption type"
|
||||
},
|
||||
"SNMP_USER_PRIV_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with DES encryption type"
|
||||
},
|
||||
"SNMP_USER_PRIV_NO_ENCRYPT_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv without encyrption type",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_PRIV_INVALID_ENCRYPT_TYPE_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with invalid encryption type",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_PRIV_NO_ENCRYPT_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with no encryption password",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_PRIV_INVALID_ENCRYPT_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with invalid encryption password",
|
||||
"eStr": "Invalid snmp user encryption password (Valid chars are ASCII printable except \":\" and\"@\")"
|
||||
},
|
||||
"SNMP_USER_PRIV_SHORT_ENCRYPT_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with short encryption password",
|
||||
"eStrKey": "Must"
|
||||
},
|
||||
"SNMP_USER_PRIV_LONG_ENCRYPT_PASS_NEG_TEST": {
|
||||
"desc": "Load SNMP user with user type Priv with long encryption password",
|
||||
"eStrKey": "Range"
|
||||
}
|
||||
}
|
||||
|
@ -79,5 +79,428 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_RO_USER_NAME_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_RW_USER_NAME_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NAME_MIN_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "tes",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NAME_INVALID_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "test@user",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NAME_INVALID_NEG_TEST_2": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "test:user",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NO_USER_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_INVALID_USER_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "randomUserType",
|
||||
"SNMP_USER_PERMISSION": "RO",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NO_USER_PERM_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_INVALID_USER_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "WR",
|
||||
"SNMP_USER_AUTH_TYPE": "",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST_2": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "MD5",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_TEST_3": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "HMAC-SHA-2",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_NO_AUTH_NO_PRIV_AUTH_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "noAuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_NO_AUTH_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_AUTH_PASSWORD": "",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_NO_AUTH_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_INVALID_AUTH_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SAH",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_AUTH_NO_PRIV_INVALID_AUTH_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "AuthNoPriv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth:pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encry_pass"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_TEST_2": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "DES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encry_pass"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_NO_ENCRYPT_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encry_pass",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_INVALID_ENCRYPT_TYPE_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "DSE",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encry_pass"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_NO_ENCRYPT_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_INVALID_ENCRYPT_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encry@pass"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_SHORT_ENCRYPT_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "en"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SNMP_USER_PRIV_LONG_ENCRYPT_PASS_NEG_TEST": {
|
||||
"sonic-snmp:sonic-snmp": {
|
||||
"sonic-snmp:SNMP_USER": {
|
||||
"SNMP_USER_LIST": [
|
||||
{
|
||||
"name": "testuser",
|
||||
"SNMP_USER_TYPE": "Priv",
|
||||
"SNMP_USER_PERMISSION": "RW",
|
||||
"SNMP_USER_AUTH_PASSWORD": "auth_pass",
|
||||
"SNMP_USER_AUTH_TYPE": "SHA",
|
||||
"SNMP_USER_ENCRYPTION_TYPE": "AES",
|
||||
"SNMP_USER_ENCRYPTION_PASSWORD": "encryption_password_longer_than_64_characters_is_not_a_valid_password"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,5 +70,91 @@ module sonic-snmp {
|
||||
}
|
||||
}
|
||||
}
|
||||
container SNMP_USER {
|
||||
list SNMP_USER_LIST {
|
||||
key name;
|
||||
description
|
||||
"List of users.";
|
||||
|
||||
leaf name {
|
||||
type string {
|
||||
length "4..32";
|
||||
pattern '[^ :@,\\' +"']*" {
|
||||
error-message 'Invalid snmp user string (Valid chars are ASCII printable except \
|
||||
SPACE, single quote,"@", ",", "\" and ":")';
|
||||
}
|
||||
}
|
||||
description
|
||||
"Name defining the SNMP User.";
|
||||
}
|
||||
|
||||
leaf SNMP_USER_TYPE {
|
||||
mandatory true;
|
||||
type enumeration {
|
||||
enum noAuthNoPriv;
|
||||
enum AuthNoPriv;
|
||||
enum Priv;
|
||||
}
|
||||
description
|
||||
"Authentication and encryption method used for the user, can be noAuthNoPriv,AuthNoPriv or Priv";
|
||||
}
|
||||
leaf SNMP_USER_PERMISSION {
|
||||
mandatory true;
|
||||
type enumeration {
|
||||
enum RO;
|
||||
enum RW;
|
||||
}
|
||||
description
|
||||
"Specify if the user permission can be Read only or Read write user, can be RO or RW";
|
||||
}
|
||||
leaf SNMP_USER_AUTH_TYPE {
|
||||
type string;
|
||||
must "(current()/../SNMP_USER_TYPE = 'noAuthNoPriv' and current() = '') or
|
||||
((current()/../SNMP_USER_TYPE = 'AuthNoPriv' or current()/../SNMP_USER_TYPE = 'Priv')
|
||||
and (current() = 'SHA' or current() = 'MD5' or current() = 'HMAC-SHA-2'))";
|
||||
default "";
|
||||
description
|
||||
"Specify authentication type used for user, can be MD5, SHA or HMAC-SHA-2";
|
||||
}
|
||||
leaf SNMP_USER_AUTH_PASSWORD {
|
||||
type string {
|
||||
length "0..64";
|
||||
pattern '[^ @:]*' {
|
||||
error-message 'Invalid snmp user authentication password (Valid chars are ASCII
|
||||
printable except ":" and"@")';
|
||||
}
|
||||
}
|
||||
must "(current()/../SNMP_USER_TYPE = 'AuthNoPriv' and string-length(current()) >= 8) or
|
||||
(current()/../SNMP_USER_TYPE = 'Priv' and string-length(current()) >= 8) or
|
||||
(current()/../SNMP_USER_TYPE = 'noAuthNoPriv' and current() = '')";
|
||||
description
|
||||
"Authentication password for the user.";
|
||||
}
|
||||
leaf SNMP_USER_ENCRYPTION_TYPE {
|
||||
type string;
|
||||
must "(current()/../SNMP_USER_TYPE = 'noAuthNoPriv' and current() = '') or
|
||||
(current()/../SNMP_USER_TYPE = 'AuthNoPriv' and current() = '') or
|
||||
(current()/../SNMP_USER_TYPE = 'Priv' and (current() = 'DES' or current() = 'AES'))";
|
||||
default "";
|
||||
description
|
||||
"Specify encrytion type used for user, can be AES or DES";
|
||||
}
|
||||
leaf SNMP_USER_ENCRYPTION_PASSWORD {
|
||||
mandatory true;
|
||||
type string {
|
||||
length "0..64";
|
||||
pattern '[^ @:]*' {
|
||||
error-message 'Invalid snmp user encryption password (Valid chars are ASCII \
|
||||
printable except ":" and"@")';
|
||||
}
|
||||
}
|
||||
must "(current()/../SNMP_USER_TYPE = 'noAuthNoPriv' and current() = '') or
|
||||
(current()/../SNMP_USER_TYPE = 'AuthNoPriv' and current() = '') or
|
||||
(current()/../SNMP_USER_TYPE = 'Priv' and string-length(current()) >= 8)";
|
||||
description
|
||||
"Encryption password for the user.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user