Skip to content
Snippets Groups Projects
Commit 72c55fe6 authored by Robert Latta's avatar Robert Latta
Browse files

added route for retrieving netconf data

parent 98d1d157
No related branches found
No related tags found
No related merge requests found
......@@ -189,6 +189,18 @@ def snmp_ids(hostname):
return jsonify(ifc_data)
@routes.route("netconf/<hostname>", methods=['GET', 'POST'])
def get_netconf(hostname):
config = current_app.config["INVENTORY_PROVIDER_CONFIG"]
try:
netconf_doc = juniper.load_config(
hostname, config["ssh"], validate=False)
msg = etree.tostring(netconf_doc, encoding='unicode')
except (ConnectionError, juniper.NetconfHandlingError) as e:
msg = f'error loading netconf data from {hostname}\n{e}'
return msg
@routes.route("latchdb", methods=['GET', 'POST'])
def latch_db():
config = current_app.config["INVENTORY_PROVIDER_CONFIG"]
......
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