From 4eb248d6328c5d5416d60c67747231e23f75ce10 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Thu, 19 May 2022 14:16:59 -0700 Subject: [PATCH 01/13] Updated encrypted password --- .../roles/sonic_bgp_neighbors/defaults/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/regression/roles/sonic_bgp_neighbors/defaults/main.yml b/tests/regression/roles/sonic_bgp_neighbors/defaults/main.yml index ffb3aa2f3..0c049ff4a 100644 --- a/tests/regression/roles/sonic_bgp_neighbors/defaults/main.yml +++ b/tests/regression/roles/sonic_bgp_neighbors/defaults/main.yml @@ -49,7 +49,7 @@ deleted_tests: neighbors: - neighbor: "{{ interface1 }}" auth_pwd: - pwd: "U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true dont_negotiate_capability: false ebgp_multihop: @@ -73,7 +73,7 @@ deleted_tests: neighbors: - neighbor: "{{ interface1 }}" auth_pwd: - pwd: "U2FsdGVkX199MZ7YOPkOR9O6wEZmtGSgiDfnlcN9hBg=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true nbr_description: 'description 3' strict_capability_match: false @@ -206,7 +206,7 @@ deleted_tests: peer_group: - name: SPINE auth_pwd: - pwd: "U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true dont_negotiate_capability: false ebgp_multihop: @@ -642,7 +642,7 @@ merged_tests: peer_group: - name: SPINE auth_pwd: - pwd: "U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true dont_negotiate_capability: true ebgp_multihop: @@ -667,7 +667,7 @@ merged_tests: neighbors: - neighbor: "{{ interface1 }}" auth_pwd: - pwd: "U2FsdGVkX1/4sRsZ624wbAJfDmagPLq2LsGDOcW/47M=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true dont_negotiate_capability: true ebgp_multihop: @@ -694,7 +694,7 @@ merged_tests: neighbors: - neighbor: "{{ interface1 }}" auth_pwd: - pwd: "U2FsdGVkX199MZ7YOPkOR9O6wEZmtGSgiDfnlcN9hBg=" + pwd: "U2FsdGVkX1/pFrFm4ChlWbaxmoqzIOSgCjQHgvi5MEI=" encrypted: true nbr_description: 'description 2' strict_capability_match: true From 4317fabd857663a67c7c304d4ed689124eff1e5b Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Thu, 19 May 2022 14:22:20 -0700 Subject: [PATCH 02/13] Removed repetitive delete test case --- .../regression/roles/sonic_vxlan/defaults/main.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/regression/roles/sonic_vxlan/defaults/main.yml b/tests/regression/roles/sonic_vxlan/defaults/main.yml index c98830463..df5cce937 100644 --- a/tests/regression/roles/sonic_vxlan/defaults/main.yml +++ b/tests/regression/roles/sonic_vxlan/defaults/main.yml @@ -92,7 +92,7 @@ tests: - vni: 102 vrf: "{{vrf2}}" - name: del_test_case_06 - description: Update VRF properties + description: Delete VRF properties state: deleted input: - name: vtep1 @@ -106,20 +106,13 @@ tests: - vni: 102 vrf: "{{vrf2}}" - name: del_test_case_07 - description: Update VRF properties + description: Delete VRF properties state: deleted input: - name: vtep1 vlan_map: [] vrf_map: [] - name: del_test_case_08 - description: Update VRF properties - state: deleted - input: - - name: vtep1 - source_ip: 1.1.1.1 - evpn_nvo: nvo5 - - name: del_test_case_09 - description: Update VRF properties + description: Delete VRF properties state: deleted input: [] From 97e977615673a4761a16ba898496987147cf69d9 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Fri, 20 May 2022 09:13:43 -0700 Subject: [PATCH 03/13] Resolved system playbook failures --- tests/regression/roles/sonic_system/defaults/main.yml | 9 +++++---- tests/regression/roles/sonic_system/tasks/main.yml | 11 +++++++---- .../roles/sonic_system/tasks/preparation_tests.yaml | 5 +++++ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 tests/regression/roles/sonic_system/tasks/preparation_tests.yaml diff --git a/tests/regression/roles/sonic_system/defaults/main.yml b/tests/regression/roles/sonic_system/defaults/main.yml index 4b5e69f50..bb679ced5 100644 --- a/tests/regression/roles/sonic_system/defaults/main.yml +++ b/tests/regression/roles/sonic_system/defaults/main.yml @@ -1,10 +1,6 @@ --- ansible_connection: httpapi module_name: system -delete_all: - - name: del_all_test_case_01 - description: Delete System properties - state: deleted tests: - name: test_case_01 description: System properties @@ -42,3 +38,8 @@ tests: input: anycast_address: mac_address: 00:09:5B:EC:EE:F2 + +test_delete_all: + - name: del_all_test_case_01 + description: Delete System properties + state: deleted diff --git a/tests/regression/roles/sonic_system/tasks/main.yml b/tests/regression/roles/sonic_system/tasks/main.yml index dc0ffaa51..7f6652f11 100644 --- a/tests/regression/roles/sonic_system/tasks/main.yml +++ b/tests/regression/roles/sonic_system/tasks/main.yml @@ -1,14 +1,17 @@ - debug: msg="sonic_system Test started ..." -- name: "delete_all {{ module_name }} stated ..." - include_tasks: tasks_template_del.yaml - loop: "{{ delete_all }}" - when: delete_all is defined +- name: Preparation Tests + include_tasks: preparation_tests.yaml - name: "Test {{ module_name }} started ..." include_tasks: tasks_template.yaml loop: "{{ tests }}" +- name: "test_delete_all {{ module_name }} stated ..." + include_tasks: tasks_template_del.yaml + loop: "{{ test_delete_all }}" + when: test_delete_all is defined + - name: "Cleanup test {{ module_name }} started" include_tasks: cleanup_tests.yaml diff --git a/tests/regression/roles/sonic_system/tasks/preparation_tests.yaml b/tests/regression/roles/sonic_system/tasks/preparation_tests.yaml new file mode 100644 index 000000000..eaf12cdf2 --- /dev/null +++ b/tests/regression/roles/sonic_system/tasks/preparation_tests.yaml @@ -0,0 +1,5 @@ +- name: Deletes system configurations + sonic_system: + config: {} + state: deleted + ignore_errors: yes From 88f1fe7399328f28a95f6e2df26e072f5fe9d661 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Tue, 24 May 2022 13:28:56 -0700 Subject: [PATCH 04/13] Added required execution-environment.yml --- meta/execution-environment.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 meta/execution-environment.yml diff --git a/meta/execution-environment.yml b/meta/execution-environment.yml new file mode 100644 index 000000000..283dbe334 --- /dev/null +++ b/meta/execution-environment.yml @@ -0,0 +1,3 @@ +dependencies: + python: requirements.txt +version: 1 From a7b91bc2d9559273f92064846789b12da5da8329 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Tue, 24 May 2022 14:21:27 -0700 Subject: [PATCH 05/13] Resolved sanity error --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index d7d0f2e2c..5c5d47fcd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ -paramiko>=2.7 -jinja2>=2.8 \ No newline at end of file +paramiko >= 2.7 +jinja2 >= 2.8 +resolvelib >= 0.5.3, < 0.6.0 From a6c2b0603393b4533bcd92ae2569f59d5c5ba748 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Tue, 24 May 2022 14:33:22 -0700 Subject: [PATCH 06/13] Resolved sanity error --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5c5d47fcd..2e48b6c4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -paramiko >= 2.7 -jinja2 >= 2.8 -resolvelib >= 0.5.3, < 0.6.0 +paramiko>=2.7 +jinja2>=2.8 +resolvelib<0.6.0,>=0.5.3 From 4c6769f58b58eb8d01b231498ff05bbf09aec2bd Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Tue, 24 May 2022 15:47:37 -0700 Subject: [PATCH 07/13] Resolved sanity test errors --- .github/workflows/ansible-test.yml | 3 +++ requirements.txt | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 89fb74c24..8757ecfd5 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -34,6 +34,9 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + - name: Install resolvelib 0.5.4 + run: pip install resolvelib==0.5.4 + - name: Install ansible_collections.ansible.netcommon run: ansible-galaxy collection install ansible.netcommon -p ../../ diff --git a/requirements.txt b/requirements.txt index 2e48b6c4b..428b322ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ paramiko>=2.7 jinja2>=2.8 -resolvelib<0.6.0,>=0.5.3 From 4fc0e8a21267dfad3ecd5217524403cbd0051aa4 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Wed, 25 May 2022 15:08:15 -0700 Subject: [PATCH 08/13] Resolved port_breakout regression playbook failures against 4.x --- .github/workflows/ansible-test.yml | 3 -- .../config/port_breakout/port_breakout.py | 8 +++-- .../module_utils/network/sonic/utils/utils.py | 18 +++++----- .../sonic_port_breakout/defaults/main.yml | 34 +++++++++---------- .../templates/cli_test_case_01.cfg | 4 +-- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 8757ecfd5..89fb74c24 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -34,9 +34,6 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Install resolvelib 0.5.4 - run: pip install resolvelib==0.5.4 - - name: Install ansible_collections.ansible.netcommon run: ansible-galaxy collection install ansible.netcommon -p ../../ diff --git a/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py b/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py index caaef957b..572312f45 100644 --- a/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py +++ b/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py @@ -145,6 +145,8 @@ def _state_merged(self, want, have, diff): """ commands = diff requests = self.get_modify_port_breakout_requests(commands, have) + print('\n\nrequests', file=open('mylog.txt', 'a')) + print(requests, file=open('mylog.txt', 'a')) if commands and len(requests) > 0: commands = update_states(commands, "merged") else: @@ -180,8 +182,8 @@ def get_port_breakout_payload(self, name, mode, match): payload = {} speed = get_speed_from_breakout_mode(mode) if speed: - num_channels = int(mode[0]) - mode_cfg = {'config': {'num-channels': num_channels, 'channel-speed': speed}} + num_breakouts = int(mode[0]) + mode_cfg = {'groups': {'group': [{'index': 1, 'config': {'index': 1, 'num-breakouts': num_breakouts, 'breakout-speed': speed}}]}} port_cfg = {'openconfig-platform-port:breakout-mode': mode_cfg} compo_cfg = {'name': name, 'port': port_cfg} payload = {'openconfig-platform:components': {'component': [compo_cfg]}} @@ -190,7 +192,7 @@ def get_port_breakout_payload(self, name, mode, match): def get_delete_single_port_breakout(self, name, match): del_req = None if match: - del_url = 'data/openconfig-platform:components/component=%s/port/openconfig-platform-port:breakout-mode/config' % (name.replace('/', '%2f')) + del_url = 'data/openconfig-platform:components/component=%s/port/openconfig-platform-port:breakout-mode' % (name.replace('/', '%2f')) del_req = {'path': del_url, 'method': DELETE} return del_req diff --git a/plugins/module_utils/network/sonic/utils/utils.py b/plugins/module_utils/network/sonic/utils/utils.py index 66c5148ee..51ea77d8e 100644 --- a/plugins/module_utils/network/sonic/utils/utils.py +++ b/plugins/module_utils/network/sonic/utils/utils.py @@ -457,14 +457,16 @@ def get_breakout_mode(module, name): port_name = raw_port_breakout.get('name', None) port_data = raw_port_breakout.get('port', None) if port_name and port_data and 'openconfig-platform-port:breakout-mode' in port_data: - if 'config' in port_data['openconfig-platform-port:breakout-mode']: - cfg = port_data['openconfig-platform-port:breakout-mode']['config'] - channel_speed = cfg.get('channel-speed', None) - num_channels = cfg.get('num-channels', None) - if channel_speed and num_channels: - speed = channel_speed.replace('openconfig-if-ethernet:SPEED_', '') - speed = speed.replace('GB', 'G') - mode = str(num_channels) + 'x' + speed + if 'groups' in port_data['openconfig-platform-port:breakout-mode']: + group = port_data['openconfig-platform-port:breakout-mode']['groups']['group'][0] + if 'config' in group: + cfg = group.get('config', None) + breakout_speed = cfg.get('breakout-speed', None) + num_breakouts = cfg.get('num-breakouts', None) + if breakout_speed and num_breakouts: + speed = breakout_speed.replace('openconfig-if-ethernet:SPEED_', '') + speed = speed.replace('GB', 'G') + mode = str(num_breakouts) + 'x' + speed return mode diff --git a/tests/regression/roles/sonic_port_breakout/defaults/main.yml b/tests/regression/roles/sonic_port_breakout/defaults/main.yml index 07e78aee3..402088be5 100644 --- a/tests/regression/roles/sonic_port_breakout/defaults/main.yml +++ b/tests/regression/roles/sonic_port_breakout/defaults/main.yml @@ -4,21 +4,21 @@ module_name: port_breakout preparations_tests: delete_port_breakouts: - - "no interface breakout port 1/1" - - "no interface breakout port 1/3" - - "no interface breakout port 1/5" - - "no interface breakout port 1/7" - - "no interface breakout port 1/9" - - "no interface breakout port 1/11" + - "no interface breakout port 1/97" + - "no interface breakout port 1/98" + - "no interface breakout port 1/99" + - "no interface breakout port 1/100" + - "no interface breakout port 1/101" + - "no interface breakout port 1/102" tests_cli: - name: cli_test_case_01 description: Configure breakout mode for ports state: merged input: - - name: 1/1 + - name: 1/97 mode: 4x25G - - name: 1/3 + - name: 1/98 mode: 1x40G tests: @@ -26,31 +26,31 @@ tests: description: Configure breakout mode for ports state: merged input: - - name: 1/1 + - name: 1/97 mode: 4x25G - - name: 1/3 + - name: 1/98 mode: 1x40G - - name: 1/5 + - name: 1/99 mode: 4x25G - - name: 1/7 + - name: 1/100 mode: 4x10G - - name: 1/9 + - name: 1/101 mode: 1x40G - - name: 1/11 + - name: 1/102 mode: 4x25G - name: test_case_02 description: Update breakout mode for ports state: merged input: - - name: 1/1 + - name: 1/97 mode: 1x40G - - name: 1/3 + - name: 1/98 mode: 4x10G - name: test_case_03 description: delete specific port breakout mode state: deleted input: - - name: 1/3 + - name: 1/98 - name: test_case_04 description: deleting all the port breakout modes state: deleted diff --git a/tests/regression/roles/sonic_port_breakout/templates/cli_test_case_01.cfg b/tests/regression/roles/sonic_port_breakout/templates/cli_test_case_01.cfg index a20a69599..c08c5950c 100644 --- a/tests/regression/roles/sonic_port_breakout/templates/cli_test_case_01.cfg +++ b/tests/regression/roles/sonic_port_breakout/templates/cli_test_case_01.cfg @@ -1,2 +1,2 @@ -interface breakout port 1/1 mode 4x25G -interface breakout port 1/3 mode 1x40G +interface breakout port 1/97 mode 4x25G +interface breakout port 1/98 mode 1x40G From f437251c94db26e535132d1bf1cbc93b819ef57f Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Wed, 25 May 2022 15:10:03 -0700 Subject: [PATCH 09/13] Removed debugging prints --- .../network/sonic/config/port_breakout/port_breakout.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py b/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py index 572312f45..371019d04 100644 --- a/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py +++ b/plugins/module_utils/network/sonic/config/port_breakout/port_breakout.py @@ -145,8 +145,6 @@ def _state_merged(self, want, have, diff): """ commands = diff requests = self.get_modify_port_breakout_requests(commands, have) - print('\n\nrequests', file=open('mylog.txt', 'a')) - print(requests, file=open('mylog.txt', 'a')) if commands and len(requests) > 0: commands = update_states(commands, "merged") else: From 8b54fdd6a45cb0a7f538112595a4f5975afcad49 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Wed, 25 May 2022 15:29:13 -0700 Subject: [PATCH 10/13] Reverting requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 428b322ed..d7d0f2e2c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ paramiko>=2.7 -jinja2>=2.8 +jinja2>=2.8 \ No newline at end of file From a6d2a194b7cbf320d3572a5a07ce3e3ffec04e76 Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Thu, 26 May 2022 08:07:18 -0700 Subject: [PATCH 11/13] Added stable-2.13 to test matrix --- .github/workflows/ansible-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 89fb74c24..988acc60c 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -17,6 +17,7 @@ jobs: - stable-2.10 - stable-2.11 - stable-2.12 + - stable-2.13 - devel runs-on: ubuntu-latest steps: From f82c0b9cc11e5357ec42f3dd9c061e1d4e6180fc Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Thu, 26 May 2022 09:52:23 -0700 Subject: [PATCH 12/13] Resolved aaa regression playbook failures --- plugins/module_utils/network/sonic/facts/aaa/aaa.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/network/sonic/facts/aaa/aaa.py b/plugins/module_utils/network/sonic/facts/aaa/aaa.py index 2dd3538e7..5a7bd05c9 100644 --- a/plugins/module_utils/network/sonic/facts/aaa/aaa.py +++ b/plugins/module_utils/network/sonic/facts/aaa/aaa.py @@ -53,11 +53,11 @@ def get_aaa(self): response = edit_config(self._module, to_request(self._module, request)) except ConnectionError as exc: self._module.fail_json(msg=str(exc), code=exc.code) + data = {} if ('openconfig-system:aaa' in response[0][1]): if ('authentication' in response[0][1]['openconfig-system:aaa']): - data = response[0][1]['openconfig-system:aaa']['authentication']['config'] - else: - data = {} + if ('config' in response[0][1]['openconfig-system:aaa']['authentication']): + data = response[0][1]['openconfig-system:aaa']['authentication']['config'] return data def populate_facts(self, connection, ansible_facts, data=None): From 4c7ce9243e8379e7a52ecd1b9b2f903fdbf192da Mon Sep 17 00:00:00 2001 From: Shade Talabi Date: Fri, 27 May 2022 12:22:23 -0700 Subject: [PATCH 13/13] Resolved users regression playbook failures --- plugins/module_utils/network/sonic/facts/users/users.py | 3 ++- tests/regression/roles/sonic_users/defaults/main.yml | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/network/sonic/facts/users/users.py b/plugins/module_utils/network/sonic/facts/users/users.py index 2f41a6791..038e97f83 100644 --- a/plugins/module_utils/network/sonic/facts/users/users.py +++ b/plugins/module_utils/network/sonic/facts/users/users.py @@ -112,9 +112,10 @@ def get_all_users(self): role = role[0] password = raw_user.get('password', None) user = {} - if name and role and password: + if name and role: user['name'] = name user['role'] = role + if password: user['password'] = password if user: users.append(user) diff --git a/tests/regression/roles/sonic_users/defaults/main.yml b/tests/regression/roles/sonic_users/defaults/main.yml index 397878bd2..342cb2d40 100644 --- a/tests/regression/roles/sonic_users/defaults/main.yml +++ b/tests/regression/roles/sonic_users/defaults/main.yml @@ -79,10 +79,12 @@ tests: input: - name: user1 role: operator + password: admin update_password: on_create - name: user2 role: admin - update_password: on_create + password: admin + update_password: on_create - name: test_case_03 description: Delete user state: deleted