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")
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")
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)
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)
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()
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)
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)
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")
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'])
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'])
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")
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()
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'])
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)
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'])
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'])
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)
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'])
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")
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")
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")
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")
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")