US2853 rename pnic to host_pnic & switch_pnic 91/39091/1
authoryayogev <yaronyogev@gmail.com>
Thu, 10 Aug 2017 21:35:14 +0000 (00:35 +0300)
committeryayogev <yaronyogev@gmail.com>
Thu, 10 Aug 2017 21:35:14 +0000 (00:35 +0300)
fixed clique finder to work with switch-switch link type

Change-Id: I4f815f77e6b4ea36669dfb58bb5f5e914fe3e1ac
Signed-off-by: yayogev <yaronyogev@gmail.com>
22 files changed:
app/config/scanners.json
app/discover/clique_finder.py
app/discover/fetchers/aci/aci_fetch_leaf_to_spine_pnics.py
app/discover/fetchers/aci/aci_fetch_switch_pnic.py
app/discover/fetchers/cli/cli_fetch_host_pnics.py
app/discover/fetchers/cli/cli_fetch_host_pnics_vpp.py
app/discover/fetchers/db/db_fetch_vedges_ovs.py
app/discover/find_links_for_oteps.py
app/discover/find_links_for_pnics.py
app/discover/find_links_for_vconnectors.py
app/discover/find_links_for_vedges.py
app/install/db/attributes_for_hover_on_data.json
app/install/db/clique_types.json
app/install/db/constants.json
app/install/db/link_types.json
app/monitoring/setup/monitoring_pnic.py
app/monitoring/setup/monitoring_setup_manager.py
app/test/api/responders_test/test_data/base.py
app/test/api/responders_test/test_data/clique_types.py
app/test/api/responders_test/test_data/cliques.py
app/test/api/responders_test/test_data/links.py
app/test/scan/test_data/scanner.py

index feaafcb..fa65891 100644 (file)
     ],
     "ScanPnicsRoot": [
       {
-        "type": "pnic",
+        "type": "host_pnic",
         "environment_condition": {
           "mechanism_drivers": [
             "OVS",
     ],
     "ScanHostPnic": [
       {
-        "type": "pnic",
+        "type": "switch_pnic",
         "fetcher": "AciFetchSwitchPnic",
         "children_scanner": "ScanSpines"
       }
     ],
     "ScanSpines": [
       {
-        "type": "pnic",
+        "type": "switch_pnic",
         "fetcher": "AciFetchLeafToSpinePnics"
       }
     ],
     ],
     "ScanVppPnicsRoot": [
       {
-        "type": "pnic",
+        "type": "host_pnic",
         "fetcher": "CliFetchHostPnicsVpp",
         "environment_condition": {
           "mechanism_drivers": "VPP"
index 9b5aad2..4c4e636 100644 (file)
@@ -100,11 +100,15 @@ class CliqueFinder(Fetcher):
             link_type_parts = link_type.split('-')
             link_type_parts.reverse()
             link_type_reversed = '-'.join(link_type_parts)
-            matches = self.links.find_one({
-                "environment": self.env,
-                "link_type": link_type_reversed
-            })
-            reversed = True if matches else False
+            self_linked = link_type == link_type_reversed
+            if self_linked:
+                reversed = False
+            else:
+                matches = self.links.find_one({
+                    "environment": self.env,
+                    "link_type": link_type_reversed
+                })
+                reversed = True if matches else False
             if reversed:
                 link_type = link_type_reversed
             from_type = link_type[:link_type.index("-")]
@@ -115,6 +119,7 @@ class CliqueFinder(Fetcher):
             if match_type not in nodes_of_type.keys():
                 continue
             other_side_type = to_type if not reversed else from_type
+            nodes_to_add = {}
             for match_point in nodes_of_type[match_type].keys():
                 matches = self.links.find({
                     "environment": self.env,
@@ -130,9 +135,10 @@ class CliqueFinder(Fetcher):
                     clique["links"].append(id)
                     clique["links_detailed"].append(link)
                     other_side_point = str(link[other_side])
-                    if other_side_type not in nodes_of_type:
-                        nodes_of_type[other_side_type] = {}
-                    nodes_of_type[other_side_type][other_side_point] = 1
+                    nodes_to_add[other_side_point] = 1
+            if other_side_type not in nodes_of_type:
+                nodes_of_type[other_side_type] = {}
+            nodes_of_type[other_side_type].update(nodes_to_add)
 
         # after adding the links to the clique, create/update the clique
         if not clique["links"]:
index 463d4d8..992df77 100644 (file)
-###############################################################################\r
-# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems)   #\r
-# and others                                                                  #\r
-#                                                                             #\r
-# All rights reserved. This program and the accompanying materials            #\r
-# are made available under the terms of the Apache License, Version 2.0       #\r
-# which accompanies this distribution, and is available at                    #\r
-# http://www.apache.org/licenses/LICENSE-2.0                                  #\r
-###############################################################################\r
-import re\r
-\r
-from discover.fetchers.aci.aci_access import AciAccess, aci_config_required\r
-from utils.inventory_mgr import InventoryMgr\r
-from utils.util import decode_aci_dn, encode_aci_dn, get_object_path_part\r
-\r
-\r
-# Fetches and adds to database:\r
-# 1. ACI Switches with role "spine"\r
-#\r
-# Returns:\r
-# 1. ACI Switch uplink pnics that belong to the "leaf" switch\r
-# 2. ACI Switch downlink pnics that belong to "spine" switches mentioned above\r
-# and are connected to the "leaf" switch\r
-class AciFetchLeafToSpinePnics(AciAccess):\r
-\r
-    def __init__(self):\r
-        super().__init__()\r
-        self.inv = InventoryMgr()\r
-\r
-    def fetch_switches_by_role(self, role_name):\r
-        query_filter = {"query-target-filter":\r
-                        "eq(fabricNode.role, \"{}\")".format(role_name)}\r
-        switches = self.fetch_objects_by_class("fabricNode", query_filter)\r
-        return [switch["attributes"] for switch in switches]\r
-\r
-    def fetch_adjacent_connections(self, device_id):\r
-        dn = "/".join((device_id, "sys"))\r
-\r
-        response = self.fetch_mo_data(dn,\r
-                                      {"query-target": "subtree",\r
-                                       "target-subtree-class": "lldpAdjEp"})\r
-\r
-        connections = self.get_objects_by_field_names(response,\r
-                                                      "lldpAdjEp", "attributes")\r
-        return connections\r
-\r
-    # Returns:\r
-    # List of:\r
-    # 1. Switches with role "spine"\r
-    # 2. Downlink pnic id for spine switch\r
-    # 3. Uplink pnic id for leaf switch\r
-    def fetch_spines_and_pnics_by_leaf_id(self, leaf_id):\r
-        spine_switches = self.fetch_switches_by_role("spine")\r
-        adjacent_devices = self.fetch_adjacent_connections(leaf_id)\r
-        spines = []\r
-        for spine in spine_switches:\r
-            # Check if spine switch is connected to current leaf switch\r
-            connection = next((d for d in adjacent_devices\r
-                               if spine["name"] == d["sysName"]),\r
-                              None)\r
-            if connection:\r
-                try:\r
-                    # Extract pnics from adjacency data\r
-                    uplink_pnic = re.match(".*\[(.+?)\].*",\r
-                                           connection["dn"]).group(1)\r
-                    downlink_pnic = re.match(".*\[(.+?)\].*",\r
-                                             connection["portDesc"]).group(1)\r
-                    spines.append({\r
-                        "device": spine,\r
-                        "downlink_pnic": downlink_pnic,\r
-                        "uplink_pnic": uplink_pnic\r
-                    })\r
-                except AttributeError:\r
-                    continue  # TODO: probably raise an exception\r
-\r
-        return spines\r
-\r
-    @aci_config_required(default=[])\r
-    def get(self, db_leaf_pnic_id):\r
-        environment = self.get_env()\r
-        leaf_pnic = self.inv.get_by_id(environment=environment,\r
-                                       item_id=db_leaf_pnic_id)\r
-        leaf_switch_id = leaf_pnic['switch']\r
-\r
-        # Decode aci leaf switch id from db format\r
-        aci_leaf_pnic_id = decode_aci_dn(db_leaf_pnic_id)\r
-        aci_leaf_id = re.match("switch-(.+?)-leaf", aci_leaf_pnic_id).group(1)\r
-\r
-        # Fetch all leaf-to-spine connectivity data\r
-        spines_with_pnics = self.fetch_spines_and_pnics_by_leaf_id(aci_leaf_id)\r
-        pnics = []\r
-        for spine_with_pnic in spines_with_pnics:\r
-            spine = spine_with_pnic["device"]\r
-            downlink_pnic_id = spine_with_pnic["downlink_pnic"]\r
-            uplink_pnic_id = spine_with_pnic["uplink_pnic"]\r
-\r
-            # Add spine switch to db if it's not there yet\r
-            spine_id_match = re.match("topology/(.+)", spine["dn"])\r
-            if not spine_id_match:\r
-                raise ValueError("Failed to fetch spine switch id "\r
-                                 "from switch dn: {}".format(spine["dn"]))\r
-\r
-            aci_spine_id = spine_id_match.group(1)\r
-            db_spine_id = "-".join(("switch", encode_aci_dn(aci_spine_id),\r
-                                    spine["role"]))\r
-            if not self.inv.get_by_id(environment, db_spine_id):\r
-                spine_json = {\r
-                    "id": db_spine_id,\r
-                    "type": "switch",\r
-                    "aci_document": spine\r
-                }\r
-                # Region name is the same as region id\r
-                region_id = get_object_path_part(leaf_pnic["name_path"],\r
-                                                 "Regions")\r
-                region = self.inv.get_by_id(environment, region_id)\r
-                self.inv.save_inventory_object(o=spine_json, parent=region,\r
-                                               environment=environment)\r
-\r
-            # Add downlink and uplink pnics to results list,\r
-            # including their mutual connection data\r
-            # (see "connected_to" field).\r
-            db_downlink_pnic_id = "-".join((db_spine_id,\r
-                                            encode_aci_dn(downlink_pnic_id)))\r
-            db_uplink_pnic_id = "-".join((leaf_pnic["switch"],\r
-                                          encode_aci_dn(uplink_pnic_id)))\r
-\r
-            downlink_pnic_json = {\r
-                "id": db_downlink_pnic_id,\r
-                "type": "pnic",\r
-                "role": "downlink",\r
-                "pnic_type": "switch",\r
-                "connected_to": db_uplink_pnic_id,\r
-                "switch": db_spine_id,\r
-                "parent_id": db_spine_id,\r
-                "parent_type": "switch",\r
-                "aci_document": {}  # TODO: what can we add here?\r
-            }\r
-\r
-            uplink_pnic_json = {\r
-                "id": db_uplink_pnic_id,\r
-                "type": "pnic",\r
-                "role": "uplink",\r
-                "pnic_type": "switch",\r
-                "connected_to": db_downlink_pnic_id,\r
-                "switch": leaf_switch_id,\r
-                "parent_id": leaf_switch_id,\r
-                "parent_type": "switch",\r
-                "aci_document": {}  # TODO: what can we add here?\r
-            }\r
-\r
-            pnics.extend([downlink_pnic_json, uplink_pnic_json])\r
-\r
-        return pnics\r
+###############################################################################
+# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems)   #
+# and others                                                                  #
+#                                                                             #
+# All rights reserved. This program and the accompanying materials            #
+# are made available under the terms of the Apache License, Version 2.0       #
+# which accompanies this distribution, and is available at                    #
+# http://www.apache.org/licenses/LICENSE-2.0                                  #
+###############################################################################
+import re
+
+from discover.fetchers.aci.aci_access import AciAccess, aci_config_required
+from utils.inventory_mgr import InventoryMgr
+from utils.util import decode_aci_dn, encode_aci_dn, get_object_path_part
+
+
+# Fetches and adds to database:
+# 1. ACI Switches with role "spine"
+#
+# Returns:
+# 1. ACI Switch uplink pnics that belong to the "leaf" switch
+# 2. ACI Switch downlink pnics that belong to "spine" switches mentioned above
+# and are connected to the "leaf" switch
+class AciFetchLeafToSpinePnics(AciAccess):
+
+    def __init__(self):
+        super().__init__()
+        self.inv = InventoryMgr()
+
+    def fetch_switches_by_role(self, role_name):
+        query_filter = {"query-target-filter":
+                        "eq(fabricNode.role, \"{}\")".format(role_name)}
+        switches = self.fetch_objects_by_class("fabricNode", query_filter)
+        return [switch["attributes"] for switch in switches]
+
+    def fetch_adjacent_connections(self, device_id):
+        dn = "/".join((device_id, "sys"))
+
+        response = self.fetch_mo_data(dn,
+                                      {"query-target": "subtree",
+                                       "target-subtree-class": "lldpAdjEp"})
+
+        connections = self.get_objects_by_field_names(response,
+                                                      "lldpAdjEp", "attributes")
+        return connections
+
+    # Returns:
+    # List of:
+    # 1. Switches with role "spine"
+    # 2. Downlink pnic id for spine switch
+    # 3. Uplink pnic id for leaf switch
+    def fetch_spines_and_pnics_by_leaf_id(self, leaf_id):
+        spine_switches = self.fetch_switches_by_role("spine")
+        adjacent_devices = self.fetch_adjacent_connections(leaf_id)
+        spines = []
+        for spine in spine_switches:
+            # Check if spine switch is connected to current leaf switch
+            connection = next((d for d in adjacent_devices
+                               if spine["name"] == d["sysName"]),
+                              None)
+            if connection:
+                try:
+                    # Extract pnics from adjacency data
+                    uplink_pnic = re.match(".*\[(.+?)\].*",
+                                           connection["dn"]).group(1)
+                    downlink_pnic = re.match(".*\[(.+?)\].*",
+                                             connection["portDesc"]).group(1)
+                    spines.append({
+                        "device": spine,
+                        "downlink_pnic": downlink_pnic,
+                        "uplink_pnic": uplink_pnic
+                    })
+                except AttributeError:
+                    continue  # TODO: probably raise an exception
+
+        return spines
+
+    @aci_config_required(default=[])
+    def get(self, db_leaf_pnic_id):
+        environment = self.get_env()
+        leaf_pnic = self.inv.get_by_id(environment=environment,
+                                       item_id=db_leaf_pnic_id)
+        leaf_switch_id = leaf_pnic['switch']
+
+        # Decode aci leaf switch id from db format
+        aci_leaf_pnic_id = decode_aci_dn(db_leaf_pnic_id)
+        aci_leaf_id = re.match("switch-(.+?)-leaf", aci_leaf_pnic_id).group(1)
+
+        # Fetch all leaf-to-spine connectivity data
+        spines_with_pnics = self.fetch_spines_and_pnics_by_leaf_id(aci_leaf_id)
+        pnics = []
+        for spine_with_pnic in spines_with_pnics:
+            spine = spine_with_pnic["device"]
+            downlink_pnic_id = spine_with_pnic["downlink_pnic"]
+            uplink_pnic_id = spine_with_pnic["uplink_pnic"]
+
+            # Add spine switch to db if it's not there yet
+            spine_id_match = re.match("topology/(.+)", spine["dn"])
+            if not spine_id_match:
+                raise ValueError("Failed to fetch spine switch id "
+                                 "from switch dn: {}".format(spine["dn"]))
+
+            aci_spine_id = spine_id_match.group(1)
+            db_spine_id = "-".join(("switch", encode_aci_dn(aci_spine_id),
+                                    spine["role"]))
+            if not self.inv.get_by_id(environment, db_spine_id):
+                spine_json = {
+                    "id": db_spine_id,
+                    "type": "switch",
+                    "aci_document": spine
+                }
+                # Region name is the same as region id
+                region_id = get_object_path_part(leaf_pnic["name_path"],
+                                                 "Regions")
+                region = self.inv.get_by_id(environment, region_id)
+                self.inv.save_inventory_object(o=spine_json, parent=region,
+                                               environment=environment)
+
+            # Add downlink and uplink pnics to results list,
+            # including their mutual connection data
+            # (see "connected_to" field).
+            db_downlink_pnic_id = "-".join((db_spine_id,
+                                            encode_aci_dn(downlink_pnic_id)))
+            db_uplink_pnic_id = "-".join((leaf_pnic["switch"],
+                                          encode_aci_dn(uplink_pnic_id)))
+
+            downlink_pnic_json = {
+                "id": db_downlink_pnic_id,
+                "type": "switch_pnic",
+                "role": "downlink",
+                "connected_to": db_uplink_pnic_id,
+                "switch": db_spine_id,
+                "parent_id": db_spine_id,
+                "parent_type": "switch",
+                "aci_document": {}  # TODO: what can we add here?
+            }
+
+            uplink_pnic_json = {
+                "id": db_uplink_pnic_id,
+                "type": "switch_pnic",
+                "role": "uplink",
+                "connected_to": db_downlink_pnic_id,
+                "switch": leaf_switch_id,
+                "parent_id": leaf_switch_id,
+                "parent_type": "switch",
+                "aci_document": {}  # TODO: what can we add here?
+            }
+
+            pnics.extend([downlink_pnic_json, uplink_pnic_json])
+
+        return pnics
index 09157b6..cd82d7e 100644 (file)
-###############################################################################\r
-# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems)   #\r
-# and others                                                                  #\r
-#                                                                             #\r
-# All rights reserved. This program and the accompanying materials            #\r
-# are made available under the terms of the Apache License, Version 2.0       #\r
-# which accompanies this distribution, and is available at                    #\r
-# http://www.apache.org/licenses/LICENSE-2.0                                  #\r
-###############################################################################\r
-import re\r
-\r
-from discover.fetchers.aci.aci_access import AciAccess, aci_config_required\r
-from utils.inventory_mgr import InventoryMgr\r
-from utils.util import encode_aci_dn, get_object_path_part\r
-\r
-\r
-# Fetches and adds to database:\r
-# 1. ACI Switch\r
-#\r
-# Returns:\r
-# 1. ACI Switch pnic that belongs to the ACI Switch (mentioned above)\r
-# and is connected to Calipso host pnic.\r
-class AciFetchSwitchPnic(AciAccess):\r
-\r
-    def __init__(self):\r
-        super().__init__()\r
-        self.inv = InventoryMgr()\r
-\r
-    def fetch_pnics_by_mac_address(self, mac_address):\r
-        mac_filter = "eq(epmMacEp.addr,\"{}\")".format(mac_address)\r
-        # We are only interested in Ethernet interfaces\r
-        pnic_filter = "wcard(epmMacEp.ifId, \"eth\")"\r
-        query_filter = {"query-target-filter":\r
-                        "and({},{})".format(mac_filter, pnic_filter)}\r
-\r
-        pnics = self.fetch_objects_by_class("epmMacEp", query_filter)\r
-\r
-        return [pnic["attributes"] for pnic in pnics]\r
-\r
-    def fetch_switch_by_id(self, switch_id):\r
-        dn = "/".join((switch_id, "sys"))\r
-        response = self.fetch_mo_data(dn)\r
-        # Unwrap switches\r
-        switch_data = self.get_objects_by_field_names(response, "topSystem",\r
-                                                      "attributes")\r
-        return switch_data[0] if switch_data else None\r
-\r
-    @aci_config_required(default=[])\r
-    def get(self, pnic_id):\r
-        environment = self.get_env()\r
-        pnic = self.inv.get_by_id(environment=environment, item_id=pnic_id)\r
-        if not pnic:\r
-            return []\r
-        mac_address = pnic.get("mac_address")\r
-        if not mac_address:\r
-            return []\r
-\r
-        # Query ACI for related switch pnic\r
-        leaf_pnics = self.fetch_pnics_by_mac_address(mac_address)\r
-        if not leaf_pnics:\r
-            return []\r
-        leaf_pnic = leaf_pnics[0]\r
-\r
-        # Prepare and save switch data in inventory\r
-        leaf_id_match = re.match("topology/(.+)/sys", leaf_pnic["dn"])\r
-        if not leaf_id_match:\r
-            raise ValueError("Failed to fetch leaf switch id from pnic dn: {}"\r
-                             .format(leaf_pnic["dn"]))\r
-\r
-        aci_leaf_id = leaf_id_match.group(1)\r
-        leaf_data = self.fetch_switch_by_id(aci_leaf_id)\r
-        if not leaf_data:\r
-            self.log.warning("No switch found for switch pnic dn: {}"\r
-                             .format(leaf_pnic["dn"]))\r
-            return []\r
-\r
-        db_leaf_id = "-".join(("switch", encode_aci_dn(aci_leaf_id),\r
-                               leaf_data["role"]))\r
-        if not self.inv.get_by_id(environment, db_leaf_id):\r
-            leaf_json = {\r
-                "id": db_leaf_id,\r
-                "ip_address": leaf_data["address"],\r
-                "type": "switch",\r
-                "host": db_leaf_id,\r
-                "aci_document": leaf_data\r
-            }\r
-            # Region name is the same as region id\r
-            region_id = get_object_path_part(pnic["name_path"], "Regions")\r
-            region = self.inv.get_by_id(environment, region_id)\r
-            self.inv.save_inventory_object(o=leaf_json, parent=region,\r
-                                           environment=environment)\r
-\r
-        # Prepare pnic json for results list\r
-        db_pnic_id = "-".join((db_leaf_id,\r
-                               encode_aci_dn(leaf_pnic["ifId"]),\r
-                               mac_address))\r
-        pnic_json = {\r
-            "id": db_pnic_id,\r
-            "type": "pnic",\r
-            "role": "hostlink",\r
-            "parent_id": db_leaf_id,\r
-            "parent_type": "switch",\r
-            "pnic_type": "switch",\r
-            "mac_address": mac_address,\r
-            "switch": db_leaf_id,\r
-            "aci_document": leaf_pnic\r
-        }\r
-        return [pnic_json]\r
+###############################################################################
+# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems)   #
+# and others                                                                  #
+#                                                                             #
+# All rights reserved. This program and the accompanying materials            #
+# are made available under the terms of the Apache License, Version 2.0       #
+# which accompanies this distribution, and is available at                    #
+# http://www.apache.org/licenses/LICENSE-2.0                                  #
+###############################################################################
+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
+
+
+# Fetches and adds to database:
+# 1. ACI Switch
+#
+# Returns:
+# 1. ACI Switch pnic that belongs to the ACI Switch (mentioned above)
+# and is connected to Calipso host pnic.
+class AciFetchSwitchPnic(AciAccess):
+
+    def __init__(self):
+        super().__init__()
+        self.inv = InventoryMgr()
+
+    def fetch_pnics_by_mac_address(self, mac_address):
+        mac_filter = "eq(epmMacEp.addr,\"{}\")".format(mac_address)
+        # We are only interested in Ethernet interfaces
+        pnic_filter = "wcard(epmMacEp.ifId, \"eth\")"
+        query_filter = {"query-target-filter":
+                        "and({},{})".format(mac_filter, pnic_filter)}
+
+        pnics = self.fetch_objects_by_class("epmMacEp", query_filter)
+
+        return [pnic["attributes"] for pnic in pnics]
+
+    def fetch_switch_by_id(self, switch_id):
+        dn = "/".join((switch_id, "sys"))
+        response = self.fetch_mo_data(dn)
+        # Unwrap switches
+        switch_data = self.get_objects_by_field_names(response, "topSystem",
+                                                      "attributes")
+        return switch_data[0] if switch_data else None
+
+    @aci_config_required(default=[])
+    def get(self, pnic_id):
+        environment = self.get_env()
+        pnic = self.inv.get_by_id(environment=environment, item_id=pnic_id)
+        if not pnic:
+            return []
+        mac_address = pnic.get("mac_address")
+        if not mac_address:
+            return []
+
+        # Query ACI for related switch pnic
+        leaf_pnics = self.fetch_pnics_by_mac_address(mac_address)
+        if not leaf_pnics:
+            return []
+        leaf_pnic = leaf_pnics[0]
+
+        # Prepare and save switch data in inventory
+        leaf_id_match = re.match("topology/(.+)/sys", leaf_pnic["dn"])
+        if not leaf_id_match:
+            raise ValueError("Failed to fetch leaf switch id from pnic dn: {}"
+                             .format(leaf_pnic["dn"]))
+
+        aci_leaf_id = leaf_id_match.group(1)
+        leaf_data = self.fetch_switch_by_id(aci_leaf_id)
+        if not leaf_data:
+            self.log.warning("No switch found for switch pnic dn: {}"
+                             .format(leaf_pnic["dn"]))
+            return []
+
+        db_leaf_id = "-".join(("switch", encode_aci_dn(aci_leaf_id),
+                               leaf_data["role"]))
+        if not self.inv.get_by_id(environment, db_leaf_id):
+            leaf_json = {
+                "id": db_leaf_id,
+                "ip_address": leaf_data["address"],
+                "type": "switch",
+                "host": db_leaf_id,
+                "aci_document": leaf_data
+            }
+            # Region name is the same as region id
+            region_id = get_object_path_part(pnic["name_path"], "Regions")
+            region = self.inv.get_by_id(environment, region_id)
+            self.inv.save_inventory_object(o=leaf_json, parent=region,
+                                           environment=environment)
+
+        # Prepare pnic json for results list
+        db_pnic_id = "-".join((db_leaf_id,
+                               encode_aci_dn(leaf_pnic["ifId"]),
+                               mac_address))
+        pnic_json = {
+            "id": db_pnic_id,
+            "type": "switch_pnic",
+            "role": "hostlink",
+            "parent_id": db_leaf_id,
+            "parent_type": "switch",
+            "mac_address": mac_address,
+            "switch": db_leaf_id,
+            "aci_document": leaf_pnic
+        }
+        return [pnic_json]
index 86aa693..3516e25 100644 (file)
@@ -71,8 +71,7 @@ class CliFetchHostPnics(CliAccess):
                         "host": host_id,
                         "name": id,
                         "local_name": interface_name,
-                        "lines": [],
-                        "pnic_type": "host"
+                        "lines": []
                     }
                     self.handle_line(interface, line_remainder)
                     if '<UP,' in line:
index 69b6413..d783998 100644 (file)
@@ -37,7 +37,7 @@ class CliFetchHostPnicsVpp(Fetcher):
                 pnic = pnic_ports[pnic_name]
                 pnic['host'] = host_id
                 pnic['id'] = host_id + "-pnic-" + pnic_name
-                pnic['type'] = 'pnic'
+                pnic['type'] = 'host_pnic'
                 pnic['object_name'] = pnic_name
                 pnic['Link detected'] = 'yes' if pnic['state'] == 'up' else 'no'
                 ret.append(pnic)
index 24cc9f8..f2b1db6 100644 (file)
@@ -167,7 +167,7 @@ class DbFetchVedgesOvs(DbAccess, CliAccess, metaclass=Singleton):
         # add port ID to pNIC
         pnic = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
+            "type": "switch_pnic",
             "host": doc["host"],
             "name": interface
         }, get_single=True)
index a9cc149..585dc19 100644 (file)
@@ -16,7 +16,7 @@ class FindLinksForOteps(FindLinks):
 
     def add_links(self):
         self.log.info("adding link types: " +
-                      "vedge-otep, otep-vconnector, otep-pnic")
+                      "vedge-otep, otep-vconnector, otep-host_pnic")
         oteps = self.inv.find_items({
             "environment": self.get_env(),
             "type": "otep"
@@ -68,7 +68,7 @@ class FindLinksForOteps(FindLinks):
     def add_otep_pnic_link(self, otep):
         pnic = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
+            "type": "host_pnic",
             "host": otep["host"],
             "IP Address": otep["ip_address"]
         }, get_single=True)
@@ -78,7 +78,7 @@ class FindLinksForOteps(FindLinks):
         source_id = otep["id"]
         target = pnic["_id"]
         target_id = pnic["id"]
-        link_type = "otep-pnic"
+        link_type = "otep-host_pnic"
         link_name = otep["host"] + "pnic" + pnic["name"]
         state = "up"  # TBD
         link_weight = 0  # TBD
index 268aa55..1372770 100644 (file)
@@ -10,6 +10,7 @@
 import re
 
 from discover.find_links import FindLinks
+from utils.util import decode_aci_dn
 
 
 class FindLinksForPnics(FindLinks):
@@ -19,20 +20,19 @@ class FindLinksForPnics(FindLinks):
     def add_links(self):
         pnics = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
-            "pnic_type": "host"
+            "type": "host_pnic"
         })
-        self.log.info("adding links of type: pnic-network, host-switch")
+        self.log.info("adding links of type: host_pnic-network, "
+                      "host_pnic-switch_pnic")
         for pnic in pnics:
             self.add_pnic_network_links(pnic)
             self.add_host_pnic_to_switch_pnic_link(pnic)
         pnics = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
-            "pnic_type": "switch",
+            "type": "switch_pnic",
             "role": "uplink"
         })
-        self.log.info("adding links of type: switch-switch")
+        self.log.info("adding links of type: switch_pnic-switch_pnic")
         for pnic in pnics:
             self.add_switch_to_switch_link(pnic)
 
@@ -55,13 +55,13 @@ class FindLinksForPnics(FindLinks):
             source_id = pnic["id"]
             target = network["_id"]
             target_id = network["id"]
-            link_type = "pnic-network"
+            link_type = "host_pnic-network"
             link_name = "Segment-" + str(network["provider:segmentation_id"]) \
                 if "provider:segmentation_id" in network \
                 else "Segment-None"
             state = "up" if pnic["Link detected"] == "yes" else "down"
             link_weight = 0  # TBD
-            attributes={"network": target_id}
+            attributes = {"network": target_id}
             if "port_id" in pnic:
                 attributes['source_label'] = "port-" + pnic["port_id"]
             self.create_link(self.get_env(),
@@ -73,8 +73,7 @@ class FindLinksForPnics(FindLinks):
     def add_host_pnic_to_switch_pnic_link(self, host_pnic):
         switch_pnic = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
-            "pnic_type": "switch",
+            "type": "switch_pnic",
             "mac_address": host_pnic["mac_address"]},
             get_single=True)
         if not switch_pnic:
@@ -83,7 +82,7 @@ class FindLinksForPnics(FindLinks):
         source_id = host_pnic["id"]
         target = switch_pnic["_id"]
         target_id = switch_pnic["id"]
-        link_type = "host-switch"
+        link_type = "host_pnic-switch_pnic"
         link_name = "{}-{}".format(host_pnic['host'],
                                    switch_pnic['parent_id'])
         state = "up" if host_pnic["Link detected"] == "yes" else "down"
@@ -102,12 +101,12 @@ class FindLinksForPnics(FindLinks):
         source_id = leaf_pnic["id"]
         target = spine_pnic["_id"]
         target_id = spine_pnic["id"]
-        link_type = "switch-switch"
+        link_type = "switch_pnic-switch_pnic"
         if_id_matches = re.search("(eth.*)$", source_id)
-        link_name = if_id_matches.group(1).replace("__", "/")
+        link_name = decode_aci_dn(if_id_matches.group(1))
         state = "up"  # TBD
         link_weight = 0  # TBD
         self.create_link(self.get_env(),
                          source, source_id, target, target_id,
                          link_type, link_name, state, link_weight,
-                         switch=leaf_pnic['switch'])
\ No newline at end of file
+                         switch=leaf_pnic['switch'])
index 855a491..ab96ebe 100644 (file)
@@ -19,7 +19,8 @@ class FindLinksForVconnectors(FindLinks):
             "environment": self.get_env(),
             "type": "vconnector"
         })
-        self.log.info("adding links of type: vnic-vconnector, vconnector-pnic")
+        self.log.info("adding links of type: vnic-vconnector, "
+                      "vconnector-host_pnic")
         for vconnector in vconnectors:
             for interface in vconnector["interfaces_names"]:
                 self.add_vnic_vconnector_link(vconnector, interface)
@@ -69,7 +70,7 @@ class FindLinksForVconnectors(FindLinks):
         host = vconnector["host"]
         pnic = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
+            "type": "host_pnic",
             "host": vconnector["host"],
             "name": ifname
         }, get_single=True)
@@ -79,7 +80,7 @@ class FindLinksForVconnectors(FindLinks):
         source_id = vconnector["id"]
         target = pnic["_id"]
         target_id = pnic["id"]
-        link_type = "vconnector-pnic"
+        link_type = "vconnector-host_pnic"
         link_name = pnic["name"]
         state = "up"  # TBD
         link_weight = 0  # TBD
index f452d97..acafceb 100644 (file)
@@ -16,7 +16,7 @@ class FindLinksForVedges(FindLinks):
 
     def add_links(self):
         self.log.info("adding link types: " +
-                      "vnic-vedge, vconnector-vedge, vedge-pnic")
+                      "vnic-vedge, vconnector-vedge, vedge-host_pnic")
         vedges = self.inv.find_items({
             "environment": self.get_env(),
             "type": "vedge"
@@ -108,7 +108,7 @@ class FindLinksForVedges(FindLinks):
             pass
         pnic = self.inv.find_items({
             "environment": self.get_env(),
-            "type": "pnic",
+            "type": "host_pnic",
             "host": vedge["host"],
             "name": pname
         }, get_single=True)
@@ -118,7 +118,7 @@ class FindLinksForVedges(FindLinks):
         source_id = vedge["id"]
         target = pnic["_id"]
         target_id = pnic["id"]
-        link_type = "vedge-pnic"
+        link_type = "vedge-host_pnic"
         link_name = "Port-" + port["id"]
         state = "up" if pnic["Link detected"] == "yes" else "down"
         link_weight = 0  # TBD
index 6fdc5a3..c2ba051 100644 (file)
@@ -1,89 +1,89 @@
-[\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "model", \r
-        "mac_address", \r
-        "type", \r
-        "koren"\r
-    ], \r
-    "type" : "vnic"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "connector_type", \r
-        "type", \r
-        "interfaces"\r
-    ], \r
-    "type" : "vconnector"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "host", \r
-        "service_type", \r
-        "type"\r
-    ], \r
-    "type" : "vservice"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "host", \r
-        "agent_type", \r
-        "binary", \r
-        "type"\r
-    ], \r
-    "type" : "vedge"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "host", \r
-        "mac_address", \r
-        "Speed", \r
-        "Link detected", \r
-        "type"\r
-    ], \r
-    "type" : "pnic"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "provider:segmentation_id", \r
-        "provider:network_type", \r
-        "type"\r
-    ], \r
-    "type" : "network"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "host_type", \r
-        "parent_id", \r
-        "type"\r
-    ], \r
-    "type" : "host"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "host", \r
-        "project", \r
-        "type", \r
-        "name_path"\r
-    ], \r
-    "type" : "instance"\r
-},\r
-{ \r
-    "attributes" : [\r
-        "object_name", \r
-        "overlay_type", \r
-        "ip_address", \r
-        "type", \r
-        "ports"\r
-    ], \r
-    "type" : "otep"\r
-}\r
-]\r
+[
+{ 
+    "attributes" : [
+        "object_name", 
+        "model", 
+        "mac_address", 
+        "type", 
+        "koren"
+    ], 
+    "type" : "vnic"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "connector_type", 
+        "type", 
+        "interfaces"
+    ], 
+    "type" : "vconnector"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "host", 
+        "service_type", 
+        "type"
+    ], 
+    "type" : "vservice"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "host", 
+        "agent_type", 
+        "binary", 
+        "type"
+    ], 
+    "type" : "vedge"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "host", 
+        "mac_address", 
+        "Speed", 
+        "Link detected", 
+        "type"
+    ], 
+    "type" : "host_pnic"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "provider:segmentation_id", 
+        "provider:network_type", 
+        "type"
+    ], 
+    "type" : "network"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "host_type", 
+        "parent_id", 
+        "type"
+    ], 
+    "type" : "host"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "host", 
+        "project", 
+        "type", 
+        "name_path"
+    ], 
+    "type" : "instance"
+},
+{ 
+    "attributes" : [
+        "object_name", 
+        "overlay_type", 
+        "ip_address", 
+        "type", 
+        "ports"
+    ], 
+    "type" : "otep"
+}
+]
index a2ef3c2..575d083 100644 (file)
@@ -1,56 +1,56 @@
-[\r
-{ \r
-    "environment" : "ANY", \r
-    "focal_point_type" : "instance", \r
-    "link_types" : [\r
-        "instance-vnic", \r
-        "vnic-vconnector", \r
-        "vconnector-vedge", \r
-        "vedge-otep", \r
-        "otep-vconnector", \r
-        "vconnector-pnic", \r
-        "pnic-network"\r
-    ], \r
-    "name" : "instance"\r
-},\r
-{  \r
-    "environment" : "ANY", \r
-    "focal_point_type" : "pnic", \r
-    "link_types" : [\r
-        "pnic-host", \r
-        "host-network", \r
-        "network-switch_pnic", \r
-        "switch_pnic-switch"\r
-    ], \r
-    "name" : "pnic_clique"\r
-},\r
-{ \r
-    "environment" : "ANY", \r
-    "focal_point_type" : "vservice", \r
-    "link_types" : [\r
-        "vservice-vnic", \r
-        "vnic-vedge", \r
-        "vedge-otep", \r
-        "otep-vconnector", \r
-        "vconnector-pnic", \r
-        "pnic-network"\r
-    ], \r
-    "name" : "vservice"\r
-},\r
-{ \r
-    "environment" : "ANY", \r
-    "focal_point_type" : "network", \r
-    "link_types" : [\r
-        "network-pnic", \r
-        "pnic-vconnector", \r
-        "vconnector-otep", \r
-        "otep-vedge", \r
-        "vedge-vconnector", \r
-        "vedge-vnic", \r
-        "vconnector-vnic", \r
-        "vnic-instance", \r
-        "vnic-vservice"\r
-    ], \r
-    "name" : "network"\r
-}\r
-]\r
+[
+{ 
+    "environment" : "ANY", 
+    "focal_point_type" : "instance", 
+    "link_types" : [
+        "instance-vnic", 
+        "vnic-vconnector", 
+        "vconnector-vedge", 
+        "vedge-otep", 
+        "otep-vconnector", 
+        "vconnector-host_pnic", 
+        "host_pnic-network"
+    ], 
+    "name" : "instance"
+},
+{  
+    "environment" : "ANY", 
+    "focal_point_type" : "host_pnic",
+    "link_types" : [
+        "host_pnic-host", 
+        "host-network", 
+        "network-switch_pnic", 
+        "switch_pnic-switch"
+    ], 
+    "name" : "pnic_clique"
+},
+{ 
+    "environment" : "ANY", 
+    "focal_point_type" : "vservice", 
+    "link_types" : [
+        "vservice-vnic", 
+        "vnic-vedge", 
+        "vedge-otep", 
+        "otep-vconnector", 
+        "vconnector-host_pnic", 
+        "host_pnic-network"
+    ], 
+    "name" : "vservice"
+},
+{ 
+    "environment" : "ANY", 
+    "focal_point_type" : "network", 
+    "link_types" : [
+        "network-host_pnic", 
+        "host_pnic-vconnector", 
+        "vconnector-otep", 
+        "otep-vedge", 
+        "vedge-vconnector", 
+        "vedge-vnic", 
+        "vconnector-vnic", 
+        "vnic-instance", 
+        "vnic-vservice"
+    ], 
+    "name" : "network"
+}
+]
index c3d59a4..a30ffa9 100644 (file)
-[\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "network", \r
-            "value" : "network"\r
-        }\r
-    ], \r
-    "name" : "constraints"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "Development", \r
-            "value" : "development"\r
-        }, \r
-        {\r
-            "label" : "Testing", \r
-            "value" : "testing"\r
-        }, \r
-        {\r
-            "label" : "Staging", \r
-            "value" : "staging"\r
-        }, \r
-        {\r
-            "label" : "Production", \r
-            "value" : "production"\r
-        }\r
-    ], \r
-    "name" : "env_types"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "CRITICAL", \r
-            "value" : "critical"\r
-        }, \r
-        {\r
-            "label" : "ERROR", \r
-            "value" : "error"\r
-        }, \r
-        {\r
-            "label" : "WARNING", \r
-            "value" : "warning"\r
-        }, \r
-        {\r
-            "label" : "INFO", \r
-            "value" : "info"\r
-        }, \r
-        {\r
-            "label" : "DEBUG", \r
-            "value" : "debug"\r
-        }, \r
-        {\r
-            "label" : "NOTSET", \r
-            "value" : "notset"\r
-        }\r
-    ], \r
-    "name" : "log_levels"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "OVS", \r
-            "value" : "OVS"\r
-        }, \r
-        {\r
-            "label" : "VPP", \r
-            "value" : "VPP"\r
-        }, \r
-        {\r
-            "label" : "LXB", \r
-            "value" : "LXB"\r
-        }, \r
-        {\r
-            "label" : "Arista", \r
-            "value" : "Arista"\r
-        }, \r
-        {\r
-            "label" : "Nexus", \r
-            "value" : "Nexus"\r
-        }\r
-    ], \r
-    "name" : "mechanism_drivers"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "local", \r
-            "value" : "local"\r
-        }, \r
-        {\r
-            "label" : "vlan", \r
-            "value" : "vlan"\r
-        }, \r
-        {\r
-            "label" : "vxlan", \r
-            "value" : "vxlan"\r
-        }, \r
-        {\r
-            "label" : "gre", \r
-            "value" : "gre"\r
-        }, \r
-        {\r
-            "label" : "flat", \r
-            "value" : "flat"\r
-        }\r
-    ], \r
-    "name" : "type_drivers"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "Sensu", \r
-            "value" : "Sensu"\r
-        }\r
-    ], \r
-    "name" : "environment_monitoring_types"\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "up", \r
-            "value" : "up"\r
-        }, \r
-        {\r
-            "label" : "down", \r
-            "value" : "down"\r
-        }\r
-    ], \r
-    "name" : "link_states"\r
-},\r
-{ \r
-    "name" : "environment_provision_types", \r
-    "data" : [\r
-        {\r
-            "label" : "None", \r
-            "value" : "None"\r
-        }, \r
-        {\r
-            "label" : "Deploy", \r
-            "value" : "Deploy"\r
-        }, \r
-        {\r
-            "label" : "Files", \r
-            "value" : "Files"\r
-        }, \r
-        {\r
-            "label" : "DB", \r
-            "value" : "DB"\r
-        }\r
-    ]\r
-},\r
-{ \r
-    "name" : "environment_operational_status", \r
-    "data" : [\r
-        {\r
-            "value" : "stopped", \r
-            "label" : "stopped"\r
-        }, \r
-        {\r
-            "value" : "running", \r
-            "label" : "running"\r
-        }, \r
-        {\r
-            "value" : "error", \r
-            "label" : "error"\r
-        }\r
-    ]\r
-},\r
-{\r
-    "name" : "link_types",\r
-    "data" : [\r
-        {\r
-            "value" : "instance-vnic", \r
-            "label" : "instance-vnic"\r
-        }, \r
-       {\r
-            "value" : "vnic-instance", \r
-            "label" : "vnic-instance"\r
-        },\r
-        {\r
-            "value" : "vnic-vconnector", \r
-            "label" : "vnic-vconnector"\r
-        },\r
-       {\r
-            "value" : "vconnector-vnic", \r
-            "label" : "vconnector-vnic"\r
-        },\r
-       {\r
-            "value" : "vconnector-vedge", \r
-            "label" : "vconnector-vedge"\r
-        },\r
-       {\r
-            "value" : "vedge-vconnector", \r
-            "label" : "vedge-vconnector"\r
-        },\r
-       {\r
-            "value" : "vedge-host_pnic", \r
-            "label" : "vedge-host_pnic"\r
-        },\r
-       {\r
-            "value" : "host_pnic-vedge", \r
-            "label" : "host_pnic-vedge"\r
-        },\r
-       {\r
-            "value" : "host_pnic-network", \r
-            "label" : "host_pnic-network"\r
-        },\r
-       {\r
-            "value" : "network-host_pnic", \r
-            "label" : "network-host_pnic"\r
-        },\r
-       {\r
-            "value" : "vedge-otep", \r
-            "label" : "vedge-otep"\r
-        },\r
-       {\r
-            "value" : "otep-vedge", \r
-            "label" : "otep-vedge"\r
-        },\r
-       {\r
-            "value" : "otep-vconnector", \r
-            "label" : "otep-vconnector"\r
-        },\r
-       {\r
-            "value" : "vconnector-otep", \r
-            "label" : "vconnector-otep"\r
-        },\r
-        {\r
-            "value" : "otep-host_pnic", \r
-            "label" : "otep-host_pnic"\r
-        },\r
-       {\r
-            "value" : "host_pnic-otep", \r
-            "label" : "host_pnic-otep"\r
-        },\r
-        {\r
-            "value" : "vconnector-host_pnic", \r
-            "label" : "vconnector-host_pnic"\r
-        },\r
-       {\r
-            "value" : "host_pnic-vconnector", \r
-            "label" : "host_pnic-vconnector"\r
-        },\r
-        {\r
-            "value" : "vnic-vedge", \r
-            "label" : "vnic-vedge"\r
-        },\r
-       {\r
-            "value" : "vedge-vnic", \r
-            "label" : "vedge-vnic"\r
-        },\r
-        {\r
-            "value" : "vservice-vnic", \r
-            "label" : "vservice-vnic"\r
-        },\r
-       {\r
-            "value" : "vnic-vservice", \r
-            "label" : "vnic-vservice"\r
-        },\r
-        {\r
-            "value" : "switch_pnic-host_pnic", \r
-            "label" : "switch_pnic-host_pnic"\r
-        },\r
-        {\r
-            "value" : "host_pnic-switch_pnic",\r
-            "label" : "host_pnic-switch_pnic"\r
-        }, \r
-        {\r
-            "value" : "switch_pnic-switch_pnic", \r
-            "label" : "switch_pnic-switch_pnic"\r
-        }\r
-    ] \r
-},\r
-{ \r
-    "name" : "monitoring_sides", \r
-    "data" : [\r
-        {\r
-            "label" : "client", \r
-            "value" : "client"\r
-        }, \r
-        {\r
-            "label" : "server", \r
-            "value" : "server"\r
-        }\r
-    ]\r
-},\r
-{ \r
-    "name" : "messages_severity", \r
-    "data" : [\r
-        {\r
-            "label" : "panic", \r
-            "value" : "panic"\r
-        }, \r
-        {\r
-            "label" : "alert", \r
-            "value" : "alert"\r
-        }, \r
-        {\r
-            "label" : "crit", \r
-            "value" : "crit"\r
-        }, \r
-        {\r
-            "label" : "error", \r
-            "value" : "error"\r
-        }, \r
-        {\r
-            "label" : "warn", \r
-            "value" : "warn"\r
-        }, \r
-        {\r
-            "label" : "notice", \r
-            "value" : "notice"\r
-        }, \r
-        {\r
-            "label" : "info", \r
-            "value" : "info"\r
-        }, \r
-        {\r
-            "label" : "debug", \r
-            "value" : "debug"\r
-        }\r
-    ]\r
-},\r
-{ \r
-    "name" : "object_types", \r
-    "data" : [\r
-        {\r
-            "label" : "vnic", \r
-            "value" : "vnic"\r
-        }, \r
-        {\r
-            "label" : "vconnector", \r
-            "value" : "vconnector"\r
-        }, \r
-        {\r
-            "label" : "vedge", \r
-            "value" : "vedge"\r
-        }, \r
-        {\r
-            "label" : "instance", \r
-            "value" : "instance"\r
-        }, \r
-        {\r
-            "label" : "vservice", \r
-            "value" : "vservice"\r
-        }, \r
-        {\r
-            "label" : "pnic", \r
-            "value" : "pnic"\r
-        },\r
-        {\r
-            "label" : "switch_pnic",\r
-            "value" : "switch_pnic"\r
-        },\r
-        {\r
-            "label" : "host_pnic",\r
-            "value" : "host_pnic"\r
-        },\r
-        {\r
-            "label" : "switch",\r
-            "value" : "switch"\r
-        }, \r
-        {\r
-            "label" : "network", \r
-            "value" : "network"\r
-        }, \r
-        {\r
-            "label" : "port", \r
-            "value" : "port"\r
-        }, \r
-        {\r
-            "label" : "otep", \r
-            "value" : "otep"\r
-        }, \r
-        {\r
-            "label" : "agent", \r
-            "value" : "agent"\r
-        }, \r
-        {\r
-            "label" : "host", \r
-            "value" : "host"\r
-        } \r
-    ]\r
-},\r
-{ \r
-    "name" : "scans_statuses", \r
-    "data" : [\r
-        {\r
-            "value" : "draft", \r
-            "label" : "Draft"\r
-        }, \r
-        {\r
-            "value" : "pending", \r
-            "label" : "Pending"\r
-        }, \r
-        {\r
-            "value" : "running", \r
-            "label" : "Running"\r
-        }, \r
-        {\r
-            "value" : "completed", \r
-            "label" : "Completed"\r
-        }, \r
-        {\r
-            "value" : "failed", \r
-            "label" : "Failed"\r
-        }, \r
-        {\r
-            "value" : "aborted", \r
-            "label" : "Aborted"\r
-        }\r
-    ]\r
-},\r
-{ \r
-    "data" : [\r
-        {\r
-            "label" : "Mirantis-6.0", \r
-            "value" : "Mirantis-6.0"\r
-        }, \r
-        {\r
-            "label" : "Mirantis-7.0", \r
-            "value" : "Mirantis-7.0"\r
-        }, \r
-        {\r
-            "label" : "Mirantis-8.0", \r
-            "value" : "Mirantis-8.0"\r
-        }, \r
-        {\r
-            "label" : "Mirantis-9.0", \r
-            "value" : "Mirantis-9.0"\r
-        }, \r
-        {\r
-            "label" : "RDO-Mitaka", \r
-            "value" : "RDO-Mitaka"\r
-        }, \r
-        {\r
-            "label" : "RDO-Liberty", \r
-            "value" : "RDO-Liberty"\r
-        }, \r
-        {\r
-            "label" : "RDO-Juno", \r
-            "value" : "RDO-Juno"\r
-        }, \r
-        {\r
-            "label" : "RDO-kilo", \r
-            "value" : "RDO-kilo"\r
-        }, \r
-        {\r
-            "label" : "devstack-liberty", \r
-            "value" : "devstack-liberty"\r
-        }, \r
-        {\r
-            "label" : "Canonical-icehouse", \r
-            "value" : "Canonical-icehouse"\r
-        }, \r
-        {\r
-            "label" : "Canonical-juno", \r
-            "value" : "Canonical-juno"\r
-        }, \r
-        {\r
-            "label" : "Canonical-liberty", \r
-            "value" : "Canonical-liberty"\r
-        }, \r
-        {\r
-            "label" : "Canonical-mitaka", \r
-            "value" : "Canonical-mitaka"\r
-        }, \r
-        {\r
-            "label" : "Apex-Mitaka", \r
-            "value" : "Apex-Mitaka"\r
-        }, \r
-        {\r
-            "label" : "Devstack-Mitaka", \r
-            "value" : "Devstack-Mitaka"\r
-        }, \r
-        {\r
-            "label" : "packstack-7.0.0-0.10.dev1682", \r
-            "value" : "packstack-7.0.0-0.10.dev1682"\r
-        }, \r
-        {\r
-            "label" : "Stratoscale-v2.1.6", \r
-            "value" : "Stratoscale-v2.1.6"\r
-        }, \r
-        {\r
-            "label" : "Mirantis-9.1", \r
-            "value" : "Mirantis-9.1"\r
-        }\r
-    ], \r
-    "name" : "distributions"\r
-},\r
-{  \r
-    "name" : "message_source_systems", \r
-    "data" : [\r
-        {\r
-            "value" : "OpenStack", \r
-            "label" : "OpenStack"\r
-        }, \r
-        {\r
-            "value" : "Calipso", \r
-            "label" : "Calipso"\r
-        }, \r
-        {\r
-            "value" : "Sensu", \r
-            "label" : "Sensu"\r
-        }\r
-    ]\r
-},\r
-{ \r
-    "name" : "object_types_for_links",\r
-    "data" : [\r
-        {\r
-            "label" : "vnic", \r
-            "value" : "vnic"\r
-        }, \r
-        {\r
-            "label" : "vconnector", \r
-            "value" : "vconnector"\r
-        }, \r
-        {\r
-            "label" : "vedge", \r
-            "value" : "vedge"\r
-        }, \r
-        {\r
-            "label" : "instance", \r
-            "value" : "instance"\r
-        }, \r
-        {\r
-            "label" : "vservice", \r
-            "value" : "vservice"\r
-        }, \r
-        {\r
-            "label" : "pnic", \r
-            "value" : "pnic"\r
-        }, \r
-        {\r
-            "label" : "switch_pnic", \r
-            "value" : "switch_pnic"\r
-        }, \r
-        {\r
-            "label" : "host_pnic", \r
-            "value" : "host_pnic"\r
-        }, \r
-        {\r
-            "label" : "switch", \r
-            "value" : "switch"\r
-        }, \r
-        {\r
-            "label" : "network", \r
-            "value" : "network"\r
-        }, \r
-        {\r
-            "label" : "port", \r
-            "value" : "port"\r
-        }, \r
-        {\r
-            "label" : "otep", \r
-            "value" : "otep"\r
-        }, \r
-        {\r
-            "label" : "agent", \r
-            "value" : "agent"\r
-        }, \r
-        {\r
-            "label" : "host", \r
-            "value" : "host"\r
-        }\r
-    ] \r
-},\r
-{ \r
-    "name" : "scan_object_types", \r
-    "data" : [\r
-        {\r
-            "label" : "vnic", \r
-            "value" : "vnic"\r
-        }, \r
-        {\r
-            "label" : "vconnector", \r
-            "value" : "vconnector"\r
-        }, \r
-        {\r
-            "label" : "vedge", \r
-            "value" : "vedge"\r
-        }, \r
-        {\r
-            "label" : "instance", \r
-            "value" : "instance"\r
-        }, \r
-        {\r
-            "label" : "vservice", \r
-            "value" : "vservice"\r
-        }, \r
-        {\r
-            "label" : "pnic", \r
-            "value" : "pnic"\r
-        }, \r
-        {\r
-            "label" : "network", \r
-            "value" : "network"\r
-        }, \r
-        {\r
-            "label" : "port", \r
-            "value" : "port"\r
-        }, \r
-        {\r
-            "label" : "otep", \r
-            "value" : "otep"\r
-        }, \r
-        {\r
-            "label" : "agent", \r
-            "value" : "agent"\r
-        }, \r
-        {\r
-            "value" : "availability_zone", \r
-            "label" : "availability_zone"\r
-        }, \r
-        {\r
-            "value" : "regions_folder", \r
-            "label" : "regions_folder"\r
-        }, \r
-        {\r
-            "value" : "instances_folder", \r
-            "label" : "instances_folder"\r
-        }, \r
-        {\r
-            "value" : "pnics_folder", \r
-            "label" : "pnics_folder"\r
-        }, \r
-        {\r
-            "value" : "vconnectors_folder", \r
-            "label" : "vconnectors_folder"\r
-        }, \r
-        {\r
-            "value" : "vedges_folder", \r
-            "label" : "vedges_folder"\r
-        }, \r
-        {\r
-            "value" : "ports_folder", \r
-            "label" : "ports_folder"\r
-        }, \r
-        {\r
-            "value" : "aggregates_folder", \r
-            "label" : "aggregates_folder"\r
-        }, \r
-        {\r
-            "value" : "vservices_folder", \r
-            "label" : "vservices_folder"\r
-        }, \r
-        {\r
-            "value" : "vnics_folder", \r
-            "label" : "vnics_folder"\r
-        }, \r
-        {\r
-            "value" : "network_agent", \r
-            "label" : "network_agent"\r
-        }, \r
-        {\r
-            "value" : "project", \r
-            "label" : "project"\r
-        }, \r
-        {\r
-            "value" : "projects_folder", \r
-            "label" : "projects_folder"\r
-        }, \r
-        {\r
-            "value" : "aggregate", \r
-            "label" : "aggregate"\r
-        }, \r
-        {\r
-            "value" : "network_agents_folder", \r
-            "label" : "network_agents_folder"\r
-        }, \r
-        {\r
-            "value" : "host", \r
-            "label" : "host"\r
-        }, \r
-        {\r
-            "value" : "region", \r
-            "label" : "region"\r
-        }, \r
-        {\r
-            "value" : "host_ref", \r
-            "label" : "host_ref"\r
-        }, \r
-        {\r
-            "value" : "network_services_folder", \r
-            "label" : "network_services_folder"\r
-        }, \r
-        {\r
-            "label" : "switch_pnic", \r
-            "value" : "switch_pnic"\r
-        }, \r
-        {\r
-            "label" : "switch", \r
-            "value" : "switch"\r
-        }\r
-    ]\r
-}\r
-]\r
+[
+{ 
+    "data" : [
+        {
+            "label" : "network", 
+            "value" : "network"
+        }
+    ], 
+    "name" : "constraints"
+},
+{ 
+    "data" : [
+        {
+            "label" : "Development", 
+            "value" : "development"
+        }, 
+        {
+            "label" : "Testing", 
+            "value" : "testing"
+        }, 
+        {
+            "label" : "Staging", 
+            "value" : "staging"
+        }, 
+        {
+            "label" : "Production", 
+            "value" : "production"
+        }
+    ], 
+    "name" : "env_types"
+},
+{ 
+    "data" : [
+        {
+            "label" : "CRITICAL", 
+            "value" : "critical"
+        }, 
+        {
+            "label" : "ERROR", 
+            "value" : "error"
+        }, 
+        {
+            "label" : "WARNING", 
+            "value" : "warning"
+        }, 
+        {
+            "label" : "INFO", 
+            "value" : "info"
+        }, 
+        {
+            "label" : "DEBUG", 
+            "value" : "debug"
+        }, 
+        {
+            "label" : "NOTSET", 
+            "value" : "notset"
+        }
+    ], 
+    "name" : "log_levels"
+},
+{ 
+    "data" : [
+        {
+            "label" : "OVS", 
+            "value" : "OVS"
+        }, 
+        {
+            "label" : "VPP", 
+            "value" : "VPP"
+        }, 
+        {
+            "label" : "LXB", 
+            "value" : "LXB"
+        }, 
+        {
+            "label" : "Arista", 
+            "value" : "Arista"
+        }, 
+        {
+            "label" : "Nexus", 
+            "value" : "Nexus"
+        }
+    ], 
+    "name" : "mechanism_drivers"
+},
+{ 
+    "data" : [
+        {
+            "label" : "local", 
+            "value" : "local"
+        }, 
+        {
+            "label" : "vlan", 
+            "value" : "vlan"
+        }, 
+        {
+            "label" : "vxlan", 
+            "value" : "vxlan"
+        }, 
+        {
+            "label" : "gre", 
+            "value" : "gre"
+        }, 
+        {
+            "label" : "flat", 
+            "value" : "flat"
+        }
+    ], 
+    "name" : "type_drivers"
+},
+{ 
+    "data" : [
+        {
+            "label" : "Sensu", 
+            "value" : "Sensu"
+        }
+    ], 
+    "name" : "environment_monitoring_types"
+},
+{ 
+    "data" : [
+        {
+            "label" : "up", 
+            "value" : "up"
+        }, 
+        {
+            "label" : "down", 
+            "value" : "down"
+        }
+    ], 
+    "name" : "link_states"
+},
+{ 
+    "name" : "environment_provision_types", 
+    "data" : [
+        {
+            "label" : "None", 
+            "value" : "None"
+        }, 
+        {
+            "label" : "Deploy", 
+            "value" : "Deploy"
+        }, 
+        {
+            "label" : "Files", 
+            "value" : "Files"
+        }, 
+        {
+            "label" : "DB", 
+            "value" : "DB"
+        }
+    ]
+},
+{ 
+    "name" : "environment_operational_status", 
+    "data" : [
+        {
+            "value" : "stopped", 
+            "label" : "stopped"
+        }, 
+        {
+            "value" : "running", 
+            "label" : "running"
+        }, 
+        {
+            "value" : "error", 
+            "label" : "error"
+        }
+    ]
+},
+{ 
+    "name" : "link_types", 
+    "data" : [
+        {
+            "label" : "instance-vnic", 
+            "value" : "instance-vnic"
+        }, 
+        {
+            "label" : "otep-vconnector", 
+            "value" : "otep-vconnector"
+        }, 
+        {
+            "label" : "otep-host_pnic", 
+            "value" : "otep-host_pnic"
+        }, 
+        {
+            "label" : "host_pnic-network", 
+            "value" : "host_pnic-network"
+        }, 
+        {
+            "label" : "vedge-otep", 
+            "value" : "vedge-otep"
+        }, 
+        {
+            "label" : "vnic-vconnector", 
+            "value" : "vnic-vconnector"
+        }, 
+        {
+            "label" : "vconnector-host_pnic", 
+            "value" : "vconnector-host_pnic"
+        }, 
+        {
+            "label" : "vnic-vedge", 
+            "value" : "vnic-vedge"
+        }, 
+        {
+            "label" : "vconnector-vedge", 
+            "value" : "vconnector-vedge"
+        }, 
+        {
+            "label" : "vedge-host_pnic", 
+            "value" : "vedge-host_pnic"
+        }, 
+        {
+            "label" : "vservice-vnic", 
+            "value" : "vservice-vnic"
+        }, 
+        {
+            "label" : "host_pnic-host", 
+            "value" : "host_pnic-host"
+        }, 
+        {
+            "label" : "host-host_pnic", 
+            "value" : "host-host_pnic"
+        }, 
+        {
+            "label" : "host-network", 
+            "value" : "host-network"
+        }, 
+        {
+            "label" : "network-host", 
+            "value" : "network-host"
+        }, 
+        {
+            "label" : "switch_pnic-network", 
+            "value" : "switch_pnic-network"
+        }, 
+        {
+            "label" : "network-switch_pnic", 
+            "value" : "network-switch_pnic"
+        }, 
+        {
+            "label" : "switch_pnic-switch", 
+            "value" : "switch_pnic-switch"
+        }, 
+        {
+            "label" : "switch-switch_pnic", 
+            "value" : "switch-switch_pnic"
+        }
+    ]
+},
+{ 
+    "name" : "monitoring_sides", 
+    "data" : [
+        {
+            "label" : "client", 
+            "value" : "client"
+        }, 
+        {
+            "label" : "server", 
+            "value" : "server"
+        }
+    ]
+},
+{ 
+    "name" : "messages_severity", 
+    "data" : [
+        {
+            "label" : "panic", 
+            "value" : "panic"
+        }, 
+        {
+            "label" : "alert", 
+            "value" : "alert"
+        }, 
+        {
+            "label" : "crit", 
+            "value" : "crit"
+        }, 
+        {
+            "label" : "error", 
+            "value" : "error"
+        }, 
+        {
+            "label" : "warn", 
+            "value" : "warn"
+        }, 
+        {
+            "label" : "notice", 
+            "value" : "notice"
+        }, 
+        {
+            "label" : "info", 
+            "value" : "info"
+        }, 
+        {
+            "label" : "debug", 
+            "value" : "debug"
+        }
+    ]
+},
+{ 
+    "name" : "object_types", 
+    "data" : [
+        {
+            "label" : "vnic", 
+            "value" : "vnic"
+        }, 
+        {
+            "label" : "vconnector", 
+            "value" : "vconnector"
+        }, 
+        {
+            "label" : "vedge", 
+            "value" : "vedge"
+        }, 
+        {
+            "label" : "instance", 
+            "value" : "instance"
+        }, 
+        {
+            "label" : "vservice", 
+            "value" : "vservice"
+        },
+        {
+            "label" : "host_pnic",
+            "value" : "host_pnic"
+        },
+        {
+            "label" : "network", 
+            "value" : "network"
+        }, 
+        {
+            "label" : "port", 
+            "value" : "port"
+        }, 
+        {
+            "label" : "otep", 
+            "value" : "otep"
+        }, 
+        {
+            "label" : "agent", 
+            "value" : "agent"
+        }, 
+        {
+            "label" : "host", 
+            "value" : "host"
+        }, 
+        {
+            "label" : "switch_pnic", 
+            "value" : "switch_pnic"
+        }, 
+        {
+            "label" : "switch", 
+            "value" : "switch"
+        }
+    ]
+},
+{ 
+    "name" : "scans_statuses", 
+    "data" : [
+        {
+            "value" : "draft", 
+            "label" : "Draft"
+        }, 
+        {
+            "value" : "pending", 
+            "label" : "Pending"
+        }, 
+        {
+            "value" : "running", 
+            "label" : "Running"
+        }, 
+        {
+            "value" : "completed", 
+            "label" : "Completed"
+        }, 
+        {
+            "value" : "failed", 
+            "label" : "Failed"
+        }, 
+        {
+            "value" : "aborted", 
+            "label" : "Aborted"
+        }
+    ]
+},
+{ 
+    "data" : [
+        {
+            "label" : "Mirantis-6.0", 
+            "value" : "Mirantis-6.0"
+        }, 
+        {
+            "label" : "Mirantis-7.0", 
+            "value" : "Mirantis-7.0"
+        }, 
+        {
+            "label" : "Mirantis-8.0", 
+            "value" : "Mirantis-8.0"
+        }, 
+        {
+            "label" : "Mirantis-9.0", 
+            "value" : "Mirantis-9.0"
+        }, 
+        {
+            "label" : "RDO-Mitaka", 
+            "value" : "RDO-Mitaka"
+        }, 
+        {
+            "label" : "RDO-Liberty", 
+            "value" : "RDO-Liberty"
+        }, 
+        {
+            "label" : "RDO-Juno", 
+            "value" : "RDO-Juno"
+        }, 
+        {
+            "label" : "RDO-kilo", 
+            "value" : "RDO-kilo"
+        }, 
+        {
+            "label" : "devstack-liberty", 
+            "value" : "devstack-liberty"
+        }, 
+        {
+            "label" : "Canonical-icehouse", 
+            "value" : "Canonical-icehouse"
+        }, 
+        {
+            "label" : "Canonical-juno", 
+            "value" : "Canonical-juno"
+        }, 
+        {
+            "label" : "Canonical-liberty", 
+            "value" : "Canonical-liberty"
+        }, 
+        {
+            "label" : "Canonical-mitaka", 
+            "value" : "Canonical-mitaka"
+        }, 
+        {
+            "label" : "Apex-Mitaka", 
+            "value" : "Apex-Mitaka"
+        }, 
+        {
+            "label" : "Devstack-Mitaka", 
+            "value" : "Devstack-Mitaka"
+        }, 
+        {
+            "label" : "packstack-7.0.0-0.10.dev1682", 
+            "value" : "packstack-7.0.0-0.10.dev1682"
+        }, 
+        {
+            "label" : "Stratoscale-v2.1.6", 
+            "value" : "Stratoscale-v2.1.6"
+        }, 
+        {
+            "label" : "Mirantis-9.1", 
+            "value" : "Mirantis-9.1"
+        }
+    ], 
+    "name" : "distributions"
+},
+{  
+    "name" : "message_source_systems", 
+    "data" : [
+        {
+            "value" : "OpenStack", 
+            "label" : "OpenStack"
+        }, 
+        {
+            "value" : "Calipso", 
+            "label" : "Calipso"
+        }, 
+        {
+            "value" : "Sensu", 
+            "label" : "Sensu"
+        }
+    ]
+},
+{ 
+    "name" : "object_types_for_links", 
+    "data" : [
+        {
+            "label" : "vnic", 
+            "value" : "vnic"
+        }, 
+        {
+            "label" : "vconnector", 
+            "value" : "vconnector"
+        }, 
+        {
+            "label" : "vedge", 
+            "value" : "vedge"
+        }, 
+        {
+            "label" : "instance", 
+            "value" : "instance"
+        }, 
+        {
+            "label" : "vservice", 
+            "value" : "vservice"
+        }, 
+        {
+            "label" : "switch_pnic",
+            "value" : "switch_pnic"
+        },
+        {
+            "label" : "network", 
+            "value" : "network"
+        }, 
+        {
+            "label" : "port", 
+            "value" : "port"
+        }, 
+        {
+            "label" : "otep", 
+            "value" : "otep"
+        }, 
+        {
+            "label" : "agent", 
+            "value" : "agent"
+        }, 
+        {
+            "label" : "host", 
+            "value" : "host"
+        }, 
+        {
+            "label" : "switch_pnic", 
+            "value" : "switch_pnic"
+        }, 
+        {
+            "label" : "switch", 
+            "value" : "switch"
+        }
+    ]
+},
+{ 
+    "name" : "scan_object_types", 
+    "data" : [
+        {
+            "label" : "vnic", 
+            "value" : "vnic"
+        }, 
+        {
+            "label" : "vconnector", 
+            "value" : "vconnector"
+        }, 
+        {
+            "label" : "vedge", 
+            "value" : "vedge"
+        }, 
+        {
+            "label" : "instance", 
+            "value" : "instance"
+        }, 
+        {
+            "label" : "vservice", 
+            "value" : "vservice"
+        },
+        {
+            "label" : "host_pnic",
+            "value" : "host_pnic"
+        },
+        {
+            "label" : "network", 
+            "value" : "network"
+        }, 
+        {
+            "label" : "port", 
+            "value" : "port"
+        }, 
+        {
+            "label" : "otep", 
+            "value" : "otep"
+        }, 
+        {
+            "label" : "agent", 
+            "value" : "agent"
+        }, 
+        {
+            "value" : "availability_zone", 
+            "label" : "availability_zone"
+        }, 
+        {
+            "value" : "regions_folder", 
+            "label" : "regions_folder"
+        }, 
+        {
+            "value" : "instances_folder", 
+            "label" : "instances_folder"
+        }, 
+        {
+            "value" : "pnics_folder", 
+            "label" : "pnics_folder"
+        }, 
+        {
+            "value" : "vconnectors_folder", 
+            "label" : "vconnectors_folder"
+        }, 
+        {
+            "value" : "vedges_folder", 
+            "label" : "vedges_folder"
+        }, 
+        {
+            "value" : "ports_folder", 
+            "label" : "ports_folder"
+        }, 
+        {
+            "value" : "aggregates_folder", 
+            "label" : "aggregates_folder"
+        }, 
+        {
+            "value" : "vservices_folder", 
+            "label" : "vservices_folder"
+        }, 
+        {
+            "value" : "vnics_folder", 
+            "label" : "vnics_folder"
+        }, 
+        {
+            "value" : "network_agent", 
+            "label" : "network_agent"
+        }, 
+        {
+            "value" : "project", 
+            "label" : "project"
+        }, 
+        {
+            "value" : "projects_folder", 
+            "label" : "projects_folder"
+        }, 
+        {
+            "value" : "aggregate", 
+            "label" : "aggregate"
+        }, 
+        {
+            "value" : "network_agents_folder", 
+            "label" : "network_agents_folder"
+        }, 
+        {
+            "value" : "host", 
+            "label" : "host"
+        }, 
+        {
+            "value" : "region", 
+            "label" : "region"
+        }, 
+        {
+            "value" : "host_ref", 
+            "label" : "host_ref"
+        }, 
+        {
+            "value" : "network_services_folder", 
+            "label" : "network_services_folder"
+        }, 
+        {
+            "label" : "switch_pnic", 
+            "value" : "switch_pnic"
+        }, 
+        {
+            "label" : "switch", 
+            "value" : "switch"
+        }
+    ]
+}
+]
index e1b98ec..61c21f2 100644 (file)
 [
 { 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "instance-vnic", 
     "endPointA" : "instance", 
     "endPointB" : "vnic", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "instance-vnic", 
-    "description" : "instance-vnic"
-},
-{  
-    "endPointA" : "vnic", 
-    "endPointB" : "instance", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vnic-instance", 
-    "description" : "vnic-instance"
+    "type" : "instance-vnic"
 },
 { 
-    "endPointA" : "vconnector", 
-    "endPointB" : "vnic", 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vconnector-vnic", 
-    "description" : "vconnector-vnic"
-},
-{  
+    "description" : "vnic-vconnector", 
     "endPointA" : "vnic", 
     "endPointB" : "vconnector", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vnic-vconnector", 
-    "description" : "vnic-vconnector"
+    "type" : "vnic-vconnector"
 },
-{  
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "vconnector-vedge", 
     "endPointA" : "vconnector", 
     "endPointB" : "vedge", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vconnector-vedge", 
-    "description" : "vconnector-vedge"
+    "type" : "vconnector-vedge"
 },
-{  
-    "endPointA" : "vedge", 
-    "endPointB" : "vconnector", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vedge-vconnector", 
-    "description" : "vedge-vconnector"
-},
-{  
+    "description" : "vedge-otep", 
     "endPointA" : "vedge", 
     "endPointB" : "otep", 
+    "type" : "vedge-otep"
+},
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vedge-otep", 
-    "description" : "vedge-otep"
+    "description" : "vconnector-host_pnic", 
+    "endPointA" : "vconnector", 
+    "endPointB" : "host_pnic", 
+    "type" : "vconnector-host_pnic"
 },
-{  
-    "endPointA" : "otep", 
-    "endPointB" : "vedge", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "otep-vedge", 
-    "description" : "otep-vedge"
+    "description" : "host_pnic-network", 
+    "endPointA" : "host_pnic", 
+    "endPointB" : "network", 
+    "type" : "host_pnic-network"
 },
-{  
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "otep-vconnector", 
     "endPointA" : "otep", 
     "endPointB" : "vconnector", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "otep-vconnector", 
-    "description" : "otep-vconnector"
+    "type" : "otep-vconnector"
 },
-{  
-    "endPointA" : "vconnector", 
-    "endPointB" : "otep", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vconnector-otep", 
-    "description" : "vconnector-otep"
-},
-{  
+    "description" : "vnic-vedge", 
     "endPointA" : "vnic", 
     "endPointB" : "vedge", 
+    "type" : "vnic-vedge"
+},
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vnic-vedge", 
-    "description" : "vnic-vedge"
+    "description" : "network-host_pnic", 
+    "endPointA" : "network", 
+    "endPointB" : "host_pnic", 
+    "type" : "network-host_pnic"
 },
-{  
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "vedge-vconnector", 
     "endPointA" : "vedge", 
+    "endPointB" : "vconnector", 
+    "type" : "vedge-vconnector"
+},
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "vconnector-vnic", 
+    "endPointA" : "vconnector", 
     "endPointB" : "vnic", 
+    "type" : "vconnector-vnic"
+},
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vedge-vnic", 
-    "description" : "vedge-vnic"
+    "description" : "vnic-instance", 
+    "endPointA" : "vnic", 
+    "endPointB" : "instance", 
+    "type" : "vnic-instance"
 },
-{  
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "vnic-vservice", 
     "endPointA" : "vnic", 
     "endPointB" : "vservice", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vnic-vservice", 
-    "description" : "vnic-vservice"
+    "type" : "vnic-vservice"
 },
 { 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "vservice-vnic", 
     "endPointA" : "vservice", 
     "endPointB" : "vnic", 
-    "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vservice-vnic", 
-    "description" : "vservice-vnic"
+    "type" : "vservice-vnic"
 },
-{  
-    "endPointA" : "vconnector", 
-    "endPointB" : "host_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vconnector-host_pnic", 
-    "description" : "vconnector-host_pnic"
-},
-{  
+    "description" : "host_pnic-vconnector", 
     "endPointA" : "host_pnic", 
     "endPointB" : "vconnector", 
+    "type" : "host_pnic-vconnector"
+},
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "host_pnic-vconnector", 
-    "description" : "host_pnic-vconnector"
+    "description" : "vconnector-otep", 
+    "endPointA" : "vconnector", 
+    "endPointB" : "otep", 
+    "type" : "vconnector-otep"
 },
