Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% load python %}
- {% var cmd internal %}
- {% python %}
- from noc.inv.models import *
- from noc.sa.models import *
- from noc.ip.models import *
- from noc.vc.models import *
- from noc.lib.ip import IP
- from noc.lib.text import split_alnum
- interface = Interface.objects.filter(managed_object=context["object"].id, type="physical")
- context["cmd"]="\n"
- for i in interface:
- # if i.lag:
- # context["cmd"]+="interface " + str(i.name) + "\n"
- # context["cmd"]+="description " + str(i.lag) + "\n"
- # elif "uplink port" in str(i.profile):
- if "uplink port" in str(i.profile) or "routed port" in str(i.profile):
- if i.link:
- nei_link = str(i.link)
- nei_obj = str(context["object"].name) + ':' + ' ' + i.name + ','
- if nei_obj in nei_link:
- nei_link = str(i.link).split(',')[1].split(')')[0]
- else:
- nei_link = str(i.link).split(',')[0].split('(')[1]
- context["cmd"]+="interface " + str(i.name) + "\n"
- nei_link = nei_link.replace(': ','--')
- nei_link = nei_link.replace('.net.billing.ru','')
- context["cmd"]+="description " + nei_link + "\n"
- # elif "default" in str(i.profile):
- elif "mng" in str(i.profile):
- context["cmd"]+="interface " + str(i.name) + "\n"
- context["cmd"]+="description " + "MNG" + "\n"
- {% endpython %}
- {{cmd}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement