Allow port in JSON ingester config
Allow config to specify a port to use in making the API calls to ingest JSON. Also added additional sample configs: neutron, keystone, monasca. Change-Id: I7d852742d0943c3857ee4e04d5a0d77b6bafeed7 partially-implements: bp json-data-model
This commit is contained in:
parent
eb8520d684
commit
7676be3cb6
|
@ -65,8 +65,14 @@ class ExecApiManager(object):
|
||||||
'supported.'.auth_config['type'])
|
'supported.'.auth_config['type'])
|
||||||
|
|
||||||
name = config['name']
|
name = config['name']
|
||||||
|
port = config.get('api_endpoint_port')
|
||||||
|
if port is not None:
|
||||||
|
port_str = ':' + str(port)
|
||||||
|
else:
|
||||||
|
port_str = ''
|
||||||
self._exec_api_endpoints[name] = (
|
self._exec_api_endpoints[name] = (
|
||||||
config.get('api_endpoint_host', '').rstrip('/') + '/'
|
config.get('api_endpoint_host', '').rstrip('/')
|
||||||
|
+ port_str + '/'
|
||||||
+ config.get('api_endpoint_path', '').lstrip('/'))
|
+ config.get('api_endpoint_path', '').lstrip('/'))
|
||||||
self._exec_api_sessions[name] = session
|
self._exec_api_sessions[name] = session
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,15 @@ class JsonIngester(datasource_driver.PollingDataSourceDriver):
|
||||||
self._create_schema_and_tables()
|
self._create_schema_and_tables()
|
||||||
self.poll_time = self._config.get('poll_interval', 60)
|
self.poll_time = self._config.get('poll_interval', 60)
|
||||||
self._setup_table_key_sets()
|
self._setup_table_key_sets()
|
||||||
self._api_endpoint = self._config.get('api_endpoint_host', '').rstrip(
|
port = self._config.get('api_endpoint_port')
|
||||||
'/') + '/' + self._config.get('api_endpoint_path', '').lstrip('/')
|
if port is not None:
|
||||||
|
port_str = ':' + str(port)
|
||||||
|
else:
|
||||||
|
port_str = ''
|
||||||
|
self._api_endpoint = (
|
||||||
|
self._config.get('api_endpoint_host', '').rstrip('/')
|
||||||
|
+ port_str + '/'
|
||||||
|
+ self._config.get('api_endpoint_path', '').lstrip('/'))
|
||||||
self._initialize_session()
|
self._initialize_session()
|
||||||
self._initialize_update_methods()
|
self._initialize_update_methods()
|
||||||
if len(self.update_methods) > 0:
|
if len(self.update_methods) > 0:
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
name: _cve
|
||||||
|
allow_exec_api: true
|
||||||
|
poll_interval: 86400 # one day
|
||||||
|
api_endpoint_host: https://cve.circl.lu
|
||||||
|
api_endpoint_path: api/
|
||||||
|
tables:
|
||||||
|
linux_kernel:
|
||||||
|
poll:
|
||||||
|
api_path: search/linux/kernel
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $[:]
|
|
@ -0,0 +1,54 @@
|
||||||
|
name: _identity
|
||||||
|
poll_interval: 60
|
||||||
|
allow_exec_api: true
|
||||||
|
authentication: !ref keystone_admin_auth_config
|
||||||
|
api_endpoint_host: !ref primary_host
|
||||||
|
api_endpoint_path: identity/v3/
|
||||||
|
api_default_headers:
|
||||||
|
X-OpenStack-Nova-API-Version: "2.26"
|
||||||
|
tables:
|
||||||
|
domains:
|
||||||
|
poll:
|
||||||
|
api_path: domains
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.domains[:]
|
||||||
|
groups:
|
||||||
|
poll:
|
||||||
|
api_path: groups
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.groups[:]
|
||||||
|
projects:
|
||||||
|
poll:
|
||||||
|
api_path: projects
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.projects[:]
|
||||||
|
regions:
|
||||||
|
poll:
|
||||||
|
api_path: regions
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.regions[:]
|
||||||
|
roles:
|
||||||
|
poll:
|
||||||
|
api_path: roles
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.roles[:]
|
||||||
|
services:
|
||||||
|
poll:
|
||||||
|
api_path: services
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.services[:]
|
||||||
|
endpoints:
|
||||||
|
poll:
|
||||||
|
api_path: endpoints
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.endpoints[:]
|
||||||
|
registered_limits:
|
||||||
|
poll:
|
||||||
|
api_path: registered_limits
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.registered_limits[:]
|
||||||
|
users:
|
||||||
|
poll:
|
||||||
|
api_path: users
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.users[:]
|
|
@ -0,0 +1,6 @@
|
||||||
|
name: _monasca
|
||||||
|
tables:
|
||||||
|
alarms:
|
||||||
|
webhook:
|
||||||
|
record_jsonpath: $
|
||||||
|
id_jsonpath: $.alarm_id
|
|
@ -0,0 +1,63 @@
|
||||||
|
name: _networking
|
||||||
|
poll_interval: 60
|
||||||
|
allow_exec_api: true
|
||||||
|
authentication: !ref keystone_admin_auth_config
|
||||||
|
api_endpoint_host: !ref primary_host
|
||||||
|
api_endpoint_path: v2.0/
|
||||||
|
api_endpoint_port: 9696
|
||||||
|
tables:
|
||||||
|
networks:
|
||||||
|
poll:
|
||||||
|
api_path: networks
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.networks[:]
|
||||||
|
ports:
|
||||||
|
poll:
|
||||||
|
api_path: ports
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.ports[:]
|
||||||
|
floatingips:
|
||||||
|
poll:
|
||||||
|
api_path: floatingips
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.floatingips[:]
|
||||||
|
routers:
|
||||||
|
poll:
|
||||||
|
api_path: routers
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.routers[:]
|
||||||
|
subnets:
|
||||||
|
poll:
|
||||||
|
api_path: subnets
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.subnets[:]
|
||||||
|
firewall_groups:
|
||||||
|
poll:
|
||||||
|
api_path: fwaas/firewall_groups
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.firewall_groups[:]
|
||||||
|
firewall_policies:
|
||||||
|
poll:
|
||||||
|
api_path: fwaas/firewall_policies
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.firewall_policies[:]
|
||||||
|
firewall_rules:
|
||||||
|
poll:
|
||||||
|
api_path: fwaas/firewall_rules
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.firewall_rules[:]
|
||||||
|
security_groups:
|
||||||
|
poll:
|
||||||
|
api_path: security-groups
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.security_groups[:]
|
||||||
|
rbac_policies:
|
||||||
|
poll:
|
||||||
|
api_path: rbac-policies
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.rbac_policies[:]
|
||||||
|
agents:
|
||||||
|
poll:
|
||||||
|
api_path: agents
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.agents[:]
|
|
@ -1,5 +1,5 @@
|
||||||
name: nova
|
name: _compute
|
||||||
poll_interval: 5
|
poll_interval: 60
|
||||||
allow_exec_api: true
|
allow_exec_api: true
|
||||||
authentication: !ref keystone_admin_auth_config
|
authentication: !ref keystone_admin_auth_config
|
||||||
api_endpoint_host: !ref primary_host
|
api_endpoint_host: !ref primary_host
|
||||||
|
@ -17,7 +17,23 @@ tables:
|
||||||
api_path: servers/detail
|
api_path: servers/detail
|
||||||
api_method: get
|
api_method: get
|
||||||
jsonpath: $.servers[:]
|
jsonpath: $.servers[:]
|
||||||
alarms:
|
hypervisors:
|
||||||
webhook:
|
poll:
|
||||||
record_jsonpath: $.payload
|
api_path: os-hypervisors/detail
|
||||||
id_jsonpath: $.id
|
api_method: get
|
||||||
|
jsonpath: $.hypervisors[:]
|
||||||
|
availability_zones:
|
||||||
|
poll:
|
||||||
|
api_path: os-availability-zone/detail
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.availabilityZoneInfo[:]
|
||||||
|
migrations:
|
||||||
|
poll:
|
||||||
|
api_path: os-migrations
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.migrations[:]
|
||||||
|
services:
|
||||||
|
poll:
|
||||||
|
api_path: os-services
|
||||||
|
api_method: get
|
||||||
|
jsonpath: $.services[:]
|
||||||
|
|
Loading…
Reference in New Issue