-{  
-    "endPointA" : "host_pnic", 
-    "endPointB" : "network", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "host_pnic-network", 
-    "description" : "host_pnic-network"
+    "description" : "otep-vedge", 
+    "endPointA" : "otep", 
+    "endPointB" : "vedge", 
+    "type" : "otep-vedge"
 },
-{  
-    "endPointA" : "network", 
-    "endPointB" : "host_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "network-host_pnic", 
-    "description" : "network-host_pnic"
+    "description" : "vedge-vnic", 
+    "endPointA" : "vedge", 
+    "endPointB" : "vnic", 
+    "type" : "vedge-vnic"
 },
-{  
-    "endPointA" : "host_pnic", 
-    "endPointB" : "vedge", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "host_pnic-vedge", 
-    "description" : "host_pnic-vedge"
+    "description" : "host_pnic-host", 
+    "endPointA" : "host_pnic", 
+    "endPointB" : "host", 
+    "type" : "host_pnic-host"
 },
-{  
-    "endPointA" : "vedge", 
-    "endPointB" : "host_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "vedge-host_pnic", 
-    "description" : "vedge-host_pnic"
+    "description" : "host-host_pnic", 
+    "endPointA" : "host", 
+    "endPointB" : "host_pnic", 
+    "type" : "host-host_pnic"
 },
-{  
-    "endPointA" : "host_pnic", 
-    "endPointB" : "otep", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "host_pnic-otep", 
-    "description" : "host_pnic-otep"
+    "description" : "host-network", 
+    "endPointA" : "host", 
+    "endPointB" : "network", 
+    "type" : "host-network"
 },
-{  
-    "endPointA" : "otep", 
-    "endPointB" : "host_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "otep-host_pnic", 
-    "description" : "otep-host_pnic"
+    "description" : "network-host", 
+    "endPointA" : "network", 
+    "endPointB" : "host", 
+    "type" : "network-host"
 },
-{  
-    "endPointA" : "switch_pnic", 
-    "endPointB" : "switch_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "switch_pnic-switch_pnic", 
-    "description" : "switch_pnic-switch_pnic"
+    "description" : "network-switch_pnic", 
+    "endPointA" : "network", 
+    "endPointB" : "switch_pnic", 
+    "type" : "network-switch_pnic"
 },
-{  
+{ 
+    "user_id" : "WS7j8oTbWPf3LbNne", 
+    "description" : "switch_pnic-network", 
     "endPointA" : "switch_pnic", 
-    "endPointB" : "host_pnic", 
+    "endPointB" : "network", 
+    "type" : "switch_pnic-network"
+},
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "switch_pnic-host_pnic", 
-    "description" : "switch_pnic-host_pnic"
+    "description" : "switch_pnic-switch", 
+    "endPointA" : "switch_pnic", 
+    "endPointB" : "switch", 
+    "type" : "switch_pnic-switch"
 },
-{  
-    "endPointA" : "host_pnic", 
-    "endPointB" : "switch_pnic", 
+{ 
     "user_id" : "WS7j8oTbWPf3LbNne", 
-    "type" : "host_pnic-switch_pnic", 
-    "description" : "host_pnic-switch_pnic"
+    "description" : "switch-switch_pnic", 
+    "endPointA" : "switch", 
+    "endPointB" : "switch_pnic", 
+    "type" : "switch-switch_pnic"
 }
 ]
index d64c8ff..fdc1c94 100644 (file)
@@ -17,5 +17,4 @@ class MonitoringPnic(MonitoringSimpleObject):
 
     # add monitoring setup for remote host
     def create_setup(self, o):
-        if o.get("pnic_type") != "switch":
-            self.setup('pnic', o)
+        self.setup('host_pnic', o)
index d6ada33..9faf5b8 100644 (file)
@@ -30,7 +30,7 @@ class MonitoringSetupManager(MonitoringHandler):
             "host": MonitoringHost(env),
             "otep": MonitoringOtep(env),
             "vedge": MonitoringVedge(env),
-            "pnic": MonitoringPnic(env),
+            "host_pnic": MonitoringPnic(env),
             "vnic": MonitoringVnic(env),
             "vservice": MonitoringVservice(env),
             "vnic-vconnector": MonitoringLinkVnicVconnector(env)}
index 1e85800..3dbd6f4 100644 (file)
@@ -70,14 +70,14 @@ CONSTANTS_BY_NAMES = {
     "link_types": [
         "instance-vnic",
         "otep-vconnector",
-        "otep-pnic",
-        "pnic-network",
+        "otep-host_pnic",
+        "host_pnic-network",
         "vedge-otep",
         "vnic-vconnector",
-        "vconnector-pnic",
+        "vconnector-host_pnic",
         "vconnector-vedge",
         "vnic-vedge",
-        "vedge-pnic",
+        "vedge-host_pnic",
         "vservice-vnic"
     ],
     "link_states": [
@@ -134,11 +134,13 @@ CONSTANTS_BY_NAMES = {
         "vedge",
         "instance",
         "vservice",
-        "pnic",
+        "host_pnic",
         "network",
         "port",
         "otep",
-        "agent"
+        "agent",
+        "switch_pnic",
+        "switch"
     ],
     "env_types": [
         "development",
index 0fbe839..ae962ce 100644 (file)
@@ -20,13 +20,13 @@ WRONG_FOCAL_POINT_TYPE = base.WRONG_OBJECT_TYPE
 CORRECT_FOCAL_POINT_POINT_TYPE = base.CORRECT_OBJECT_TYPE
 
 WRONG_LINK_TYPE = base.WRONG_LINK_TYPE
-NONEXISTENT_LINK_TYPE = "otep-pnic"
+NONEXISTENT_LINK_TYPE = "otep-host_pnic"
 CORRECT_LINK_TYPE = base.CORRECT_LINK_TYPE
 
 CLIQUE_TYPES_WITH_SPECIFIC_ID = [
     {
        "environment": "Mirantis-Liberty-API",
-       "focal_point_type": "pnic",
+       "focal_point_type": "host_pnic",
        "id": CORRECT_ID
     }
 ]
index e1995cd..314de20 100644 (file)
@@ -94,7 +94,7 @@ CLIQUES_WITH_SPECIFIC_LINK_TYPE = [
             }
         ],
         "environment": "Mirantis-Liberty-API",
-        "focal_point_type": "pnic",
+        "focal_point_type": "host_pnic",
         "id": "576c119a3f4173144c7a75c7"
     }
 ]
@@ -124,7 +124,7 @@ CLIQUES_WITH_SPECIFIC_LINK_ID = [
             }
         ],
         "environment": "Mirantis-Liberty-API",
-        "focal_point_type": "pnic",
+        "focal_point_type": "host_pnic",
         "id": "576c119a3f4173144c7a75c7"
     }
 ]
@@ -161,7 +161,7 @@ CLIQUES = [{
         }
     ],
     "environment": "Miratis-Liberty-API",
-    "focal_point_type": "pnic",
+    "focal_point_type": "host_pnic",
     "id": "576c119a3f4173144c7a75c6"
     }
 ]
index e71c02d..1626392 100644 (file)
@@ -69,7 +69,7 @@ LINKS_WITH_SPECIFIC_ID = [
     {
         "id": LINK_ID,
         "host": "node-1.cisco.com",
-        "link_type": "pnic-network",
+        "link_type": "host_pnic-network",
         "link_name": "Segment-103",
         "environment": "Mirantis-Liberty-API"
     }
@@ -79,7 +79,7 @@ LINKS = [
     {
         "id": "58ca73ae3a8a836d10ff3b45",
         "host": "node-1.cisco.com",
-        "link_type": "pnic-network",
+        "link_type": "host_pnic-network",
         "link_name": "Segment-103",
         "environment": "Mirantis-Liberty-API"
     }
index ebdee06..36c2033 100644 (file)
@@ -19,14 +19,14 @@ METADATA = {
 }
 
 TYPE_TO_FETCH = {
-    "type": "pnic",
+    "type": "host_pnic",
     "fetcher": "CliFetchHostPnicsVpp",
     "environment_condition": {"mechanism_drivers": "OVS"},
     "children_scanner": "ScanOteps"
 }
 
 TYPE_TO_FETCH_WITH_WRONG_ENVIRONMENT_CONDITION = {
-    "type": "pnic",
+    "type": "host_pnic",
     "fetcher": "CliFetchHostPnicsVpp",
     "environment_condition": {"mechanism_drivers": "VPP"},
     "children_scanner": "ScanOteps"
@@ -39,7 +39,7 @@ TYPE_TO_FETCH_WITH_ERROR_VALUE = {
 }
 
 TYPE_TO_FETCH_WITHOUT_ENV_CON = {
-    "type": "pnic",
+    "type": "host_pnic",
     "fetcher": "CliFetchHostPnicsVpp",
     "children_scanner": "ScanOteps"
 }
@@ -131,14 +131,14 @@ CONFIGURATIONS = {
 }
 
 TYPES_TO_FETCHES_FOR_PNIC = {
-    "type": "pnic",
+    "type": "host_pnic",
     "fetcher": "CliFetchHostPnicsVpp",
     "environment_condition": {"mechanism_drivers": "VPP"},
     "children_scanner": "ScanOteps"
 }
 
 TYPES_TO_FETCHES_FOR_PNIC_WITHOUT_ENV_CON = {
-    "type": "pnic",
+    "type": "host_pnic",
     "fetcher": "CliFetchHostPnicsVpp",
     "children_scanner": "ScanOteps"
 }