The NSX-V to Avi migration facilitates the transition from NSX's built-in NSX Advanced Load Balancer to the Avi Load Balancer. The tool retrieves the existing load balancer configurations from NSX and maps them to the Avi Load Balancer.

Note:
  • The NSX-V to Avi migration tool is available only through the CLI.

  • This is not a mandatory configuration. It is required only when the Controllers and NSX are in separate VPCs.

Prerequisites

Perform the following steps before implementing the NSX-V to Avi Migration Tool.

1. Create a virtual environment, for example, migrationtools.

python3 -m venv migrationtools

2. Activate the virtual environment using the command below:

source migrationtools/bin/activate

3. Once the virtual environment has been activated, install the dependencies. To install the avimigrationtools package, use the command given below:

pip3 install avimigrationtools

The following dependencies should be present after the successful execution of the command.

The dependencies installed post avimigrationtools package are as follows:
(migrationtools) aviuser@avi-dev:~/workspace$ pip freeze
appdirs==1.4.4
avimigrationtools==30.1.2
avisdk==30.1.2
bcrypt==4.0.1
beautifulsoup4==4.12.3
certifi==2024.2.2
cffi==1.15.1
charset-normalizer==2.0.12
configparser==5.2.0
cryptography==40.0.2
decorator==4.4.2
ecdsa==0.18.0
et-xmlfile==1.1.0
idna==3.6
Jinja2==3.0.3
linecache2==1.0.0
MarkupSafe==2.0.1
networkx==2.5.1
nose==1.3.7
nose-html-reporting==0.2.3
nose-testconfig==0.10
numpy==1.19.5
openpyxl==3.1.2
pandas==1.1.5
paramiko==3.4.0
pexpect==4.9.0
ptyprocess==0.7.0
pycparser==2.21
pycrypto==2.6.1
PyNaCl==1.5.0
pyOpenSSL==23.2.0
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
requests==2.27.1
six==1.16.0
soupsieve==2.3.2.post1
traceback2==1.4.0
unittest2==1.1.0
urllib3==1.26.18
XlsxWriter==3.2.0
xmltodict==0.13.0

4. Install the NSX dependencies.

python /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/nsxt_converter/install_nsx_dependencies.py
The additional dependencies installed are as follows:
lxml==5.1.0
nsx-policy-python-sdk @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl
nsx-python-sdk @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/nsx-python-sdk/nsx_python_sdk-4.1.2.0.0-py2.py3-none-any.whl
nsx-vmc-aws-integration-python-sdk @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.1.2.0.0-py2.py3-none-any.whl
pyvmomi==8.0.2.0.1
vapi-common-client @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/vapi-common-client/vapi_common_client-2.44.0-py2.py3-none-any.whl
vapi-runtime @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/vapi-runtime/vapi_runtime-2.44.0-py2.py3-none-any.whl
vcenter-bindings @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/vcenter-bindings/vcenter_bindings-4.2.0-py2.py3-none-any.whl
vmwarecloud-aws @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/vmwarecloud-aws/vmwarecloud_aws-1.64.0-py2.py3-none-any.whl
vmwarecloud-draas @ file://localhost//tmp/pip-req-build-rj1zvnp7/lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl
vsphere-automation-sdk==1.86.0

5. Once all the dependencies have been installed, export the $PYTHONPATH.

cd /home/aviuser/workspace/avi-migrationtools
export PYTHONPATH=$(pwd)

6. After exporting the $PYTHONPATH, set the Avi SDK present in virtual environment as the primary SDK.

ln -sf /home/aviuser/migrationtools/lib/python3.6/site-packages/avi/sdk sdk

Types of Migration

Offline Migration

Under this mode, the NSX-V LB config file is provided as the input and the avi-config is generated as the output in the folder structure as shown below:



python v2avi_converter.py -c 10.158.163.83 --alb_controller_version 22.1.6 --alb_controller_user admin --alb_controller_password admin --byot /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/pulkit/byot.json -o /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/pulkit1/ --cloud_name test -O auto-upload
Online Migration
  • Under this mode, the NSX-V LB config is picked up directly from the live NSX-V setup and it is migrated to the live Avi Controller.

python v2avi_converter.py -c 10.158.163.83 --alb_controller_version 22.1.6 --alb_controller_user admin --alb_controller_password admin -n 10.186.234.112 -u admin -p FDRB0hsuK+w.nrC4 --t_host 10.208.201.5 --t_user admin --t_pass Avivmware123$% --byot /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/pulkit/byot.json -o /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/pulkit1/ --cloud_name test -O auto-upload

Run the Migration Tool

1. Clone the avi-migrationtools repository if it is not already present in your system.

git clone https://github.com/avinetworks/avi-migrationtools.git

2. After cloning, go to the directory using the following command:

cd /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/

3. Execute the script using the following command:

python v2avi_converter.py -c 10.158.163.83 --alb_controller_version 22.1.6 --alb_controller_user admin --alb_controller_password admin -n 10.186.234.112 -u admin -p FDRB0hsuK+w.nrC4 --t_host 10.208.201.5 --t_user admin --t_pass Avivmware123$%  --byot /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/user/byot.json -o /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/user1/ -O  auto-upload
Note:

If the directory path mentioned for output_file_path is not created, the tool will create the directory path. Executing the code multiple times on the directory will create sub-folders on the same output_file_path.

Each parameter in the code is explained as below:

Parameter

Function

Example

-c / --alb_controller_ip

IP address of the Controller

10.158.163.87

--alb_controller_version

Version in which the Controller is in

22.1.6

--alb_controller_user

Username to log in to the Controller

admin

--alb_controller_password

Password to log in to the Controller

admin

-n / --nsxv_ip

IP address of the NSX-V manager

10.208.201.5

-u / --nsxv_user

Username of the NSX-V manager

admin

-p / --nsxv_password

Password of the NSX-V manager

Avivmware123$%

--t_host

IP address of the NSX-T manager

10.208.201.8

--t_user

Username of the NSX-T manager

[email protected]

--t_pass

Password of the NSX-T manager

VMware@123

-o / --output_file_path

ath to the directory where the output and config files will be stored

/home/aviuser/workspace/avi-dev/avi-migrationtools/avi/migrationtools/v2alb_converter/user_new

--cloud_name

Name of the cloud

test

-O

The type of upload that you want to perform:

  • cli-upload

  • auto-upload

auto-upload

-d

Where d is the directory of the path where the NSX-V LB config file is present

d /home/aviuser/workspace/avi-migrationtools/avi/migrationtools/v2alb_converter/nsx-v

The mandatory directory structure of the NSX-V LB is as shown below:



Here, edge-1.json is the NSX-V LB config file.

A sample byot.json to map the NSX-V edge IDs and T1 routers associateed with the Avi cloud is as shown below:

{
    "edge-id" : "t1_router_name"
}
  • Key: The ID of the NSX-V edge containing the load balancer configurations to be migrated to the Avi Controller.

  • Value: The T1-router that contains the Avi cloud.

A summary of the migration process with the status of completion, errors (if any), output location, and more is displayed:

Converting Monitor ...
Progress |##################################################| 100.0%

Converting Pools ...
Progress |##################################################| 100.0%

Converting Profiles ...
Progress |##################################################| 100.0%

Converting VS ...
Progress |##################################################| 100.0%
Total SKIPPED OBJECT: 2
Total SUCCESSFUL OBJECT: 286
Total NOT APPLICABLE OBJECT: 0
Total ERROR COUNT: 0
Total PARTIAL OBJECT: 0
Total DATASCRIPT OBJECT: 0
Writing Excel Sheet For Converted Configuration..
Progress |##################################################| 100.0%
Total Objects of ApplicationProfile : 5
Total Objects of NetworkProfile : 0
Total Objects of SSLProfile : 3
Total Objects of PKIProfile : 0
Total Objects of SSLKeyAndCertificate : 0
Total Objects of ApplicationPersistenceProfile : 0
Total Objects of HealthMonitor : 3
Total Objects of IpAddrGroup : 0
Total Objects of VSDataScriptSet : 0
Total Objects of Pool : 139
Total Objects of VirtualService : 139 (139  migrated)
Total Objects of VsVip : 6

Converted Output Location: user1_offline_136/config-output/avi_config.json
Total Warning:  0
Total Errors:  0
The time of execution of above program is : 0:00:01.746721 

Caveats

The limitations in the NSX-V to Avi Load Balancer migration tool are listed below:

  • It does not support migration to NSX-T VLAN cloud.

  • It does not perform any pre-checks for the destination topology, vCenter, NSX, and Avi compatibility.

  • It does not use UUIDs for NSX-T objects.

  • It does not perform a pre-check for the existence of two T1 gateways with the same name.

  • It does not perform a pre-check for the existence of two segments with the same name.

  • It does not validate the HA-mode of T0s in the edge cluster.