The congress.datasources.doctor_driver Module

class congress.datasources.doctor_driver.DoctorDriver(name='', args=None)

Bases: congress.datasources.datasource_driver.PushedDataSourceDriver

A DataSource Driver for OPNFV Doctor project.

This driver has a table for Doctor project’s Inspector. Please check https://wiki.opnfv.org/display/doctor/Doctor+Home for the details about OPNFV Doctor project.

To update the table, call Update row API.

PUT /v1/data-sources/<the driver id>/tables/<table id>/rows

For updating ‘events’ table, the request body should be following style. The request will replace all rows in the table with the body, which means if you update the table with [] it will clear the table. One {} object in the list represents one row of the table.

request body: [

{

“id”: “0123-4567-89ab”, “time”: “2016-02-22T11:48:55Z”, “type”: “compute.host.down”, “details”: {

“hostname”: “compute1”, “status”: “down”, “monitor”: “zabbix1”, “monitor_event_id”: “111”

}

]

TRANSLATORS = [{'selector-type': 'DICT_SELECTOR', 'table-name': 'events', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'time', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'hostname', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'status', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'monitor', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'monitor_event_id', 'translator': {'translation-type': 'VALUE'}}), 'objects-extract-fn': <function flatten_events at 0x7fdb9b510488>}]
events_translator = {'selector-type': 'DICT_SELECTOR', 'table-name': 'events', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'time', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'hostname', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'status', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'monitor', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'monitor_event_id', 'translator': {'translation-type': 'VALUE'}}), 'objects-extract-fn': <function flatten_events at 0x7fdb9b510488>}
flatten_events(row_events)
static get_datasource_info()
safe_id(x)
value_trans = {'translation-type': 'VALUE'}