コード例 #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
コード例 #2
0
ファイル: test_migrationtool.py プロジェクト: avinetworks/sdk
    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'))

        with open('./output/ns-Output.json', '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
コード例 #3
0
    def test_error_and_warning_count_on_file_v10(self):
        set_update_count()
        f5_conv(bigip_config_file=setup.get('config_file_name_v10'),
                f5_config_version=setup.get('file_version_v10'),
                controller_version=setup.get('controller_version_v17'),
                output_file_path=setup.get('output_file_path'))

        assert get_count('error') == 0
        assert get_count('warning') == 0
コード例 #4
0
    def test_error_and_warning_count(self):
        set_update_count()
        netscaler_conv(config_file_name=setup.get('config_file_name'),
                       tenant=file_attribute['tenant'],
                       cloud_name=file_attribute['cloud_name'],
                       output_file_path=setup.get('output_file_path'),
                       controller_version=setup.get('controller_version_v17'))

        assert get_count('error') == 0
        assert get_count('warning') == 5
コード例 #5
0
ファイル: test_migrationtool.py プロジェクト: avinetworks/sdk
    def test_error_and_warning_count(self):
        set_update_count()
        netscaler_conv(config_file_name=setup.get('config_file_name'),
                       tenant=file_attribute['tenant'],
                       cloud_name=file_attribute['cloud_name'],
                       output_file_path=setup.get('output_file_path'),
                       controller_version=setup.get('controller_version_v17'))

        assert get_count('error') == 0
        assert get_count('warning') == 5
コード例 #6
0
    def test_lb_vrf_match(self):
        set_update_count()
        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'),
                       ansible=True,
                       vrf=setup.get('vrf'))

        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)
            vsvips = avi_config['VsVip']
            assert vsvips[0].get(
                'vrf_context_ref'
            ) == "/api/vrfcontext/?tenant=admin&name=test_vrf&cloud=Default-Cloud"