Skip to content

Commit

Permalink
Prep v121 (#48)
Browse files Browse the repository at this point in the history
Fix flake8 issues. Update release notes and version number.
  • Loading branch information
tony-vanderpeet authored Oct 9, 2022
1 parent 5e07fb4 commit d3890d5
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 33 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ Allied Telesis Alliedware Plus (AW+) Collection Release Notes

.. contents:: Topics

v1.2.1
======

Minor Changes
-------------

- awplus_facts - Add interface speed to legacy facts
- awplus_l2_interfaces - Support native VLAN none on trunk mode
- awplus_l2_interfaces - Add playbook tests and a playbook test runner

Bugfixes
--------

- awplus_l2_interfaces - Support list of allowed VLANs correctly

Deleted Modules
---------------

New Modules
-----------

v1.2.0
======

Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ build_ignore:
- .vscode
- .github
- .gitignore
version: 1.2.0
version: 1.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
dict_diff,
)
from ansible_collections.alliedtelesis.awplus.plugins.module_utils.network.awplus.facts.facts import Facts
from ansible_collections.alliedtelesis.awplus.plugins.module_utils.network.awplus.utils.utils import (
remove_duplicate_interface,
)


class L2_interfaces(ConfigBase):
Expand Down
6 changes: 3 additions & 3 deletions tests/playbook/pb_test_l2_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def run_playbook(playbook, tag, debug=False):
def parse_output(op):
looking = True
pop = ""
for l in op.splitlines():
ls = l.strip()
for outl in op.splitlines():
ls = outl.strip()
if looking:
if ls.startswith(('ok:', 'changed:')) and ls.endswith('{'):
pop = "{"
looking = False
else:
pop += ls
if l.rstrip() == '}':
if outl.rstrip() == '}':
break
pop = pop.replace("false", "False")
pop = pop.replace("true", "True")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/compat/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _iterate_read_data(read_data):
# Retrieve lines from read_data via a generator so that separate calls to
# readline, read, and readlines are properly interleaved
sep = b"\n" if isinstance(read_data, bytes) else "\n"
data_as_list = [l + sep for l in read_data.split(sep)]
data_as_list = [rdl + sep for rdl in read_data.split(sep)]

if data_as_list[-1] == sep:
# If the last line ended in a newline, the list comprehension will have an
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/modules/test_awplus_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_awplus_config_replace_block(self):
commands = parents + lines
self.execute_module(changed=True, commands=commands)

def test_awplus_config_match_none(self):
def test_awplus_config_match_none_1(self):
lines = ["hostname R-changed"]
set_module_args(dict(lines=lines, match="none"))
self.conn.get_diff = MagicMock(
Expand All @@ -227,7 +227,7 @@ def test_awplus_config_match_none(self):
)
self.execute_module(changed=True, commands=lines)

def test_awplus_config_match_none(self):
def test_awplus_config_match_none_2(self):
lines = ["ip address 1.2.3.4 255.255.255.0", "description test string"]
parents = ["interface port1.0.1"]
set_module_args(dict(lines=lines, parents=parents, match="none"))
Expand Down Expand Up @@ -285,29 +285,29 @@ def test_awplus_config_match_exact(self):
def test_awplus_confic_src_and_lines_fails(self):
args = dict(src="foo", lines="foo")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)

def test_awplus_config_src_and_parents_fails(self):
args = dict(src="foo", parents="foo")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)

def test_awplus_config_march_exact_requires_lines(self):
args = dict(match="exact")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)

def test_awplus_config_match_strict_requires_lines(self):
args = dict(match="strict")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)

def test_awplus_config_replace_block_requires_lines(self):
args = dict(replace="block")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)

def test_awplus_config_replace_config_requires_src(self):
args = dict(replace="config")
set_module_args(args)
result = self.execute_module(failed=True)
self.execute_module(failed=True)
2 changes: 0 additions & 2 deletions tests/unit/modules/test_awplus_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from ansible_collections.alliedtelesis.awplus.tests.unit.compat.mock import patch
from ansible_collections.alliedtelesis.awplus.plugins.modules import awplus_facts
from ansible.module_utils.six import assertCountEqual
from ansible_collections.alliedtelesis.awplus.tests.unit.utils import set_module_args
from .awplus_module import TestAwplusModule, load_fixture

Expand Down Expand Up @@ -67,7 +66,6 @@ def tearDown(self):

def load_fixtures(self, commands=None):
def load_from_file(*args, **kwargs):
module = args
commands = kwargs["commands"]
output = list()

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/modules/test_awplus_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

__metaclass__ = type

import json

from ansible_collections.alliedtelesis.awplus.tests.unit.compat.mock import patch
from ansible_collections.alliedtelesis.awplus.plugins.modules import awplus_logging
from ansible_collections.alliedtelesis.awplus.tests.unit.utils import set_module_args
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/modules/test_awplus_openflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ def test_awplus_openflow_add_existing_controller(self):
)
)
commands = ["no openflow controller test_ssl1", "openflow controller test_ssl1 ssl 192.56.8.3 8"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_openflow_add_new_controller(self):
set_module_args(
dict(config=dict(controllers=[dict(name="oc2", protocol="tcp", address="184.5.3.2", l4_port=10)]), state="merged")
)
commands = ["openflow controller oc2 tcp 184.5.3.2 10"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_openflow_remove_existing_controller(self):
set_module_args(
Expand All @@ -105,7 +105,7 @@ def test_awplus_openflow_remove_existing_controller(self):
)
)
commands = ["no openflow controller test_ssl1"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_openflow_remove_nonexisitng_controller(self):
set_module_args(
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_awplus_openflow_add_new_port(self):
def test_awplus_openflow_remove_existing_port(self):
set_module_args(dict(config=dict(ports=["port1.0.1"]), state="deleted"))
commands = ["interface port1.0.1", "no openflow"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_openflow_remove_nonexisting_port(self):
set_module_args(dict(config=dict(ports=["port1.0.2"]), state="deleted"))
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/modules/test_awplus_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,43 +81,43 @@ def load_from_file(*args, **kwargs):
def test_awplus_user_create(self):
set_module_args(dict(config=[dict(name="test", configured_password="test")]))
commands = ["username test privilege 1 password test"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_user_merge_idempotent(self):
set_module_args(dict(config=[dict(name="ansible", privilege=8)]))
result = self.execute_module(changed=False)
self.execute_module(changed=False)

def test_awplus_user_replaced(self):
set_module_args(dict(config=[dict(name="test", configured_password="test")], state="replaced"))
commands = ["username test privilege 1 password test"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_user_replaced_idempotent(self):
set_module_args(dict(config=[dict(name="ansible", privilege=8)], state="replaced"))
result = self.execute_module(changed=False)
self.execute_module(changed=False)

def test_awplus_user_overridden(self):
set_module_args(dict(config=[dict(name="test", configured_password="test")], state="overridden"))
commands = ["username test privilege 1 password test",
"no username ansible",
"no username jin"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_user_overridden_idempotent(self):
set_module_args(dict(config=[dict(name="ansible", privilege=8), dict(name="jin", privilege=3)], state="overridden"))
result = self.execute_module(changed=False)
self.execute_module(changed=False)

def test_awplus_user_delete(self):
set_module_args(dict(config=[dict(name="ansible")], state="deleted"))
commands = ["no username ansible"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_user_delete_all(self):
set_module_args(dict(state="deleted"))
commands = ["no username ansible",
"no username jin"]
result = self.execute_module(changed=True, commands=commands)
self.execute_module(changed=True, commands=commands)

def test_awplus_user_delete_no_user(self):
set_module_args(dict(config=[dict(name="intern")], state="deleted"))
result = self.execute_module(changed=False)
self.execute_module(changed=False)

0 comments on commit d3890d5

Please sign in to comment.