Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 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. i.profile=InterfaceProfile.objects.get(name="NNI").id
  13. i.save()
  14. continue
  15. elif not i.description:
  16. i.profile=InterfaceProfile.objects.get(name="default").id
  17. i.save()
  18. continue
  19. elif i.profile.name==InterfaceProfile.objects.get(name="default").name:
  20. i.profile=InterfaceProfile.objects.get(name="UNI").id
  21. i.save()
  22. continue
  23. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement