Skip to content

Commit

Permalink
ldap: Add YANG tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpil2002 committed Mar 5, 2024
1 parent 6ecdd92 commit 4f7f048
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def run(self):
'./yang-models/sonic-system-aaa.yang',
'./yang-models/sonic-system-tacacs.yang',
'./yang-models/sonic-system-radius.yang',
'./yang-models/sonic-system-ldap.yang',
'./yang-models/sonic-telemetry.yang',
'./yang-models/sonic-telemetry_client.yang',
'./yang-models/sonic-gnmi.yang',
Expand Down
16 changes: 16 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,22 @@
"timeout": "5"
}
},
"LDAP": {
"global": {
"bind_dn": "test_bind",
"bind_password": "secret",
"bind_timeout": "5",
"version": "3",
"base_dn": "test_base",
"port": "389",
"timeout": "5"
}
},
"LDAP_SERVER": {
"192.168.1.1": {
"priority": "5"
}
},
"NAT_BINDINGS": {
"bind1": {
"nat_pool": "pool1",
Expand Down
16 changes: 16 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/ldap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"LDAP_TABLE": {
"desc": "Configure LDAP global fields."
},
"LDAP_INVALID_TIMEOUT_TEST": {
"desc": "LDAP global configuration with invalid timeout value in LDAP table.",
"eStr": "LDAP timeout must be 1..60"
},
"LDAP_SERVER_TEST" : {
"desc": "LDAP server configuration in LDAP_SERVER table."
},
"LDAP_SERVER_INVALID_PRIORITY_TEST": {
"desc": "LDAP server configuration with invalid priority value in LDAP_SERVER table.",
"eStr": "LDAP server priority must be 1..8"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"LDAP_TABLE": {
"sonic-system-ldap:sonic-system-ldap": {
"sonic-system-ldap:LDAP": {
"global":{
"bind_dn": "test_bind",
"bind_password": "secret",
"bind_timeout": "5",
"version": "3",
"base_dn": "test_base",
"port": "389",
"timeout": "5"
}
}
}
},
"LDAP_INVALID_TIMEOUT_TEST": {
"sonic-system-ldap:sonic-system-ldap": {
"sonic-system-ldap:LDAP": {
"global": {
"bind_dn": "test_bind",
"bind_password": "secret",
"bind_timeout": "5",
"version": "3",
"base_dn": "test_base",
"port": "389",
"timeout": 150
}
}
}
},
"LDAP_SERVER_TEST": {
"sonic-system-ldap:sonic-system-ldap": {
"sonic-system-ldap:LDAP_SERVER": {
"LDAP_SERVER_LIST": [
{
"hostname": "192.168.1.1",
"priority": 1
},
{
"hostname": "ldap_server_1",
"priority": 2
}
]
}
}
},

"LDAP_SERVER_INVALID_PRIORITY_TEST": {
"sonic-system-ldap:sonic-system-ldap": {
"sonic-system-ldap:LDAP_SERVER": {
"LDAP_SERVER_LIST": [
{
"hostname": "192.168.1.1",
"priority": 70
}
]
}
}
}
}

0 comments on commit 4f7f048

Please sign in to comment.