Skip to content

Commit

Permalink
Merge pull request #7 from nokia/module-rename
Browse files Browse the repository at this point in the history
Renaming modules
  • Loading branch information
hellt authored Apr 25, 2023
2 parents 910329e + 0b0ef87 commit 89bea4e
Show file tree
Hide file tree
Showing 24 changed files with 128 additions and 122 deletions.
6 changes: 6 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plugin_routing:
modules:
srl_config:
redirect: nokia.srlinux.config
srl_get:
redirect: nokia.srlinux.get
9 changes: 4 additions & 5 deletions plugins/modules/jsonrpc_cli.py → plugins/modules/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

"""Ansible module for jsonrpc cli"""
"""Ansible module for executing CLI commands to SR Linux devices"""

from __future__ import absolute_import, division, print_function

Expand All @@ -21,8 +21,8 @@

DOCUMENTATION = """
---
module: jsonrpc_cli
short_description: "Implementation of the Nokia SR Linux JSON-RPC's CLI method."
module: cli
short_description: "Execute CLI commands on SR Linux devices."
description:
- This module allows CLI commands to be executed in Nokia SR Linux using JSON-RPC interface.
version_added: "0.1.0"
Expand All @@ -42,11 +42,10 @@

EXAMPLES = """
- name: Run \"show version\" CLI command
nokia.srlinux.jsonrpc_cli:
nokia.srlinux.cli:
commands:
- show version
register: response
failed_when: response.json.result[0]["basic system info"].Architecture != "x86_64"
"""


Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/jsonrpc_set.py → plugins/modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause

# -*- coding: utf-8 -*-
"""Ansible module for jsonrpc set"""
"""Ansible module for configuring SR Linux devices"""

from __future__ import absolute_import, division, print_function

Expand All @@ -25,8 +25,8 @@

DOCUMENTATION = """
---
module: jsonrpc_set
short_description: "Implementation of the Nokia SR Linux JSON-RPC's Set method."
module: config
short_description: "Update, replace and delete configuration on SR Linux devices."
description:
- This module allows to set a configuration or run operational transaction. The set method can be used with the candidate and tools datastores.
version_added: "0.1.0"
Expand Down Expand Up @@ -91,7 +91,7 @@

EXAMPLES = """
- name: Set system information with values
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/jsonrpc_get.py → plugins/modules/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

"""Ansible module for jsonrpc get"""
"""Ansible module for retrieving configuration and state from SR Linux devices"""

from __future__ import absolute_import, division, print_function

Expand All @@ -21,8 +21,8 @@

DOCUMENTATION = """
---
module: jsonrpc_get
short_description: "Implementation of the Nokia SR Linux JSON-RPC's Get method."
module: get
short_description: "Retrieve configuration or state element from Nokia SR Linux devices."
description:
- >-
This module allows to retrieve configuration and state details from the system.
Expand Down Expand Up @@ -59,7 +59,7 @@

EXAMPLES = """
- name: Get /system/information container
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

"""Ansible module for jsonrpc validate"""
"""Ansible module for validating configuration on SR Linux devices"""
from __future__ import absolute_import, division, print_function

import json
Expand All @@ -19,10 +19,10 @@

DOCUMENTATION = """
---
module: jsonrpc_validate
short_description: "Implementation of the Nokia SR Linux JSON-RPC's Validate method."
module: validate
short_description: "Validating configuration on SR Linux devices."
description:
- This module allows to verify that the system accepts a configuration transaction before applying it to the system.
- Validating configuration on SR Linux devices using `commit validate` feature of SR Linux.
version_added: "0.1.0"
options:
update:
Expand Down Expand Up @@ -80,7 +80,7 @@

EXAMPLES = """
- name: Validate a valid change set
nokia.srlinux.jsonrpc_validate:
nokia.srlinux.validate:
update:
- path: /system/information
value:
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/auth-fail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ansible_password: wrong
tasks:
- name: Get system information
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/backup-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- "/tmp/{{inventory_hostname}}.cfg.*"

- name: Get entire running config
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /
datastore: running
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/cli-show-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Run "show version" CLI command
nokia.srlinux.jsonrpc_cli:
nokia.srlinux.cli:
commands:
- show version
register: response
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/cli-wrong-cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Run wrong CLI command
nokia.srlinux.jsonrpc_cli:
nokia.srlinux.cli:
commands:
- show wrong
register: response
Expand Down
6 changes: 3 additions & 3 deletions tests/playbooks/delete-leaves.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
tasks:
# test preparation step
- name: Set system information with values
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
location: Some location
contact: Some contact

- name: Test Delete operation on leaf nodes
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
delete:
- path: /system/information/location
- path: /system/information/contact
Expand All @@ -26,7 +26,7 @@
var: delete_response

- name: Ensure leaves were deleted
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/get-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
tasks:
# this task ensures that we can get information for a container
- name: Get /system/information container
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/get-wrong-path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
tasks:
# this task ensures that we fail with expected error when get is targeted to a wrong path
- name: Get wrong path
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/informations
datastore: state
Expand Down
4 changes: 2 additions & 2 deletions tests/playbooks/replace-full-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Replace entire config from file
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
replace:
- path: /
value: "{{lookup('ansible.builtin.template', '{{playbook_dir}}/golden/{{inventory_hostname}}-golden.cfg.json.j2') }}"
Expand All @@ -19,7 +19,7 @@
var: set_response

- name: Ensure changes were made to the device
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /interface[name=ethernet-1/1]/description
datastore: state
Expand Down
7 changes: 4 additions & 3 deletions tests/playbooks/set-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
gather_facts: false
tasks:
- name: Test check mode
nokia.srlinux.jsonrpc_set:
# srl_config module name tests the redirection to nokia.srlinux.config
nokia.srlinux.srl_config:
update:
- path: /system/information
value:
Expand All @@ -21,7 +22,7 @@
var: set_response

- name: Test check mode with diff
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand All @@ -36,7 +37,7 @@
var: set_response

- name: Ensure no changes were made to the device
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
8 changes: 4 additions & 4 deletions tests/playbooks/set-idempotent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Set system information with values
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand All @@ -20,7 +20,7 @@
var: set_response

- name: Ensure changes were made to the device
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand All @@ -31,7 +31,7 @@
var: get_response

- name: Repeated set should not run
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand All @@ -44,7 +44,7 @@
var: set_response

- name: Repeated set should not run with diff
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand Down
4 changes: 2 additions & 2 deletions tests/playbooks/set-leaves.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Set system information with values
nokia.srlinux.jsonrpc_set:
nokia.srlinux.config:
update:
- path: /system/information
value:
Expand All @@ -19,7 +19,7 @@
var: set_response

- name: Ensure changes were made to the device
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/tls-missed-check-fail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ansible_httpapi_use_ssl: yes
tasks:
- name: json RPC get
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
2 changes: 1 addition & 1 deletion tests/playbooks/tls-skipped-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ansible_httpapi_validate_certs: no
tasks:
- name: json RPC get
nokia.srlinux.jsonrpc_get:
nokia.srlinux.get:
paths:
- path: /system/information
datastore: state
Expand Down
4 changes: 2 additions & 2 deletions tests/playbooks/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gather_facts: false
tasks:
- name: Validate a valid change set
nokia.srlinux.jsonrpc_validate:
nokia.srlinux.validate:
update:
- path: /system/information
value:
Expand All @@ -19,7 +19,7 @@
var: response

- name: Validate an invalid change set
nokia.srlinux.jsonrpc_validate:
nokia.srlinux.validate:
update:
- path: /system/information
value:
Expand Down
32 changes: 16 additions & 16 deletions tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
plugins/httpapi/srlinux.py validate-modules:missing-gplv3-license
plugins/httpapi/srlinux.py validate-modules:import-before-documentation
plugins/modules/jsonrpc_cli.py import-2.7!skip # srlinux collection requires py3.6+
plugins/modules/jsonrpc_cli.py import-3.5!skip
plugins/modules/jsonrpc_cli.py validate-modules:missing-gplv3-license
plugins/modules/jsonrpc_cli.py validate-modules:import-before-documentation
plugins/modules/jsonrpc_get.py import-2.7!skip
plugins/modules/jsonrpc_get.py import-3.5!skip
plugins/modules/jsonrpc_get.py validate-modules:missing-gplv3-license
plugins/modules/jsonrpc_get.py validate-modules:import-before-documentation
plugins/modules/jsonrpc_set.py import-2.7!skip
plugins/modules/jsonrpc_set.py import-3.5!skip
plugins/modules/jsonrpc_set.py validate-modules:missing-gplv3-license
plugins/modules/jsonrpc_set.py validate-modules:import-before-documentation
plugins/modules/jsonrpc_validate.py import-2.7!skip
plugins/modules/jsonrpc_validate.py import-3.5!skip
plugins/modules/jsonrpc_validate.py validate-modules:missing-gplv3-license
plugins/modules/jsonrpc_validate.py validate-modules:import-before-documentation
plugins/modules/cli.py import-2.7!skip # srlinux collection requires py3.6+
plugins/modules/cli.py import-3.5!skip
plugins/modules/cli.py validate-modules:missing-gplv3-license
plugins/modules/cli.py validate-modules:import-before-documentation
plugins/modules/get.py import-2.7!skip
plugins/modules/get.py import-3.5!skip
plugins/modules/get.py validate-modules:missing-gplv3-license
plugins/modules/get.py validate-modules:import-before-documentation
plugins/modules/config.py import-2.7!skip
plugins/modules/config.py import-3.5!skip
plugins/modules/config.py validate-modules:missing-gplv3-license
plugins/modules/config.py validate-modules:import-before-documentation
plugins/modules/validate.py import-2.7!skip
plugins/modules/validate.py import-3.5!skip
plugins/modules/validate.py validate-modules:missing-gplv3-license
plugins/modules/validate.py validate-modules:import-before-documentation
plugins/module_utils/srlinux.py import-2.7!skip
plugins/module_utils/srlinux.py import-3.5!skip
plugins/module_utils/const.py import-2.7!skip
Expand Down
Loading

0 comments on commit 89bea4e

Please sign in to comment.