'Create api executor by nas model.'

def creat_api_executor(self):

    self.api_executor = QnapAPIExecutor(username=self.configuration.san_login, password=self.configuration.san_password, management_url=self.configuration.qnap_management_url)
    (nas_model_name, internal_model_name, fw_version) = self.api_executor.get_basic_info(self.configuration.qnap_management_url)
    pattern = re.compile('^([A-Z]+)-?[A-Z]{0,2}(\\d+)\\d{2}(U|[a-z]*)')
    matches = pattern.match(nas_model_name)
    if (not matches):
        return None
    model_type = matches.group(1)
    ts_model_types = ['TS', 'SS', 'IS', 'TVS', 'TDS', 'TBS']
    tes_model_types = ['TES']
    es_model_types = ['ES']
    if (model_type in ts_model_types):
        if (fw_version.startswith('4.2') or fw_version.startswith('4.3')):
            LOG.debug('Create    TS    API    Executor')
            self.configuration.qnap_poolname = self._get_ts_model_pool_id(self.configuration.qnap_poolname)
            return QnapAPIExecutorTS(username=self.configuration.san_login, password=self.configuration.san_password, management_url=self.configuration.qnap_management_url)
    elif (model_type in tes_model_types):
        if ('TS' in internal_model_name):
            if (fw_version.startswith('4.2') or fw_version.startswith('4.3')):
                LOG.debug('Create    TS    API    Executor')
                self.configuration.qnap_poolname = self._get_ts_model_pool_id(self.configuration.qnap_poolname)
                return QnapAPIExecutorTS(username=self.configuration.san_login, password=self.configuration.san_password, management_url=self.configuration.qnap_management_url)
        if (fw_version.startswith('1.1.2') or fw_version.startswith('1.1.3')):
            LOG.debug('Create    TES    API    Executor')
            return QnapAPIExecutorTES(username=self.configuration.san_login, password=self.configuration.san_password, management_url=self.configuration.qnap_management_url)
    elif (model_type in es_model_types):
        if (fw_version.startswith('1.1.2') or fw_version.startswith('1.1.3')):
            LOG.debug('Create    ES    API    Executor')
            return QnapAPIExecutor(username=self.configuration.san_login, password=self.configuration.san_password, management_url=self.configuration.qnap_management_url)
    msg = _('Model    not    support')
    raise exception.VolumeDriverException(message=msg)
