Advertisement
Guest User

Untitled

a guest
Feb 4th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. > cat /usr/local/noc-19-12-12/scripts/my-profile-os242.py
  2. #!/usr/bin/env python
  3. # -*- coding: utf-8 -*-
  4. ##----------------------------------------------------------------------
  5. ## Copyright (C) 2007-2012 The NOC Project
  6. ## See LICENSE for details
  7. ##----------------------------------------------------------------------
  8.  
  9. import set_env
  10.  
  11. set_env.setup(use_django=True)
  12.  
  13. from noc.inv.models import Interface, InterfaceProfile
  14. from noc.sa.models import ManagedObject
  15.  
  16. pi = InterfaceProfile.objects.get(name="seg_gb_ports").id
  17. pd = InterfaceProfile.objects.get(name="default").id
  18. print pi
  19. print pd
  20.  
  21. for mo in ManagedObject.objects.filter(profile_name="Opticin.OS"):
  22. print str(mo.id)
  23.  
  24. ifaces = Interface.objects.filter(managed_object=mo.id, name="Port 25", profile=pd)
  25. for i in ifaces:
  26. print "Changing profile for %s" % i
  27. i["profile"] = pi
  28. i.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement