예제 #1
0
 def update_network_function_config(self, context, body):
     """Method of rpc handler for delete_network_function_config.
     Return: Http Response.
     """
     module_context.init()
     transport.send_request_to_configurator(self._conf, context, body,
                                            "UPDATE")
예제 #2
0
 def update_network_function_config(self, context, body):
     """Method of rpc handler for delete_network_function_config.
     Return: Http Response.
     """
     module_context.init()
     transport.send_request_to_configurator(self._conf,
                                            context, body,
                                            "UPDATE")
예제 #3
0
 def network_function_event(self, context, body):
     """Method of rpc handler for create_service.
     Return: Http Response.
     """
     transport.send_request_to_configurator(self._conf,
                                            context,
                                            body,
                                            "CREATE",
                                            network_function_event=True)
예제 #4
0
 def delete_network_function_device_config(self, context, body):
     """Method of rpc handler for delete_network_function_device_config.
     Return: Http Response.
     """
     transport.send_request_to_configurator(self._conf,
                                            context,
                                            body,
                                            "DELETE",
                                            device_config=True)
예제 #5
0
 def delete_firewall(self, context, firewall, host):
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(firewall["description"])
     nfp_logging.store_logging_context(meta_id=nf_id)
     nf = common.get_network_function_details(context, nf_id)
     body = self._data_wrapper(context, firewall, host, nf, 'DELETE')
     transport.send_request_to_configurator(self._conf, context, body,
                                            "DELETE")
     nfp_logging.clear_logging_context()
예제 #6
0
 def create_network_function_device_config(self, context, body):
     """Method of rpc handler for create_network_function_device_config.
     Return: Http Response.
     """
     module_context.init()
     transport.send_request_to_configurator(self._conf,
                                            context, body,
                                            "CREATE",
                                            device_config=True)
예제 #7
0
 def create_network_function_device_config(self, context, body):
     """Method of rpc handler for create_network_function_device_config.
     Return: Http Response.
     """
     module_context.init()
     transport.send_request_to_configurator(self._conf,
                                            context,
                                            body,
                                            "CREATE",
                                            device_config=True)
예제 #8
0
 def delete_firewall(self, context, firewall, host):
     nfp_context = module_context.init()
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(firewall["description"])
     nfp_context['log_context']['meta_id'] = nf_id
     nf = common.get_network_function_details(context, nf_id)
     LOG.info("Received RPC DELETE FIREWALL for "
              "Firewall: %(firewall)s", {'firewall': firewall})
     body = self._data_wrapper(context, firewall, host, nf, 'DELETE')
     transport.send_request_to_configurator(self._conf, context, body,
                                            "DELETE")
예제 #9
0
    def test_rpc_send_request_to_configurator(self):

        with mock.patch('oslo_messaging.rpc.client._CallContext.cast') as cast:
            cast.side_effect = self._cast

            test_context = TestContext().get_test_context()
            conf = Map(backend='rpc', RPC=Map(topic='topic'))

            transport.send_request_to_configurator(
                conf, test_context['context'], test_context['body'],
                test_context['method_type'], test_context['device_config'])
예제 #10
0
    def test_unix_rest_send_request_to_configurator(self):

        with mock.patch(self.imprt_rc + '.post') as mock_post:
            mock_post.side_effect = self._upost

            test_context = TestContext().get_test_context()
            conf = Map(backend='unix_rest')

            transport.send_request_to_configurator(
                conf, test_context['context'], test_context['body'],
                test_context['method_type'], test_context['device_config'])
예제 #11
0
 def delete_firewall(self, context, firewall, host):
     nfp_context = module_context.init()
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(firewall["description"])
     nfp_context['log_context']['meta_id'] = nf_id
     nf = common.get_network_function_details(context, nf_id)
     LOG.info("Received RPC DELETE FIREWALL for "
              "Firewall: %(firewall)s",
              {'firewall': firewall})
     body = self._data_wrapper(context, firewall, host, nf, 'DELETE')
     transport.send_request_to_configurator(self._conf,
                                            context, body, "DELETE")
예제 #12
0
 def vpnservice_updated(self, context, **kwargs):
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(
         kwargs['resource']['description'])
     nfp_logging.store_logging_context(meta_id=nf_id)
     nf = common.get_network_function_details(context, nf_id)
     reason = kwargs['reason']
     body = self._data_wrapper(context, kwargs['resource']['tenant_id'], nf,
                               **kwargs)
     transport.send_request_to_configurator(self._conf, context, body,
                                            reason)
     nfp_logging.clear_logging_context()
예제 #13
0
    def test_tcp_rest_send_request_to_configurator(self):

        with mock.patch.object(transport.RestApi, 'post') as mock_post:
            mock_post.side_effect = self._post

            test_context = TestContext().get_test_context()
            conf = Map(backend='tcp_rest',
                       RPC=Map(topic='topic'),
                       REST=Map(rest_server_ip='0.0.0.0',
                                rest_server_port=5672))

            transport.send_request_to_configurator(
                conf, test_context['context'], test_context['body'],
                test_context['method_type'], test_context['device_config'])
예제 #14
0
 def vpnservice_updated(self, context, **kwargs):
     nfp_context = module_context.init()
     LOG.info(_LI("Received RPC VPN SERVICE UPDATED with data:%(data)s"),
              {'data': kwargs})
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(
         kwargs['resource']['description'])
     nfp_context['log_context']['meta_id'] = nf_id
     nf = common.get_network_function_details(context, nf_id)
     reason = kwargs['reason']
     body = self._data_wrapper(context, kwargs['resource']['tenant_id'], nf,
                               **kwargs)
     transport.send_request_to_configurator(self._conf, context, body,
                                            reason)
예제 #15
0
    def test_unix_rest_send_request_to_configurator(self):

        with mock.patch(self.imprt_rc + '.post') as mock_post:
            mock_post.side_effect = self._upost

            test_context = TestContext().get_test_context()
            conf = Map(backend='unix_rest')

            transport.send_request_to_configurator(
                conf,
                test_context['context'],
                test_context['body'],
                test_context['method_type'],
                test_context['device_config'])
예제 #16
0
    def test_rpc_send_request_to_configurator(self):

        with mock.patch('oslo_messaging.rpc.client._CallContext.cast') as cast:
            cast.side_effect = self._cast

            test_context = TestContext().get_test_context()
            conf = Map(backend='rpc', RPC=Map(topic='topic'))

            transport.send_request_to_configurator(
                conf,
                test_context['context'],
                test_context['body'],
                test_context['method_type'],
                test_context['device_config'])
예제 #17
0
 def vpnservice_updated(self, context, **kwargs):
     nfp_context = module_context.init()
     LOG.info("Received RPC VPN SERVICE UPDATED with data:%(data)s",
              {'data': kwargs})
     # Fetch nf_id from description of the resource
     nf_id = self._fetch_nf_from_resource_desc(kwargs[
         'resource']['description'])
     nfp_context['log_context']['meta_id'] = nf_id
     nf = common.get_network_function_details(context, nf_id)
     reason = kwargs['reason']
     body = self._data_wrapper(context, kwargs[
         'resource']['tenant_id'], nf, **kwargs)
     transport.send_request_to_configurator(self._conf,
                                            context, body,
                                            reason)
예제 #18
0
    def test_tcp_rest_send_request_to_configurator(self):

        with mock.patch.object(transport.RestApi, 'post') as mock_post:
            mock_post.side_effect = self._post

            test_context = TestContext().get_test_context()
            conf = Map(backend='tcp_rest', RPC=Map(topic='topic'),
                       REST=Map(rest_server_ip='0.0.0.0',
                                rest_server_port=5672))

            transport.send_request_to_configurator(
                conf,
                test_context['context'],
                test_context['body'],
                test_context['method_type'],
                test_context['device_config'])
예제 #19
0
 def _delete(self, context, tenant_id, name, nf, **kwargs):
     body = self._data_wrapper(context, tenant_id, name, 'DELETE', nf,
                               **kwargs)
     transport.send_request_to_configurator(self._conf, context, body,
                                            "DELETE")
예제 #20
0
 def _post(self, context, tenant_id, name, nf, **kwargs):
     body = self._data_wrapper(context, tenant_id, name, 'CREATE', nf,
                               **kwargs)
     transport.send_request_to_configurator(self._conf, context, body,
                                            "CREATE")
예제 #21
0
 def _post(self, context, tenant_id, name, nf, **kwargs):
     body = self._data_wrapper(context, tenant_id, name,
                               'CREATE', nf, **kwargs)
     transport.send_request_to_configurator(self._conf,
                                            context, body, "CREATE")
예제 #22
0
 def _delete(self, context, tenant_id, name, nf, **kwargs):
     body = self._data_wrapper(context, tenant_id, name,
                               'DELETE', nf, **kwargs)
     transport.send_request_to_configurator(self._conf,
                                            context, body, "DELETE")
예제 #23
0
 def create_network_function_config(self, context, body):
     """Method of rpc handler for create_network_function_config.
     Return: Http Response.
     """
     transport.send_request_to_configurator(self._conf, context, body,
                                            "CREATE")