-
Notifications
You must be signed in to change notification settings - Fork 46
dcnm_fabric v2. Ready for review. #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
4d3aa86
Convert type hints to non-deprecated dict/list and remove typing impo…
allenrobel b6f5ca7
Modularize integration tests (not yet complete)
allenrobel dbb2813
Modularize integration tests (complete)
allenrobel 959b586
Replace Any,Dict with non-deprecated type hints.
allenrobel 6a42493
Copy image_policies.py to module_utils/common...
allenrobel 59011ac
Update Log() to v2.
allenrobel 3ad8de0
Update MergeDicts() import to MergeDicts() v2.
allenrobel 46c5584
Update ParamsMergeDefaults() import to ParamsMergeDefaults() v2.
allenrobel eebee3a
Update ParamsValidate() import to ParamsValidate() v2.
allenrobel df81da2
Add EpIssu() endpoint
allenrobel a1b72c6
Leverage v2 classes (work in progress)
allenrobel 525651b
WIP: Modify support classes to use RestSend() v2
allenrobel b9e93cb
WIP: Modify support classes to use RestSend() v2 Part2
allenrobel 9c84f65
Align integration test with latest commits.
allenrobel 399bf2a
ImageUpgrade: use ConversionUtils() for conversion functions.
allenrobel c620d1e
ImageUpgrade: Set endpoint closer to commit()
allenrobel ce1ca43
ImagePolicyAttach(): hardening.
allenrobel 277dbb1
WaitForControllerDone: new class
allenrobel 2585dcb
RestSend() v2: set payload to None after commit()
allenrobel 8be8511
EpPolicyDetach(): require list of serial numbers.
allenrobel ceeb82d
Minor code reordering.
allenrobel 6e7ec81
ImagePolicyDetach() fixes, more...
allenrobel c307708
dcnm_image_upgrade.py: fix serial_numbers populate
allenrobel 26319ed
Refactor, add method return type hints
allenrobel 2ea4bb7
Update debug log message with class/method names.
allenrobel bad8fa3
Remove useless results property assignments.
allenrobel ddfb6a8
rename self.endpoint to self.ep_policy_attach
allenrobel c0d6b53
wait_for_controller_done.py: fix raise, more...
allenrobel 9c3785a
General improvements
allenrobel ad30849
Log debug message only once per loop.
allenrobel 7837564
Remove debug log that's no longer needed.
allenrobel c39ba73
IT: deleted.yaml: Align asserts with expected results.
allenrobel 25b9a87
Run through linters.
allenrobel 681e4bd
Results(): Be extra-careful to avoid false positives.
allenrobel 245dc66
IT: Add deleted_1x_switch integration test.
allenrobel 6c100fe
IT: Update testcase to reflect new result output.
allenrobel cfd3bda
dcnm_image_upgrade.py: appease pylint
allenrobel f996b52
Remove unused files.
allenrobel f2a9bdf
Remove debug log messages.
allenrobel ee0c7f4
dcnm_image_upgrade.py: Refactor
allenrobel ea51372
install_options.py: rename self.endpoint to self.ep_install_options
allenrobel 44e97b5
IT: update integration tests to reflect Results() v2 output.
allenrobel ca36718
image_policy_detach.py: Update docstrings
allenrobel 9cfde70
Remove files that are no longer needed.
allenrobel b8f2b5a
UT: WIP, initial updates to utils.py for unit tests.
allenrobel dbddbf6
UT: ImageStage(): Convert unit tests to align with v2 support classes.
allenrobel b914a19
test_image_stsage.py : Various cleanup
allenrobel b99b649
test_image_stage.py: add test
allenrobel 0768907
test_image_stage.py: Add asserts, update comments
allenrobel bb2b9e2
image_stage.py: Add debug logs for method entry, more...
allenrobel 91154b4
UT: ImageValidate(): Convert unit tests to align with v2 support clas…
allenrobel cd200c4
UT: ImageValidate(): complete unit test alignment.
allenrobel 948a0ee
image_stage.py: Add serial_numbers to several log messages.
allenrobel 950f309
UT: test_switch_issu_details_by_serial_number.py
allenrobel 13c9803
UT: SwitchIssuDetailsBy*(): Unit test alignment complete.
allenrobel f1e8e68
UT: WIP ImageUpgrade(): Unit test alignment with v2 support libraries.
allenrobel 21f35ed
UT: ImageUpgrade(): Unit test alignment with v2 support libraries com…
allenrobel cb4873d
Remove unused vars
allenrobel 72acf5c
UT: ImageUpgrade: move devices out of test file.
allenrobel 32c2474
UT: ImageInstallOptions: Unit test alignment with v2 support libraries.
allenrobel 35557eb
Minor, rename var
allenrobel 33eb9c6
RestSend(): set _payload to None after commit.
allenrobel af82e16
Update two fabric testcases that started failing.
allenrobel e8c565e
UT: ControllerVersion: align unit tests with v2 support classes
allenrobel 2cb8ffa
UT: ImagePolicies: align unit tests with v2 support classes
allenrobel 648f4c3
UT: EpPolicyDetach() update unit tests
allenrobel 46a3e20
UT: Remove duplicate unit tests
allenrobel 20be34b
Run through black
allenrobel 76b37c8
UT: Remove duplicate unit tests
allenrobel aa9c60c
dcnm_image_upgrade v2: Fix sanity errors
allenrobel 86120c8
dcnm_image_upgrade v2: Fix more sanity errors
allenrobel 28aa5aa
Add boilerplate
allenrobel e826f50
ControllerFeatures(): leverage RestSend() v2
allenrobel 7e64268
UT: SwitchDetails(): Add 500 response test, more
allenrobel 3e4b0d7
Remove deprecated use of typing Any, Dict.
allenrobel bc58972
Remove need to pass params to FabricDetails*() v2
allenrobel 6a41238
Remove need to pass params to FabricConfigDeploy()
allenrobel 9135bdc
Remove need to pass params to FabricConfigSave()
allenrobel 68c731a
UT: FabricConfigDeploy() update unit tests to use Sender() and RestSe…
allenrobel 671606b
WIP: initial work to move to RestSend() v2
allenrobel 9fcb447
Results().did_anything_change(): add condition
allenrobel b507dfe
FabricCommon(): remove properties dict.
allenrobel ba3f41c
FabricCreateCommon()._build_properties(): remove.
allenrobel d44bad3
FabricDelete(): changes for RestSend() v2
allenrobel 85862e0
UT: FabricDelete(): update unit tests
allenrobel f4d5fb5
UT: FabricCreateCommon(): update unit tests
allenrobel de232a1
UT: utils.py, align with previous UT changes.
allenrobel 2e0f1e8
FabricSummary()._build_properties(): remove
allenrobel 0144c9e
UT: update to align with b507dfe7.
allenrobel 48c8bb2
UT: FabricSummary(): align unit tests with 2e0f1e83.
allenrobel 4850c96
FabricCreate(): remove properties dict.
allenrobel 3796017
FabricQuery: Remove need to pass params.
allenrobel 2becfd0
FabricReplaced: Remove need to pass params
allenrobel f4a6cc3
FabricUpdate(): Remove need to pass params
allenrobel f4425cd
WIP: dcnm_fabric.py: update to use v2 libraries
allenrobel 140eca1
Use Properties() class decorators
allenrobel c4e559c
Remove unused import.
allenrobel 9102057
IT: Update integration tests
allenrobel 2d91a50
Remove unneeded comment
allenrobel 767b0c1
IT: Update asserts for metadata.action
allenrobel 964b4ba
FabricConfigSave(): fix check_mode and state assignment
allenrobel 8a631b8
dcnm_fabric.py: Remove params from class initializers.
allenrobel 9abf3d6
dcnm_fabric.py: Various improvements...
allenrobel 47aa8bb
IT: Add dcnm_fabric_replaced_vxlan
allenrobel 2f940d8
IT: Fix comments in dcnm_fabric_replaced_basic
allenrobel c04d253
IT: Add test for VXLAN with non-default SITE_ID
allenrobel 9cae00f
Idempotence fixes.
allenrobel a7ea0b7
Fix pylint and PEP8 sanity errors.
allenrobel a8e694d
Common(): leverage class decorators in Properties()
allenrobel 52fe2ce
Numerous changes to remove legacy fabric_details.py
allenrobel 647e6fa
Query(): Fix and add integration test.
allenrobel 16d897a
Merge branch 'develop' into dcnm_image_upgrade_v2_backup
allenrobel dfc1a72
Merge branch 'dcnm_image_upgrade_v2_backup' into dcnm_fabric_v2
allenrobel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
all: | ||
vars: | ||
ansible_user: "admin" | ||
ansible_password: "password-ndfc" | ||
switch_password: "password-switch" | ||
ansible_python_interpreter: python | ||
ansible_httpapi_validate_certs: False | ||
ansible_httpapi_use_ssl: True | ||
children: | ||
ndfc: | ||
vars: | ||
ansible_connection: ansible.netcommon.httpapi | ||
ansible_network_os: cisco.dcnm.dcnm | ||
hosts: | ||
192.168.1.1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
# This playbook can be used to execute integration tests for | ||
# the role located in: | ||
# | ||
# tests/integration/targets/dcnm_image_upgrade | ||
# | ||
# Modify the hosts and vars sections with details for your testing | ||
# setup and uncomment the testcase you want to run. | ||
# | ||
- hosts: dcnm | ||
gather_facts: no | ||
connection: ansible.netcommon.httpapi | ||
|
||
vars: | ||
# testcase: 00_setup_create_fabric | ||
# testcase: 01_setup_add_switches_to_fabric | ||
# testcase: 02_setup_replace_image_policies | ||
# testcase: deleted | ||
# testcase: deleted_1x_switch | ||
# testcase: merged_global_config | ||
# testcase: merged_override_global_config | ||
# testcase: query | ||
fabric_name: LAN_Classic_Fabric | ||
switch_username: admin | ||
switch_password: "{{ switch_password }}" | ||
leaf1: 192.168.1.2 | ||
leaf2: 192.168.1.3 | ||
spine1: 192.168.1.4 | ||
# for dcnm_image_policy and dcnm_image_upgrade roles | ||
image_policy_1: NR1F | ||
image_policy_2: NR2F | ||
# for dcnm_image_policy role | ||
epld_image_1: n9000-epld.10.3.1.F.img | ||
epld_image_2: n9000-epld.10.3.1.F.img | ||
nxos_image_1: nxos64-cs.10.3.1.F.bin | ||
nxos_image_2: nxos64-cs.10.3.2.F.bin | ||
nxos_release_1: 10.3.1_nxos64-cs_64bit | ||
nxos_release_2: 10.3.2_nxos64-cs_64bit | ||
# for dcnm_image_upgrade role | ||
fabric_name_1: "{{ fabric_name }}" | ||
ansible_switch_1: "{{ leaf1 }}" | ||
ansible_switch_2: "{{ leaf2 }}" | ||
ansible_switch_3: "{{ spine1 }}" | ||
|
||
roles: | ||
- dcnm_image_upgrade |
87 changes: 87 additions & 0 deletions
87
plugins/module_utils/common/api/v1/imagemanagement/rest/packagemgnt/packagemgnt.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright (c) 2024 Cisco and/or its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
__author__ = "Allen Robel" | ||
|
||
import logging | ||
|
||
from ansible_collections.cisco.dcnm.plugins.module_utils.common.api.v1.imagemanagement.rest.rest import \ | ||
Rest | ||
|
||
|
||
class PackageMgnt(Rest): | ||
""" | ||
## api.v1.imagemanagement.rest.packagemgnt.PackageMgnt() | ||
|
||
### Description | ||
Common methods and properties for PackageMgnt() subclasses | ||
|
||
### Path | ||
``/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/packagemgnt`` | ||
""" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.class_name = self.__class__.__name__ | ||
self.log = logging.getLogger(f"dcnm.{self.class_name}") | ||
self.packagemgnt = f"{self.rest}/packagemgnt" | ||
self.log.debug("ENTERED api.v1.PackageMgnt()") | ||
|
||
|
||
class EpIssu(PackageMgnt): | ||
""" | ||
## api.v1.imagemanagement.rest.packagemgnt.EpIssu() | ||
|
||
### Description | ||
Return endpoint information. | ||
|
||
### Raises | ||
- None | ||
|
||
### Path | ||
- ``/api/v1/imagemanagement/rest/packagemgnt/issu`` | ||
|
||
### Verb | ||
- GET | ||
|
||
### Parameters | ||
- path: retrieve the path for the endpoint | ||
- verb: retrieve the verb for the endpoint | ||
|
||
### Usage | ||
```python | ||
instance = EpIssu() | ||
path = instance.path | ||
verb = instance.verb | ||
``` | ||
""" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.class_name = self.__class__.__name__ | ||
self.log = logging.getLogger(f"dcnm.{self.class_name}") | ||
msg = "ENTERED api.v1.imagemanagement.rest." | ||
msg += f"packagemgnt.{self.class_name}" | ||
self.log.debug(msg) | ||
|
||
@property | ||
def path(self): | ||
return f"{self.packagemgnt}/issu" | ||
|
||
@property | ||
def verb(self): | ||
return "GET" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.