blob: a5d2a8d0d31ba2291a0c22f761d5648472941937 [file] [log] [blame]
Anves Kumar rayankulab44c9572021-04-27 00:44:06 -05001*** Settings ***
2Documentation This module provides general keywords for LDAP.
3
4*** Keywords ***
5
6Get LDAP Configuration Using Redfish
7 [Documentation] Retrieve LDAP Configuration.
8 [Arguments] ${ldap_type}
9
10 # Description of argument(s):
11 # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
12
13 ${ldap_config}= Redfish.Get Properties ${REDFISH_BASE_URI}AccountService
14 [Return] ${ldap_config["${ldap_type}"]}
15
16
17Get LDAP Privilege And Group Name Via Redfish
18 [Documentation] Get LDAP groupname via Redfish.
19
20 # Get LDAP configuration via Redfish.
21 # Sample output of LDAP configuration:
22 # {
23 # 'RemoteRoleMapping': [
24 # {
25 # 'RemoteGroup': 'openldapgroup',
26 # 'LocalRole': 'Administrator'
27 # },
28 # ],
29 # 'Authentication':
30 # {
31 # 'Username': 'cn=Administrator,dc=ldap,dc=com',
32 # 'Password': None,
33 # 'AuthenticationType': 'UsernameAndPassword'
34 # },
35 # 'LDAPService':
36 # {
37 # 'SearchSettings':
38 # {
39 # 'BaseDistinguishedNames': ['dc=ldap,dc=com'],
40 # 'UsernameAttribute': 'cn',
41 # 'GroupsAttribute': 'gidNumber'
42 # }
43 # },
44 # 'ServiceEnabled': True,
45 # 'Certificates':
46 # {
47 # '@odata.id': u'/redfish/v1/AccountService/LDAP/Certificates'
48 # },
49 # 'ServiceAddresses': ['ldap://xx.xx.xx.xx/']
50 # }
51
52 ${ldap_config}= Get LDAP Configuration Using Redfish ${LDAP_TYPE}
53 ${num_list_entries}= Get Length ${ldap_config["RemoteRoleMapping"]}
54 Return From Keyword If ${num_list_entries} == ${0} @{EMPTY}
55 ${ldap_group_names}= Create List
56 FOR ${i} IN RANGE ${num_list_entries}
57 Append To List ${ldap_group_names} ${ldap_config["RemoteRoleMapping"][${i}]["RemoteGroup"]}
58 END
59
60 [Return] ${ldap_group_names}
61