4.8 KiB
4.8 KiB
Exercise 7: Bulk VPG NIC Settings Management
This exercise demonstrates how to perform bulk operations on VPG NIC settings using two provided scripts:
export_vpg_settings_nics_to_csv.py- Exports current VPG NIC settings to a CSV fileimport_vpg_settings_nics_from_csv.py- Imports and applies NIC settings from a CSV file
Prerequisites
- Python 3.6 or higher
- Zerto Python SDK (
zvmlpackage) installed in development mode:cd /path/to/zvml-python-sdk pip install -e . - Access to a Zerto Virtual Manager (ZVM) with appropriate permissions
- VPGs already created and configured in your environment
Exercise Overview
This exercise will guide you through the process of:
- Exporting current VPG NIC settings to a CSV file
- Modifying the CSV file to update IP configurations
- Importing and applying the updated settings back to the VPGs
Step 1: Export Current VPG Settings
Use the export script to save current VPG NIC settings to a CSV file:
python export_vpg_settings_nics_to_csv.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--vpg_names "VpgTest1,VpgTest2" \
--ignore_ssl
The script will create two files:
ExportedSettings_[timestamp].json- Full VPG settings in JSON formatExportedSettings_[timestamp].csv- NIC settings in CSV format
Step 2: Modify the CSV File
Open the generated CSV file in a spreadsheet application (e.g., Microsoft Excel, Google Sheets) and modify the following settings as needed:
-
Failover Network Settings:
Failover ShouldReplaceIpConfiguration- Set to "True" to modify IP settingsFailover Network- Network identifier for failoverFailover DHCP- Set to "True" for DHCP or "False" for static IPFailover IP- Static IP address (required if DHCP is False)Failover Subnet- Subnet mask (required if DHCP is False)Failover Gateway- Default gateway (optional)Failover DNS1- Primary DNS server (optional)Failover DNS2- Secondary DNS server (optional)
-
Failover Test Network Settings:
Failover Test ShouldReplaceIpConfiguration- Set to "True" to modify IP settingsFailover Test Network- Network identifier for test failoverFailover Test DHCP- Set to "True" for DHCP or "False" for static IPFailover Test IP- Static IP address (required if DHCP is False)Failover Test Subnet- Subnet mask (required if DHCP is False)Failover Test Gateway- Default gateway (optional)Failover Test DNS1- Primary DNS server (optional)Failover Test DNS2- Secondary DNS server (optional)
Step 3: Import Updated Settings
Use the import script to apply the modified settings:
python import_vpg_settings_nics_from_csv.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--csv_file "ExportedSettings_2024-03-14_12-34-56.csv" \
--vpg_names "VpgTest1,VpgTest2" \
--ignore_ssl
The script will:
- Validate the settings in the CSV file
- Show a summary of changes to be applied
- Ask for confirmation before applying changes
- Apply the changes and commit them to the VPGs
Important Notes
- Backup: Always keep a backup of the original CSV file before making changes
- Validation: The import script validates settings before applying them:
- Checks for conflicting DHCP and static IP settings
- Verifies required fields are present
- Ensures network identifiers are valid
- Safety: The script requires explicit confirmation before applying changes
- Rollback: If needed, you can re-import the original settings from the backup CSV
Common Use Cases
-
Bulk IP Address Changes:
- Export current settings
- Update IP addresses in the CSV
- Import modified settings
-
Network Migration:
- Export current settings
- Update network identifiers
- Import modified settings
-
DHCP to Static IP Conversion:
- Export current settings
- Set
ShouldReplaceIpConfigurationto "True" - Set
DHCPto "False" - Add static IP settings
- Import modified settings
Troubleshooting
-
Validation Errors:
- Ensure
ShouldReplaceIpConfigurationis set to "True" when modifying IP settings - Check that DHCP and static IP settings are not conflicting
- Verify all required fields are filled when using static IP
- Ensure
-
Import Failures:
- Verify network identifiers exist in the target site
- Check that IP addresses are in the correct format
- Ensure you have sufficient permissions on the ZVM
-
CSV Format Issues:
- Keep the original column headers
- Don't modify the
VPG Name,VM Identifier, orNIC Identifiercolumns - Use "True" or "False" (case-insensitive) for boolean values