-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Configure LIFs and SVM on NetApp #1190
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
Open
skrobul
wants to merge
17
commits into
main
Choose a base branch
from
configure-svm-ips
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
- extract fixtures - resolve UUID parsing problems
Otherwise NetApp refuses to create a logical interface.
This fixes: - too long lines - various mocking after changes to openstack style logging format
...and related elements
Completely restructure the NetApp integration from a monolithic manager to a layered architecture with dependency injection, improving maintainability, testability, and extensibility. - Replace single `netapp_manager.py` with modular package - Introduce 4-layer architecture: Manager → Services → Client → SDK - Implement dependency injection for all components to help with testing - Add comprehensive error handling and configuration management ```text NetAppManager ├── SvmService ──────┐ ├── VolumeService ───┼── NetAppClient ── NetApp SDK ├── LifService ──────┘ ├── NetAppConfig └── ErrorHandler ``` Note: SDK is provided by NetApp, included here for visibility. - Replace complex SDK mocking with clean service interfaces - Add integration tests for cross-service coordination - All existing NetAppManager public methods unchanged - Same method signatures and return values - Existing code continues to work without modification - Enhanced error messages with structured context (will be useful when we get Sentry or similar solution) **Maintainability**: Clear separation of concerns with single responsibility **Testability**: Each layer tested in isolation with mock-friendly interfaces (no more `@patch` 10 times for a single test) **Extensibility**: New operations easily added at appropriate layer **Reliability**: Centralized error handling and structured logging
According to Venkat, the physical slots used for those interfaces will vary with each environment.
… boundaries - Replace manager tests with focused orchestration and delegation tests - Consolidate integration tests into single comprehensive file - Remove duplicate test logic that violated service boundaries - Manager tests now focus on service coordination, error propagation, and API contracts - Integration tests focus on cross-service workflows and complex scenarios - Eliminate ~70+ redundant tests while maintaining comprehensive coverage This cleanup addresses architectural boundary violations where manager tests were duplicating service-level logic, creating maintenance overhead and unclear test responsibilities. The refactored tests properly separate concerns between orchestration (manager), coordination (integration), and business logic (services).
As per Venkat's recommendation.
7b1da4e
to
7ea55b0
Compare
Replace positional %s format strings with dictionary-based %(key)s format in all NetApp module logging calls to fix literal format string display
7ea55b0
to
0432bb1
Compare
Example run: ``` ❯ ./delete_volumes_and_svms_netapp.py 70487c184b8244e39d8ffea6d7c4908d Deleting resources for project: 70487c184b8244e39d8ffea6d7c4908d Connecting to ONTAP: netapp1.dev.undercloud.rackspace.net Starting LIF cleanup process for SVM: os-70487c184b8244e39d8ffea6d7c4908d Step 1: Discovering LIFs for SVM os-70487c184b8244e39d8ffea6d7c4908d Found 4 LIFs for SVM os-70487c184b8244e39d8ffea6d7c4908d Debug - Raw LIF data: {'uuid': '6bdea5db-8745-11f0-9990-d039eabcb02a', 'name': 'N1-lif-A', 'ip': {'address': '100.127.0.69'}, 'svm': {'name': 'os-70487c184b8244e39d8ffea6d7c4908d'}, 'location': {'home_node': {'name': 'c-5836964-1337319-n01'}, 'home_port': {'uuid': '6bbee3ac-8745-11f0-9990-d039eabcb02a', 'name': 'e4a-2008', '_links': {'self': {'href': '/api/network/ethernet/ports/6bbee3ac-8745-11f0-9990-d039eabcb02a'}}}}, '_links': {'self': {'href': '/api/network/ip/interfaces/6bdea5db-8745-11f0-9990-d039eabcb02a'}}} LIF: N1-lif-A (UUID: 6bdea5db-8745-11f0-9990-d039eabcb02a) Home Port: e4a-2008 (UUID: 6bbee3ac-8745-11f0-9990-d039eabcb02a) Home Node: c-5836964-1337319-n01 Debug - Raw LIF data: {'uuid': '6c33d011-8745-11f0-9990-d039eabcb02a', 'name': 'N1-lif-B', 'ip': {'address': '100.127.128.69'}, 'svm': {'name': 'os-70487c184b8244e39d8ffea6d7c4908d'}, 'location': {'home_node': {'name': 'c-5836964-1337319-n01'}, 'home_port': {'uuid': '6c178b20-8745-11f0-9990-d039eabcb02a', 'name': 'e4b-2008', '_links': {'self': {'href': '/api/network/ethernet/ports/6c178b20-8745-11f0-9990-d039eabcb02a'}}}}, '_links': {'self': {'href': '/api/network/ip/interfaces/6c33d011-8745-11f0-9990-d039eabcb02a'}}} LIF: N1-lif-B (UUID: 6c33d011-8745-11f0-9990-d039eabcb02a) Home Port: e4b-2008 (UUID: 6c178b20-8745-11f0-9990-d039eabcb02a) Home Node: c-5836964-1337319-n01 Debug - Raw LIF data: {'uuid': '6c8c4b89-8745-11f0-b46e-d039eabcaa76', 'name': 'N2-lif-A', 'ip': {'address': '100.127.0.70'}, 'svm': {'name': 'os-70487c184b8244e39d8ffea6d7c4908d'}, 'location': {'home_node': {'name': 'c-5836964-1337320-n02'}, 'home_port': {'uuid': '6c67b34e-8745-11f0-b46e-d039eabcaa76', 'name': 'e4a-2008', '_links': {'self': {'href': '/api/network/ethernet/ports/6c67b34e-8745-11f0-b46e-d039eabcaa76'}}}}, '_links': {'self': {'href': '/api/network/ip/interfaces/6c8c4b89-8745-11f0-b46e-d039eabcaa76'}}} LIF: N2-lif-A (UUID: 6c8c4b89-8745-11f0-b46e-d039eabcaa76) Home Port: e4a-2008 (UUID: 6c67b34e-8745-11f0-b46e-d039eabcaa76) Home Node: c-5836964-1337320-n02 Debug - Raw LIF data: {'uuid': '6ce935ae-8745-11f0-b46e-d039eabcaa76', 'name': 'N2-lif-B', 'ip': {'address': '100.127.128.70'}, 'svm': {'name': 'os-70487c184b8244e39d8ffea6d7c4908d'}, 'location': {'home_node': {'name': 'c-5836964-1337320-n02'}, 'home_port': {'uuid': '6cc40c40-8745-11f0-b46e-d039eabcaa76', 'name': 'e4b-2008', '_links': {'self': {'href': '/api/network/ethernet/ports/6cc40c40-8745-11f0-b46e-d039eabcaa76'}}}}, '_links': {'self': {'href': '/api/network/ip/interfaces/6ce935ae-8745-11f0-b46e-d039eabcaa76'}}} LIF: N2-lif-B (UUID: 6ce935ae-8745-11f0-b46e-d039eabcaa76) Home Port: e4b-2008 (UUID: 6cc40c40-8745-11f0-b46e-d039eabcaa76) Home Node: c-5836964-1337320-n02 Found 4 LIFs that need to be cleaned up Step 2: Analyzing home ports used by SVM os-70487c184b8244e39d8ffea6d7c4908d Found 4 unique home ports used by SVM os-70487c184b8244e39d8ffea6d7c4908d Analyzing 34 total LIFs across all SVMs for port usage Found 4 home ports used exclusively by SVM os-70487c184b8244e39d8ffea6d7c4908d Exclusive port: e4a-2008 on node c-5836964-1337320-n02 (UUID: 6c67b34e-8745-11f0-b46e-d039eabcaa76) Exclusive port: e4b-2008 on node c-5836964-1337320-n02 (UUID: 6cc40c40-8745-11f0-b46e-d039eabcaa76) Exclusive port: e4b-2008 on node c-5836964-1337319-n01 (UUID: 6c178b20-8745-11f0-9990-d039eabcb02a) Exclusive port: e4a-2008 on node c-5836964-1337319-n01 (UUID: 6bbee3ac-8745-11f0-9990-d039eabcb02a) Identified 4 home ports for potential cleanup Step 3: Deleting 4 LIFs for SVM os-70487c184b8244e39d8ffea6d7c4908d Deleting LIF: N1-lif-A (UUID: 6bdea5db-8745-11f0-9990-d039eabcb02a) Successfully deleted LIF N1-lif-A (UUID: 6bdea5db-8745-11f0-9990-d039eabcb02a) Deleting LIF: N1-lif-B (UUID: 6c33d011-8745-11f0-9990-d039eabcb02a) Successfully deleted LIF N1-lif-B (UUID: 6c33d011-8745-11f0-9990-d039eabcb02a) Deleting LIF: N2-lif-A (UUID: 6c8c4b89-8745-11f0-b46e-d039eabcaa76) Successfully deleted LIF N2-lif-A (UUID: 6c8c4b89-8745-11f0-b46e-d039eabcaa76) Deleting LIF: N2-lif-B (UUID: 6ce935ae-8745-11f0-b46e-d039eabcaa76) Successfully deleted LIF N2-lif-B (UUID: 6ce935ae-8745-11f0-b46e-d039eabcaa76) LIF deletion completed: 4/4 LIFs deleted successfully Step 4: Cleaning up 4 exclusive home ports Starting cleanup of 4 home ports Attempting to clean up home port e4a-2008 on node c-5836964-1337320-n02 (UUID: 6c67b34e-8745-11f0-b46e-d039eabcaa76) Port e4a-2008 details retrieved successfully Port e4a-2008 type: vlan, state: up Port e4a-2008 is VLAN type - proceeding with cleanup Home port e4a-2008 cleanup completed (VLAN configuration verified) Attempting to clean up home port e4b-2008 on node c-5836964-1337320-n02 (UUID: 6cc40c40-8745-11f0-b46e-d039eabcaa76) Port e4b-2008 details retrieved successfully Port e4b-2008 type: vlan, state: up Port e4b-2008 is VLAN type - proceeding with cleanup Home port e4b-2008 cleanup completed (VLAN configuration verified) Attempting to clean up home port e4b-2008 on node c-5836964-1337319-n01 (UUID: 6c178b20-8745-11f0-9990-d039eabcb02a) Port e4b-2008 details retrieved successfully Port e4b-2008 type: vlan, state: up Port e4b-2008 is VLAN type - proceeding with cleanup Home port e4b-2008 cleanup completed (VLAN configuration verified) Attempting to clean up home port e4a-2008 on node c-5836964-1337319-n01 (UUID: 6bbee3ac-8745-11f0-9990-d039eabcb02a) Port e4a-2008 details retrieved successfully Port e4a-2008 type: vlan, state: up Port e4a-2008 is VLAN type - proceeding with cleanup Home port e4a-2008 cleanup completed (VLAN configuration verified) Home port cleanup completed: 4/4 ports processed successfully Home port cleanup completed successfully === LIF Cleanup Summary === SVM: os-70487c184b8244e39d8ffea6d7c4908d LIFs found: 4 LIFs deleted: 4 Home ports identified for cleanup: 4 Home ports cleaned: 4 LIF cleanup process completed successfully === End LIF Cleanup Summary === Volume vol_70487c184b8244e39d8ffea6d7c4908d deletion initiated successfully SVM os-70487c184b8244e39d8ffea6d7c4908d deletion initiated successfully All resources deleted successfully ```
0754c6d
to
b46c60e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This PR implements a NetApp network configuration system that queries Nautobot for virtual machine network information and automatically creates corresponding LIF (Logical Interface) configurations on NetApp cluster. The implementation includes both a major architectural refactoring of the NetApp manager and a new Argo workflow that wraps the new functionality.
Key Features
🔧 NetApp Manager Architecture Refactoring
netapp_manager.py
to a layered architecture with dependency injectionSvmService
,VolumeService
,LifService
for business logicNetAppClient
for API abstractionErrorHandler
for centralized error management and loggingNetAppConfig
for configuration managementunderstack_workflows/docs/netapp_architecture.md
🌐 Network Configuration Workflow
netapp_configure_net.py
script that queries Nautobot for VM network configurationsTechnical Implementation
Data Flow
os-{project_id}
Configuration
nic_slot_prefix
must be part of thecinder-netapp-config
Secret inopenstack
namespace.Testing & Quality
Comprehensive Test Suite
Code Quality
Breaking Changes
netapp_manager.py
understack_workflows.netapp
packageUnfinished
You may have noticed that there is some code around the NVMe Namespaces. It is not wired in and has not been tested. Out of scope for this PR.
Command Line Testing
Argo Workflow
Example Results