Beispiel #1
0
 def __init__(self, inputs, logger):
     self.inputs = inputs
     self.logger = logger
     self.vnc_lib = None
     self.agent_inspect = custom_dict(self.get_vrouter_agent_inspect_handle,
                                      'agent_inspect')
     self.k8s_client = Kubernetes_client(self.inputs.kube_config_file,
                                         self.logger)
Beispiel #2
0
    def __init__(self, inputs=None, logger=None, project_name=None,
                 username=None, password=None, domain_name=None, ini_file=None):
        project_fq_name = [domain_name or 'default-domain', project_name] \
                          if project_name else None
        self.inputs = inputs or ContrailTestInit(ini_file,
                                project_fq_name=project_fq_name)
        self.project_name = project_name or self.inputs.project_name
        self.domain_name = domain_name or self.inputs.domain_name
        self.username = username or self.inputs.stack_user
        self.password = password or self.inputs.stack_password
        self.logger = logger or self.inputs.logger
        self.nova_h = None
        self.quantum_h = None
        self.api_server_inspects = custom_dict(self.get_api_inspect_handle,
                        'api_inspect:'+self.project_name+':'+self.username)
        self.dnsagent_inspect = custom_dict(self.get_dns_agent_inspect_handle,
                                            'dns_inspect')
        self.agent_inspect = custom_dict(self.get_vrouter_agent_inspect_handle,
                                         'agent_inspect')
        self.ops_inspects = custom_dict(self.get_opserver_inspect_handle,
                                        'ops_inspect')
        self.cn_inspect = custom_dict(self.get_control_node_inspect_handle,
                                      'cn_inspect')
        self.ds_inspect = custom_dict(self.get_discovery_service_inspect_handle,
                                      'ds_inspect')

        # ToDo: msenthil/sandipd rest of init needs to be better handled
        self.vnc_lib = self.get_vnc_lib_h()
        self.auth = self.get_auth_h()
        if self.inputs.orchestrator == 'openstack':
            self.project_id = self.get_project_id()
            if self.inputs.verify_thru_gui():
                self.ui_login = UILogin(self, self.inputs, project_name, username, password)
                self.browser = self.ui_login.browser
                self.browser_openstack = self.ui_login.browser_openstack

            self.orch = OpenstackOrchestrator(username=self.username,
                                              password=self.password,
                                              project_id=self.project_id,
                                              project_name=self.project_name,
                                              inputs=self.inputs,
                                              vnclib=self.vnc_lib,
                                              logger=self.logger,
                                             auth_server_ip=self.inputs.auth_ip)
            self.nova_h = self.orch.get_compute_handler()
            self.quantum_h = self.orch.get_network_handler()
        else: # vcenter
            self.orch = VcenterOrchestrator(user=self.username,
                                            pwd=self.password,
                                            host=self.inputs.auth_ip,
                                            port=self.inputs.auth_port,
                                            dc_name=self.inputs.vcenter_dc,
                                            vnc=self.vnc_lib,
                                            inputs=self.inputs,
                                            logger=self.logger)
    def __init__(self, inputs=None, logger=None, project_name=None,
                 username=None, password=None, domain_name=None, ini_file=None):
        self.inputs = inputs or ContrailTestInit(ini_file,
                                stack_tenant=project_name)
        self.project_name = project_name or self.inputs.project_name
        self.domain_name = domain_name or self.inputs.domain_name
        self.username = username or self.inputs.stack_user
        self.password = password or self.inputs.stack_password
        self.logger = logger or self.inputs.logger
        self.nova_h = None
        self.quantum_h = None
        self.api_server_inspects = custom_dict(self.get_api_inspect_handle,
                        'api_inspect:'+self.project_name+':'+self.username)
        self.dnsagent_inspect = custom_dict(self.get_dns_agent_inspect_handle,
                                            'dns_inspect')
        self.agent_inspect = custom_dict(self.get_vrouter_agent_inspect_handle,
                                         'agent_inspect')
        self.ops_inspects = custom_dict(self.get_opserver_inspect_handle,
                                        'ops_inspect')
        self.cn_inspect = custom_dict(self.get_control_node_inspect_handle,
                                      'cn_inspect')
        self.ds_inspect = custom_dict(self.get_discovery_service_inspect_handle,
                                      'ds_inspect')

        # ToDo: msenthil/sandipd rest of init needs to be better handled
        self.vnc_lib = self.get_vnc_lib_h()
        self.auth = self.get_auth_h()
        if self.inputs.orchestrator == 'openstack':
            self.project_id = self.get_project_id()
            if self.inputs.verify_thru_gui():
                self.ui_login = UILogin(self, self.inputs, project_name, username, password)
                self.browser = self.ui_login.browser
                self.browser_openstack = self.ui_login.browser_openstack

            self.orch = OpenstackOrchestrator(username=self.username,
                                              password=self.password,
                                              project_id=self.project_id,
                                              project_name=self.project_name,
                                              inputs=self.inputs,
                                              vnclib=self.vnc_lib,
                                              logger=self.logger,
                                             auth_server_ip=self.inputs.auth_ip)
            self.nova_h = self.orch.get_compute_handler()
            self.quantum_h = self.orch.get_network_handler()
        else: # vcenter
            self.orch = VcenterOrchestrator(user=self.username,
                                            pwd=self.password,
                                            host=self.inputs.auth_ip,
                                            port=self.inputs.auth_port,
                                            dc_name=self.inputs.vcenter_dc,
                                            vnc=self.vnc_lib,
                                            inputs=self.inputs,
                                            logger=self.logger)
Beispiel #4
0
 def __init__(self, auth_h=None, **kwargs):
     self.inputs = kwargs.get('inputs')
     self.obj = None
     self.logger = kwargs.get('logger') or self.inputs.logger if self.inputs \
         else contrail_logging.getLogger(__name__)
     if not auth_h:
         auth_h = self.get_auth_h(**kwargs)
     self.auth_h = auth_h
     self.images_info = parse_cfg_file('configs/device_images.cfg')
     self.images_dir = os.path.realpath(os.path.join(
         os.path.dirname(os.path.realpath(__file__)), '..', 'images'))
     self.container_name = None
     self.installed_images = {}
     self.models = dict()
     for key, items in MODELS.items():
         for item in items:
             self.models[item] = key
     self.device_images_cfg = custom_dict(self.get_device_images_config,
                     'device_images')
Beispiel #5
0
    def __init__(self,
                 inputs=None,
                 logger=None,
                 project_name=None,
                 username=None,
                 password=None,
                 domain_name=None,
                 input_file=None,
                 domain_obj=None,
                 scope='domain'):
        self.inputs = inputs or ContrailTestInit(input_file,
                                                 stack_tenant=project_name)
        self.project_name = project_name or self.inputs.project_name
        self.domain_name = domain_name or self.inputs.domain_name
        self.orch_domain_name = domain_name or self.inputs.domain_name
        if self.orch_domain_name == 'Default':
            self.domain_name = 'default-domain'
        self.scope = scope
        self.username = username or self.inputs.stack_user
        self.password = password or self.inputs.stack_password
        self.logger = logger or self.inputs.logger
        self.nova_h = None
        self.quantum_h = None
        self.vnc_lib_fixture = None
        self.api_server_inspects = custom_dict(
            self.get_api_inspect_handle,
            'api_inspect:' + self.project_name + ':' + self.username)
        self.dnsagent_inspect = custom_dict(self.get_dns_agent_inspect_handle,
                                            'dns_inspect')
        self.agent_inspect = custom_dict(self.get_vrouter_agent_inspect_handle,
                                         'agent_inspect')
        self.ops_inspects = custom_dict(
            self.get_opserver_inspect_handle,
            'ops_inspect:' + self.project_name + ':' + self.username)
        self.cn_inspect = custom_dict(self.get_control_node_inspect_handle,
                                      'cn_inspect')
        self.k8s_client = self.get_k8s_api_client_handle()

        # ToDo: msenthil/sandipd rest of init needs to be better handled
        self.domain_id = None
        if self.inputs.domain_isolation:
            #get admin auth to list domains and get domain_id
            auth = self.get_auth_h(username=self.inputs.admin_username,
                                   password=self.inputs.admin_password,
                                   project_name=self.inputs.admin_tenant,
                                   domain_name=self.inputs.admin_domain)
            self.domain_id = auth.get_domain_id(self.domain_name)
        self.auth = self.get_auth_h()
        self.vnc_lib = self.get_vnc_lib_h()
        self.project_id = self.get_project_id()
        if self.inputs.orchestrator == 'openstack':
            if self.inputs.verify_thru_gui():
                self.ui_login = UILogin(self, self.inputs, project_name,
                                        username, password)
                self.browser = self.ui_login.browser
                self.browser_openstack = self.ui_login.browser_openstack

            self.orch = OpenstackOrchestrator(inputs=self.inputs,
                                              vnclib=self.vnc_lib,
                                              logger=self.logger,
                                              auth_h=self.auth)
            self.nova_h = self.orch.get_compute_handler()
            self.quantum_h = self.orch.get_network_handler()
            self.glance_h = self.orch.get_image_handler()
        elif self.inputs.orchestrator == 'vcenter' and self.inputs.slave_orchestrator == 'vro':
            self.orch = VroWorkflows(user=self.inputs.vcenter_username,
                                     pwd=self.inputs.vcenter_password,
                                     host=self.inputs.vcenter_server,
                                     port=self.inputs.vcenter_port,
                                     dc_name=self.inputs.vcenter_dc,
                                     vnc=self.vnc_lib,
                                     inputs=self.inputs,
                                     logger=self.logger)
        elif self.inputs.orchestrator == 'vcenter':  # vcenter
            self.orch = VcenterOrchestrator(user=self.inputs.vcenter_username,
                                            pwd=self.inputs.vcenter_password,
                                            host=self.inputs.vcenter_server,
                                            port=self.inputs.vcenter_port,
                                            dc_name=self.inputs.vcenter_dc,
                                            vnc=self.vnc_lib,
                                            inputs=self.inputs,
                                            logger=self.logger)
        elif self.inputs.orchestrator == 'kubernetes':
            self.orch = None
        if self.inputs.vcenter_gw_setup:  # vcenter_gateway
            self.slave_orch = VcenterGatewayOrch(
                user=self.inputs.vcenter_username,
                pwd=self.inputs.vcenter_password,
                host=self.inputs.vcenter_server,
                port=int(self.inputs.vcenter_port),
                dc_name=self.inputs.vcenter_dc,
                vnc=self.vnc_lib,
                inputs=self.inputs,
                logger=self.logger)
        self._kube_manager_inspect = None
    def __init__(self, ini_file=None, logger=None):
        self.jenkins_trigger = self.get_os_env('JENKINS_TRIGGERED')
        self.os_type = custom_dict(self.get_os_version, 'os_type')
        self.config = None
        if ini_file:
            self.config = ConfigParser.ConfigParser()
            self.config.read(ini_file)
        self.logger = logger or contrail_logging.getLogger(__name__)
        self.orchestrator = read_config_option(self.config, 'Basic',
                                               'orchestrator', 'openstack')
        self.prov_file = read_config_option(self.config, 'Basic', 'provFile',
                                            None)
        self.key = read_config_option(self.config, 'Basic', 'key', 'key1')

        self.tenant_isolation = read_config_option(self.config, 'Basic',
                                                   'tenant_isolation', True)

        self.user_isolation = read_config_option(self.config, 'Basic',
                                                 'user_isolation', True)
        # Read admin credentials if any

        self.admin_username = read_config_option(
            self.config, 'Basic', 'adminUser', os.getenv('OS_USERNAME', None))
        self.admin_password = read_config_option(
            self.config, 'Basic', 'adminPassword',
            os.getenv('OS_PASSWORD', None))
        self.admin_tenant = read_config_option(
            self.config, 'Basic', 'adminTenant',
            os.getenv('OS_TENANT_NAME', None))

        self.stack_user = read_config_option(self.config, 'Basic', 'stackUser',
                                             self.admin_username)
        self.stack_password = read_config_option(
            self.config, 'Basic', 'stackPassword', self.admin_password)
        self.stack_tenant = read_config_option(
            self.config, 'Basic', 'stackTenant', self.admin_tenant)
        self.stack_domain = read_config_option(
            self.config, 'Basic', 'stackDomain',
            os.getenv('OS_DOMAIN_NAME', 'default-domain'))
        self.region_name = read_config_option(
            self.config, 'Basic', 'stackRegion',
            os.getenv('OS_REGION_NAME', 'RegionOne'))
        self.neutron_username = read_config_option(self.config, 'Basic',
                                                   'neutron_username', None)
        self.availability_zone = read_config_option(self.config, 'Basic',
                                                    'availability_zone', None)
        self.endpoint_type = read_config_option(self.config, 'Basic',
                                                'endpoint_type', 'publicURL')
        self.auth_ip = read_config_option(self.config, 'Basic', 'auth_ip',
                                          None)
        self.auth_port = read_config_option(self.config, 'Basic', 'auth_port',
                                            5000)
        self.auth_protocol = read_config_option(self.config, 'Basic',
                                                'auth_protocol', 'http')
        self.ds_port = read_config_option(self.config, 'services',
                                          'discovery_port', '5998')
        self.api_server_port = read_config_option(self.config, 'services',
                                                  'config_api_port', '8082')
        self.analytics_api_port = read_config_option(
            self.config, 'services', 'analytics_api_port', '8081')
        self.bgp_port = read_config_option(self.config, 'services',
                                           'control_port', '8083')
        self.dns_port = read_config_option(self.config, 'services', 'dns_port',
                                           '8092')
        self.agent_port = read_config_option(self.config, 'services',
                                             'agent_port', '8085')
        self.discovery_ip = read_config_option(self.config, 'services',
                                               'discovery_ip', None)
        self.api_server_ip = read_config_option(self.config, 'services',
                                                'config_api_ip', None)
        self.analytics_api_ip = read_config_option(self.config, 'services',
                                                   'analytics_api_ip', None)
        self.contrail_internal_vip = read_config_option(
            self.config, 'HA', 'contrail_internal_vip', None)
        self.contrail_external_vip = read_config_option(
            self.config, 'HA', 'contrail_external_vip',
            self.contrail_internal_vip)
        self.internal_vip = read_config_option(self.config, 'HA',
                                               'internal_vip', None)
        self.external_vip = read_config_option(
            self.config, 'HA', 'external_vip', self.internal_vip)
        self.multi_tenancy = read_config_option(self.config, 'Basic',
                                                'multiTenancy', False)
        self.enable_ceilometer = read_config_option(self.config, 'Basic',
                                                    'enable_ceilometer', False)
        self.ci_flavor = read_config_option(self.config, 'Basic', 'ci_flavor',
                                            None)
        self.config_amqp_ips = read_config_option(self.config, 'services',
                                                  'config_amqp_ips', None)
        if self.config_amqp_ips:
            self.config_amqp_ips = self.config_amqp_ips.split(',')
        self.config_amqp_port = read_config_option(self.config, 'services',
                                                   'config_amqp_port', '5672')
        self.fixture_cleanup = read_config_option(self.config, 'Basic',
                                                  'fixtureCleanup', 'yes')
        self.key_filename = read_config_option(self.config, 'Basic',
                                               'key_filename', None)
        self.pubkey_filename = read_config_option(self.config, 'Basic',
                                                  'pubkey_filename', None)
        self.http_proxy = read_config_option(self.config, 'proxy', 'proxy_url',
                                             None)
        self.ui_config = read_config_option(self.config, 'ui', 'ui_config',
                                            None)
        self.ui_browser = read_config_option(self.config, 'ui', 'ui_browser',
                                             None)
        self.verify_webui = read_config_option(self.config, 'ui', 'webui',
                                               False)
        self.verify_horizon = read_config_option(self.config, 'ui', 'horizon',
                                                 False)
        if not self.ui_browser and (self.verify_webui or self.verify_horizon):
            raise ValueError(
                "Verification via GUI needs 'browser' details. Please set the same."
            )
        self.devstack = read_config_option(self.config, 'devstack', 'devstack',
                                           None)
        self.use_devicemanager_for_md5 = read_config_option(
            self.config, 'use_devicemanager_for_md5',
            'use_devicemanager_for_md5', False)
        # router options
        self.mx_rt = read_config_option(self.config, 'router', 'route_target',
                                        '10003')
        self.router_asn = read_config_option(self.config, 'router', 'asn',
                                             '64512')
        router_info_tuples_string = read_config_option(self.config, 'router',
                                                       'router_info', '[]')
        self.ext_routers = ast.literal_eval(router_info_tuples_string)
        self.fip_pool_name = read_config_option(self.config, 'router',
                                                'fip_pool_name', 'public-pool')
        self.fip_pool = read_config_option(self.config, 'router', 'fip_pool',
                                           None)
        if self.fip_pool:
            update_reserve_cidr(self.fip_pool)
        self.public_vn = read_config_option(
            self.config, 'router', 'public_virtual_network', 'public-network')
        self.public_tenant = read_config_option(
            self.config, 'router', 'public_tenant_name', 'public-tenant')

        # HA setup IPMI username/password
        self.ha_setup = read_config_option(self.config, 'HA', 'ha_setup', None)

        if self.ha_setup == True:
            self.ipmi_username = read_config_option(self.config, 'HA',
                                                    'ipmi_username', 'ADMIN')
            self.ipmi_password = read_config_option(self.config, 'HA',
                                                    'ipmi_password', 'ADMIN')
        # debug option
        self.verify_on_setup = read_config_option(self.config, 'debug',
                                                  'verify_on_setup', True)
        self.stop_on_fail = bool(
            read_config_option(self.config, 'debug', 'stop_on_fail', None))

        self.ha_tmp_list = []
        self.tor_agent_data = {}
        self.sriov_data = {}
        self.dpdk_data = {}
        self.mysql_token = None

        self.public_host = read_config_option(self.config, 'Basic',
                                              'public_host', '10.204.216.50')

        self.prov_file = self.prov_file or self._create_prov_file()
        self.prov_data = self.read_prov_file()
        self.auth_url = os.getenv('OS_AUTH_URL') or \
                        '%s://%s:%s/v2.0'%(self.auth_protocol,
                                           self.auth_ip,
                                           self.auth_port)
        #vcenter server
        self.vcenter_dc = read_config_option(self.config, 'vcenter',
                                             'vcenter_dc', None)
        self.vcenter_server = read_config_option(self.config, 'vcenter',
                                                 'vcenter_server', None)
        self.vcenter_port = read_config_option(self.config, 'vcenter',
                                               'vcenter_port', None)
        self.vcenter_username = read_config_option(self.config, 'vcenter',
                                                   'vcenter_username', None)
        self.vcenter_password = read_config_option(self.config, 'vcenter',
                                                   'vcenter_password', None)
        self.vcenter_compute = read_config_option(self.config, 'vcenter',
                                                  'vcenter_compute', None)
        #for multiple vcenter
        try:
            if 'vcenter_servers' in self.prov_data.keys():
                for server in self.prov_data['vcenter_servers']:
                    for k in server.keys():
                        self.dv_switch = server[k]['dv_switch'][
                            'dv_switch_name']
            elif 'vcenter' in self.prov_data.keys():
                self.dv_switch = self.prov_data['vcenter'][0]['dv_switch'][
                    'dv_switch_name']
        except Exception as e:
            pass

        self.username = self.host_data[self.cfgm_ip]['username']
        self.password = self.host_data[self.cfgm_ip]['password']
        # List of service correspond to each module
        self.compute_services = [
            'contrail-vrouter-agent', 'supervisor-vrouter',
            'contrail-vrouter-nodemgr'
        ]
        self.control_services = [
            'contrail-control', 'supervisor-control',
            'contrail-control-nodemgr', 'contrail-dns', 'contrail-named'
        ]
        self.cfgm_services = [
            'contrail-api', 'contrail-schema', 'contrail-discovery',
            'supervisor-config', 'contrail-config-nodemgr',
            'contrail-device-manager'
        ]
        self.webui_services = [
            'contrail-webui', 'contrail-webui-middleware', 'supervisor-webui'
        ]
        self.openstack_services = [
            'openstack-cinder-api', 'openstack-cinder-scheduler',
            'openstack-cinder-scheduler', 'openstack-glance-api',
            'openstack-glance-registry', 'openstack-keystone',
            'openstack-nova-api', 'openstack-nova-scheduler',
            'openstack-nova-cert'
        ]
        self.collector_services = [
            'contrail-collector', 'contrail-analytics-api',
            'contrail-query-engine', 'contrail-analytics-nodemgr',
            'supervisor-analytics', 'contrail-snmp-collector',
            'contrail-topology'
        ]
        self.correct_states = ['active', 'backup']
    def __init__(self, ini_file=None, logger=None):
        self.jenkins_trigger = self.get_os_env('JENKINS_TRIGGERED')
        self.os_type = custom_dict(self.get_os_version, 'os_type')
        self.config = None
        if ini_file:
            self.config = ConfigParser.ConfigParser()
            self.config.read(ini_file)
        self.logger = logger or contrail_logging.getLogger(__name__)
        self.orchestrator = read_config_option(self.config, 'Basic',
                                               'orchestrator', 'openstack')
        self.prov_file = read_config_option(self.config, 'Basic', 'provFile',
                                            None)
        self.key = read_config_option(self.config, 'Basic', 'key', 'key1')

        self.tenant_isolation = read_config_option(self.config, 'Basic',
                                                   'tenant_isolation', True)

        self.user_isolation = read_config_option(self.config, 'Basic',
                                                 'user_isolation', True)
        # Read admin credentials if any

        self.admin_username = read_config_option(
            self.config, 'Basic', 'adminUser', os.getenv('OS_USERNAME', None))
        self.admin_password = read_config_option(
            self.config, 'Basic', 'adminPassword',
            os.getenv('OS_PASSWORD', None))
        self.admin_tenant = read_config_option(
            self.config, 'Basic', 'adminTenant',
            os.getenv('OS_TENANT_NAME', None))

        self.stack_user = read_config_option(self.config, 'Basic', 'stackUser',
                                             self.admin_username)
        self.stack_password = read_config_option(self.config, 'Basic',
                                                 'stackPassword',
                                                 self.admin_password)
        self.stack_tenant = read_config_option(self.config, 'Basic',
                                               'stackTenant',
                                               self.admin_tenant)
        self.stack_domain = read_config_option(
            self.config, 'Basic', 'stackDomain',
            os.getenv('OS_DOMAIN_NAME', 'default-domain'))
        self.region_name = read_config_option(
            self.config, 'Basic', 'stackRegion',
            os.getenv('OS_REGION_NAME', 'RegionOne'))
        self.neutron_username = read_config_option(self.config, 'Basic',
                                                   'neutron_username', None)
        self.availability_zone = read_config_option(self.config, 'Basic',
                                                    'availability_zone', None)
        self.endpoint_type = read_config_option(self.config, 'Basic',
                                                'endpoint_type', 'publicURL')
        self.auth_ip = read_config_option(self.config, 'Basic', 'auth_ip',
                                          None)
        self.auth_port = read_config_option(self.config, 'Basic', 'auth_port',
                                            5000)
        self.auth_protocol = read_config_option(self.config, 'Basic',
                                                'auth_protocol', 'http')
        self.ds_port = read_config_option(self.config, 'services',
                                          'discovery_port', '5998')
        self.api_server_port = read_config_option(self.config, 'services',
                                                  'config_api_port', '8082')
        self.analytics_api_port = read_config_option(self.config, 'services',
                                                     'analytics_api_port',
                                                     '8081')
        self.bgp_port = read_config_option(self.config, 'services',
                                           'control_port', '8083')
        self.dns_port = read_config_option(self.config, 'services', 'dns_port',
                                           '8092')
        self.agent_port = read_config_option(self.config, 'services',
                                             'agent_port', '8085')
        self.discovery_ip = read_config_option(self.config, 'services',
                                               'discovery_ip', None)
        self.api_server_ip = read_config_option(self.config, 'services',
                                                'config_api_ip', None)
        self.analytics_api_ip = read_config_option(self.config, 'services',
                                                   'analytics_api_ip', None)
        self.contrail_internal_vip = read_config_option(
            self.config, 'HA', 'contrail_internal_vip', None)
        self.contrail_external_vip = read_config_option(
            self.config, 'HA', 'contrail_external_vip',
            self.contrail_internal_vip)
        self.internal_vip = read_config_option(self.config, 'HA',
                                               'internal_vip', None)
        self.external_vip = read_config_option(self.config, 'HA',
                                               'external_vip',
                                               self.internal_vip)
        self.multi_tenancy = read_config_option(self.config, 'Basic',
                                                'multiTenancy', False)
        self.enable_ceilometer = read_config_option(self.config, 'Basic',
                                                    'enable_ceilometer', False)
        self.ci_flavor = read_config_option(self.config, 'Basic', 'ci_flavor',
                                            None)
        self.fixture_cleanup = read_config_option(self.config, 'Basic',
                                                  'fixtureCleanup', 'yes')
        self.key_filename = read_config_option(self.config, 'Basic',
                                               'key_filename', None)
        self.pubkey_filename = read_config_option(self.config, 'Basic',
                                                  'pubkey_filename', None)
        self.http_proxy = read_config_option(self.config, 'proxy', 'proxy_url',
                                             None)
        self.ui_config = read_config_option(self.config, 'ui', 'ui_config',
                                            None)
        self.ui_browser = read_config_option(self.config, 'ui', 'ui_browser',
                                             None)
        self.verify_webui = read_config_option(self.config, 'ui', 'webui',
                                               False)
        self.verify_horizon = read_config_option(self.config, 'ui', 'horizon',
                                                 False)
        if not self.ui_browser and (self.verify_webui or self.verify_horizon):
            raise ValueError(
                "Verification via GUI needs 'browser' details. Please set the same."
            )
        self.devstack = read_config_option(self.config, 'devstack', 'devstack',
                                           None)
        self.use_devicemanager_for_md5 = read_config_option(
            self.config, 'use_devicemanager_for_md5',
            'use_devicemanager_for_md5', False)
        # router options
        self.mx_rt = read_config_option(self.config, 'router', 'route_target',
                                        '10003')
        self.router_asn = read_config_option(self.config, 'router', 'asn',
                                             '64512')
        router_info_tuples_string = read_config_option(self.config, 'router',
                                                       'router_info', '[]')
        self.ext_routers = ast.literal_eval(router_info_tuples_string)
        self.fip_pool_name = read_config_option(self.config, 'router',
                                                'fip_pool_name', 'public-pool')
        self.fip_pool = read_config_option(self.config, 'router', 'fip_pool',
                                           None)
        if self.fip_pool:
            update_reserve_cidr(self.fip_pool)
        self.public_vn = read_config_option(self.config, 'router',
                                            'public_virtual_network',
                                            'public-network')
        self.public_tenant = read_config_option(self.config, 'router',
                                                'public_tenant_name',
                                                'public-tenant')

        # HA setup IPMI username/password
        self.ha_setup = read_config_option(self.config, 'HA', 'ha_setup', None)

        if self.ha_setup == True:
            self.ipmi_username = read_config_option(self.config, 'HA',
                                                    'ipmi_username', 'ADMIN')
            self.ipmi_password = read_config_option(self.config, 'HA',
                                                    'ipmi_password', 'ADMIN')
        # debug option
        self.verify_on_setup = read_config_option(self.config, 'debug',
                                                  'verify_on_setup', True)
        self.stop_on_fail = bool(
            read_config_option(self.config, 'debug', 'stop_on_fail', None))

        self.ha_tmp_list = []
        self.tor_agent_data = {}
        self.sriov_data = {}
        self.dpdk_data = {}
        self.mysql_token = None

        self.public_host = read_config_option(self.config, 'Basic',
                                              'public_host', '10.204.216.50')

        self.prov_file = self.prov_file or self._create_prov_file()
        self.prov_data = self.read_prov_file()
        self.auth_url = os.getenv('OS_AUTH_URL') or \
                        '%s://%s:%s/v2.0'%(self.auth_protocol,
                                           self.auth_ip,
                                           self.auth_port)
        #vcenter server
        self.vcenter_dc = read_config_option(self.config, 'vcenter',
                                             'vcenter_dc', None)
        self.vcenter_server = read_config_option(self.config, 'vcenter',
                                                 'vcenter_server', None)
        self.vcenter_port = read_config_option(self.config, 'vcenter',
                                               'vcenter_port', None)
        self.vcenter_username = read_config_option(self.config, 'vcenter',
                                                   'vcenter_username', None)
        self.vcenter_password = read_config_option(self.config, 'vcenter',
                                                   'vcenter_password', None)
        self.vcenter_compute = read_config_option(self.config, 'vcenter',
                                                  'vcenter_compute', None)
        if 'vcenter' in self.prov_data.keys():
            try:
                self.dv_switch = self.prov_data['vcenter'][0]['dv_switch'][
                    'dv_switch_name']
            except Exception as e:
                pass

        self.username = self.host_data[self.cfgm_ip]['username']
        self.password = self.host_data[self.cfgm_ip]['password']
        # List of service correspond to each module
        self.compute_services = [
            'contrail-vrouter-agent', 'supervisor-vrouter',
            'contrail-vrouter-nodemgr'
        ]
        self.control_services = [
            'contrail-control', 'supervisor-control',
            'contrail-control-nodemgr', 'contrail-dns', 'contrail-named'
        ]
        self.cfgm_services = [
            'contrail-api', 'contrail-schema', 'contrail-discovery',
            'supervisor-config', 'contrail-config-nodemgr',
            'contrail-device-manager'
        ]
        self.webui_services = [
            'contrail-webui', 'contrail-webui-middleware', 'supervisor-webui'
        ]
        self.openstack_services = [
            'openstack-cinder-api', 'openstack-cinder-scheduler',
            'openstack-cinder-scheduler', 'openstack-glance-api',
            'openstack-glance-registry', 'openstack-keystone',
            'openstack-nova-api', 'openstack-nova-scheduler',
            'openstack-nova-cert'
        ]
        self.collector_services = [
            'contrail-collector', 'contrail-analytics-api',
            'contrail-query-engine', 'contrail-analytics-nodemgr',
            'supervisor-analytics', 'contrail-snmp-collector',
            'contrail-topology'
        ]
        self.correct_states = ['active', 'backup']
Beispiel #8
0
    def __init__(self, ini_file=None):
        self.api_server_port = '8082'
        self.bgp_port = '8083'
        self.ds_port = '5998'
        self.jenkins_trigger = self.get_os_env('JENKINS_TRIGGERED')
        self.os_type = custom_dict(self.get_os_version, 'os_type')
        self.config = None
        if ini_file:
            self.config = ConfigParser.ConfigParser()
            self.config.read(ini_file)
        self.orchestrator = read_config_option(self.config,
                                               'Basic', 'orchestrator', 'openstack')
        self.prov_file = read_config_option(self.config,
                                            'Basic', 'provFile', None)
        self.key = read_config_option(self.config,
                                      'Basic', 'key', 'key1')
        self.stack_user = read_config_option(
            self.config,
            'Basic',
            'stackUser',
            os.getenv('OS_USERNAME', 'admin'))
        self.stack_password = read_config_option(
            self.config,
            'Basic',
            'stackPassword',
            os.getenv('OS_PASSWORD', 'contrail123'))
        self.stack_tenant = read_config_option(
            self.config,
            'Basic',
            'stackTenant',
            os.getenv('OS_TENANT_NAME', 'admin'))
        self.stack_domain = read_config_option(
            self.config,
            'Basic',
            'stackDomain',
            os.getenv('OS_DOMAIN_NAME', 'default-domain'))
        self.endpoint_type = read_config_option(
            self.config,
            'Basic',
            'endpoint_type',
            'publicURL')
        self.auth_ip = read_config_option(self.config,
                                          'Basic', 'auth_ip', None)
        self.auth_port = read_config_option(self.config,
                                            'Basic', 'auth_port', None)
        self.multi_tenancy = read_config_option(self.config,
                                                'Basic', 'multiTenancy', False)
        self.enable_ceilometer = read_config_option(self.config,
                                                    'Basic', 'enable_ceilometer', False)
        self.fixture_cleanup = read_config_option(
            self.config,
            'Basic',
            'fixtureCleanup',
            'yes')

        self.http_proxy = read_config_option(self.config,
                                             'proxy', 'proxy_url', None)
        self.ui_config = read_config_option(self.config,
                                            'ui', 'ui_config', None)
        self.ui_browser = read_config_option(self.config,
                                             'ui', 'ui_browser', None)
        self.verify_webui = read_config_option(self.config,
                                               'ui', 'webui', False)
        self.verify_horizon = read_config_option(self.config,
                                                 'ui', 'horizon', False)
        if not self.ui_browser and (self.verify_webui or self.verify_horizon):
            raise ValueError(
                "Verification via GUI needs 'browser' details. Please set the same.")
        self.devstack = read_config_option(self.config,
                                           'devstack', 'devstack', None)
        self.use_devicemanager_for_md5 = read_config_option(
            self.config, 'use_devicemanager_for_md5', 'use_devicemanager_for_md5', False)
        # router options
        self.mx_rt = read_config_option(self.config,
                                        'router', 'route_target', '10003')
        self.router_asn = read_config_option(self.config,
                                             'router', 'asn', '64512')
        router_info_tuples_string = read_config_option(
            self.config,
            'router',
            'router_info',
            '[]')
        self.ext_routers = ast.literal_eval(router_info_tuples_string)
        self.fip_pool_name = read_config_option(
            self.config,
            'router',
            'fip_pool_name',
            'public-pool')
        self.fip_pool = read_config_option(self.config,
                                           'router', 'fip_pool', None)
        if self.fip_pool:
            update_reserve_cidr(self.fip_pool)
        self.public_vn = read_config_option(
            self.config,
            'router',
            'public_virtual_network',
            'public-network')
        self.public_tenant = read_config_option(
            self.config,
            'router',
            'public_tenant_name',
            'public-tenant')

        # HA setup IPMI username/password
        self.ha_setup = read_config_option(self.config, 'HA', 'ha_setup', None)

        if self.ha_setup == 'True':
            self.ipmi_username = read_config_option(
                self.config,
                'HA',
                'ipmi_username',
                'ADMIN')
            self.ipmi_password = read_config_option(
                self.config,
                'HA',
                'ipmi_password',
                'ADMIN')
        # debug option
        self.verify_on_setup = read_config_option(
            self.config,
            'debug',
            'verify_on_setup',
            True)
        self.stop_on_fail = bool(
            read_config_option(
                self.config,
                'debug',
                'stop_on_fail',
                None))

        #vcenter server
        self.vcenter_dc = read_config_option(
           self.config, 'vcenter', 'vcenter_dc', None)
        self.vcenter_server = read_config_option(
           self.config, 'vcenter', 'vcenter_server', None)
        self.vcenter_port = read_config_option(
           self.config, 'vcenter', 'vcenter_port', None)
        self.vcenter_username = read_config_option(
           self.config, 'vcenter', 'vcenter_username', None)
        self.vcenter_password = read_config_option(
           self.config, 'vcenter', 'vcenter_password', None)
        self.vcenter_compute = read_config_option(
           self.config, 'vcenter', 'vcenter_compute', None)

        self.ha_tmp_list = []
        self.tor_agent_data = {}
        self.mysql_token = None

        self.public_host = read_config_option(self.config, 'Basic',
                                              'public_host', '10.204.216.50')

        self.prov_file = self.prov_file or self._create_prov_file()
        self.prov_data = self.read_prov_file()
        if self.ha_setup == 'True':
            self.update_etc_hosts_for_vip()

        self.username = self.host_data[self.cfgm_ip]['username']
        self.password = self.host_data[self.cfgm_ip]['password']
        # List of service correspond to each module
        self.compute_services = [
            'contrail-vrouter-agent',
            'supervisor-vrouter',
            'contrail-vrouter-nodemgr']
        self.control_services = ['contrail-control', 'supervisor-control',
                                 'contrail-control-nodemgr', 'contrail-dns',
                                 'contrail-named']
        self.cfgm_services = [
            'contrail-api',
            'contrail-schema',
            'contrail-discovery',
            'supervisor-config',
            'contrail-config-nodemgr',
            'contrail-device-manager']
        self.webui_services = ['contrail-webui', 'contrail-webui-middleware',
                               'supervisor-webui']
        self.openstack_services = [
            'openstack-cinder-api', 'openstack-cinder-scheduler',
            'openstack-cinder-scheduler', 'openstack-glance-api',
            'openstack-glance-registry', 'openstack-keystone',
            'openstack-nova-api', 'openstack-nova-scheduler',
            'openstack-nova-cert']
        self.collector_services = [
            'contrail-collector', 'contrail-analytics-api',
            'contrail-query-engine', 'contrail-analytics-nodemgr',
            'supervisor-analytics',
            'contrail-snmp-collector', 'contrail-topology']
        self.correct_states = ['active', 'backup']
Beispiel #9
0
    def __init__(self, inputs=None, logger=None, project_name=None,
                 username=None, password=None, domain_name=None, input_file=None, domain_obj=None,scope='domain'):
        self.inputs = inputs or ContrailTestInit(input_file,
                                stack_tenant=project_name)
        self.project_name = project_name or self.inputs.project_name
        self.domain_name = domain_name or self.inputs.domain_name
        self.orch_domain_name = domain_name or self.inputs.domain_name
        if self.orch_domain_name == 'Default':
            self.domain_name = 'default-domain'
        self.scope = scope
        self.username = username or self.inputs.stack_user
        self.password = password or self.inputs.stack_password
        self.logger = logger or self.inputs.logger
        self.nova_h = None
        self.quantum_h = None
        self.vnc_lib_fixture = None
        self.ironic_h = None
        self.api_server_inspects = custom_dict(self.get_api_inspect_handle,
                        'api_inspect:'+self.project_name+':'+self.username)
        self.dnsagent_inspect = custom_dict(self.get_dns_agent_inspect_handle,
                                            'dns_inspect')
        self.agent_inspect = custom_dict(self.get_vrouter_agent_inspect_handle,
                                         'agent_inspect')
        self.ops_inspects = custom_dict(self.get_opserver_inspect_handle,
                                        'ops_inspect:'+self.project_name+':'+self.username)
        self.cn_inspect = custom_dict(self.get_control_node_inspect_handle,
                                      'cn_inspect')
        self.k8s_cluster = self.get_k8s_cluster()
        self.k8s_client = self.get_k8s_api_client_handle()

        # ToDo: msenthil/sandipd rest of init needs to be better handled
        self.domain_id = None
        if self.inputs.domain_isolation: 
            #get admin auth to list domains and get domain_id
            auth = self.get_auth_h(username = self.inputs.admin_username,
                                   password=self.inputs.admin_password,
                                   project_name=self.inputs.admin_tenant,
                                   domain_name=self.inputs.admin_domain)
            self.domain_id = auth.get_domain_id(self.domain_name)
        self.auth = self.get_auth_h()
        self.vnc_lib = self.get_vnc_lib_h()
        self.project_id = self.get_project_id()
        if self.inputs.orchestrator == 'openstack':
            if self.inputs.verify_thru_gui():
                self.ui_login = UILogin(self, self.inputs, project_name, username, password)
                self.browser = self.ui_login.browser
                self.browser_openstack = self.ui_login.browser_openstack

            self.orch = OpenstackOrchestrator(inputs=self.inputs,
                                              vnclib=self.vnc_lib,
                                              logger=self.logger,
                                              auth_h=self.auth
                                             )
            self.ironic_h = self.orch.get_ironic_handler()
            self.nova_h = self.orch.get_compute_handler()
            self.quantum_h = self.orch.get_network_handler()
            self.glance_h = self.orch.get_image_handler()
        elif self.inputs.orchestrator == 'vcenter': 
            self.orch = VcenterOrchestrator(user=self.inputs.vcenter_username,
                                            pwd= self.inputs.vcenter_password,
                                            host=self.inputs.vcenter_server,
                                            port=self.inputs.vcenter_port,
                                            dc_name=self.inputs.vcenter_dc,
                                            vnc=self.vnc_lib,
                                            inputs=self.inputs,
                                            logger=self.logger)
            if self.inputs.vro_server:
                self.vro_orch = VroWorkflows(user=self.inputs.vcenter_username,
                            pwd= self.inputs.vcenter_password,
                            host=self.inputs.vcenter_server,
                            port=self.inputs.vcenter_port,
                            dc_name=self.inputs.vcenter_dc,
                            vnc=self.vnc_lib,
                            inputs=self.inputs,
                            logger=self.logger)
        elif self.inputs.orchestrator == 'kubernetes':
            self.orch = None
        if self.inputs.vcenter_gw_setup: # vcenter_gateway
            self.slave_orch = VcenterGatewayOrch(user=self.inputs.vcenter_username,
                                            pwd=self.inputs.vcenter_password,
                                            host=self.inputs.vcenter_server,
                                            port=int(self.inputs.vcenter_port),
                                            dc_name=self.inputs.vcenter_dc,
                                            vnc=self.vnc_lib,
                                            inputs=self.inputs,
                                            logger=self.logger)
        self._kube_manager_inspect = None