Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f1cd01d
MaintenanceModeInfo: linting
allenrobel Dec 3, 2025
1fc4fb5
MaintenanceMode: linting
allenrobel Dec 3, 2025
bf1f2e1
dcnm_maintenance_mode.py: linting
allenrobel Dec 3, 2025
2f9bcd4
UT: test_dcnm_maintenance_mode: linting
allenrobel Dec 3, 2025
ded7b59
Update all docstrings to conform to Markdown
allenrobel Dec 3, 2025
0e26ebb
Appease pep8 linter
allenrobel Dec 3, 2025
3041e2d
dcnm_maintenance_mode.py: Add type hints/annotations
allenrobel Dec 4, 2025
2e9b67c
UT: Update to align with last commit.
allenrobel Dec 4, 2025
50202f2
UT: Update docstrings in dcnm_maintenance_mode unit test files
allenrobel Dec 4, 2025
89f23a3
UT: Update copyright dates
allenrobel Dec 4, 2025
baa9adb
Fix typo in docstring
allenrobel Dec 4, 2025
d47c154
Merge branch 'dcnm-maintenance-mode-docstrings' into dcnm-maintenance…
allenrobel Dec 4, 2025
f5ee6ca
Add pylint suppression directive and module docstring
allenrobel Dec 4, 2025
60da07f
Type hints and remove class decorators
allenrobel Dec 6, 2025
71db705
Appease linters
allenrobel Dec 6, 2025
26c6977
IT: Update tests with standard fabric numbering
allenrobel Dec 6, 2025
3cafb07
Merge branch 'develop' into dcnm-maintenance-mode-lint
allenrobel Dec 6, 2025
abe760e
Merge branch 'dcnm-maintenance-mode-lint' into dcnm-maintenance-mode-…
allenrobel Dec 6, 2025
fc59aa1
Merge branch 'dcnm-maintenance-mode-docstrings' into dcnm-maintenance…
allenrobel Dec 6, 2025
4041228
Merge branch 'dcnm-maintenance-mode-type-hints' into dcnm-maintenance…
allenrobel Dec 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions plugins/module_utils/common/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
"""
Common enum definitions for module utilities in module_utils/common
"""
# Copyright (c) 2025 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, annotations, division, print_function

__metaclass__ = type # pylint: disable=invalid-name
__author__ = "Allen Robel"

from enum import Enum


class MaintenanceModeSetEnum(str, Enum):
"""
# Summary

Valid maintenance mode values for switches.

These are modes that the user can set.

## Raises

None

## Values

- `MAINTENANCE`: Switch is in maintenance mode
- `NORMAL`: Switch is in normal operational mode

## See also

MaintenanceModeGetEnum
"""

MAINTENANCE = "maintenance"
NORMAL = "normal"

@classmethod
def values(cls) -> list[str]:
"""
# Summary

Return a set of valid maintenance mode values.

## Raises

None

## Returns

List of string values for all maintenance modes.
"""
return [mode.value for mode in cls]


class MaintenanceModeGetEnum(str, Enum):
"""
# Summary

Valid maintenance mode values for switches.

These are modes that the user can retrieve.

## Raises

None

## Values

- `INCONSISTENT`: A synthesized mode indicating that mode != systemMode
- `MAINTENANCE`: Switch is in maintenance mode
- `NORMAL`: Switch is in normal operational mode

## See also

MaintenanceModeGetEnum
"""

INCONSISTENT = "inconsistent"
MAINTENANCE = "maintenance"
NORMAL = "normal"

@classmethod
def values(cls) -> list[str]:
"""
# Summary

Return a set of valid maintenance mode values.

## Raises

None

## Returns

List of string values for all maintenance modes.
"""
return [mode.value for mode in cls]
Loading