Advertisement
Guest User

Untitled

a guest
Jan 31st, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. from noc.inv.models import *
  2.  
  3. uni_id = InterfaceProfile.objects.get(name="UNI").id
  4. nni_id = InterfaceProfile.objects.get(name="NNI").id
  5. default_id = InterfaceProfile.objects.get(name="default").id
  6. interface = Interface.objects.filter(type="physical")
  7. for i in interface:
  8. if i.link:
  9. i.profile = nni_id
  10. i.save()
  11. continue
  12. elif not i.description:
  13. i.profile = default_id
  14. i.save()
  15. continue
  16. elif i.profile.name == InterfaceProfile.objects.get(name="default").name:
  17. i.profile = uni_id
  18. i.save()
  19. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement