congress.datasources.doctor_driver module

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:

[
  {
    "time": "2016-02-22T11:48:55Z",
    "type": "compute.host.down",
    "details": {
        "hostname": "compute1",
        "status": "down",
        "monitor": "zabbix1",
        "monitor_event_id": "111"
    }
  },
  .....
]
TRANSLATORS = [{'translation-type': 'HDICT', 'table-name': 'events', 'selector-type': 'DICT_SELECTOR', 'objects-extract-fn': <function DoctorDriver.flatten_events>, 'field-translators': ({'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'}})}]
events_translator = {'field-translators': ({'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 DoctorDriver.flatten_events>, 'selector-type': 'DICT_SELECTOR', 'table-name': 'events', 'translation-type': 'HDICT'}
flatten_events()
static get_datasource_info()
safe_id()
value_trans = {'translation-type': 'VALUE'}
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.