Advertisement
Guest User

Untitled

a guest
May 8th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. diff -r 40f55fbce410 inv/discovery/jobs/link_discovery.py
  2. --- a/inv/discovery/jobs/link_discovery.py Thu May 08 09:40:58 2014 +0400
  3. +++ b/inv/discovery/jobs/link_discovery.py Thu May 08 12:43:32 2014 +0400
  4. @@ -45,13 +45,19 @@
  5. """
  6. i = Interface.objects.filter(
  7. managed_object=object.id, name=name).first()
  8. - if not i:
  9. - # JUNOS names fixup
  10. - si = list(SubInterface.objects.filter(
  11. - managed_object=object.id, name=name))
  12. - if len(si) == 1:
  13. - i = si[0].interface
  14. - return i
  15. + if i:
  16. + return i
  17. + # Construct alternative names
  18. + alt_names = object.profile.get_interface_names(name)
  19. + nn = object.profile.convert_interface_name(name)
  20. + if nn != name:
  21. + alt_names = [nn] + alt_names
  22. + for n in alt_names:
  23. + i = Interface.objects.filter(
  24. + managed_object=object.id, name=n).first()
  25. + if i:
  26. + return i
  27. + return None
  28.  
  29. def submit_candidate(self, local_interface,
  30. remote_object, remote_interface=None):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement