def __init__(self, args): self.bigip_config_file = args.bigip_config_file self.skip_default_file = args.skip_default_file self.skip_pki = args.skip_pki self.f5_config_version = args.f5_config_version self.input_folder_location = args.input_folder_location self.output_file_path = args.output_file_path if args.output_file_path \ else 'output' self.option = args.option self.user = args.user self.password = args.password self.controller_ip = args.controller_ip self.tenant = args.tenant self.cloud_name = args.cloud_name self.vs_state = args.vs_state self.controller_version = args.controller_version self.distinct_app_profile = args.distinct_app_profile self.f5_host_ip = args.f5_host_ip self.f5_ssh_user = args.f5_ssh_user self.f5_ssh_password = args.f5_ssh_password self.f5_ssh_port = args.f5_ssh_port self.f5_key_file = args.f5_key_file self.ignore_config = args.ignore_config self.partition_config = args.partition_config self.version = args.version self.object_merge_check = args.no_object_merge # config_patch.py args taken into class variable self.patch = args.patch # vs_filter.py args taken into classs variable self.vs_filter = args.vs_filter # skip the object while creating ansible playbook self.ansible_skip_types = args.ansible_skip_types # Create ansible object playbook based on filter types. self.ansible_filter_types = args.ansible_filter_types # Tag to create ansible playbook. self.create_ansible = args.ansible # Prefix for objects self.prefix = args.prefix # rule config for irule conversion self.custom_config = args.custom_config # Setting snat conversion flag using args self.con_snatpool = args.convertsnat # Added not in use flag self.not_in_use = args.not_in_use # Added args for baseline profile json file to be changed self.profile_path = args.baseline_profile self.f5_passphrase_file = args.f5_passphrase_file self.vs_level_status = args.vs_level_status # Added args for creating test vips self.test_vip = args.test_vip # Support for vrf ref and segroup ref self.vrf = args.vrf self.segroup = args.segroup self.reuse_http_policy = args.reuse_http_policy # Created f5 util object. self.conversion_util = F5Util()
def __init__(self, avi_cfg, outdir, skip_types=None, filter_types=None): self.outdir = outdir self.avi_cfg = avi_cfg self.ansible_avi_config = {'avi_config': {}} self.conversion_util = F5Util() if skip_types is None: skip_types = DEFAULT_SKIP_TYPES if skip_types: self.skip_types = (skip_types if type(skip_types) == list else skip_types.split(',')) if filter_types: self.filter_types = \ (set(filter_types) if type(filter_types) == list else set(filter_types.split(','))) else: self.filter_types = None
import logging import copy import random import re import avi.migrationtools.f5_converter.converter_constants as final from avi.migrationtools.f5_converter.conversion_util import F5Util from avi.migrationtools.f5_converter.policy_converter import used_pools from avi.migrationtools.avi_migration_utils import update_count from pkg_resources import parse_version LOG = logging.getLogger(__name__) # Creating f5 object for util library. conv_utils = F5Util() used_policy=[] class VSConfigConv(object): @classmethod def get_instance(cls, version, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings): """ :param version: version of f5 instance :param f5_virtualservice_attributes: yaml attribute file for object :param prefix: prefix for objects :param con_snatpool: flag for converting snat into individual address :param custom_mappings: custom config to migrate irules :return: """ if version == '10': return VSConfigConvV10(f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings)
from pyparsing import * import logging import sys from avi.migrationtools.f5_converter.conversion_util import F5Util LOG = logging.getLogger(__name__) # Creating f5 object for util library. conversion_util = F5Util() def generate_grammar_v11(): # define data types that might be in the values unquoted_string = Word(alphanums + "!#$%&'()*+,-./:;<=>?@[\]^_`|~") quoted_string = quotedString.setParseAction(removeQuotes) ltm = Keyword("ltm") apm = Keyword("apm") auth = Keyword("auth") net = Keyword("net") sys = Keyword("sys") and_kw = Keyword("and") monitor_kw = Keyword("monitor") empty_object = Keyword("{ }") # common = Suppress("/Common/") comment = Suppress("#") + Suppress(restOfLine) BS, LBRACE, RBRACE = map(Suppress, " {}") SOL = LineStart().suppress() EOL = LineEnd().suppress() reserved_words = (ltm | apm | auth | net | sys).suppress() ignore = comment
def my_represent_scalar(self, tag, value, style=None): if style is None: if should_use_block(value): style = '|' else: style = self.default_style node = yaml.representer.ScalarNode(tag, value, style=style) if self.alias_key is not None: self.represented_objects[self.alias_key] = node return node yaml.representer.BaseRepresenter.represent_scalar = my_represent_scalar utils = F5Util() meta_file = utils.get_project_path() + '/../common/avi_resource_types.yaml' with open(meta_file) as f: supported_obj = yaml.load(f) class AviAnsibleConverter(object): common_task_args = { 'controller': "{{ controller }}", 'username': "******", 'password': "******" } ansible_dict = dict({ 'connection': 'local', 'hosts': 'localhost',