Utilities collection#
The Utilities collection contains modules that can be used to perform common tasks when working with the Nokia EDA platform. These tasks currently include authentication helpers such as retrieving the API client secret from Keycloak and getting the authentication token.
Examples#
Fetching client secret#
The client secret authenticates the API client against the authorization server (Keycloak is used as the authorization server in Nokia EDA). Different methods of fetching the client secret are provided in the API documentation. Here we provide an example how the get_client_secret module can be used to fetch the client secret.
- name: Get client secret from keycloak
hosts: all
gather_facts: false
tasks:
- name: Get client secret
nokia.eda_utils_v1.get_client_secret:
baseUrl: "{{ eda_api_url }}"
tlsSkipVerify: "{{ tls_skip_verify }}"
# all other parameters are at their default values:
# clientId: eda
# keycloakUrl: /core/httpproxy/v1/keycloak/
keycloakAdminUsername: "{{ kc_username }}" # default admin
keycloakAdminPassword: "{{ kc_password }}" # default admin
# keycloakMasterRealm: master
# keycloakAdminClientId: admin-cli
# realm: eda
register: client_secret
- name: print var
ansible.builtin.debug:
var: client_secret.result[0].secret
Getting authentication token#
As all collections that interact with the Nokia EDA API server require authentication, a module for obtaining an authentication token is also provided for user' convenience.
- name: Get authentication token
hosts: all
gather_facts: false
tasks:
- name: Get auth token
nokia.eda_utils_v1.get_token:
baseUrl: "{{ eda_api_url }}"
clientSecret: "{{client_secret}}"
username: admin
password: "{{eda_password}}"
tlsSkipVerify: "{{ tls_skip_verify }}"
# all other parameters are at their default values:
# clientId: eda
# keycloakUrl: /core/httpproxy/v1/keycloak/
# keycloakAdminUsername: admin
# keycloakAdminPassword: admin
# keycloakMasterRealm: master
# keycloakAdminClientId: admin-cli
# realm: eda
register: auth_token
- name: print var
ansible.builtin.debug:
var: auth_token.result
Note
If you omit the client_secret parameter, the collection will try to fetch the secret by authenticating with the Keycloak service using keycloak authentication parameters that are set to their default values. While this might be tempting to use, this method is not recommended and should not be used in production.
The fetched authentication token must be provided to the other modules that require authentication:
ok: [localhost] =>
authToken.result:
access_token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJrZHBqeHZkMURxQUtEMnRreFI5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Krd5A3zzjEN9vj5Hw
expires_in: 300
not-before-policy: 0
refresh_expires_in: 1800
refresh_token: eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJkNTNmNDE1YS0wMmQwLTRkMTktYTAxZi02ZTZiYjMyNGExZjQifQ.eyJleHAiOjE3NTYwMjM4OTcsImlhdCI6MTc1NjAyMjA5NywianRpIjoiMGM5ODliMWMtZTZhYy00OTAyLWI2MjYtMTRiYjQzMzkzNjM3IiwiaXNzIjoiaHR0cHM6Ly9kZXZib3gubmV0ZGV2b3BzLm1lOjk0NDMvY29yZS9odHRwcHJveHkvdjEva2V5Y2xvYWsvcmVhbG1zL2VkYSIsImF1ZCI6Imh0dHBzOi8vZGV2Ym94Lm5ldGRldm9wcy5tZTo5NDQzL2NvcmUvaHR0cHByb3h5L3YxL2tleWNsb2FrL3JlYWxtcy9lZGEiLCJzdWIiOiJmMmE3NTAzNS01NmE1LTRiYTAtYmU5Yi01M2UxMzUxMjU5YmUiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoiZWRhIiwic2lkIjoiZTJhYzA5ZjAtZTc5Yy00MjViLTkwNzUtZjM3N2MzMzVlZDZjIiwic2NvcGUiOiJvcGVuaWQgcm9sZXMgd2ViLW9yaWdpbnMgYWNyIGJhc2ljIHByb2ZpbGUgZW1haWwifQ.ajJmLzdzd4ykO1EiEZB5BB8FZcVQc4IssNYlvTC53ToU9QgNGRW-E5OIwwWcBAV4srTEgkHnUh2uGxm7RtE34A
scope: openid profile email
session_state: e2ac09f0-e79c-425b-9075-f377c335ed6c
token_type: Bearer
Changelog v1#
1.2.0#
- Add the
admin/clientsmodules for OAuth service account client management, includingregeneratesecretandrolesendpoints. - Add autocomplete modules for
alarm,group,jspath,kind, andnamespace. - Remove the autocomplete
labelsmodule. - Add the
features/v1modules for feature status inspection. - Add the
i18n/v1modules for internationalization and language file management. - Add the
chat/v1/chats/{chatId}/exportmodule for chat export. - Add merge request
approveandunapprovemodules. - Update the
admin/sessionsmodule to use{id}instead of{uuid}in the path parameter. - Add the
x-ui-annotationextension to theK8sPatchOpmodel. - Add
endpoint_a_namespaceandendpoint_b_namespaceto theTopoOverlayLinkmodel. - Added no_log to authToken parameter.
- Regenerate modules from the EDA 26.8 application specifications.
1.1.2#
- Add
federationIdsto the groups module.
1.1.1#
- Add the
admin/groups/usersmodule andAddUserToGroupPostBodymodel to manage user membership within groups; update theadmin/groups/groupsmodule andAuthUserGroupmodel accordingly.
1.1.0#
- Add the Transaction v3 API modules (
transaction/v3/rebase,resources, andresult/{changedcrs,execution,intentsrun,nodes}). - Add the store vendor icon modules (
store/v1/vendors/icon/{dark,light}). - Rework API error handling (unified
ErrorResponse, HTTP 404 handling) and normalizebaseUrltrailing slashes. - Regenerate modules from the latest EDA 26.4 core specifications.
1.0.3#
- Fixed
admin.users.groupsmodule to correctly fetch the groups and user by their UUIDs.
1.0.2#
- Deprecate the
full-rolesparameter for thegroupsmodule and introduce thefullRolesparameter instead.
1.0.1#
- Make
baseUrlandauthTokenoptional whencronlyoperation is used against the resource. - Fix optionality of the arguments in the module documentation.
- Fix K8s Patch operation for the resource.
1.0.0#
Initial release.
0.2.0#
- Add documentation for the top level collection fields
- Update modules for workflows and resource lists
0.1.0#
Initial Beta release.