def _setup_nvp_dhcp_metadata(self): # In agentless mode the following extensions, and related # operations, are not supported; so do not publish them if "agent" in self.supported_extension_aliases: self.supported_extension_aliases.remove("agent") if "dhcp_agent_scheduler" in self.supported_extension_aliases: self.supported_extension_aliases.remove( "dhcp_agent_scheduler") nvp_svc.register_dhcp_opts(cfg) nvp_svc.register_metadata_opts(cfg) self.lsn_manager = nvp_svc.LsnManager(self) self.agent_notifiers[const.AGENT_TYPE_DHCP] = ( nvp_svc.DhcpAgentNotifyAPI(self, self.lsn_manager)) # In agentless mode, ports whose owner is DHCP need to # be special cased; so add it to the list of special # owners list if const.DEVICE_OWNER_DHCP not in self.port_special_owners: self.port_special_owners.append(const.DEVICE_OWNER_DHCP) try: error = None nvp_svc.check_services_requirements(self.cluster) except nvp_exc.NvpInvalidVersion: error = _("Unable to run Neutron with config option '%s', as NVP " "does not support it") % config.AgentModes.AGENTLESS except nvp_exc.ServiceClusterUnavailable: error = _("Unmet dependency for config option " "'%s'") % config.AgentModes.AGENTLESS if error: LOG.exception(error) raise nvp_exc.NvpPluginException(err_msg=error)
def _setup_nvp_dhcp_metadata(self): # In agentless mode the following extensions, and related # operations, are not supported; so do not publish them if "agent" in self.supported_extension_aliases: self.supported_extension_aliases.remove("agent") if "dhcp_agent_scheduler" in self.supported_extension_aliases: self.supported_extension_aliases.remove("dhcp_agent_scheduler") nvp_svc.register_dhcp_opts(cfg) nvp_svc.register_metadata_opts(cfg) self.lsn_manager = nvp_svc.LsnManager(self) self.agent_notifiers[const.AGENT_TYPE_DHCP] = ( nvp_svc.DhcpAgentNotifyAPI(self, self.lsn_manager)) # In agentless mode, ports whose owner is DHCP need to # be special cased; so add it to the list of special # owners list if const.DEVICE_OWNER_DHCP not in self.port_special_owners: self.port_special_owners.append(const.DEVICE_OWNER_DHCP) try: error = None nvp_svc.check_services_requirements(self.cluster) except nvp_exc.NvpInvalidVersion: error = _("Unable to run Neutron with config option '%s', as NSX " "does not support it") % config.AgentModes.AGENTLESS except nvp_exc.ServiceClusterUnavailable: error = _("Unmet dependency for config option " "'%s'") % config.AgentModes.AGENTLESS if error: LOG.exception(error) raise nvp_exc.NvpPluginException(err_msg=error)
def setUp(self): super(LsnManagerTestCase, self).setUp() self.net_id = 'foo_network_id' self.sub_id = 'foo_subnet_id' self.port_id = 'foo_port_id' self.lsn_id = 'foo_lsn_id' self.mac = 'aa:bb:cc:dd:ee:ff' self.lsn_port_id = 'foo_lsn_port_id' self.tenant_id = 'foo_tenant_id' self.manager = nvp.LsnManager(mock.Mock()) self.mock_lsn_api_p = mock.patch.object(nvp, 'lsn_api') self.mock_lsn_api = self.mock_lsn_api_p.start() nvp.register_dhcp_opts(cfg) nvp.register_metadata_opts(cfg) self.addCleanup(cfg.CONF.reset) self.addCleanup(self.mock_lsn_api_p.stop)