diff --git a/gbpservice/contrib/nfp/config_orchestrator/common/common.py b/gbpservice/contrib/nfp/config_orchestrator/common/common.py index 9f960f47f..5b4697dba 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/common/common.py +++ b/gbpservice/contrib/nfp/config_orchestrator/common/common.py @@ -15,6 +15,7 @@ from gbpservice.contrib.nfp.config_orchestrator.common import ( from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LE from neutron.common import constants as n_constants from neutron.common import rpc as n_rpc from neutron.common import topics as n_topics @@ -144,12 +145,13 @@ def get_network_function_details(context, network_function_id): 'get_network_function_details', network_function_id=network_function_id) msg = (" %s " % (network_function_details)) - LOG.info(msg) + LOG.debug(msg) return network_function_details['network_function'] except Exception as e: - msg = (" %s " % (e)) - LOG.info(msg) + LOG.error(_LE("Failed to get network function details of " + "network_function_id %(network_function_id)s : %(ex)s "), + {'ex': e, 'network_function_id': network_function_id}) def get_network_function_map(context, network_function_id): @@ -169,9 +171,10 @@ def get_network_function_map(context, network_function_id): request_data = _prepare_structure(network_function_details, ports_info, mngmt_port_info, monitor_port_info) msg = (" %s " % (request_data)) - LOG.info(msg) + LOG.debug(msg) return request_data except Exception as e: - msg = (" %s " % (e)) - LOG.info(msg) + LOG.error(_LE("Failed to get network function map of " + "network_function_id %(network_function_id)s : %(ex)s "), + {'ex': e, 'network_function_id': network_function_id}) return request_data diff --git a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/firewall.py b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/firewall.py index 5459e0a83..3c4fd0be8 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/firewall.py +++ b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/firewall.py @@ -19,6 +19,7 @@ from gbpservice.nfp.common import data_formatter as df from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LI from neutron_fwaas.db.firewall import firewall_db from oslo_log import helpers as log_helpers @@ -151,6 +152,9 @@ class FwAgent(firewall_db.Firewall_db_mixin): 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) + LOG.info(_LI("Received RPC CREATE FIREWALL for " + "Firewall: %(firewall)s"), + {'firewall': firewall}) body = self._data_wrapper(context, firewall, host, nf, 'CREATE') transport.send_request_to_configurator(self._conf, context, body, "CREATE") @@ -162,6 +166,9 @@ class FwAgent(firewall_db.Firewall_db_mixin): 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) + LOG.info(_LI("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") diff --git a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancer.py b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancer.py index 2b393aea5..faec6bf36 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancer.py +++ b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancer.py @@ -19,6 +19,7 @@ from gbpservice.nfp.common import data_formatter as df from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LI from neutron_lbaas.db.loadbalancer import loadbalancer_db from oslo_log import helpers as log_helpers @@ -199,6 +200,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def create_vip(self, context, vip): + LOG.info(_LI("Received RPC CREATE VIP for VIP:%(vip)s"), + {'vip': vip}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(vip["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -208,6 +211,10 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def update_vip(self, context, old_vip, vip): + LOG.info(_LI("Received RPC UPDATE VIP for VIP:%(vip)s " + "and OLD_VIP:%(old_vip)s"), + {'vip': vip, + 'old_vip': old_vip}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(vip["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -218,6 +225,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def delete_vip(self, context, vip): + LOG.info(_LI("Received RPC DELETE VIP for VIP:%(vip)s"), + {'vip': vip}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(vip["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -227,6 +236,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def create_pool(self, context, pool, driver_name): + LOG.info(_LI("Received RPC CREATE POOL for Pool:%(pool)s"), + {'pool': pool}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(pool["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -238,6 +249,10 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def update_pool(self, context, old_pool, pool): + LOG.info(_LI("Received RPC UPDATE POOL with Pool: %(pool)s " + "and Old_Pool:%(old_pool)s"), + {'pool': pool, + 'old_pool': old_pool}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(pool["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -248,6 +263,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def delete_pool(self, context, pool): + LOG.info(_LI("Received RPC DELETE POOL for Pool:%(pool)s"), + {'pool': pool}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(pool["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -257,6 +274,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def create_member(self, context, member): + LOG.info(_LI("Received RPC CREATE MEMBER for Member:%(member)s"), + {'member': member}) # Fetch pool from pool_id pool = self._get_pool(context, member['pool_id']) # Fetch nf_id from description of the resource @@ -268,6 +287,10 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def update_member(self, context, old_member, member): + LOG.info(_LI("Received RPC UPDATE MEMBER with Member:%(member)s " + "and Old_Member:%(old_member)s"), + {'member': member, + 'old_member': old_member}) # Fetch pool from pool_id pool = self._get_pool(context, member['pool_id']) # Fetch nf_id from description of the resource @@ -280,6 +303,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def delete_member(self, context, member): + LOG.info(_LI("Received RPC DELETE MEMBER for Member:%(member)s"), + {'member': member}) # Fetch pool from pool_id pool = self._get_pool(context, member['pool_id']) # Fetch nf_id from description of the resource @@ -293,6 +318,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def create_pool_health_monitor(self, context, health_monitor, pool_id): + LOG.info(_LI("Received RPC CREATE POOL HEALTH MONITOR for HM:%(hm)s"), + {'hm': health_monitor}) # Fetch pool from pool_id pool = self._get_pool(context, pool_id) # Fetch nf_id from description of the resource @@ -307,6 +334,10 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def update_pool_health_monitor(self, context, old_health_monitor, health_monitor, pool_id): + LOG.info(_LI("Received RPC UPDATE POOL HEALTH MONITOR with " + "HM:%(hm)s and Old_HM:%(old_hm)s"), + {'hm': health_monitor, + 'old_hm': old_health_monitor}) # Fetch pool from pool_id pool = self._get_pool(context, pool_id) # Fetch nf_id from description of the resource @@ -321,6 +352,8 @@ class LbAgent(loadbalancer_db.LoadBalancerPluginDb): @log_helpers.log_method_call def delete_pool_health_monitor(self, context, health_monitor, pool_id): + LOG.info(_LI("Received RPC DELETE POOL HEALTH MONITOR for HM:%(hm)s"), + {'hm': health_monitor}) # Fetch pool from pool_id pool = self._get_pool(context, pool_id) # Fetch nf_id from description of the resource diff --git a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancerv2.py b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancerv2.py index 096639413..f2e6d5953 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancerv2.py +++ b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/loadbalancerv2.py @@ -20,6 +20,7 @@ from gbpservice.nfp.common import data_formatter as df from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LI from neutron_lbaas.common import cert_manager from neutron_lbaas.common.tls_utils import cert_parser from neutron_lbaas.db.loadbalancer import loadbalancer_dbv2 @@ -271,6 +272,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def create_loadbalancer(self, context, loadbalancer, driver_name, allocate_vip=True): + LOG.info(_LI("Received RPC CREATE LOADBALANCER for LB:%(lb)s"), + {'lb': loadbalancer}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -298,6 +301,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def delete_loadbalancer(self, context, loadbalancer, delete_vip_port=True): + LOG.info(_LI("Received RPC DELETE LOADBALANCER for LB:" + "%(lb)s"), {'lb': loadbalancer}) # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) nfp_logging.store_logging_context(meta_id=nf_id) @@ -310,6 +315,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def create_listener(self, context, listener): + LOG.info(_LI("Received RPC CREATE LISTENER for Listener:%(listener)s"), + {'listener': listener}) loadbalancer = listener['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -336,6 +343,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def delete_listener(self, context, listener): + LOG.info(_LI("Received RPC DELETE LISTENER for Listener:%(listener)s"), + {'listener': listener}) loadbalancer = listener['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -349,6 +358,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def create_pool(self, context, pool): + LOG.info(_LI("Received RPC CREATE POOL for Pool:%(pool)s"), + {'pool': pool}) loadbalancer = pool['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -375,6 +386,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def delete_pool(self, context, pool): + LOG.info(_LI("Received RPC DELETE POOL for Pool:%(pool)s"), + {'pool': pool}) loadbalancer = pool['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -388,6 +401,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def create_member(self, context, member): + LOG.info(_LI("Received RPC CREATE MEMBER for Member:%(member)s"), + {'member': member}) loadbalancer = member['pool']['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -414,6 +429,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def delete_member(self, context, member): + LOG.info(_LI("Received RPC DELETE MEMBER for Member:%(member)s"), + {'member': member}) loadbalancer = member['pool']['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -427,6 +444,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def create_healthmonitor(self, context, healthmonitor): + LOG.info(_LI("Received RPC CREATE HEALTH MONITOR for HM:%(hm)s"), + {'hm': healthmonitor}) loadbalancer = healthmonitor['pool']['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) @@ -454,6 +473,8 @@ class Lbv2Agent(loadbalancer_dbv2.LoadBalancerPluginDbv2): @log_helpers.log_method_call def delete_healthmonitor(self, context, healthmonitor): + LOG.info(_LI("Received RPC DELETE HEALTH MONITOR for HM:%(hm)s"), + {'hm': healthmonitor}) loadbalancer = healthmonitor['pool']['loadbalancer'] # Fetch nf_id from description of the resource nf_id = self._fetch_nf_from_resource_desc(loadbalancer["description"]) diff --git a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/vpn.py b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/vpn.py index 95d956156..639bfc456 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/handlers/config/vpn.py +++ b/gbpservice/contrib/nfp/config_orchestrator/handlers/config/vpn.py @@ -12,6 +12,7 @@ import ast import copy + from gbpservice.contrib.nfp.config_orchestrator.common import common from gbpservice.nfp.common import constants as const from gbpservice.nfp.common import data_formatter as df @@ -19,6 +20,7 @@ from gbpservice.nfp.common import utils from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LI from neutron_vpnaas.db.vpn import vpn_db from oslo_log import helpers as log_helpers @@ -142,6 +144,8 @@ class VpnAgent(vpn_db.VPNPluginDb, vpn_db.VPNPluginRpcDbMixin): @log_helpers.log_method_call def vpnservice_updated(self, context, **kwargs): + 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']) diff --git a/gbpservice/contrib/nfp/config_orchestrator/handlers/notification/handler.py b/gbpservice/contrib/nfp/config_orchestrator/handlers/notification/handler.py index 57e6255ec..893b9359e 100644 --- a/gbpservice/contrib/nfp/config_orchestrator/handlers/notification/handler.py +++ b/gbpservice/contrib/nfp/config_orchestrator/handlers/notification/handler.py @@ -21,6 +21,7 @@ from gbpservice.nfp.common import constants as const from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.lib import transport +from neutron._i18n import _LI import oslo_messaging as messaging @@ -38,6 +39,9 @@ class RpcHandler(object): def network_function_notification(self, context, notification_data): try: + LOG.info(_LI("Received NETWORK FUNCTION NOTIFICATION:" + "%(notification)s"), + {'notification': notification_data['notification']}) if notification_data['info']['service_type'] is not None: handler = NaasNotificationHandler(self.conf, self.sc) handler.\ @@ -50,7 +54,7 @@ class RpcHandler(object): traceback.format_exception(exc_type, exc_value, exc_traceback))) - LOG.info(msg) + LOG.error(msg) class FirewallNotifier(object): @@ -71,11 +75,11 @@ class FirewallNotifier(object): firewall_id = resource_data['firewall_id'] status = resource_data['status'] - msg = ("Config Orchestrator received " - "firewall_configuration_create_complete API, making an " - "set_firewall_status RPC call for firewall: %s & status " - " %s" % (firewall_id, status)) - LOG.info(msg) + LOG.info(_LI("Received firewall configuration create complete API, " + "making an RPC call set firewall status for " + "firewall:%(firewall)s and status: %(status)s"), + {'firewall': firewall_id, + 'status': status}) # RPC call to plugin to set firewall status rpcClient = transport.RPCClient(a_topics.FW_NFP_PLUGIN_TOPIC) @@ -96,10 +100,10 @@ class FirewallNotifier(object): resource_data = notification['data'] firewall_id = resource_data['firewall_id'] - msg = ("Config Orchestrator received " - "firewall_configuration_delete_complete API, making an " - "firewall_deleted RPC call for firewall: %s" % (firewall_id)) - LOG.info(msg) + LOG.info(_LI("Received firewall_configuration_delete_complete API, " + "making an RPC call firewall_deleted for firewall:" + "%(firewall)s "), + {'firewall': firewall_id}) # RPC call to plugin to update firewall deleted rpcClient = transport.RPCClient(a_topics.FW_NFP_PLUGIN_TOPIC) @@ -128,10 +132,12 @@ class LoadbalancerNotifier(object): obj_id = resource_data['obj_id'] status = resource_data['status'] - msg = ("NCO received LB's update_status API, making an update_status" - "RPC call to plugin for %s: %s with status %s" % ( - obj_type, obj_id, status)) - LOG.info(msg) + LOG.info(_LI("Received LB's update_status API. Making an " + "update_status RPC call to plugin for %(obj_type)s:" + "%(obj_id)s with status:%(status)s"), + {'obj_type': obj_type, + 'obj_id': obj_id, + 'status': status}) nfp_logging.clear_logging_context() # RPC call to plugin to update status of the resource @@ -156,10 +162,10 @@ class LoadbalancerNotifier(object): stats = resource_data['stats'] host = resource_data['host'] - msg = ("NCO received LB's update_pool_stats API, making an " - "update_pool_stats RPC cast to plugin for updating" - "pool: %s stats" % (pool_id)) - LOG.info(msg) + LOG.info(_LI("Received LB's update_pool_stats API, making an " + "update_pool_stats RPC cast to plugin for updating " + "pool stats for pool: %(pool)s"), + {'pool': pool_id}) # RPC cast to plugin to update stats of pool rpcClient = transport.RPCClient(a_topics.LB_NFP_PLUGIN_TOPIC) @@ -202,10 +208,12 @@ class LoadbalancerV2Notifier(object): obj_p_status = resource_data['provisioning_status'] obj_o_status = resource_data['operating_status'] - msg = ("NCO received LB's update_status API, making an update_status " - "RPC call to plugin for %s: %s with status %s" % ( - obj_type, obj_id, obj_p_status)) - LOG.info(msg) + LOG.info(_LI("Received LB's update_status API. Making an " + "update_status RPC call to plugin for %(obj_type)s:" + "%(obj_id)s with status: %(status)s"), + {'obj_type': obj_type, + 'obj_id': obj_id, + 'status': obj_p_status}) if obj_type == 'healthmonitor': obj_o_status = None @@ -249,10 +257,10 @@ class VpnNotifier(object): nfp_logging.store_logging_context(**logging_context) status = resource_data['status'] - msg = ("NCO received VPN's update_status API," - "making an update_status RPC cast to plugin for object" - "with status %s" % (status)) - LOG.info(msg) + LOG.info(_LI("Received VPN's update_status API. " + "Making an update_status RPC cast to plugin for object" + "with status: %(status)s"), + {'status': status}) rpcClient = transport.RPCClient(a_topics.VPN_NFP_PLUGIN_TOPIC) rpcClient.cctxt.cast(context, 'update_status', status=status) @@ -276,6 +284,8 @@ class NaasNotificationHandler(object): def handle_notification(self, context, notification_data): try: + LOG.debug("Handling Notification with Data:%s" + % notification_data) resource_data = notification_data['notification'][0]['data'] handler = ServicetypeToHandlerMap[notification_data[ 'info']['service_type']](self.conf, self.sc) diff --git a/gbpservice/contrib/nfp/configurator/agents/agent_base.py b/gbpservice/contrib/nfp/configurator/agents/agent_base.py index 64e4681ef..179c98599 100644 --- a/gbpservice/contrib/nfp/configurator/agents/agent_base.py +++ b/gbpservice/contrib/nfp/configurator/agents/agent_base.py @@ -10,13 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. -import oslo_messaging as messaging from gbpservice.contrib.nfp.configurator.lib import constants as const from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.core import module as nfp_api + +from neutron._i18n import _LI from neutron.common import rpc as n_rpc from oslo_config import cfg +import oslo_messaging as messaging n_rpc.init(cfg.CONF) @@ -55,6 +57,29 @@ class AgentBaseRPCManager(object): else: return False + def get_diff_of_dict(self, old_dict, new_dict): + """Getting difference between two dict. + + :param Two dictionary + + Returns: Two dictionary which has different values for same keys. + + """ + diff_values = [] + new_val = {} + old_val = {} + for key in new_dict: + if old_dict.get(key) != new_dict.get(key): + diff_values.append(key) + + for value in diff_values: + if value == 'description': + pass + else: + new_val[value] = new_dict.get(value) + old_val[value] = old_dict.get(value) + return old_val, new_val + def process_request(self, sa_req_list, notification_data): """Forwards the RPC message from configurator to service agents. @@ -80,6 +105,7 @@ class AgentBaseRPCManager(object): # Multiple request data blobs needs batch processing. Send batch # processing event or do direct processing of single request data blob if (len(sa_req_list) > 1): + LOG.info(_LI("Creating event PROCESS BATCH")) args_dict = { 'sa_req_list': sa_req_list, 'notification_data': notification_data diff --git a/gbpservice/contrib/nfp/configurator/agents/firewall.py b/gbpservice/contrib/nfp/configurator/agents/firewall.py index 3c7938fb2..e24ba5dd1 100644 --- a/gbpservice/contrib/nfp/configurator/agents/firewall.py +++ b/gbpservice/contrib/nfp/configurator/agents/firewall.py @@ -11,10 +11,11 @@ # under the License. import operator -import os import oslo_messaging as messaging import requests +from neutron._i18n import _LI + from gbpservice.contrib.nfp.configurator.agents import agent_base from gbpservice.contrib.nfp.configurator.lib import constants as common_const from gbpservice.contrib.nfp.configurator.lib import fw_constants as const @@ -59,6 +60,11 @@ class FwaasRpcSender(agent_base.AgentBaseEventHandler): 'set_firewall_status'), 'firewall': firewall}}] } + LOG.info(_LI("Sending Notification 'Set Firewall Status' to " + "Orchestrator for firewall: %(fw_id)s with status:" + "%(status)s"), + {'fw_id': firewall_id, + 'status': status}) self.notify._notification(msg) def firewall_deleted(self, agent_info, firewall_id, firewall=None): @@ -79,6 +85,9 @@ class FwaasRpcSender(agent_base.AgentBaseEventHandler): 'firewall_deleted'), 'firewall': firewall}}] } + LOG.info(_LI("Sending Notification 'Firewall Deleted' to " + "Orchestrator for firewall: %(fw_id)s "), + {'fw_id': firewall_id}) self.notify._notification(msg) @@ -131,8 +140,7 @@ class FWaasRpcManager(agent_base.AgentBaseRPCManager): """ - msg = ("FwaasRpcReceiver received Create Firewall request.") - LOG.debug(msg) + LOG.info(_LI("Received request 'Create Firewall'.")) self._create_event(context, firewall, host, const.FIREWALL_CREATE_EVENT) @@ -140,9 +148,7 @@ class FWaasRpcManager(agent_base.AgentBaseRPCManager): """ Receives request to update firewall from configurator """ - - msg = ("FwaasRpcReceiver received Update Firewall request.") - LOG.debug(msg) + LOG.info(_LI("Received request 'Update Firewall'.")) self._create_event(context, firewall, host, const.FIREWALL_UPDATE_EVENT) @@ -150,9 +156,7 @@ class FWaasRpcManager(agent_base.AgentBaseRPCManager): """ Receives request to delete firewall from configurator """ - - msg = ("FwaasRpcReceiver received Delete Firewall request.") - LOG.debug(msg) + LOG.info(_LI("Received request 'Delete Firewall'.")) self._create_event(context, firewall, host, const.FIREWALL_DELETE_EVENT) @@ -212,10 +216,8 @@ class FWaasEventHandler(nfp_api.NfpEventHandler): """ try: - msg = ("Worker process with ID: %s starting to " - "handle task: %s of type firewall. " - % (os.getpid(), ev.id)) - LOG.debug(msg) + msg = ("Handling event %s" % (ev.id)) + LOG.info(msg) # The context here in ev.data is the neutron context that was # renamed to context in the agent_base. This erstwhile @@ -227,11 +229,15 @@ class FWaasEventHandler(nfp_api.NfpEventHandler): service_vendor = agent_info['service_vendor'] service_feature = agent_info.get('service_feature', '') driver = self._get_driver(service_vendor, service_feature) - + LOG.info(_LI("Invoking driver with service vendor:" + "%(service_vendor)s "), + {'service_vendor': service_vendor}) self.method = getattr(driver, "%s" % (ev.id.lower())) self.invoke_driver_for_plugin_api(ev) + msg = ("Handled event %s successfully" % (ev.id)) + LOG.info(msg) except Exception as err: - msg = ("Failed to perform the operation: %s. %s" + msg = ("Failed handling event: %s. Reason %s" % (ev.id, str(err).capitalize())) LOG.error(msg) @@ -274,8 +280,9 @@ class FWaasEventHandler(nfp_api.NfpEventHandler): if ev.id == const.FIREWALL_CREATE_EVENT: if not self._is_firewall_rule_exists(firewall): - msg = ("Firewall status set to ACTIVE") - LOG.debug(msg) + msg = ("Firewall rule list is empty, setting Firewall " + "status to ACTIVE %s" % (firewall)) + LOG.info(msg) return self.plugin_rpc.set_firewall_status( agent_info, firewall['id'], common_const.STATUS_ACTIVE, firewall) @@ -300,6 +307,9 @@ class FWaasEventHandler(nfp_api.NfpEventHandler): elif ev.id == const.FIREWALL_DELETE_EVENT: if not self._is_firewall_rule_exists(firewall): + msg = ("Firewall rule list is empty, sending firewall deleted " + "status to plugin %s" % (firewall)) + LOG.info(msg) return self.plugin_rpc.firewall_deleted( agent_info, firewall['id'], firewall) try: @@ -398,8 +408,8 @@ def load_drivers(conf): driver_obj = driver_name(conf=conf) drivers[service_type] = driver_obj - msg = ("Firewall loaded drivers: %s" % drivers) - LOG.info(msg) + LOG.info(_LI("Firewall loaded drivers:%(drivers)s"), + {'drivers': drivers}) return drivers diff --git a/gbpservice/contrib/nfp/configurator/agents/generic_config.py b/gbpservice/contrib/nfp/configurator/agents/generic_config.py index 4d8dacc5b..342bc9cba 100644 --- a/gbpservice/contrib/nfp/configurator/agents/generic_config.py +++ b/gbpservice/contrib/nfp/configurator/agents/generic_config.py @@ -214,7 +214,22 @@ class GenericConfigEventHandler(agent_base.AgentBaseEventHandler, Returns: None """ - msg = ("Handling event ev.id %s" % (ev.id)) + try: + event_data = ev.data + if ev.id == 'PROCESS_BATCH': + NFI = event_data['sa_req_list'][0][ + 'agent_info']['context']['nfi_id'] + NF = event_data['sa_req_list'][0][ + 'agent_info']['context']['nf_id'] + else: + NFI = event_data['context']['context']['nfi_id'] + NF = event_data['context']['context']['nf_id'] + except Exception: + NFI = None + NF = None + + msg = ("Handling event '%s', with NF:%s and NFI:%s" + % (ev.id, NF, NFI)) LOG.info(msg) # Process batch of request data blobs @@ -239,7 +254,8 @@ class GenericConfigEventHandler(agent_base.AgentBaseEventHandler, else: self._process_event(ev) except Exception as err: - msg = ("Failed to process event %s, reason %s " % (ev.data, err)) + msg = ("Failed to process event %s, reason %s " + % (ev.data, err)) LOG.error(msg) return @@ -453,9 +469,9 @@ def load_drivers(conf): for service_type, driver_name in drivers.iteritems(): driver_obj = driver_name(conf=conf) drivers[service_type] = driver_obj - - msg = ("Generic config agent loaded drivers: %s" % drivers) - LOG.info(msg) + LOG.info(_LI("Generic config agent loaded drivers drivers:" + "%(drivers)s"), + {'drivers': drivers}) return drivers @@ -486,7 +502,8 @@ def init_agent(cm, sc, conf): try: drivers = load_drivers(conf) except Exception as err: - msg = ("Generic configuration agent failed to load service drivers. %s" + msg = ("Generic configuration agent failed to load service drivers." + "Error:%s" % (str(err).capitalize())) LOG.error(msg) raise err diff --git a/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v1.py b/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v1.py index 5e9621843..2eebbf793 100644 --- a/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v1.py +++ b/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v1.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron import context from gbpservice.contrib.nfp.configurator.agents import agent_base from gbpservice.contrib.nfp.configurator.lib import data_filter @@ -20,6 +19,9 @@ from gbpservice.nfp.core import event as nfp_event from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.core import module as nfp_api +from neutron._i18n import _LI +from neutron import context + LOG = nfp_logging.getLogger(__name__) @@ -43,6 +45,9 @@ class LBaasRpcSender(data_filter.Filter): Returns: logical_device """ + LOG.info(_LI("Sending RPC call 'Get Logical Device' " + "for pool: %(pool_id)s"), + {'pool_id': pool_id}) return self.call( context, self.make_msg( @@ -74,6 +79,11 @@ class LBaasRpcSender(data_filter.Filter): 'status': status, obj_type: obj}}] } + LOG.info(_LI("Sending Notification 'Update Status' " + "for resource: %(resource)s with status:" + "%(status)s"), + {'resource': agent_info['resource'], + 'status': status}) self.notify._notification(msg) def update_pool_stats(self, pool_id, stats, context, pool=None): @@ -94,6 +104,10 @@ class LBaasRpcSender(data_filter.Filter): 'update_pool_stats'), 'pool': pool_id}}] } + LOG.info(_LI("Sending Notification 'Update Pool Stats' " + "for pool: %(pool_id)s with stats:%(stats)s"), + {'pool_id': pool_id, + 'stats': stats}) self.notify._notification(msg) def vip_deleted(self, vip, status, agent_info): @@ -114,6 +128,10 @@ class LBaasRpcSender(data_filter.Filter): 'notification_type': 'vip_deleted', 'status': status}}] } + LOG.info(_LI("Sending Notification 'VIP Deleted' " + "for vip: %(vip_id)s with status:%(status)s"), + {'vip_id': vip['id'], + 'status': status}) self.notify._notification(msg) @@ -169,6 +187,8 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create VIP' for VIP:%(vip_id)s "), + {'vip_id': vip['id']}) arg_dict = {'context': context, 'vip': vip, } @@ -186,10 +206,16 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_vip, vip) arg_dict = {'context': context, 'old_vip': old_vip, 'vip': vip, } + LOG.info(_LI("Received request 'Update VIP' for VIP:%(vip_id)s " + "with new Param:%(new_val)s and old Param:%(old_val)s"), + {'vip_id': vip['id'], + 'new_val': new_val, + 'old_val': old_val}) self._send_event(lb_constants.EVENT_UPDATE_VIP, arg_dict, serialize=True, binding_key=vip['pool_id'], key=vip['id']) @@ -206,6 +232,8 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): arg_dict = {'context': context, 'vip': vip, } + LOG.info(_LI("Received 'Delete VIP' request for VIP:%(vip_id)s "), + {'vip_id': vip['id']}) self._send_event(lb_constants.EVENT_DELETE_VIP, arg_dict, serialize=True, binding_key=vip['pool_id'], key=vip['id']) @@ -224,6 +252,8 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): 'pool': pool, 'driver_name': driver_name, } + LOG.info(_LI("Received request 'Create Pool' for Pool:%(pool_id)s "), + {'pool_id': pool['id']}) self._send_event(lb_constants.EVENT_CREATE_POOL, arg_dict, serialize=True, binding_key=pool['id'], key=pool['id']) @@ -238,10 +268,16 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_pool, pool) arg_dict = {'context': context, 'old_pool': old_pool, 'pool': pool, } + LOG.info(_LI("Received request 'Update Pool' for Pool:%(pool_id)s " + "with new Param:%(new_val)s and old Param:%(old_val)s"), + {'pool_id': pool['id'], + 'new_val': new_val, + 'old_val': old_val}) self._send_event(lb_constants.EVENT_UPDATE_POOL, arg_dict, serialize=True, binding_key=pool['id'], key=pool['id']) @@ -258,6 +294,8 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): arg_dict = {'context': context, 'pool': pool, } + LOG.info(_LI("Received request 'Delete Pool' for Pool:%(pool_id)s "), + {'pool_id': pool['id']}) self._send_event(lb_constants.EVENT_DELETE_POOL, arg_dict, serialize=True, binding_key=pool['id'], key=pool['id']) @@ -274,6 +312,9 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): arg_dict = {'context': context, 'member': member, } + LOG.info(_LI("Received request 'Create Member' for Pool:" + "%(pool_id)s "), + {'pool_id': member['pool_id']}) self._send_event(lb_constants.EVENT_CREATE_MEMBER, arg_dict, serialize=True, binding_key=member['pool_id'], key=member['id']) @@ -288,10 +329,18 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_member, member) arg_dict = {'context': context, 'old_member': old_member, 'member': member, } + LOG.info(_LI("Received request 'Update Member' for Member:" + "%(member_id)s in Pool:%(pool_id)s with new Param:" + "%(new_val)s and old Param:%(old_val)s"), + {'member_id': member['id'], + 'pool_id': member['pool_id'], + 'new_val': new_val, + 'old_val': old_val}) self._send_event(lb_constants.EVENT_UPDATE_MEMBER, arg_dict, serialize=True, binding_key=member['pool_id'], key=member['id']) @@ -308,6 +357,8 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): arg_dict = {'context': context, 'member': member, } + LOG.info(_LI("Received request 'Delete Member' for Pool:%(pool_id)s "), + {'pool_id': member['pool_id']}) self._send_event(lb_constants.EVENT_DELETE_MEMBER, arg_dict, serialize=True, binding_key=member['pool_id'], key=member['id']) @@ -326,6 +377,10 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): 'health_monitor': health_monitor, 'pool_id': pool_id, } + LOG.info(_LI("Received request 'Create Pool Health Monitor' for " + "Pool:%(pool_id)s and Health monitor:%(hm)s"), + {'pool_id': pool_id, + 'hm': health_monitor['id']}) self._send_event(lb_constants.EVENT_CREATE_POOL_HEALTH_MONITOR, arg_dict, serialize=True, binding_key=pool_id, key=health_monitor['id']) @@ -342,11 +397,19 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict( + old_health_monitor, health_monitor) arg_dict = {'context': context, 'old_health_monitor': old_health_monitor, 'health_monitor': health_monitor, 'pool_id': pool_id, } + LOG.info(_LI("Received request 'Update Pool Health Monitor' for " + "Pool Health Monitor:%(hm_id)s with new Param:" + "%(new_val)s and old Param:%(old_val)s"), + {'hm_id': health_monitor['id'], + 'new_val': new_val, + 'old_val': old_val}) self._send_event(lb_constants.EVENT_UPDATE_POOL_HEALTH_MONITOR, arg_dict, serialize=True, binding_key=pool_id, key=health_monitor['id']) @@ -365,6 +428,10 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): 'health_monitor': health_monitor, 'pool_id': pool_id, } + LOG.info(_LI("Received request 'Delete Pool Health Monitor' for " + "Pool:%(pool_id)s and Health monitor:%(hm)s"), + {'pool_id': pool_id, + 'hm': health_monitor['id']}) self._send_event(lb_constants.EVENT_DELETE_POOL_HEALTH_MONITOR, arg_dict, serialize=True, binding_key=pool_id, key=health_monitor['id']) @@ -380,6 +447,7 @@ class LBaaSRpcManager(agent_base.AgentBaseRPCManager): """ arg_dict = {'context': context, 'payload': payload} + LOG.info(_LI("Received request 'Agent Updated' ")) self._send_event(lb_constants.EVENT_AGENT_UPDATED, arg_dict) @@ -442,7 +510,7 @@ class LBaaSEventHandler(agent_base.AgentBaseEventHandler, Returns: None """ - msg = ("Starting handling event %s" % (ev.id)) + msg = ("Starting handling event '%s' " % (ev.id)) LOG.info(msg) try: method = getattr(self, "_%s" % (ev.id.lower())) @@ -458,7 +526,7 @@ class LBaaSEventHandler(agent_base.AgentBaseEventHandler, """ pass else: - msg = ("Completed handling event %s" % (ev.id)) + msg = ("Completed handling event '%s'" % (ev.id)) LOG.info(msg) self.sc.event_complete(ev) diff --git a/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v2.py b/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v2.py index e0836f999..512d25fd9 100644 --- a/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v2.py +++ b/gbpservice/contrib/nfp/configurator/agents/loadbalancer_v2.py @@ -12,6 +12,8 @@ import os +from neutron._i18n import _LI + from gbpservice.contrib.nfp.configurator.agents import agent_base from gbpservice.contrib.nfp.configurator.lib import data_filter from gbpservice.contrib.nfp.configurator.lib import lbv2_constants as lb_const @@ -62,6 +64,12 @@ class LBaaSV2RpcSender(data_filter.Filter): operating_status, obj_type: obj}}] } + LOG.info(_LI("Sending Notification 'Update Status' " + "for resource: %(resource)s with Provisioning status:" + "%(p_status)s and Operating status:%(o_status)s"), + {'resource': agent_info['resource'], + 'p_status': provisioning_status, + 'o_status': operating_status}) self.notify._notification(msg) # REVISIT(jiahao): need to revisit how lbaasv2 update lb stats, @@ -82,6 +90,10 @@ class LBaaSV2RpcSender(data_filter.Filter): 'update_pool_stats'), 'pool': pool_id}}] } + LOG.info(_LI("Sending Notification 'Update Pool Stats' " + "for pool: %(pool_id)s with stats:%(stats)s"), + {'pool_id': pool_id, + 'stats': stats}) self.notify._notification(msg) @@ -136,6 +148,10 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create Loadbalancer' for LB:%(lb)s " + "with driver:%(driver_name)s"), + {'lb': loadbalancer['id'], + 'driver_name': driver_name}) arg_dict = {'context': context, lb_const.LOADBALANCER: loadbalancer, 'driver_name': driver_name @@ -154,10 +170,17 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict( + old_loadbalancer, loadbalancer) arg_dict = {'context': context, lb_const.OLD_LOADBALANCER: old_loadbalancer, lb_const.LOADBALANCER: loadbalancer, } + LOG.info(_LI("Received request 'Update Loadbalancer' for LB:%(lb)s " + "with new Param:%(new_val)s and old Param:%(old_val)s"), + {'lb': loadbalancer['id'], + 'new_val': new_val, + 'old_val': old_val}) self._send_event(lb_const.EVENT_UPDATE_LOADBALANCER_V2, arg_dict, serialize=True, binding_key=loadbalancer['id'], key=loadbalancer['id']) @@ -171,6 +194,9 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Delete Loadbalancer' for LB:%(lb)s "), + {'lb': loadbalancer['id']}) + arg_dict = {'context': context, lb_const.LOADBALANCER: loadbalancer, } @@ -187,6 +213,8 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create Listener' for LB:%(lb)s "), + {'lb': listener['loadbalancer_id']}) arg_dict = {'context': context, lb_const.LISTENER: listener, } @@ -205,6 +233,14 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_listener, listener) + LOG.info(_LI("Received request 'Update Listener' for Listener:" + "%(listener)s in LB:%(lb_id)s with new Param:" + "%(new_val)s and old Param:%(old_val)s"), + {'lb_id': listener['loadbalancer_id'], + 'listener': listener['id'], + 'old_val': old_val, + 'new_val': new_val}) arg_dict = {'context': context, lb_const.OLD_LISTENER: old_listener, lb_const.LISTENER: listener, @@ -223,6 +259,8 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Delete Listener' for LB:%(lb)s "), + {'lb': listener['loadbalancer_id']}) arg_dict = {'context': context, lb_const.LISTENER: listener, } @@ -240,6 +278,8 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create Pool' for Pool:%(pool_id)s "), + {'pool_id': pool['id']}) arg_dict = {'context': context, lb_const.POOL: pool } @@ -259,6 +299,14 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_pool, pool) + LOG.info(_LI("Received request 'Update Pool' for Pool:%(pool)s " + "in LB:%(lb_id)s with new Param:%(new_val)s and " + "old Param:%(old_val)s"), + {'pool': pool['id'], + 'lb_id': pool['loadbalancer_id'], + 'old_val': old_val, + 'new_val': new_val}) arg_dict = {'context': context, lb_const.OLD_POOL: old_pool, lb_const.POOL: pool, @@ -277,6 +325,8 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Delete Pool' for Pool:%(pool_id)s "), + {'pool_id': pool['id']}) arg_dict = {'context': context, lb_const.POOL: pool, } @@ -294,6 +344,8 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create Member' for Pool:%(pool_id)s "), + {'pool_id': member['pool_id']}) arg_dict = {'context': context, lb_const.MEMBER: member, } @@ -312,6 +364,14 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict(old_member, member) + LOG.info(_LI("Received request 'Update Member' for Member:" + "%(member_id)s in Pool:%(pool_id)s with new Param:" + "%(new_val)s and old Param:%(old_val)s"), + {'pool_id': member['pool_id'], + 'member_id': member['id'], + 'old_val': old_val, + 'new_val': new_val}) arg_dict = {'context': context, lb_const.OLD_MEMBER: old_member, lb_const.MEMBER: member, @@ -330,6 +390,9 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Delete Member' for Pool:" + "%(pool_id)s "), + {'pool_id': member['pool_id']}) arg_dict = {'context': context, lb_const.MEMBER: member, } @@ -348,6 +411,9 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Create Pool Health Monitor' for" + "Health monitor:%(hm)s"), + {'hm': healthmonitor['id']}) arg_dict = {'context': context, lb_const.HEALTHMONITOR: healthmonitor } @@ -368,6 +434,14 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + old_val, new_val = self.get_diff_of_dict( + old_healthmonitor, healthmonitor) + LOG.info(_LI("Received request 'Update Pool Health Monitor' for " + "Health monitor:%(hm)s with new Param:%(new_val)s and " + "old Param:%(old_val)s"), + {'hm': healthmonitor['id'], + 'old_val': old_val, + 'new_val': new_val}) arg_dict = {'context': context, lb_const.OLD_HEALTHMONITOR: old_healthmonitor, lb_const.HEALTHMONITOR: healthmonitor @@ -388,6 +462,9 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Delete Pool Health Monitor' for " + "Health monitor:%(hm)s"), + {'hm': healthmonitor['id']}) arg_dict = {'context': context, lb_const.HEALTHMONITOR: healthmonitor } @@ -406,6 +483,7 @@ class LBaaSv2RpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'Agent Updated' ")) arg_dict = {'context': context, 'payload': payload} self._send_event(lb_const.EVENT_AGENT_UPDATED_V2, arg_dict) @@ -511,7 +589,7 @@ class LBaaSV2EventHandler(agent_base.AgentBaseEventHandler, Returns: None """ - msg = ("Handling event=%s" % (ev.id)) + msg = ("Handling event '%s' " % (ev.id)) LOG.info(msg) try: msg = ("Worker process with ID: %s starting " @@ -532,7 +610,7 @@ class LBaaSV2EventHandler(agent_base.AgentBaseEventHandler, """ pass else: - msg = ("Calling event done for event=%s" % (ev.id)) + msg = ("Calling event done for event '%s' " % (ev.id)) LOG.info(msg) self.sc.event_complete(ev) diff --git a/gbpservice/contrib/nfp/configurator/agents/vpn.py b/gbpservice/contrib/nfp/configurator/agents/vpn.py index 20dfee6d7..d546d2d36 100644 --- a/gbpservice/contrib/nfp/configurator/agents/vpn.py +++ b/gbpservice/contrib/nfp/configurator/agents/vpn.py @@ -22,8 +22,10 @@ from gbpservice.nfp.core import event as nfp_event from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.core import module as nfp_api +from neutron._i18n import _LI import oslo_messaging as messaging + LOG = nfp_logging.getLogger(__name__) @@ -55,6 +57,8 @@ class VpnaasRpcSender(data_filter.Filter): Returns: Dictionary of vpn service type which matches with the filters. """ + LOG.info(_LI("Sending RPC for GET VPN SERVICES with %(filters)s "), + {'filters': filters}) return self.call( context, self.make_msg('get_vpn_services', ids=ids, filters=filters)) @@ -71,6 +75,9 @@ class VpnaasRpcSender(data_filter.Filter): Returns: dictionary of vpnservice """ + LOG.info(_LI("Sending RPC for GET VPN SERVICECONTEXT with " + "Filters:%(filters)s "), + {'filters': filters}) return self.call( context, self.make_msg( @@ -81,6 +88,9 @@ class VpnaasRpcSender(data_filter.Filter): Get list of ipsec conns with filters specified. """ + LOG.info(_LI("Sending RPC for GET IPSEC CONNS with Filters:" + "%(filters)s "), + {'filters': filters}) return self.call( context, self.make_msg( @@ -101,6 +111,9 @@ class VpnaasRpcSender(data_filter.Filter): 'notification_type': ( 'update_status')}}] } + LOG.info(_LI("Sending Notification 'Update Status' with " + "status:%(status)s "), + {'status': status}) self._notify._notification(msg) def ipsec_site_conn_deleted(self, context, resource_id): @@ -114,6 +127,9 @@ class VpnaasRpcSender(data_filter.Filter): 'notification_type': ( 'ipsec_site_conn_deleted')}}] } + LOG.info(_LI("Sending Notification 'Ipsec Site Conn Deleted' " + "for resource:%(resource_id)s "), + {'resource_id': resource_id}) self._notify._notification(msg) @@ -155,6 +171,9 @@ class VPNaasRpcManager(agent_base.AgentBaseRPCManager): Returns: None """ + LOG.info(_LI("Received request 'VPN Service Updated'." + "for API '%(api)s'"), + {'api': resource_data.get('reason', '')}) arg_dict = {'context': context, 'resource_data': resource_data} ev = self.sc.new_event(id='VPNSERVICE_UPDATED', data=arg_dict) @@ -207,6 +226,9 @@ class VPNaasEventHandler(nfp_api.NfpEventHandler): service_vendor = agent_info['service_vendor'] service_feature = agent_info['service_feature'] driver = self._get_driver(service_vendor, service_feature) + LOG.info(_LI("Invoking driver with service vendor:" + "%(service_vendor)s "), + {'service_vendor': service_vendor}) setattr(VPNaasEventHandler, "service_driver", driver) self._vpnservice_updated(ev, driver) except Exception as err: @@ -226,7 +248,7 @@ class VPNaasEventHandler(nfp_api.NfpEventHandler): context = ev.data.get('context') resource_data = ev.data.get('resource_data') msg = "Vpn service updated from server side" - LOG.debug(msg) + LOG.info(msg) try: driver.vpnservice_updated(context, resource_data) @@ -243,7 +265,8 @@ class VPNaasEventHandler(nfp_api.NfpEventHandler): self._sc.post_event(ev1) break except Exception as err: - msg = ("Failed to update VPN service. %s" % str(err).capitalize()) + msg = ("Failed to update VPN service. %s" + % str(err).capitalize()) LOG.error(msg) reason = resource_data.get('reason') rsrc = resource_data.get('rsrc_type') @@ -376,7 +399,8 @@ def init_agent(cm, sc, conf): try: drivers = load_drivers(sc, conf) except Exception as err: - msg = ("VPNaas failed to load drivers. %s" % (str(err).capitalize())) + msg = ("VPNaas failed to load drivers. %s" + % (str(err).capitalize())) LOG.error(msg) raise err else: diff --git a/gbpservice/contrib/nfp/configurator/drivers/base/base_driver.py b/gbpservice/contrib/nfp/configurator/drivers/base/base_driver.py index 66e89c553..e24e46bab 100644 --- a/gbpservice/contrib/nfp/configurator/drivers/base/base_driver.py +++ b/gbpservice/contrib/nfp/configurator/drivers/base/base_driver.py @@ -96,11 +96,8 @@ class BaseDriver(object): except Exception as e: msg = ("VM health check failed. Command '%s' execution failed." " Reason=%s" % (command, e)) - LOG.warn(msg) + LOG.debug(msg) return const.FAILED - msg = ("VM Health check successful. Command '%s' executed" - " successfully" % (command)) - LOG.debug(msg) return const.SUCCESS def _configure_log_forwarding(self, url, mgmt_ip, port): diff --git a/gbpservice/contrib/nfp/configurator/drivers/firewall/vyos/vyos_fw_driver.py b/gbpservice/contrib/nfp/configurator/drivers/firewall/vyos/vyos_fw_driver.py index 0015fc376..4b2d57257 100644 --- a/gbpservice/contrib/nfp/configurator/drivers/firewall/vyos/vyos_fw_driver.py +++ b/gbpservice/contrib/nfp/configurator/drivers/firewall/vyos/vyos_fw_driver.py @@ -12,8 +12,6 @@ import requests -from gbpservice.nfp.core import log as nfp_logging - from oslo_serialization import jsonutils from gbpservice.contrib.nfp.configurator.drivers.base import base_driver @@ -22,6 +20,8 @@ from gbpservice.contrib.nfp.configurator.drivers.firewall.vyos import ( from gbpservice.contrib.nfp.configurator.lib import constants as common_const from gbpservice.contrib.nfp.configurator.lib import data_parser from gbpservice.contrib.nfp.configurator.lib import fw_constants as fw_const +from gbpservice.nfp.core import log as nfp_logging +from neutron._i18n import _LI LOG = nfp_logging.getLogger(__name__) @@ -53,6 +53,10 @@ class RestApi(object): """ try: + msg = ("SENDING CURL request to URL: %s, request_type:%s, " + "vm with data %s" + % (url, request_type, data)) + LOG.debug(msg) resp = self.request_type_to_api_map(url, data, request_type.lower()) except requests.exceptions.ConnectionError as err: @@ -114,10 +118,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): 'add_static_ip') data = jsonutils.dumps(static_ips_info) - msg = ("Initiating POST request to add static IPs for primary " - "service at: %r" % mgmt_ip) - LOG.info(msg) - + LOG.info(_LI("Initiating POST request to add static IPs for primary " + "service at mgmt ip:%(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) err_msg = ("Static IP POST request to the VyOS firewall " "service at %s failed. " % url) try: @@ -172,8 +175,8 @@ class FwGenericConfigDriver(base_driver.BaseDriver): # Failure in log forward configuration won't break chain # creation. However, error will be logged for detecting # failure. - msg = ("Failed to configure log forwarding for service at %s. " - "Error: %s" % (mgmt_ip, result_log_forward)) + msg = ("Failed to configure log forwarding for service at %s." + " Error: %s" % (mgmt_ip, result_log_forward)) LOG.error(msg) try: @@ -193,10 +196,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): url = const.request_url % (mgmt_ip, self.port, 'add_rule') data = jsonutils.dumps(rule_info) - msg = ("Initiating POST request to add persistent rule to primary " - "service at: %r" % mgmt_ip) - LOG.info(msg) - + LOG.info(_LI("Initiating POST request to add persistent rule to " + "primary service at mgmt ip: %(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) err_msg = ("Add persistent rule POST request to the VyOS firewall " "service at %s failed. " % url) try: @@ -245,9 +247,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): 'del_static_ip') data = jsonutils.dumps(static_ips_info) - msg = ("Initiating POST request to remove static IPs for primary " - "service at: %r" % mgmt_ip) - LOG.info(msg) + LOG.info(_LI("Initiating POST request to remove static IPs for " + "primary service at mgmt ip: %(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) err_msg = ("Static IP DELETE request to the VyOS firewall " "service at %s failed. " % url) @@ -297,9 +299,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): if result_static_ips != common_const.STATUS_SUCCESS: return result_static_ips else: - msg = ("Successfully removed static IPs. " - "Result: %s" % result_static_ips) - LOG.info(msg) + LOG.info(_LI("Successfully removed static IPs. " + "Result: %(result_static_ips)s"), + {'result_static_ips': result_static_ips}) rule_info = dict( provider_mac=resource_data['provider_mac'], @@ -307,8 +309,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): mgmt_ip = resource_data['mgmt_ip'] - msg = ("Initiating DELETE persistent rule.") - LOG.info(msg) + LOG.info(_LI("Initiating DELETE persistent rule for primary " + "service at mgmt ip: %(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) url = const.request_url % (mgmt_ip, self.port, 'delete_rule') data = jsonutils.dumps(rule_info) @@ -351,6 +354,11 @@ class FwGenericConfigDriver(base_driver.BaseDriver): resource_data) mgmt_ip = resource_data.get('mgmt_ip') gateway_ip = resource_data.get('stitching_gw_ip') + + # checking whether VPN service is present in the chain + # if yes, just configure the stitching pbr else + # configure both stitching and provider pbrs. + if not forward_routes: source_cidrs = [resource_data.get('stitching_cidr')] else: @@ -364,9 +372,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): route_info.append({'source_cidr': source_cidr, 'gateway_ip': gateway_ip}) data = jsonutils.dumps(route_info) - msg = ("Initiating POST request to configure route of " - "primary service at: %r" % mgmt_ip) - LOG.info(msg) + LOG.info(_LI("Initiating POST request to configure route of primary " + "service at mgmt ip: %(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) err_msg = ("Configure routes POST request to the VyOS firewall " "service at %s failed. " % url) @@ -414,9 +422,9 @@ class FwGenericConfigDriver(base_driver.BaseDriver): for source_cidr in source_cidrs: route_info.append({'source_cidr': source_cidr}) data = jsonutils.dumps(route_info) - msg = ("Initiating DELETE route request to primary service at: %r" - % mgmt_ip) - LOG.info(msg) + LOG.info(_LI("Initiating Delete route to primary " + "service at mgmt ip: %(mgmt_ip)s"), + {'mgmt_ip': mgmt_ip}) err_msg = ("Routes DELETE request to the VyOS firewall " "service at %s failed. " % url) @@ -475,16 +483,16 @@ class FwaasDriver(FwGenericConfigDriver): resource_data = self.parse.parse_data(common_const.FIREWALL, context) - msg = ("Processing create firewall request in FWaaS Driver " - "for Firewall ID: %s." % firewall['id']) - LOG.debug(msg) + LOG.info(_LI("Processing request 'Create Firewall' in FWaaS Driver " + "for Firewall ID: %(f_id)s"), + {'f_id': firewall['id']}) mgmt_ip = resource_data.get('mgmt_ip') url = const.request_url % (mgmt_ip, self.port, 'configure-firewall-rule') msg = ("Initiating POST request for FIREWALL ID: %r Tenant ID:" " %r. URL: %s" % (firewall['id'], firewall['tenant_id'], url)) - LOG.info(msg) + LOG.debug(msg) data = jsonutils.dumps(firewall) err_msg = ("Configure firewall POST request to the VyOS " @@ -497,8 +505,8 @@ class FwaasDriver(FwGenericConfigDriver): return common_const.STATUS_ERROR if resp is common_const.STATUS_SUCCESS: - msg = ("Configured firewall successfully for service at %r." % url) - LOG.info(msg) + LOG.info(_LI("Configured firewall successfully at URL: %(url)s "), + {'url': url}) return common_const.STATUS_ACTIVE err_msg += (("Reason: %r, Response Content: %r" % @@ -520,14 +528,16 @@ class FwaasDriver(FwGenericConfigDriver): Returns: SUCCESS/Failure message with reason. """ - + LOG.info(_LI("Processing request 'Update Firewall' in FWaaS Driver " + "for Firewall ID:%(f_id)s"), + {'f_id': firewall['id']}) resource_data = self.parse.parse_data(common_const.FIREWALL, context) mgmt_ip = resource_data.get('mgmt_ip') url = const.request_url % (mgmt_ip, self.port, 'update-firewall-rule') msg = ("Initiating UPDATE request. URL: %s" % url) - LOG.info(msg) + LOG.debug(msg) data = jsonutils.dumps(firewall) err_msg = ("Update firewall POST request to the VyOS " @@ -541,7 +551,7 @@ class FwaasDriver(FwGenericConfigDriver): if resp is common_const.STATUS_SUCCESS: msg = ("Updated firewall successfully for service at %r." % url) - LOG.info(msg) + LOG.debug(msg) return common_const.STATUS_ACTIVE err_msg += (("Reason: %r, Response Content: %r" % @@ -564,6 +574,9 @@ class FwaasDriver(FwGenericConfigDriver): """ + LOG.info(_LI("Processing request 'Delete Firewall' in FWaaS Driver " + "for Firewall ID:%(f_id)s"), + {'f_id': firewall['id']}) resource_data = self.parse.parse_data(common_const.FIREWALL, context) mgmt_ip = resource_data.get('mgmt_ip') url = const.request_url % (mgmt_ip, diff --git a/gbpservice/contrib/nfp/configurator/drivers/loadbalancer/v1/haproxy/haproxy_lb_driver.py b/gbpservice/contrib/nfp/configurator/drivers/loadbalancer/v1/haproxy/haproxy_lb_driver.py index b8125a9c3..9006e48f4 100644 --- a/gbpservice/contrib/nfp/configurator/drivers/loadbalancer/v1/haproxy/haproxy_lb_driver.py +++ b/gbpservice/contrib/nfp/configurator/drivers/loadbalancer/v1/haproxy/haproxy_lb_driver.py @@ -66,8 +66,8 @@ class LbGenericConfigDriver(base_driver.BaseDriver): # creation. However, error will be logged for detecting # failure. else: - msg = ("Configured log forwarding for service at %s. " - "Result: %s" % (mgmt_ip, result_log_forward)) + msg = ("Configured log forwarding for service at %s." + % (mgmt_ip)) LOG.info(msg) return lb_constants.STATUS_SUCCESS @@ -489,7 +489,9 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): def create_vip(self, vip, context): resource_data = self.parse.parse_data(common_const.LOADBALANCER, context) - msg = ("Handling create vip [vip=%s]" % (vip)) + msg = ("Handling 'Create VIP' for VIP:%s with Pool:%s" + "and tenant:%s" + % (vip['id'], vip['pool_id'], vip['tenant_id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(vip['pool_id'], context) @@ -516,7 +518,8 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): def update_vip(self, old_vip, vip, context): resource_data = self.parse.parse_data(common_const.LOADBALANCER, context) - msg = ("Handling update vip [old_vip=%s, vip=%s]" % (old_vip, vip)) + msg = ("Handling 'Update VIP' for VIP:%s and Old_VIP:%s" % ( + vip['id'], old_vip['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(old_vip['pool_id'], @@ -530,9 +533,8 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): # is vip's pool changed if not vip['pool_id'] == old_vip['pool_id']: - msg = (" vip pool id changed. first deleting old vip " - " [old pool=%s, new pool=%s]" % (old_vip['pool_id'], - vip['pool_id'])) + msg = (" VIP pool id changed to %s. Deleting old VIP:%s " + % (vip['pool_id'], old_vip['pool_id'])) LOG.info(msg) # Delete the old VIP self._delete_vip(old_vip, device_addr) @@ -555,11 +557,11 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.error(msg) raise e else: - msg = ("Updated vip %s." % vip['id']) + msg = ("Updated VIP:%s." % vip['id']) LOG.info(msg) def delete_vip(self, vip, context): - msg = ("Handling delete vip [vip=%s]" % (vip)) + msg = ("Handling 'Delete VIP' for VIP:%s" % (vip['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(vip['pool_id'], context) @@ -579,12 +581,12 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): def create_pool(self, pool, context): # nothing to do here because a pool needs a vip to be useful - msg = ("Handled create pool [pool=%s]" % (pool)) + msg = ("Handled 'Create Pool' for Pool:%s" % (pool['id'])) LOG.info(msg) def update_pool(self, old_pool, pool, context): - msg = ("Handling update pool [old_pool=%s, pool=%s]" - % (old_pool, pool)) + msg = ("Handling 'Update Pool' for Pool:%s and Old_Pool:%s" + % (pool['id'], old_pool['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(pool['id'], context) @@ -605,7 +607,7 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.info(msg) def delete_pool(self, pool, context): - msg = ("Handling delete pool [pool=%s]" % (pool)) + msg = ("Handling 'Delete Pool' for Pool:%s" % (pool['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(pool['id'], context) @@ -620,11 +622,12 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.error(msg) raise e else: - msg = ("Deleted pool: %s." % pool['id']) + msg = ("Deleted pool:%s." % pool['id']) LOG.info(msg) def create_member(self, member, context): - msg = ("Handling create member [member=%s] " % (member)) + msg = ("Handling 'Create Member' for Member:%s with Pool:%s " + % (member['id'], member['pool_id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(member['pool_id'], @@ -641,8 +644,8 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.info(msg) def update_member(self, old_member, member, context): - msg = ("Handling update member [old_member=%s, member=%s] " - % (old_member, member)) + msg = ("Handling 'Update Member' for Member:%s with Old_Member:%s" + % (member['id'], old_member['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(old_member['pool_id'], @@ -664,7 +667,7 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.info(msg) def delete_member(self, member, context): - msg = ("Handling delete member [member=%s] " % (member)) + msg = ("Handling 'Delete Member' for Member:%s " % (member['id'])) LOG.info(msg) try: device_addr = self._get_device_for_pool(member['pool_id'], @@ -681,8 +684,9 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.info(msg) def create_pool_health_monitor(self, health_monitor, pool_id, context): - msg = ("Handling create pool health monitor [hm=%s, pool_id=%s]" - % (health_monitor, pool_id)) + msg = ("Handling 'Create Pool Health Monitor' for " + "Healthmonitor:%s and Pool:%s" + % (health_monitor['id'], pool_id)) LOG.info(msg) try: device_addr = self._get_device_for_pool(pool_id, context) @@ -696,14 +700,15 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.error(msg) raise e else: - msg = ("Created pool health monitor: %s with pool ID: %s" - % (str(health_monitor), pool_id)) + msg = ("Created pool health monitor:%s with Pool: %s" + % (health_monitor['id'], pool_id)) LOG.info(msg) def update_pool_health_monitor(self, old_health_monitor, health_monitor, pool_id, context): - msg = ("Handling update pool health monitor [old_hm=%s, hm=%s," - "pool_id=%s]" % (old_health_monitor, health_monitor, pool_id)) + msg = ("Handling 'Update Pool Health Monitor' for HM:%s " + "with Old_HM:%s and Pool:%s" + % (health_monitor['id'], old_health_monitor['id'], pool_id)) LOG.info(msg) try: device_addr = self._get_device_for_pool(pool_id, context) @@ -728,13 +733,14 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.error(msg) raise e else: - msg = ("Updated health monitor from %s to %s for pool: %s" - % (str(old_health_monitor), str(health_monitor), pool_id)) + msg = ("Updated health monitor from %s to %s for Pool:%s" + % (old_health_monitor['id'], + health_monitor['id'], pool_id)) LOG.info(msg) def delete_pool_health_monitor(self, health_monitor, pool_id, context): - msg = ("Handling delete pool health monitor [hm=%s, pool_id=%s]" - % (health_monitor, pool_id)) + msg = ("Handling 'Delete Pool Health Monitor' for HM:%s Pool:%s" + % (health_monitor['id'], pool_id)) LOG.info(msg) try: device_addr = self._get_device_for_pool(pool_id, context) @@ -748,6 +754,6 @@ class HaproxyOnVmDriver(LbGenericConfigDriver): LOG.error(msg) raise e else: - msg = ("Deleted pool health monitor: %s with pool ID: %s" - % (str(health_monitor), pool_id)) + msg = ("Deleted pool health monitor: %s for Pool:%s" + % (health_monitor['id'], pool_id)) LOG.info(msg) diff --git a/gbpservice/contrib/nfp/configurator/modules/configurator.py b/gbpservice/contrib/nfp/configurator/modules/configurator.py index 2e86c90e2..4aef0d384 100644 --- a/gbpservice/contrib/nfp/configurator/modules/configurator.py +++ b/gbpservice/contrib/nfp/configurator/modules/configurator.py @@ -18,6 +18,8 @@ from gbpservice.contrib.nfp.configurator.lib import utils from gbpservice.nfp.core import log as nfp_logging from gbpservice.nfp.core import rpc +from neutron._i18n import _LI + LOG = nfp_logging.getLogger(__name__) @@ -135,6 +137,12 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC CREATE NETWORK FUNCTION DEVICE CONFIG " + "for %(service_type)s, NFI: %(nfi)s, " + "NF_ID: %(nf_id)s"), + {'service_type': request_data['info']['service_type'], + 'nfi': request_data['info']['context']['nfi_id'], + 'nf_id': request_data['info']['context']['nf_id']}) self._invoke_service_agent('create', request_data, True) except Exception as err: @@ -163,6 +171,12 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC DELETE NETWORK FUNCTION DEVICE CONFIG " + "for %(service_type)s, NFI: %(nfi)s, " + "NF_ID: %(nf_id)s"), + {'service_type': request_data['info']['service_type'], + 'nfi': request_data['info']['context']['nfi_id'], + 'nf_id': request_data['info']['context']['nf_id']}) self._invoke_service_agent('delete', request_data, True) except Exception as err: @@ -191,6 +205,12 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC UPDATE NETWORK FUNCTION DEVICE CONFIG " + "for %(service_type)s, NFI: %(nfi)s, " + "NF_ID: %(nf_id)s"), + {'service_type': request_data['info']['service_type'], + 'nfi': request_data['info']['context']['nfi_id'], + 'nf_id': request_data['info']['context']['nf_id']}) self._invoke_service_agent('update', request_data, True) except Exception as err: @@ -219,6 +239,9 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC CREATE NETWORK FUNCTION CONFIG " + "for %(service_type)s "), + {'service_type': request_data['info']['service_type']}) self._invoke_service_agent('create', request_data) except Exception as err: @@ -247,6 +270,9 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC DELETE NETWORK FUNCTION CONFIG " + "for %(service_type)s "), + {'service_type': request_data['info']['service_type']}) self._invoke_service_agent('delete', request_data) except Exception as err: @@ -275,6 +301,9 @@ class ConfiguratorRpcManager(object): log_info = request_data.get('info') logging_context = log_info['context']['logging_context'] nfp_logging.store_logging_context(**logging_context) + LOG.info(_LI("Received RPC UPDATE NETWORK FUNCTION CONFIG " + "for %(service_type)s "), + {'service_type': request_data['info']['service_type']}) self._invoke_service_agent('update', request_data) except Exception as err: @@ -296,6 +325,7 @@ class ConfiguratorRpcManager(object): """ + LOG.info(_LI("Received RPC GET NOTIFICATIONS ")) events = self.sc.get_stashed_events() notifications = [] for event in events: diff --git a/gbpservice/contrib/tests/unit/nfp/configurator/lib/test_demuxer.py b/gbpservice/contrib/tests/unit/nfp/configurator/lib/test_demuxer.py index 85243e46e..2c5101953 100644 --- a/gbpservice/contrib/tests/unit/nfp/configurator/lib/test_demuxer.py +++ b/gbpservice/contrib/tests/unit/nfp/configurator/lib/test_demuxer.py @@ -53,6 +53,9 @@ class ServiceAgentDemuxerTestCase(base.BaseTestCase): actual_val, service_type = self.demuxer.get_service_agent_info( 'create', 'firewall', request_data, True) + for agent_info in expected_val: + agent_info['agent_info']['context']['nf_id'] = 'nf_id' + agent_info['agent_info']['context']['nfi_id'] = 'nfi_id' self.assertEqual(actual_val, expected_val) def test_get_service_agent_info_firewall(self): diff --git a/gbpservice/contrib/tests/unit/nfp/configurator/modules/test_configurator.py b/gbpservice/contrib/tests/unit/nfp/configurator/modules/test_configurator.py index 23e79d91b..e7b26cf39 100644 --- a/gbpservice/contrib/tests/unit/nfp/configurator/modules/test_configurator.py +++ b/gbpservice/contrib/tests/unit/nfp/configurator/modules/test_configurator.py @@ -116,6 +116,9 @@ class ConfiguratorRpcManagerTestCase(base.BaseTestCase): if operation == 'delete': data[0]['method'] = data[0]['method'].replace( 'configure', 'clear', 1) + for agent_info in data: + agent_info['agent_info']['context']['nf_id'] = 'nf_id' + agent_info['agent_info']['context']['nfi_id'] = 'nfi_id' mock_request.assert_called_with(data, notification_data) diff --git a/gbpservice/contrib/tests/unit/nfp/configurator/test_data/fw_test_data.py b/gbpservice/contrib/tests/unit/nfp/configurator/test_data/fw_test_data.py index 3c1eadc14..8c619bf6c 100644 --- a/gbpservice/contrib/tests/unit/nfp/configurator/test_data/fw_test_data.py +++ b/gbpservice/contrib/tests/unit/nfp/configurator/test_data/fw_test_data.py @@ -110,7 +110,9 @@ class FakeObjects(object): "service_vendor": "vyos", "context": { "requester": "device_orch", - "logging_context": {} + "logging_context": {}, + "nf_id": "nf_id", + "nfi_id": "nfi_id" } }, "config": [{ diff --git a/gbpservice/neutron/services/servicechain/plugins/ncp/node_drivers/nfp_node_driver.py b/gbpservice/neutron/services/servicechain/plugins/ncp/node_drivers/nfp_node_driver.py index dbd0fee03..7bdf01fc1 100644 --- a/gbpservice/neutron/services/servicechain/plugins/ncp/node_drivers/nfp_node_driver.py +++ b/gbpservice/neutron/services/servicechain/plugins/ncp/node_drivers/nfp_node_driver.py @@ -153,6 +153,12 @@ class NFPClientApi(object): self.client = n_rpc.get_client(target) def create_network_function(self, context, network_function): + LOG.info(_LI("Sending RPC CREATE NETWORK FUNCTION to Service " + "Orchestrator for tenant:%(tenant_id)s with " + "service profile:%(service_profile_id)s"), + {'tenant_id': network_function['tenant_id'], + 'service_profile_id': network_function[ + 'service_profile']['id']}) cctxt = self.client.prepare( fanout=False, topic=nfp_rpc_topics.NFP_NSO_TOPIC) return cctxt.call( @@ -161,6 +167,10 @@ class NFPClientApi(object): network_function=network_function) def delete_network_function(self, context, network_function_id): + LOG.info(_LI("Sending RPC DELETE NETWORK FUNCTION to Service " + "Orchestrator for NF:" + "%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call( context, @@ -168,6 +178,10 @@ class NFPClientApi(object): network_function_id=network_function_id) def update_network_function(self, context, network_function_id, config): + LOG.info(_LI("Sending RPC UPDATE NETWORK FUNCTION to Service " + "Orchestrator for NF:" + "%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call( context, @@ -176,6 +190,8 @@ class NFPClientApi(object): config=config) def get_network_function(self, context, network_function_id): + LOG.debug("Sending RPC GET NETWORK FUNCTION to Service " + "Orchestrator for NF: %s" % network_function_id) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call( context, @@ -184,6 +200,10 @@ class NFPClientApi(object): def consumer_ptg_added_notification(self, context, network_function_id, policy_target_group): + LOG.info(_LI("Sending RPC CONSUMER PTG ADDED NOTIFICATION to Service " + "Orchestrator for NF:" + "%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call(context, 'consumer_ptg_added_notification', @@ -192,6 +212,9 @@ class NFPClientApi(object): def consumer_ptg_removed_notification(self, context, network_function_id, policy_target_group): + LOG.info(_LI("Sending RPC CONSUMER PTG REMOVED NOTIFICATION to " + " Service Orchestrator for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call(context, 'consumer_ptg_removed_notification', @@ -200,6 +223,9 @@ class NFPClientApi(object): def policy_target_added_notification(self, context, network_function_id, policy_target): + LOG.info(_LI("Sending RPC POLICY TARGET ADDED NOTIFICATION to " + "Service Orchestrator for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call(context, 'policy_target_added_notification', @@ -208,6 +234,9 @@ class NFPClientApi(object): def policy_target_removed_notification(self, context, network_function_id, policy_target): + LOG.info(_LI("Sending RPC POLICY TARGET REMOVED NOTIFICATION to " + "Service Orchestrator for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) cctxt = self.client.prepare(version=self.RPC_API_VERSION) return cctxt.call(context, 'policy_target_removed_notification', @@ -215,6 +244,7 @@ class NFPClientApi(object): policy_target=policy_target) def get_plumbing_info(self, context, node_driver_ctxt): + LOG.info(_LI("Sending RPC GET PLUMBING INFO to Service Orchestrator ")) request_info = dict(profile=node_driver_ctxt.current_profile, tenant_id=node_driver_ctxt.provider['tenant_id'], provider=node_driver_ctxt.provider) @@ -368,8 +398,9 @@ class NFPNodeDriver(driver_base.NodeDriverBase): plumbing_request = self.nfp_notifier.get_plumbing_info( context._plugin_context, context) - LOG.info(_LI("Requesting plumber for %(plumbing_request)s PTs for " - "service type %(service_type)s"), + LOG.info(_LI("Requesting plumber for PTs for " + "service type %(service_type)s with " + "%(plumbing_request)s "), {'plumbing_request': plumbing_request, 'service_type': service_type}) return plumbing_request @@ -579,7 +610,7 @@ class NFPNodeDriver(driver_base.NodeDriverBase): # When a group is created which is both consumer and provider. # method is invoked for stitching group too.. ignoring. - if policy_target_group['proxied_group_id']: + if policy_target_group.get('proxied_group_id'): return if context.current_profile['service_type'] == pconst.FIREWALL: context._plugin_context = self._get_resource_owner_context( @@ -688,23 +719,31 @@ class NFPNodeDriver(driver_base.NodeDriverBase): time_waited = time_waited + 5 continue else: - LOG.info(_LI("%(operation)s network function result: " - "%(network_function)s"), - {'network_function': network_function, - 'operation': operation}) + if time_waited == 0: + LOG.info(_LI("STARTED POLLING for %(operation)s network " + "function for NF:%(network_function_id)s " + "with initial result: %(result)s "), + {'operation': operation, + 'network_function_id': network_function_id, + 'result': network_function}) if (network_function['status'] == nfp_constants.ACTIVE or network_function['status'] == nfp_constants.ERROR): + LOG.info(_LI("COMPLETED POLLING for %(operation)s network " + "function for NF:%(network_function_id)s "), + {'network_function_id': network_function_id, + 'operation': operation}) break eventlet.sleep(5) time_waited = time_waited + 5 - LOG.info(_LI("%(operation)s Got network function result: " - "%(network_function)s"), - {'network_function': network_function, - 'operation': operation}) + LOG.info(_LI("Got %(operation)s network function result for NF:" + "%(network_function_id)s with status:%(status)s"), + {'network_function_id': network_function_id, + 'operation': operation, + 'status': network_function['status']}) if network_function['status'] != nfp_constants.ACTIVE: - LOG.error(_LE("%(operation)s network function" + LOG.error(_LE("%(operation)s network function:" "%(network_function)s " "failed. Status: %(status)s"), {'network_function': network_function_id, @@ -733,10 +772,12 @@ class NFPNodeDriver(driver_base.NodeDriverBase): return tenant.id except k_exceptions.NotFound: with excutils.save_and_reraise_exception(reraise=True): - LOG.error(_LE('No tenant with name %s exists.'), tenant) + LOG.error(_LE('No tenant with name %(tenant)s exists.'), + {'tenant': tenant}) except k_exceptions.NoUniqueMatch: with excutils.save_and_reraise_exception(reraise=True): - LOG.error(_LE('Multiple tenants matches found for %s'), tenant) + LOG.error(_LE('Multiple tenants matches found for %(tenant)s'), + {'tenant': tenant}) def _get_resource_owner_context(self, plugin_context): # REVISIT(AKASH) Need to revisit as this api is not needed @@ -845,7 +886,7 @@ class NFPNodeDriver(driver_base.NodeDriverBase): not provider_service_targets or (service_type in [pconst.FIREWALL, pconst.VPN] and not consumer_service_targets))): LOG.error(_LE("Service Targets are not created for the Node " - "of service_type %(service_type)s"), + "of service_type %(service_type)s"), {'service_type': service_type}) raise Exception("Service Targets are not created for the Node") @@ -1088,7 +1129,11 @@ class NFPNodeDriver(driver_base.NodeDriverBase): 'consuming_ptgs_details': consuming_ptgs_details, 'consuming_eps_details': consuming_eps_details, 'service_chain_specs': service_chain_specs} - + LOG.info(_LI("Received Call CREATE NETWORK FUNCTION for tenant: " + "%(tenant_id)s with service profile:" + "%(service_profile)s"), + {'tenant_id': nfp_create_nf_data['tenant_id'], + 'service_profile': nfp_create_nf_data['service_profile']}) return self.nfp_notifier.create_network_function( context.plugin_context, network_function=nfp_create_nf_data)['id'] diff --git a/gbpservice/neutron/tests/unit/nfp/orchestrator/modules/test_service_orchestrator.py b/gbpservice/neutron/tests/unit/nfp/orchestrator/modules/test_service_orchestrator.py index ba823e96c..1474c87eb 100644 --- a/gbpservice/neutron/tests/unit/nfp/orchestrator/modules/test_service_orchestrator.py +++ b/gbpservice/neutron/tests/unit/nfp/orchestrator/modules/test_service_orchestrator.py @@ -88,9 +88,11 @@ class NSORpcHandlerTestCase(NSOModuleTestCase): def test_rpc_create_network_function(self, mock_create_network_function): with mock.patch.object(identity_client, "Client"): self.rpc_handler.create_network_function( - "context", "network_function") + "context", {'resource_owner_context': + {'tenant_id': 'tenant_id'}}) mock_create_network_function.assert_called_once_with( - "context", "network_function") + "context", {'resource_owner_context': + {'tenant_id': 'tenant_id'}}) @mock.patch.object(nso.ServiceOrchestrator, "get_network_function") @@ -372,6 +374,7 @@ class ServiceOrchestratorTestCase(NSOModuleTestCase): 'provider': {'pt': None} } test_event = Event(data=create_nfi_request) + nfp_logging.store_logging_context(path='create') self.service_orchestrator.create_network_function_instance( test_event) diff --git a/gbpservice/nfp/lib/transport.py b/gbpservice/nfp/lib/transport.py index 5b730da37..bf45cd7fc 100644 --- a/gbpservice/nfp/lib/transport.py +++ b/gbpservice/nfp/lib/transport.py @@ -235,13 +235,13 @@ def send_request_to_configurator(conf, context, body, body=body) message = ("%s -> POST response: (%s) body : %s " % (method_name, content, body)) - LOG.info(message) + LOG.debug(message) elif method_type.lower() in [nfp_constants.UPDATE]: resp, content = unix_rc.put(method_name, body=body) message = ("%s -> PUT response: (%s) body : %s " % (method_name, content, body)) - LOG.info(message) + LOG.debug(message) else: message = ("%s api not supported" % (method_name)) LOG.error(message) @@ -251,8 +251,7 @@ def send_request_to_configurator(conf, context, body, LOG.error(message) else: - message = ("%s -> RPC request sent ! with body : %s " % ( - (method_name, body))) + message = ("%s -> RPC request sent. " % (method_name)) LOG.info(message) rpcClient = RPCClient(conf.RPC.topic) rpcClient.cctxt.cast(context, method_name, @@ -300,7 +299,7 @@ def get_response_from_configurator(conf): if content: message = ("get_notification ->" "GET response: (%s)" % (content)) - LOG.info(message) + LOG.debug(message) return content except unix_rc.RestClientException as rce: message = ("get_notification ->" diff --git a/gbpservice/nfp/orchestrator/drivers/orchestration_driver.py b/gbpservice/nfp/orchestrator/drivers/orchestration_driver.py index eef539180..fb86e3b4a 100644 --- a/gbpservice/nfp/orchestrator/drivers/orchestration_driver.py +++ b/gbpservice/nfp/orchestrator/drivers/orchestration_driver.py @@ -13,7 +13,6 @@ import ast from collections import defaultdict from neutron._i18n import _LE -from neutron._i18n import _LI from neutron._i18n import _LW from oslo_utils import excutils @@ -201,10 +200,9 @@ class OrchestrationDriver(object): if attr in provider_metadata: setattr(self, attr, provider_metadata[attr]) else: - LOG.info(_LI("Provider metadata specified in image, doesn't" - " contains %(attr)s value, proceeding with default" - " value %(default)s"), - {'attr': attr, 'default': attr_value}) + LOG.debug("Provider metadata specified in image, doesn't contains " + "%s value, proceeding with default value " + "%s" % (attr, attr_value)) def _update_provider_metadata(self, device_data, token=None): provider_metadata = {} @@ -212,9 +210,8 @@ class OrchestrationDriver(object): image_name = self._get_image_name(device_data) provider_metadata = self._get_provider_metadata(device_data, image_name) - LOG.info(_LI("Provider metadata, specified in image:" - " %(provider_metadata)s"), - {'provider_metadata': provider_metadata}) + LOG.debug("Provider metadata, specified in image: %s" + % provider_metadata) if provider_metadata: self._update_self_with_provider_metadata( provider_metadata, @@ -223,8 +220,8 @@ class OrchestrationDriver(object): provider_metadata, nfp_constants.SUPPORTS_HOTPLUG) else: - LOG.info(_LI("No provider metadata specified in image," - " proceeding with default values")) + LOG.debug("No provider metadata specified in image," + " proceeding with default values") except Exception: LOG.error(_LE("Error while getting metadata for image name:" "%(image_name)s, proceeding with default values"), @@ -237,9 +234,8 @@ class OrchestrationDriver(object): try: provider_metadata = self._get_provider_metadata_fast( token, admin_tenant_id, image_name, device_data) - LOG.info(_LI("Provider metadata, specified in image:" - " %(provider_metadata)s"), - {'provider_metadata': provider_metadata}) + LOG.debug("Provider metadata, specified in image: %s" + % provider_metadata) if provider_metadata: self._update_self_with_provider_metadata( provider_metadata, @@ -248,8 +244,8 @@ class OrchestrationDriver(object): provider_metadata, nfp_constants.SUPPORTS_HOTPLUG) else: - LOG.info(_LI("No provider metadata specified in image," - " proceeding with default values")) + LOG.debug("No provider metadata specified in image," + " proceeding with default values") except Exception: LOG.error(_LE("Error while getting metadata for image name: " "%(image_name)s, proceeding with default values"), @@ -260,11 +256,10 @@ class OrchestrationDriver(object): if device_data['service_details'].get('image_name'): image_name = device_data['service_details']['image_name'] else: - LOG.info(_LI("No image name provided in service profile's " - "service flavor field, image will be selected " - "based on service vendor's name : %(vendor)s"), - {'vendor': - device_data['service_details']['service_vendor']}) + LOG.debug("No image name provided in service profile's " + "service flavor field, image will be selected " + "based on service vendor's name : %s" + % (device_data['service_details']['service_vendor'])) image_name = device_data['service_details']['service_vendor'] image_name = '%s' % image_name.lower() device_data['service_details']['image_name'] = image_name @@ -517,9 +512,9 @@ class OrchestrationDriver(object): if device_data['service_details'].get('flavor'): flavor = device_data['service_details']['flavor'] else: - LOG.info(_LI("No Device flavor provided in service profile's " - "service flavor field, using default " - "flavor: m1.medium")) + LOG.debug("No Device flavor provided in service profile's " + "service flavor field, using default " + "flavor: m1.medium") flavor = 'm1.medium' return flavor @@ -877,8 +872,8 @@ class OrchestrationDriver(object): device_data)) if not provider_metadata: - LOG.warning(_LW('Failed to get provider metadata for' - ' device deletion.')) + LOG.debug('Failed to get provider metadata for' + ' device deletion.') if provider_metadata.get('supports_hotplug') is False: return True diff --git a/gbpservice/nfp/orchestrator/modules/device_orchestrator.py b/gbpservice/nfp/orchestrator/modules/device_orchestrator.py index 56bb37b09..5393ce2ba 100644 --- a/gbpservice/nfp/orchestrator/modules/device_orchestrator.py +++ b/gbpservice/nfp/orchestrator/modules/device_orchestrator.py @@ -10,8 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron._i18n import _LE -from neutron._i18n import _LI + import oslo_messaging as messaging from gbpservice.nfp.common import constants as nfp_constants @@ -24,6 +23,8 @@ from gbpservice.nfp.lib import transport from gbpservice.nfp.orchestrator.db import nfp_db as nfp_db from gbpservice.nfp.orchestrator.drivers import orchestration_driver from gbpservice.nfp.orchestrator.openstack import openstack_driver +from neutron._i18n import _LE +from neutron._i18n import _LI from neutron.common import rpc as n_rpc from neutron import context as n_context from neutron.db import api as db_api @@ -101,9 +102,20 @@ class RpcHandler(object): } def _log_event_created(self, event_id, event_data): - LOG.info(_LI("Device Orchestrator, RPC Handler, Created event " - "%s(event_name)s with event data: %(event_data)s"), - {'event_name': event_id, 'event_data': event_data}) + NFD = event_data.get('network_function_device_id') + NF = event_data.get('network_function_id') + NFI = event_data.get('network_function_instance_id') + + if NFD and NF and NFI: + LOG.info(_LI("Created event %(event_name)s with" + " NF:%(nf)s ,NFI:%(nfi)s and NFD:%(nfd)s"), + {'event_name': event_id, + 'nf': NF, + 'nfi': NFI, + 'nfd': NFD}) + else: + LOG.info(_LI("Created event %(event_name)s "), + {'event_name': event_id}) def _create_event(self, event_id, event_data=None, key=None, is_poll_event=False, original_event=False, max_times=10): @@ -161,8 +173,8 @@ class RpcHandler(object): event_id = self.rpc_event_mapping[resource][0] if result.lower() != 'success': - LOG.info(_LI("NDO RPC HAndler response data: %(data)s") % { - 'data': data}) + LOG.info(_LI("RPC Handler response data:%(data)s"), + {'data': data}) if is_delete_request: # Ignore any deletion errors, generate SUCCESS event event_id = self.rpc_event_mapping[resource][1] @@ -297,26 +309,49 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): def handle_event(self, event): try: - nf_id = (event.data['network_function_id'] - if 'network_function_id' in event.data else None) - LOG.info(_LI("NDO: received event %(id)s for network function : " - "%(nf_id)s"), - {'id': event.id, 'nf_id': nf_id}) + event_data = event.data + NFD = event_data.get('network_function_device_id') + NF = event_data.get('network_function_id') + NFI = event_data.get('network_function_instance_id') + + if NFD and NF and NFI: + LOG.info(_LI("Received event %(event_name)s with " + "NF:%(nf)s ,NFI:%(nfi)s and NFD:%(nfd)s"), + {'event_name': event.id, + 'nf': NF, + 'nfi': NFI, + 'nfd': NFD}) + else: + LOG.info(_LI("Received event %(event_name)s "), + {'event_name': event.id}) event_handler = self.event_method_mapping(event.id) event_handler(event) except Exception as e: - LOG.exception(_LE("Error in processing event: %(event_id)s for " - "event data %(event_data)s. Error: %(error)s"), - {'event_id': event.id, 'event_data': event.data, - 'error': e}) + LOG.error(_LE("error in processing event: %(event_id)s for " + "event data %(event_data)s. error: %(error)s"), + {'event_id': event.id, 'event_data': event.data, + 'error': e}) _, _, tb = sys.exc_info() traceback.print_tb(tb) # Helper functions def _log_event_created(self, event_id, event_data): - LOG.info(_LI("Device Orchestrator created event %s(event_name)s " - "with event data: %(event_data)s"), { - 'event_name': event_id, 'event_data': event_data}) + network_function_instance = event_data.get('network_function_instance') + if network_function_instance: + nf = network_function_instance.get('network_function_id') + nfi = network_function_instance.get('id') + else: + nf = None + nfi = None + if nf and nfi: + LOG.info(_LI("Created event %(event_name)s with NF:%(nf)s and " + "NFI:%(nfi)s "), + {'event_name': event_id, + 'nf': nf, + 'nfi': nfi}) + else: + LOG.info(_LI("Created event %(event_name)s "), + {'event_name': event_id}) def _create_event(self, event_id, event_data=None, is_poll_event=False, original_event=False, @@ -351,6 +386,9 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): data=device, key=nf_id + nfi_id) if 'binding_key' in device: ev.binding_key = device['binding_key'] + LOG.debug("Releasing tenant based lock for " + "CREATE_NETWORK_FUNCTION_DEVICE event with binding " + "key: %s" % ev.binding_key) self._controller.event_complete(ev) def event_cancelled(self, ev, reason): @@ -648,17 +686,16 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): nfd_request = self._prepare_failure_case_device_data(nfp_context) service_details = nfp_context['service_details'] - LOG.info(_LI("Device Orchestrator received create network service " - "device request with data %(data)s"), - {'data': nfd_request}) + LOG.info(_LI("Received event CREATE NETWORK FUNCTION " + "DEVICE request.")) orchestration_driver = self._get_orchestration_driver( service_details['service_vendor']) device_data = self._prepare_device_data_from_nfp_context(nfp_context) - LOG.info(_LI("Creating new device," - "device request: %(device)s"), {'device': nfd_request}) + LOG.info(_LI("Creating new device:%(device)s"), + {'device': nfd_request}) device_data['volume_support'] = ( self.config.device_orchestrator.volume_support) device_data['volume_size'] = ( @@ -728,6 +765,10 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): orchestration_driver.get_network_function_device_status(device)) if is_device_up == nfp_constants.ACTIVE: + LOG.info(_LI("Device with NFD:%(id)s came up for " + "tenant:%(tenant)s "), + {'id': network_function_device['id'], + 'tenant': tenant_id}) self._post_device_up_event_graph(nfp_context) return STOP_POLLING @@ -804,6 +845,9 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): desc_dict=nfp_context.pop('event_desc')) if 'binding_key' in nfp_context: nfd_event.binding_key = nfp_context['binding_key'] + LOG.debug("Releasing tenant based lock for " + "CREATE_NETWORK_FUNCTION_DEVICE event with binding " + "key: %s" % nfd_event.binding_key) for result in results: if result.result.lower() != 'success': @@ -820,12 +864,11 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): network_function_device, nfp_constants.ACTIVE) LOG.info(_LI( - "Device Configuration completed for device: %(device_id)s" - "Updated DB status to ACTIVE, Incremented device " - "reference count for %(device)s"), - {'device_id': network_function_device['id'], - 'device': network_function_device}) - + "Configuration completed for device with NFD:%(device_id)s. " + "Updated DB status to ACTIVE."), + {'device_id': network_function_device['id']}) + LOG.debug("Device detail:%s" + % network_function_device) self._controller.event_complete(nfd_event) self._post_configure_device_graph(nfp_context, serialize=serialize_config) @@ -1206,11 +1249,10 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): self._update_network_function_device_db( device, nfp_constants.ACTIVE) LOG.info(_LI( - "Device Configuration completed for device: %(device_id)s" - "Updated DB status to ACTIVE, Incremented device " - "reference count for %(device)s"), - {'device_id': device['id'], 'device': device}) - + "Configuration completed for device with NFD:%(device_id)s. " + "Updated DB status to ACTIVE."), + {'device_id': device['id']}) + LOG.debug("Device detail:%s" % device) # Invoke event_complete for original event which is # CREATE_DEVICE_CONFIGURATION self._increment_device_ref_count(device) @@ -1228,9 +1270,8 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): self._controller.event_complete(event, result="SUCCESS") return device = self._prepare_device_data_fast(network_function_details) - LOG.info(_LI("Device Orchestrator received delete network service " - "device request for device %(device)s"), - {'device': device}) + LOG.info(_LI("Recieved DELETE NETWORK FUNCTION " + "DEVICE request ")) device['event_desc'] = event.desc.to_dict() self._create_event(event_id='DELETE_CONFIGURATION', event_data=device, @@ -1339,8 +1380,8 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler): return STOP_POLLING except Exception as exc: device['id'] = device_id - msg = "Exception - %s - in DEVICE_BEING_DELETED" % exc - LOG.error(msg) + err = ("Exception - %s - in DEVICE_BEING_DELETED" % (exc)) + LOG.error(err) return CONTINUE_POLLING else: return CONTINUE_POLLING @@ -1500,8 +1541,8 @@ class NDOConfiguratorRpcApi(object): config_params): self._update_params(device_data, config_params, operation='create') LOG.info(_LI("Sending create NFD config request to configurator " - "with config_params = %(config_params)s"), - {'config_params': config_params}) + "for NF:%(nf_id)s "), + {'nf_id': config_params['info']['context']['nf_id']}) transport.send_request_to_configurator(self.conf, self.context, @@ -1514,9 +1555,7 @@ class NDOConfiguratorRpcApi(object): config_params): self._update_params(device_data, config_params, operation='delete') config_params['info']['context']['nfp_context'] = device_data - LOG.info(_LI("Sending delete NFD config request to configurator " - "with config_params = %(config_params)s"), - {'config_params': config_params}) + LOG.info(_LI("Sending delete NFD config request to configurator ")) transport.send_request_to_configurator(self.conf, self.context, diff --git a/gbpservice/nfp/orchestrator/modules/service_orchestrator.py b/gbpservice/nfp/orchestrator/modules/service_orchestrator.py index 9881e4281..b6cf7e3b5 100644 --- a/gbpservice/nfp/orchestrator/modules/service_orchestrator.py +++ b/gbpservice/nfp/orchestrator/modules/service_orchestrator.py @@ -119,6 +119,10 @@ class RpcHandler(object): created. Results in an Event for async processing of Network Function Instance ''' + LOG.info(_LI("Received RPC call for CREATE NETWORK FUNCTION for " + "tenant:%(tenant_id)s"), + {'tenant_id': network_function[ + 'resource_owner_context']['tenant_id']}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.create_network_function( context, network_function) @@ -126,6 +130,8 @@ class RpcHandler(object): @log_helpers.log_method_call def get_network_function(self, context, network_function_id): '''Invoked in an RPC Call. Return the Network function DB object''' + LOG.debug("Received RPC call for GET NETWORK FUNCTION for NFI %s" + % network_function_id) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_network_function( context, network_function_id) @@ -136,6 +142,7 @@ class RpcHandler(object): Returns the Network functions from DB ''' + LOG.info(_LI("Received RPC call for GET NETWORK FUNCTIONS ")) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_network_functions( context, filters) @@ -149,6 +156,9 @@ class RpcHandler(object): Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call for UPDATE NETWORK FUNCTION for NF:" + "%(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.update_network_function( context, network_function_id, config) @@ -160,6 +170,9 @@ class RpcHandler(object): Invoked in an RPC call. Return the updated Network function DB object. Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call for DELETE NETWORK FUNCTION for NF:" + "%(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.delete_network_function( context, network_function_id) @@ -172,6 +185,10 @@ class RpcHandler(object): Invoked in an RPC call. Return the updated Network function DB object. Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call for POLICY TARGET ADDED NOTIFICATION " + "for NF:" + " %(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.handle_policy_target_added( context, network_function_id, policy_target) @@ -184,6 +201,9 @@ class RpcHandler(object): Invoked in an RPC call. Return the updated Network function DB object. Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call for POLICY TARGET REMOVED " + "NOTIFICATION for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.handle_policy_target_removed( context, network_function_id, policy_target) @@ -196,6 +216,9 @@ class RpcHandler(object): Invoked in an RPC call. Return the updated Network function DB object. Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call CONSUMER PTG ADDED NOTIFICATION " + "for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.handle_consumer_ptg_added( context, network_function_id, policy_target_group) @@ -208,6 +231,9 @@ class RpcHandler(object): Invoked in an RPC call. Return the updated Network function DB object. Results in an Event for async processing of Network Function Instance. ''' + LOG.info(_LI("Received RPC call for CONSUMER PTG REMOVED NOTIFICATION " + "for NF:%(network_function_id)s"), + {'network_function_id': network_function_id}) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) service_orchestrator.handle_consumer_ptg_removed( context, network_function_id, policy_target_group) @@ -218,6 +244,9 @@ class RpcHandler(object): Return the Network function Details object ''' + LOG.debug("Received RPC call for GET NETWORK FUNCTION DETAILS in " + "for NF:%s" + % network_function_id) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_network_function_details( network_function_id) @@ -225,6 +254,9 @@ class RpcHandler(object): @log_helpers.log_method_call def get_port_info(self, context, port_id): '''Invoked in an RPC Call. Return the Port Info Details object''' + LOG.debug("Received RPC call for GET PORT INFO in " + "for PORT ID:%s" + % port_id) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_port_info(port_id) @@ -233,12 +265,18 @@ class RpcHandler(object): '''Invoked in an RPC Call. Return the Network function context ''' + LOG.debug("Received RPC call for GET NETWORK FUNCTION CONTEXT in " + "for NF:%s" + % network_function_id) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_network_function_context( network_function_id) @log_helpers.log_method_call def get_plumbing_info(self, context, request_info): + LOG.debug("Received RPC call for GET PLUMBING INFO " + "for request info:%s" + % request_info) service_orchestrator = ServiceOrchestrator(self._controller, self.conf) return service_orchestrator.get_pt_info_for_plumbing(request_info) @@ -267,10 +305,22 @@ class RpcHandlerConfigurator(object): } def _log_event_created(self, event_id, event_data): - LOG.info(_LI("Service Orchestrator, RPC Handler for configurator," - "Created event, %(event_name)s with " - "event data: %(event_data)s"), - {'event_name': event_id, 'event_data': event_data}) + network_function_instance = event_data.get('network_function_instance') + if network_function_instance: + NF = network_function_instance.get('network_function_id') + NFI = network_function_instance.get('id') + else: + NF = None + NFI = None + if NF and NFI: + LOG.info(_LI("Created event %(event_name)s with NF:%(nf)s " + "and NFI:%(nfi)s "), + {'event_name': event_id, + 'nf': NF, + 'nfi': NFI}) + else: + LOG.info(_LI("Created event %(event_name)s "), + {'event_name': event_id}) def _create_event(self, event_id, event_data=None, is_poll_event=False, original_event=None, @@ -471,8 +521,24 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): return event_handler_mapping[event_id] def handle_event(self, event): - LOG.info(_LI("NSO: received event %(id)s"), - {'id': event.id}) + event_data = event.data + network_function_instance = event_data.get( + 'network_function_instance') + if network_function_instance: + NF = network_function_instance.get('network_function_id') + NFI = network_function_instance.get('id') + else: + NF = None + NFI = None + if NF and NFI: + LOG.info(_LI("Received event %(event_name)s with NF:%(nf)s and " + "NFI:%(nfi)s "), + {'event_name': event.id, + 'nf': NF, + 'nfi': NFI}) + else: + LOG.info(_LI("Received event %(event_name)s "), + {'event_name': event.id}) try: event_handler = self.event_method_mapping(event.id) event_handler(event) @@ -485,7 +551,7 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): traceback.print_tb(tb) def handle_poll_event(self, event): - LOG.info(_LI("Service Orchestrator received poll event %(id)s"), + LOG.info(_LI("Received poll event %(id)s"), {'id': event.id}) try: event_handler = self.event_method_mapping(event.id) @@ -498,11 +564,10 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): if event.id == 'CHECK_USER_CONFIG_COMPLETE': nfp_context = event.data network_function = nfp_context['network_function'] - LOG.info(_LI("NSO: applying user config failed for " - "network function %(network_function_id)s data " - "%(data)s with reason %(reason)s" - ""), {'data': nfp_context, - 'network_function_id': network_function[ + LOG.info(_LI("Applying user config failed for " + "NF:%(network_function_id)s " + "with reason %(reason)s" + ""), {'network_function_id': network_function[ 'id'], 'reason': str(reason)}) @@ -529,8 +594,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): elif event.id == 'APPLY_USER_CONFIG_IN_PROGRESS' or ( event.id == 'UPDATE_USER_CONFIG_STILL_IN_PROGRESS'): request_data = event.data - LOG.info(_LI("NSO: applying user config failed for " - "network function %(network_function_id)s data " + LOG.info(_LI("Applying user config failed for " + "NF: %(network_function_id)s data:" "%(data)s with reason %(reason)s" ""), {'data': request_data, 'network_function_id': request_data[ @@ -568,12 +633,26 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): event_data=event_data, is_internal_event=True) def _log_event_created(self, event_id, event_data): - LOG.debug("Created event %s(event_name)s with event " - "data: %(event_data)s", - {'event_name': event_id, 'event_data': event_data}) - + network_function_instance = event_data.get( + 'network_function_instance') + if network_function_instance: + NF = network_function_instance.get('network_function_id') + NFI = network_function_instance.get('id') + else: + NF = None + NFI = None + if NF and NFI: + LOG.info(_LI("Created event %(event_name)s with NF:%(nf)s and " + "NFI:%(nfi)s "), + {'event_name': event_id, + 'nf': NF, + 'nfi': NFI}) + else: + LOG.info(_LI("Created event %(event_name)s "), + {'event_name': event_id}) # REVISIT(ashu): Merge this _create_event, and above one to have # single function. + def _create_event(self, event_id, event_data=None, key=None, binding_key=None, serialize=False, is_poll_event=False, original_event=None, @@ -822,7 +901,10 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): nfp_context['service_details'] = service_details nfp_context['share_existing_device'] = False nfp_context['base_mode'] = base_mode_support - + LOG.info(_LI("Handling RPC call CREATE NETWORK FUNCTION for " + "%(service_type)s with tenant:%(tenant_id)s"), + {'tenant_id': tenant_id, + 'service_type': service_profile['service_type']}) if base_mode_support: # Store the context in current thread nfp_core_context.store_nfp_context(nfp_context) @@ -1054,6 +1136,9 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): nfp_context['network_function_instance'] = nfi nfp_logging.update_logging_context(nfi_id=nfi['id']) + LOG.info(_LI("Creating event CREATE NETWORK FUNCTION DEVICE " + "for NF: %(network_function_id)s"), + {'network_function_id': network_function['id']}) ev = self._controller.new_event( id='CREATE_NETWORK_FUNCTION_DEVICE', @@ -1064,8 +1149,15 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): ev.sequence = True ev.binding_key = nfp_context['binding_key'] + LOG.debug("Acquiring tenant based lock for " + "CREATE_NETWORK_FUNCTION_DEVICE event with binding " + "key: %s, sequence: %s" % ( + ev.binding_key, ev.sequence)) self._controller.post_event(ev) if event.binding_key and not nfp_context.get('is_nfi_in_graph'): + LOG.debug("Releasing lock for CREATE_NETWORK_FUNCTION_INSTANCE" + " event for gateway services sharing with binding key:" + " %s" % event.binding_key) self._controller.event_complete(event) def handle_device_created(self, event): @@ -1426,9 +1518,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): request_data['config_policy_id'], request_data['tenant_id'], request_data['network_function_details']) if config_status == nfp_constants.ERROR: - LOG.info(_LI("NSO: applying user config failed for " - "network function %(network_function_id)s data " - "%(data)s"), {'data': request_data, + LOG.info(_LI("Applying user config failed for " + "NF:%(network_function_id)s "), { 'network_function_id': request_data['network_function_id']}) updated_network_function = {'status': nfp_constants.ERROR} @@ -1470,8 +1561,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): max_times=self.UPDATE_USER_CONFIG_MAXRETRY) return STOP_POLLING updated_network_function = {'status': nfp_constants.ACTIVE} - LOG.info(_LI("NSO: applying user config is successfull moving " - "network function %(network_function_id)s to ACTIVE"), + LOG.info(_LI("Applying user config is successfull moving " + "NF:%(network_function_id)s to ACTIVE"), {'network_function_id': request_data['network_function_id']}) self.db_handler.update_network_function( @@ -1507,8 +1598,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): nfp_context = event.data network_function = nfp_context['network_function'] updated_network_function = {'status': nfp_constants.ACTIVE} - LOG.info(_LI("NSO: applying user config is successfull moving " - "network function %(network_function_id)s to ACTIVE"), + LOG.info(_LI("Applying user config is successfull moving " + "NF: %(network_function_id)s to ACTIVE"), {'network_function_id': network_function['id']}) self.db_handler.update_network_function( self.db_session, @@ -1544,9 +1635,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): if config_status == nfp_constants.ERROR: - LOG.info(_LI("NSO: applying user config failed for " - "network function %(network_function_id)s data " - "%(data)s"), {'data': nfp_context, + LOG.info(_LI("Applying user config failed for " + "NF: %(network_function_id)s"), { 'network_function_id': network_function['id']}) updated_network_function = {'status': nfp_constants.ERROR} @@ -1602,8 +1692,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): network_function) except Exception as err: # REVISIT: May be we need a count before removing the poll event - LOG.error(_LE("Error: %(err)s while verifying configuration delete" - " completion."), {'err': err}) + LOG.error(_LE("Error: %(err)s while verifying configuration " + "delete completion."), {'err': err}) self._create_event('USER_CONFIG_DELETE_FAILED', event_data=request_data, is_internal_event=True) self._controller.event_complete(event) @@ -1659,8 +1749,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): request_data['config_policy_id'], request_data['tenant_id']) except Exception as err: # REVISIT: May be we need a count before removing the poll event - LOG.error(_LE("Error: %(err)s while verifying configuration delete" - " completion."), {'err': err}) + LOG.error(_LE("Error: %(err)s while verifying configuration " + "delete completion."), {'err': err}) self._create_event('USER_CONFIG_DELETE_FAILED', event_data=event_data, is_internal_event=True) self._controller.event_complete(event) @@ -1721,10 +1811,10 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): self.db_session, network_function_id, network_function) - LOG.info(_LI("NSO: applying user config is successfull moving " - "network function %(network_function_id)s " - "to ACTIVE"), {'network_function_id': - network_function_id}) + LOG.info(_LI("Applying user config is successfull moving " + "NF: %(network_function_id)s to ACTIVE"), + {'network_function_id': + network_function_id}) else: network_function_instance_id = ( event.data['network_function_instance_id']) @@ -1865,7 +1955,7 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): nf_id=nf_id, service_type=service_type) - LOG.info(_LI("NSO: Deleted network function: %(nf_id)s"), + LOG.info(_LI("Deleted NF:%(nf_id)s "), {'nf_id': nf_id}) # Inform delete service caller with delete completed RPC @@ -1877,6 +1967,11 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler): network_function = self.db_handler.get_network_function( self.db_session, network_function_id) return network_function + except nfp_exc.NetworkFunctionNotFound: + LOG.warning(_LW("Failed to retrieve Network Function details for" + " %(network_function)s"), + {'network_function': network_function_id}) + return None except Exception: LOG.exception(_LE("Failed to retrieve Network Function details for" " %(network_function)s"), @@ -2325,9 +2420,10 @@ class NSOConfiguratorRpcApi(object): config_tag) self._update_params(user_config_data, config_params, operation='create') - LOG.info(_LI("Sending create heat config request to configurator " - "with config_params = %(config_params)s") % - {'config_params': config_params}) + LOG.info(_LI("Sending create heat config request to configurator ")) + LOG.debug("Sending create heat config request to configurator " + "with config_params = %s" + % config_params) transport.send_request_to_configurator(self.conf, self.context, @@ -2342,10 +2438,10 @@ class NSOConfiguratorRpcApi(object): config_tag) self._update_params(user_config_data, config_params, operation='delete') - LOG.info(_LI("Sending delete heat config request to configurator " - " with config_params = %(config_params)s") % - {'config_params': config_params}) - + LOG.info(_LI("Sending delete heat config request to configurator ")) + LOG.debug("Sending delete heat config request to configurator " + " with config_params = %s" + % config_params) transport.send_request_to_configurator(self.conf, self.context, config_params, @@ -2359,9 +2455,7 @@ class NSOConfiguratorRpcApi(object): config_tag) self._update_params(user_config_data, config_params, operation='update') - LOG.info(_LI("Sending update heat config request to configurator " - " with config_params = %(config_params)s") % - {'config_params': config_params}) + LOG.info(_LI("Sending update heat config request to configurator. ")) transport.send_request_to_configurator(self.conf, self.context, @@ -2376,9 +2470,8 @@ class NSOConfiguratorRpcApi(object): config_tag) self._update_params(user_config_data, config_params, operation='pt_add') - LOG.info(_LI("Sending Policy Target add heat config request to " - "configurator with config_params = %(config_params)s") % - {'config_params': config_params}) + LOG.info(_LI("Sending Policy Target and heat config request to " + "configurator .")) transport.send_request_to_configurator(self.conf, self.context, @@ -2394,8 +2487,7 @@ class NSOConfiguratorRpcApi(object): self._update_params(user_config_data, config_params, operation='pt_remove') LOG.info(_LI("Sending Policy Target remove heat config request to " - "configurator with config_params = %(config_params)s") % - {'config_params': config_params}) + "configurator. ")) transport.send_request_to_configurator(self.conf, self.context, @@ -2410,9 +2502,8 @@ class NSOConfiguratorRpcApi(object): config_tag) self._update_params(user_config_data, config_params, operation='consumer_add') - LOG.info(_LI("Sending consumer add heat config request to " - "configurator with config_params = %(config_params)s") % - {'config_params': config_params}) + LOG.info(_LI("Sending consumer and heat config request to " + "configurator .")) transport.send_request_to_configurator(self.conf, self.context, @@ -2428,8 +2519,7 @@ class NSOConfiguratorRpcApi(object): self._update_params(user_config_data, config_params, operation='consumer_remove') LOG.info(_LI("Sending consumer remove heat config request to " - "configurator with config_params = %(config_params)s") % - {'config_params': config_params}) + "configurator .")) transport.send_request_to_configurator(self.conf, self.context, diff --git a/gbpservice/nfp/proxy_agent/proxy/proxy.py b/gbpservice/nfp/proxy_agent/proxy/proxy.py index 70d86981f..45785b07b 100644 --- a/gbpservice/nfp/proxy_agent/proxy/proxy.py +++ b/gbpservice/nfp/proxy_agent/proxy/proxy.py @@ -24,6 +24,13 @@ import time oslo_logging.register_options(oslo_config.CONF) +if not hasattr(oslo_config.CONF, 'module'): + module_opts = [ + oslo_config.StrOpt('module', + default='proxy', + help='component name for logging.')] + oslo_config.CONF.register_opts(module_opts) + LOG = nfp_logging.getLogger(__name__) # Queue of proxy connections which workers will handle