Skip to content
Snippets Groups Projects
Commit fd1177ed authored by Erik Reid's avatar Erik Reid
Browse files

added snmp query to worker jobs

parent 41618bfe
No related branches found
No related tags found
No related merge requests found
......@@ -15,13 +15,23 @@ def update():
config = current_app.config["INVENTORY_PROVIDER_CONFIG"]
for r in config["routers"]:
task_logger.info("fetching router details for: %r" % r)
task_logger.debug('launching task: '
'inventory_provider'
'.tasks.worker.netconf_refresh_config'
'(%s)' % r['hostname'])
task_logger.info("fetching details for: %r" % r)
task_logger.debug(
'launching task: '
'inventory_provider.tasks.worker.netconf_refresh_config'
'(%s)' % r['hostname'])
app.send_task(
'inventory_provider.tasks.worker.netconf_refresh_config',
args=[r["hostname"]])
task_logger.debug(
'launching task: '
'inventory_provider.tasks.worker.snmp_refresh_interfaces'
'(%s)' % r['hostname'])
app.send_task(
'inventory_provider.tasks.worker.snmp_refresh_interfaces',
args=[r["hostname"], r["community"]])
return Response("OK")
......@@ -51,7 +51,7 @@ class InventoryTask(Task):
InventoryTask.save_key(
hostname,
key,
etree.tostring(data, encoding='utf-8'))
etree.tostring(data, encoding='unicode'))
class WorkerArgs(bootsteps.Step):
......@@ -74,28 +74,28 @@ app.user_options['worker'].add(worker_args)
app.steps['worker'].add(WorkerArgs)
@app.task(bind=InventoryTask)
def juniper_refresh_bgp(self, hostname):
InventoryTask.save_key_json(
hostname,
"bgp",
juniper.fetch_bgp_config(hostname, InventoryTask.config["ssh"]))
@app.task(bind=InventoryTask)
def juniper_refresh_vrr(self, hostname):
InventoryTask.save_key_json(
hostname,
"vrr",
juniper.fetch_vrr_config(hostname, InventoryTask.config["ssh"]))
@app.task(bind=InventoryTask)
def juniper_refresh_interfaces(self, hostname):
InventoryTask.save_key_json(
hostname,
"interfaces",
juniper.fetch_interfaces(hostname, InventoryTask.config["ssh"]))
# @app.task(bind=InventoryTask)
# def juniper_refresh_bgp(self, hostname):
# InventoryTask.save_key_json(
# hostname,
# "bgp",
# juniper.fetch_bgp_config(hostname, InventoryTask.config["ssh"]))
#
#
# @app.task(bind=InventoryTask)
# def juniper_refresh_vrr(self, hostname):
# InventoryTask.save_key_json(
# hostname,
# "vrr",
# juniper.fetch_vrr_config(hostname, InventoryTask.config["ssh"]))
#
#
# @app.task(bind=InventoryTask)
# def juniper_refresh_interfaces(self, hostname):
# InventoryTask.save_key_json(
# hostname,
# "interfaces",
# juniper.fetch_interfaces(hostname, InventoryTask.config["ssh"]))
@app.task(bind=InventoryTask)
......@@ -115,4 +115,3 @@ def netconf_refresh_config(self, hostname):
hostname,
"netconf",
netconf.load_config(hostname, InventoryTask.config["ssh"]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment