From 2d9c5445b11213314d65b77dfb3e832254c30d8e Mon Sep 17 00:00:00 2001 From: yayogev Date: Fri, 11 Aug 2017 18:16:08 +0300 Subject: US2853 make object name shorter for switch pnics Change-Id: Iadc5df69fcdbfa46c29bb94709f67bb95592efcb Signed-off-by: yayogev --- app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py | 2 ++ app/discover/fetchers/aci/aci_fetch_switch_pnic.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py b/app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py index 992df77..d400007 100644 --- a/app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py +++ b/app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py @@ -126,6 +126,7 @@ class AciFetchLeafToSpinePnics(AciAccess): downlink_pnic_json = { "id": db_downlink_pnic_id, + "object_name": downlink_pnic_id, "type": "switch_pnic", "role": "downlink", "connected_to": db_uplink_pnic_id, @@ -137,6 +138,7 @@ class AciFetchLeafToSpinePnics(AciAccess): uplink_pnic_json = { "id": db_uplink_pnic_id, + "object_name": uplink_pnic_id, "type": "switch_pnic", "role": "uplink", "connected_to": db_downlink_pnic_id, diff --git a/app/discover/fetchers/aci/aci_fetch_switch_pnic.py b/app/discover/fetchers/aci/aci_fetch_switch_pnic.py index cd82d7e..bb87b7b 100644 --- a/app/discover/fetchers/aci/aci_fetch_switch_pnic.py +++ b/app/discover/fetchers/aci/aci_fetch_switch_pnic.py @@ -11,7 +11,7 @@ import re from discover.fetchers.aci.aci_access import AciAccess, aci_config_required from utils.inventory_mgr import InventoryMgr -from utils.util import encode_aci_dn, get_object_path_part +from utils.util import decode_aci_dn, encode_aci_dn, get_object_path_part # Fetches and adds to database: @@ -91,11 +91,11 @@ class AciFetchSwitchPnic(AciAccess): environment=environment) # Prepare pnic json for results list - db_pnic_id = "-".join((db_leaf_id, - encode_aci_dn(leaf_pnic["ifId"]), - mac_address)) + if_id = decode_aci_dn(leaf_pnic["ifId"]) + db_pnic_id = "-".join([db_leaf_id, if_id, mac_address]) pnic_json = { "id": db_pnic_id, + "object_name": if_id, "type": "switch_pnic", "role": "hostlink", "parent_id": db_leaf_id, -- cgit 1.2.3-korg