You need to create a class in inora/lib/Gateway/lib/routers. This class must inherit from AbstractDevicesExtractor
. This implies having a method called get_devices_dict
that returns a dictionary with entries like "<mac-address>:<hostname>", such as :
{
"D0-87-E2-07-38-BB": "Device1",
"00-14-22-01-23-45": "Device2",
"00-1B-63-84-45-E6": "Device3"
}
The AbstractDevicesExtractor class gives access to the router IP, its credentials and the poll period between each set of connected hosts retrieval. They can be accessed respectively with :
super(<yourNewClassName>, self).get_router_ip()
super(<yourNewClassName>, self).get_poll_period()
super(<yourNewClassName>, self).get_credentials()["router_login"]
and super(<yourNewClassName>, self).get_credentials()["router_password"]
In the device_extractor_factory
function of inora/Gateway/inora_gateway.py, add an if condition with the newly created router :
if type == "<MyNewRouter>":
return MyNewRouterClass(router_ip, poll_period)
Where MyNewRouter
will be the value for the the router_type
variable in inora.conf.
Also, the newly created class must be imported in this file. Example :
from lib.routers.bboxconnecteddevicesextractor import BboxConnectedDevicesExtractor