diff --git a/etc/neutron/plugins/cisco/cisco_cfg_agent.ini b/etc/neutron/plugins/cisco/cisco_cfg_agent.ini new file mode 100644 index 0000000000..d99e838278 --- /dev/null +++ b/etc/neutron/plugins/cisco/cisco_cfg_agent.ini @@ -0,0 +1,15 @@ +[cfg_agent] +# (IntOpt) Interval in seconds for processing of service updates. +# That is when the config agent's process_services() loop executes +# and it lets each service helper to process its service resources. +# rpc_loop_interval = 10 + +# (StrOpt) Period-separated module path to the routing service helper class. +# routing_svc_helper_class = neutron.plugins.cisco.cfg_agent.service_helpers.routing_svc_helper.RoutingServiceHelper + +# (IntOpt) Timeout value in seconds for connecting to a hosting device. +# device_connection_timeout = 30 + +# (IntOpt) The time in seconds until a backlogged hosting device is +# presumed dead or booted to an error state. +# hosting_device_dead_timeout = 300 diff --git a/neutron/plugins/cisco/cfg_agent/cfg_agent.py b/neutron/plugins/cisco/cfg_agent/cfg_agent.py index d3d9eefb48..7512dee8ae 100644 --- a/neutron/plugins/cisco/cfg_agent/cfg_agent.py +++ b/neutron/plugins/cisco/cfg_agent/cfg_agent.py @@ -127,20 +127,20 @@ class CiscoCfgAgent(manager.Manager): self.devmgr_rpc = CiscoDeviceManagementApi(topics.L3PLUGIN, host) def _initialize_service_helpers(self, host): - svc_helper_class = self.conf.routing_svc_helper_class + svc_helper_class = self.conf.cfg_agent.routing_svc_helper_class try: self.routing_service_helper = importutils.import_object( svc_helper_class, host, self.conf, self) except ImportError as e: LOG.warn(_("Error in loading routing service helper. Class " "specified is %(class)s. Reason:%(reason)s"), - {'class': self.conf.routing_svc_helper_class, + {'class': self.conf.cfg_agent.routing_svc_helper_class, 'reason': e}) self.routing_service_helper = None def _start_periodic_tasks(self): self.loop = loopingcall.FixedIntervalLoopingCall(self.process_services) - self.loop.start(interval=self.conf.rpc_loop_interval) + self.loop.start(interval=self.conf.cfg_agent.rpc_loop_interval) def after_start(self): LOG.info(_("Cisco cfg agent started")) @@ -334,7 +334,7 @@ class CiscoCfgAgentWithStateReport(CiscoCfgAgent): def main(manager='neutron.plugins.cisco.cfg_agent.' 'cfg_agent.CiscoCfgAgentWithStateReport'): conf = cfg.CONF - conf.register_opts(CiscoCfgAgent.OPTS) + conf.register_opts(CiscoCfgAgent.OPTS, "cfg_agent") config.register_agent_state_opts_helper(conf) config.register_root_helper(conf) conf.register_opts(interface.OPTS) diff --git a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py index 95d80b7cac..9993ddb379 100644 --- a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py +++ b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py @@ -55,7 +55,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase): if credentials: self._csr_user = credentials['username'] self._csr_password = credentials['password'] - self._timeout = cfg.CONF.device_connection_timeout + self._timeout = cfg.CONF.cfg_agent.device_connection_timeout self._csr_conn = None self._intfs_enabled = False except KeyError as e: diff --git a/neutron/plugins/cisco/cfg_agent/device_status.py b/neutron/plugins/cisco/cfg_agent/device_status.py index ff389fbc62..5bd9fc8af2 100644 --- a/neutron/plugins/cisco/cfg_agent/device_status.py +++ b/neutron/plugins/cisco/cfg_agent/device_status.py @@ -33,7 +33,7 @@ STATUS_OPTS = [ "or high load when the device may not be responding.")), ] -cfg.CONF.register_opts(STATUS_OPTS) +cfg.CONF.register_opts(STATUS_OPTS, "cfg_agent") def _is_pingable(ip): @@ -76,7 +76,7 @@ class DeviceStatus(object): def get_backlogged_hosting_devices_info(self): wait_time = datetime.timedelta( - seconds=cfg.CONF.hosting_device_dead_timeout) + seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout) resp = [] for hd_id in self.backlog_hosting_devices: hd = self.backlog_hosting_devices[hd_id]['hd'] @@ -158,13 +158,14 @@ class DeviceStatus(object): 'ip': hd['management_ip_address']}) if timeutils.is_older_than( hd['backlog_insertion_ts'], - cfg.CONF.hosting_device_dead_timeout): + cfg.CONF.cfg_agent.hosting_device_dead_timeout): LOG.debug("Hosting device: %(hd_id)s @ %(ip)s hasn't " "been reachable for the last %(time)d seconds. " "Marking it dead.", {'hd_id': hd_id, 'ip': hd['management_ip_address'], - 'time': cfg.CONF.hosting_device_dead_timeout}) + 'time': cfg.CONF.cfg_agent. + hosting_device_dead_timeout}) response_dict['dead'].append(hd_id) hd.pop('backlog_insertion_ts', None) del self.backlog_hosting_devices[hd_id] diff --git a/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py b/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py index 48c7b4866e..e9df1a0902 100644 --- a/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py +++ b/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py @@ -71,7 +71,7 @@ class TestCiscoCfgAgentWIthStateReporting(base.BaseTestCase): self.conf = cfg.ConfigOpts() config.register_agent_state_opts_helper(cfg.CONF) self.conf.register_opts(base_config.core_opts) - self.conf.register_opts(cfg_agent.CiscoCfgAgent.OPTS) + self.conf.register_opts(cfg_agent.CiscoCfgAgent.OPTS, "cfg_agent") cfg.CONF.set_override('report_interval', 0, 'AGENT') super(TestCiscoCfgAgentWIthStateReporting, self).setUp() self.devmgr_plugin_api_cls_p = mock.patch( diff --git a/setup.cfg b/setup.cfg index 4f0697c80e..602afc2bff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,6 +55,7 @@ data_files = etc/neutron/plugins/bigswitch/ssl/host_certs/README etc/neutron/plugins/brocade = etc/neutron/plugins/brocade/brocade.ini etc/neutron/plugins/cisco = + etc/neutron/plugins/cisco/cisco_cfg_agent.ini etc/neutron/plugins/cisco/cisco_plugins.ini etc/neutron/plugins/cisco/cisco_router_plugin.ini etc/neutron/plugins/cisco/cisco_vpn_agent.ini