Advertisement
Guest User

Untitled

a guest
Dec 25th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. from noc.inv.models import *
  2. from noc.sa.models import *
  3.  
  4. @pyrule
  5.  
  6. def set_interface_profile(timeout = None):
  7. interface = Interface.objects.filter(type="physical")
  8. for i in interface:
  9. if i.profile.name==InterfaceProfile.objects.get(name="IgnoredNNI").name:
  10. continue
  11. elif i.link:
  12. if i.link.other(i)[0].managed_object.object_profile==ManagedObjectProfile.objects.get(name="cpe-switch"):
  13. i.profile=InterfaceProfile.objects.get(name="UNI").id
  14. i.save()
  15. continue
  16. i.profile=InterfaceProfile.objects.get(name="NNI").id
  17. i.save()
  18. continue
  19. elif not i.description:
  20. i.profile=InterfaceProfile.objects.get(name="default").id
  21. i.save()
  22. continue
  23. elif i.profile.name==InterfaceProfile.objects.get(name="default").name:
  24. i.profile=InterfaceProfile.objects.get(name="UNI").id
  25. i.save()
  26. continue
  27. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement