Пример #1
0
    def _data_wrapper(self, context, tenant_id, nf, **kwargs):
        nfp_context = {}
        description, str_description = (
            utils.get_vpn_description_from_nf(nf))
        description.update({'tenant_id': tenant_id})
        context_resource_data = self._get_resource_data(description,
                                                        const.VPN)
        resource = kwargs['rsrc_type']
        resource_data = kwargs['resource']
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        resource_data['description'] = str_description
        if resource.lower() == 'ipsec_site_connection':
            nfp_context = {'network_function_id': nf['id'],
                           'ipsec_site_connection_id': kwargs[
                               'rsrc_id']}

        ctx_dict, rsrc_ctx_dict = self.\
            _prepare_resource_context_dicts(context, tenant_id,
                                            resource, resource_data,
                                            context_resource_data)
        service_vm_context = utils.get_service_vm_context(
                                                description['service_vendor'])
        nfp_context.update({'neutron_context': ctx_dict,
                            'service_vm_context': service_vm_context,
                            'requester': 'nas_service',
                            'logging_context':
                                module_context.get()['log_context']})
        resource_type = 'vpn'
        kwargs.update({'neutron_context': rsrc_ctx_dict})
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, kwargs,
                                           description['service_vendor'])
        self._update_request_data(body, description)
        return body
Пример #2
0
    def _data_wrapper(self, context, tenant_id, nf, **kwargs):
        nfp_context = {}
        str_description = nf['description'].split('\n')[1]
        description = self._get_dict_desc_from_string(str_description)
        resource = kwargs['rsrc_type']
        resource_data = kwargs['resource']
        resource_data['description'] = str_description
        if resource.lower() == 'ipsec_site_connection':
            nfp_context = {
                'network_function_id': nf['id'],
                'ipsec_site_connection_id': kwargs['rsrc_id']
            }

        ctx_dict, rsrc_ctx_dict = self.\
            _prepare_resource_context_dicts(context, tenant_id,
                                            resource, resource_data)
        nfp_context.update({
            'neutron_context': ctx_dict,
            'requester': 'nas_service',
            'logging_context': nfp_logging.get_logging_context()
        })
        resource_type = 'vpn'
        kwargs.update({'neutron_context': rsrc_ctx_dict})
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, kwargs,
                                           description['service_vendor'])
        return body
Пример #3
0
    def _data_wrapper(self, context, firewall, host, nf, reason):
        # Hardcoding the position for fetching data since we are owning
        # its positional change
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        fw_mac = description['provider_ptg_info'][0]
        firewall.update({'description': str(description)})
        kwargs = {
            'context': context,
            'firewall_policy_id': firewall['firewall_policy_id'],
            'description': str(description),
            'tenant_id': firewall['tenant_id']
        }

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(
            **kwargs)
        nfp_context = {
            'network_function_id': nf['id'],
            'neutron_context': ctx_dict,
            'fw_mac': fw_mac,
            'requester': 'nas_service',
            'logging_context': nfp_logging.get_logging_context()
        }
        resource = resource_type = 'firewall'
        resource_data = {
            resource: firewall,
            'host': host,
            'neutron_context': rsrc_ctx_dict
        }
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        return body
    def _data_wrapper(self, context, tenant_id, name, reason, nf, **kwargs):
        nfp_context = {}
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        description.update({'tenant_id': tenant_id})
        context_resource_data = df.get_network_function_info(
            description, const.LOADBALANCERV2)
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        if name.lower() == 'loadbalancer':
            lb_id = kwargs['loadbalancer']['id']
            kwargs['loadbalancer'].update({'description': str(description)})
            nfp_context = {'network_function_id': nf['id'],
                           'loadbalancer_id': kwargs['loadbalancer']['id']}
        elif name.lower() == 'listener':
            lb_id = kwargs['listener'].get('loadbalancer_id')
            kwargs['listener']['description'] = str(description)
        elif name.lower() == 'pool':
            lb_id = kwargs['pool'].get('loadbalancer_id')
            kwargs['pool']['description'] = str(description)
        elif name.lower() == 'member':
            pool = kwargs['member'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['member']['description'] = str(description)
        elif name.lower() == 'healthmonitor':
            pool = kwargs['healthmonitor'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['healthmonitor']['description'] = str(description)
        else:
            kwargs[name.lower()].update({'description': str(description)})
            lb_id = kwargs[name.lower()].get('loadbalancer_id')

        args = {'tenant_id': tenant_id,
                'lb_id': lb_id,
                'context': context,
                'description': str(description),
                'context_resource_data': context_resource_data}

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(**args)
        service_vm_context = utils.get_service_vm_context(
                                                description['service_vendor'])
        nfp_context.update({'neutron_context': ctx_dict,
                            'requester': 'nas_service',
                            'logging_context':
                                module_context.get()['log_context'],
                            'service_vm_context': service_vm_context})
        resource_type = 'loadbalancerv2'
        resource = name
        resource_data = {'neutron_context': rsrc_ctx_dict}
        resource_data.update(**kwargs)
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        return body
Пример #5
0
    def _data_wrapper(self, context, tenant_id, name, reason, nf, **kwargs):
        nfp_context = {}
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        if name.lower() == 'loadbalancer':
            lb_id = kwargs['loadbalancer']['id']
            kwargs['loadbalancer'].update({'description': str(description)})
            nfp_context = {
                'network_function_id': nf['id'],
                'loadbalancer_id': kwargs['loadbalancer']['id']
            }
        elif name.lower() == 'listener':
            lb_id = kwargs['listener'].get('loadbalancer_id')
            kwargs['listener']['description'] = str(description)
        elif name.lower() == 'pool':
            lb_id = kwargs['pool'].get('loadbalancer_id')
            kwargs['pool']['description'] = str(description)
        elif name.lower() == 'member':
            pool = kwargs['member'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['member']['description'] = str(description)
        elif name.lower() == 'healthmonitor':
            pool = kwargs['healthmonitor'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['healthmonitor']['description'] = str(description)
        else:
            kwargs[name.lower()].update({'description': str(description)})
            lb_id = kwargs[name.lower()].get('loadbalancer_id')

        args = {
            'tenant_id': tenant_id,
            'lb_id': lb_id,
            'context': context,
            'description': str(description)
        }

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(**args)

        nfp_context.update({
            'neutron_context': ctx_dict,
            'requester': 'nas_service',
            'logging_context': nfp_logging.get_logging_context()
        })
        resource_type = 'loadbalancerv2'
        resource = name
        resource_data = {'neutron_context': rsrc_ctx_dict}
        resource_data.update(**kwargs)
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        return body
Пример #6
0
    def _data_wrapper(self, context, firewall, host, nf, reason):
        # Hardcoding the position for fetching data since we are owning
        # its positional change
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        description.update({'tenant_id': firewall['tenant_id']})
        context_resource_data = self._get_resource_data(
            description, const.FIREWALL)
        fw_mac = description['provider_ptg_info'][0]
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        firewall.update({'description': str(description)})
        kwargs = {
            'context': context,
            'context_resource_data': context_resource_data,
            'firewall_policy_id': firewall['firewall_policy_id'],
            'description': str(description),
            'tenant_id': firewall['tenant_id']
        }

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(
            **kwargs)
        service_vm_context = utils.get_service_vm_context(
            description['service_vendor'])
        nfp_context = {
            'network_function_id': nf['id'],
            'neutron_context': ctx_dict,
            'fw_mac': fw_mac,
            'requester': 'nas_service',
            'logging_context': module_context.get()['log_context'],
            'service_vm_context': service_vm_context
        }
        resource = resource_type = 'firewall'
        resource_data = {
            resource: firewall,
            'host': host,
            'neutron_context': rsrc_ctx_dict
        }
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        self._update_request_data(body, description)
        return body
Пример #7
0
    def _data_wrapper(self, context, tenant_id, nf, **kwargs):
        nfp_context = {}
        description, str_description = (utils.get_vpn_description_from_nf(nf))
        description.update({'tenant_id': tenant_id})
        context_resource_data = self._get_resource_data(description, const.VPN)
        resource = kwargs['rsrc_type']
        resource_data = kwargs['resource']
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        resource_data['description'] = str_description
        if resource.lower() == 'ipsec_site_connection':
            nfp_context = {
                'network_function_id': nf['id'],
                'ipsec_site_connection_id': kwargs['rsrc_id']
            }

        ctx_dict, rsrc_ctx_dict = self.\
            _prepare_resource_context_dicts(context, tenant_id,
                                            resource, resource_data,
                                            context_resource_data)
        service_vm_context = utils.get_service_vm_context(
            description['service_vendor'])
        nfp_context.update({
            'neutron_context':
            ctx_dict,
            'service_vm_context':
            service_vm_context,
            'requester':
            'nas_service',
            'logging_context':
            module_context.get()['log_context']
        })
        resource_type = 'vpn'
        kwargs.update({'neutron_context': rsrc_ctx_dict})
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, kwargs,
                                           description['service_vendor'])
        self._update_request_data(body, description)
        return body
Пример #8
0
    def _data_wrapper(self, context, firewall, host, nf, reason):
        # Hardcoding the position for fetching data since we are owning
        # its positional change
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        description.update({'tenant_id': firewall['tenant_id']})
        context_resource_data = self._get_resource_data(description,
                                                        const.FIREWALL)
        fw_mac = description['provider_ptg_info'][0]
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        firewall.update({'description': str(description)})
        kwargs = {'context': context,
                  'context_resource_data': context_resource_data,
                  'firewall_policy_id': firewall[
                      'firewall_policy_id'],
                  'description': str(description),
                  'tenant_id': firewall['tenant_id']}

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(
            **kwargs)
        service_vm_context = utils.get_service_vm_context(
            description['service_vendor'])
        nfp_context = {'network_function_id': nf['id'],
                       'neutron_context': ctx_dict,
                       'fw_mac': fw_mac,
                       'requester': 'nas_service',
                       'logging_context': module_context.get()['log_context'],
                       'service_vm_context': service_vm_context}
        resource = resource_type = 'firewall'
        resource_data = {resource: firewall,
                         'host': host,
                         'neutron_context': rsrc_ctx_dict}
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        self._update_request_data(body, description)
        return body
    def _data_wrapper(self, context, tenant_id, name, reason, nf, **kwargs):
        nfp_context = {}
        description = ast.literal_eval((nf['description'].split('\n'))[1])
        description.update({'tenant_id': tenant_id})
        context_resource_data = df.get_network_function_info(
            description, const.LOADBALANCERV2)
        # REVISIT(dpak): We need to avoid resource description
        # dependency in OTC and instead use neutron context description.
        if name.lower() == 'loadbalancer':
            lb_id = kwargs['loadbalancer']['id']
            kwargs['loadbalancer'].update({'description': str(description)})
            nfp_context = {
                'network_function_id': nf['id'],
                'loadbalancer_id': kwargs['loadbalancer']['id']
            }
        elif name.lower() == 'listener':
            lb_id = kwargs['listener'].get('loadbalancer_id')
            kwargs['listener']['description'] = str(description)
        elif name.lower() == 'pool':
            lb_id = kwargs['pool'].get('loadbalancer_id')
            kwargs['pool']['description'] = str(description)
        elif name.lower() == 'member':
            pool = kwargs['member'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['member']['description'] = str(description)
        elif name.lower() == 'healthmonitor':
            pool = kwargs['healthmonitor'].get('pool')
            if pool:
                lb_id = pool.get('loadbalancer_id')
            kwargs['healthmonitor']['description'] = str(description)
        else:
            kwargs[name.lower()].update({'description': str(description)})
            lb_id = kwargs[name.lower()].get('loadbalancer_id')

        args = {
            'tenant_id': tenant_id,
            'lb_id': lb_id,
            'context': context,
            'description': str(description),
            'context_resource_data': context_resource_data
        }

        ctx_dict, rsrc_ctx_dict = self._prepare_resource_context_dicts(**args)
        service_vm_context = utils.get_service_vm_context(
            description['service_vendor'])
        nfp_context.update({
            'neutron_context':
            ctx_dict,
            'requester':
            'nas_service',
            'logging_context':
            module_context.get()['log_context'],
            'service_vm_context':
            service_vm_context
        })
        resource_type = 'loadbalancerv2'
        resource = name
        resource_data = {'neutron_context': rsrc_ctx_dict}
        resource_data.update(**kwargs)
        body = common.prepare_request_data(nfp_context, resource,
                                           resource_type, resource_data,
                                           description['service_vendor'])
        return body