Exemplo n.º 1
0
    def test_lb_algorithm_match(self):
        set_update_count()
        ns_config = get_ns_conf_dict(setup.get('config_file_name'))[0]
        netscaler_conv(config_file_name=setup.get('config_file_name'),
                       tenant=file_attribute['tenant'],
                       output_file_path=setup.get('output_file_path'),
                       controller_version=setup.get('controller_version_v17'))
        
        output_file = '%s/ns-Output.json' %setup.get('output_file_path')

        with open(output_file, 'r') as file_strem:
            avi_config = json.load(file_strem)
            lb_vs_conf = ns_config.get('add lb vserver', {})
            for vs_name in lb_vs_conf.keys():
                pg_name = '%s-poolgroup' % vs_name
                pg_obj = [pg for pg in avi_config['PoolGroup'] if
                          pg['name'] == pg_name]
                if not pg_obj:
                    continue
                pg_obj = pg_obj[0]
                ns_util = NsUtil()
                ns_algo = lb_vs_conf[vs_name].get(
                    'lbMethod', 'LEASTCONNECTIONS')
                algo = ns_util.get_avi_lb_algorithm(ns_algo)
                for member in pg_obj['members']:
                    pool_name = ns_util.get_name(member['pool_ref'])
                    pool = [pool for pool in avi_config['Pool'] if
                            pool['name'] == pool_name][0]
                    assert pool['lb_algorithm'] == algo
Exemplo n.º 2
0
import re
import yaml
import avi.migrationtools.netscaler_converter.ns_constants as ns_constants
from datetime import datetime
from OpenSSL import crypto as c
from avi.migrationtools.netscaler_converter.ns_constants \
    import (STATUS_SKIPPED, STATUS_SUCCESSFUL, STATUS_INDIRECT,
            STATUS_MISSING_FILE, STATUS_COMMAND_NOT_SUPPORTED)
from avi.migrationtools.netscaler_converter.monitor_converter \
    import merge_object_mapping
from avi.migrationtools.netscaler_converter.ns_util import NsUtil
from avi.migrationtools.avi_migration_utils import update_count

LOG = logging.getLogger(__name__)
# Creating f5 object for util library.
ns_util = NsUtil()
tmp_ssl_key_and_cert_list = []
tmp_pki_profile_list = []
app_merge_count = {'count': 0}


class ProfileConverter(object):
    def __init__(self, tenant_name, cloud_name, tenant_ref, cloud_ref,
                 ssl_ciphers, object_merge_check, user_ignore, prefix,
                 keypassphrase=None):
        """
        Construct a new 'ProfileConverter' object.
        :param tenant_name: Name of tenant
        :param cloud_name: Name of cloud
        :param tenant_ref: Tenant reference
        :param cloud_ref: Cloud Reference