def collect(self): results = {} neutron_client = NeutronAPIClient( username=self.username, password=self.password, auth_url=self.auth_url, project_id=self.project_id, region_name=self.region_name, ) result = yield neutron_client.agents() results["agents"] = result["agents"] result = yield neutron_client.networks() results["networks"] = result["networks"] result = yield neutron_client.subnets() results["subnets"] = result["subnets"] result = yield neutron_client.routers() results["routers"] = result["routers"] result = yield neutron_client.ports() results["ports"] = result["ports"] result = yield neutron_client.security_groups() results["security_groups"] = result["security_groups"] result = yield neutron_client.floatingips() results["floatingips"] = result["floatingips"] returnValue(results)
def collect(self, config): log.debug("Collect for OpenStack Neutron Agent Status (%s)" % config.id) ds0 = config.datasources[0] client = NeutronAPIClient( ds0.zCommandUsername, ds0.zCommandPassword, ds0.zOpenStackAuthUrl, ds0.zOpenStackProjectId, ds0.zOpenStackRegionName) results = {} log.debug('Requesting agent-list') result = yield client.agents() results['agents'] = result['agents'] defer.returnValue(results)
results["hypervisors"] = result["hypervisors"] log.debug("hypervisors: %s\n" % str(results["hypervisors"])) result = yield client.servers(detailed=True, search_opts={"all_tenants": 1}) results["servers"] = result["servers"] log.debug("servers: %s\n" % str(results["servers"])) result = yield client.services() results["services"] = result["services"] log.debug("services: %s\n" % str(results["services"])) # Neutron neutron_client = NeutronAPIClient( username=device.zCommandUsername, password=device.zCommandPassword, auth_url=device.zOpenStackAuthUrl, project_id=device.zOpenStackProjectId, region_name=device.zOpenStackRegionName, ) result = yield neutron_client.agents() results["agents"] = result["agents"] # --------------------------------------------------------------------- # Insert the l3_agents -> (routers, networks, subnets, gateways) data # --------------------------------------------------------------------- for _agent in results["agents"]: _agent["l3_agent_routers"] = [] _routers = set() _subnets = set() _gateways = set()