Guest User

Untitled

a guest
Dec 18th, 2013
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. from noc.inv.models import Interface, InterfaceProfile
  3. from noc.sa.models import ManagedObject
  4.  
  5. pi = InterfaceProfile.objects.get(name="seg_gb_ports").id
  6. pd = InterfaceProfile.objects.get(name="default").id
  7. print pi
  8. print pd
  9.  
  10. for mo in ManagedObject.objects.filter(profile_name="Opticin.OS"):
  11. print str(mo.id)
  12.  
  13. ifaces = Interface.objects.filter(managed_object=mo.id, name="Port 25", profile=pd)
  14. # print ifaces
  15. for i in ifaces:
  16. print "Changing profile for %s" % i
  17. i["profile"] = pi
  18. i.save()
RAW Paste Data