Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > cat /usr/local/noc-19-12-12/scripts/my-profile-os242.py
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- ##----------------------------------------------------------------------
- ## Copyright (C) 2007-2012 The NOC Project
- ## See LICENSE for details
- ##----------------------------------------------------------------------
- import set_env
- set_env.setup(use_django=True)
- from noc.inv.models import Interface, InterfaceProfile
- from noc.sa.models import ManagedObject
- pi = InterfaceProfile.objects.get(name="seg_gb_ports").id
- pd = InterfaceProfile.objects.get(name="default").id
- print pi
- print pd
- for mo in ManagedObject.objects.filter(profile_name="Opticin.OS"):
- print str(mo.id)
- ifaces = Interface.objects.filter(managed_object=mo.id, name="Port 25", profile=pd)
- for i in ifaces:
- print "Changing profile for %s" % i
- i["profile"] = pi
- i.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement