From 40a335ab72fa439f0849ac357a779f7b6eea6091 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Tue, 22 Jan 2019 15:13:12 +0000 Subject: [PATCH] added coriant interface name population --- inventory_provider/opsdb.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inventory_provider/opsdb.py b/inventory_provider/opsdb.py index 1d330354..974904ce 100644 --- a/inventory_provider/opsdb.py +++ b/inventory_provider/opsdb.py @@ -211,6 +211,16 @@ def _juniper_field_update(record): return record +def _coriant_field_update(record): + record["interface_name"] = record["card_id"] + if record["port"] is not None and record["port"] != "": + separator = "/" if "-" in record["interface_name"] else "" + record["interface_name"] += separator + str(record["port"]) + if record["logical_unit"] is not None and record["logical_unit"] != "": + record["interface_name"] += "." + str(record["logical_unit"]) + return record + + def _update_fields(r): func = globals().get("_" + r["manufacturer"] + "_field_update") return func(r) if func else r -- GitLab