US2853 fix creation of switch-switch_pnic, remove switch-host_pnic 99/39199/1
authoryayogev <yaronyogev@gmail.com>
Sun, 13 Aug 2017 09:28:43 +0000 (12:28 +0300)
committeryayogev <yaronyogev@gmail.com>
Sun, 13 Aug 2017 09:28:43 +0000 (12:28 +0300)
Change-Id: Ife6f0f7a007a1c792359f56b91eb033fcfd4400a
Signed-off-by: yayogev <yaronyogev@gmail.com>
app/discover/find_links_for_pnics.py

index 3ca6b7e..372ff39 100644 (file)
@@ -27,7 +27,6 @@ class FindLinksForPnics(FindLinks):
         for pnic in pnics:
             self.add_pnic_network_links(pnic)
             self.add_host_pnic_to_switch_pnic_link(pnic)
-            self.add_switch_to_pnic_link(pnic)
 
         self.log.info("adding links of type: switch_pnic-switch_pnic, "
                       "switch-switch_pnic")
@@ -116,7 +115,7 @@ class FindLinksForPnics(FindLinks):
                          switch=leaf_pnic['switch'])
 
     def add_switch_to_pnic_link(self, pnic):
-        switch = self.inv.get_by_id(self.get_env(), pnic['id'])
+        switch = self.inv.get_by_id(self.get_env(), pnic['parent_id'])
         if not switch:
             return
         source = switch["_id"]