コード例 #1
0
def get_dhcp_agent_host(config):
    try:
        neutronclient = openstack_driver.NeutronClient(config)
        keystoneclient = openstack_driver.KeystoneClient(config)
        token = keystoneclient.get_admin_token()
        filters = {'agent_type': 'DHCP agent', 'alive': True}
        agents = neutronclient.get_agents(token, filters)
        if agents:
            return agents[0].get('host', None)
    except Exception as exc:
        LOG.error(_LE("Failed to get dhcp agent host : %(exc)s"), {'exc': exc})
コード例 #2
0
 def __init__(self, *args, **kwargs):
     super(TestNeutronClient, self).__init__(*args, **kwargs)
     self.neutron_obj = openstack_driver.NeutronClient(cfg.CONF)
コード例 #3
0
 def __init__(self, config):
     # self.network_handler = openstack_driver.NeutronClient(config)
     self.neutron_client = openstack_driver.NeutronClient(config)