from django.conf import settings from periscope.topology.models import * from periscope.topology.lib.topology import create_from_xml_file from periscope.topology.lib.util import save_parsed_elements try: topo = Topology.objects.get(unis_id='terapaths-escps') topo.delete() except: print "no existing tps topo" t = create_from_xml_file(settings.PERISCOPE_ROOT + "examples/terapaths-unis-2.xml") save_parsed_elements(t[0]) PeriscopeDomainProperties.objects.all().delete() PeriscopeNodeProperties.objects.all().delete() PeriscopePortProperties.objects.all().delete() d = Domain.objects.get(unis_id='urn:ogf:network:domain=escps.lbl.gov') PeriscopeDomainProperties.objects.create(parent=d, shape=PeriscopeShape.objects.create( shape="rect", x=800, y=280, width=200, height=100, fill="lightpink", text_xdisp="10", text_ydisp="20", text_align="left" )) d = Domain.objects.get(unis_id='urn:ogf:network:domain=escps.bnl.gov') PeriscopeDomainProperties.objects.create(parent=d, shape=PeriscopeShape.objects.create( shape="rect", x=10, y=10, width=425, height=350, fill="moccasin", text_xdisp="10", text_ydisp="20", text_align="left" ))
""" Imports ANI Testbed XML unis topology to Django's model and generates Periscope shape properties. """ import math from django.conf import settings from periscope.topology.models import * from periscope.topology.lib.topology import create_from_xml_file from periscope.topology.lib.util import save_parsed_elements # Imports ANI's XML unis topology to Django's model if Topology.objects.all().count() == 0: topo = create_from_xml_file(settings.PERISCOPE_ROOT + "examples/anitestbed.xml") save_parsed_elements(topo[0]) # Delete all previous shape properties PeriscopeDomainProperties.objects.all().delete() PeriscopeNodeProperties.objects.all().delete() PeriscopePortProperties.objects.all().delete() d = Domain.objects.get(unis_id='urn:ogf:network:domain=testbed.es.net') PeriscopeDomainProperties.objects.create(parent=d, shape=PeriscopeShape.objects.create( shape="rect", x=5, y=5, width=1070, height=490, fill="moccasin", text_xdisp="10", text_ydisp="20", text_align="left" ))
from django.conf import settings from periscope.topology.models import * from periscope.topology.lib.topology import create_from_xml_file from periscope.topology.lib.util import save_parsed_elements try: topo = Topology.objects.get(unis_id='escps') topo.delete() except: print "no existing escps topo" t = create_from_xml_file(settings.PERISCOPE_ROOT + "examples/escps-unis.xml") save_parsed_elements(t[0]) PeriscopeDomainProperties.objects.all().delete() PeriscopeNodeProperties.objects.all().delete() PeriscopePortProperties.objects.all().delete() p = Port.objects.get(unis_id='urn:ogf:network:domain=escps.bnl.gov:node=qtr1:port=unrouted-VLAN-3561') PeriscopePortProperties.objects.create(parent=p, shape=PeriscopeShape.objects.create( shape="circle", x=300, y=140, width=5, height=5, fill="aliceblue", text_xdisp="-10", text_ydisp="-10", text_align="middle" )) p = Port.objects.get(unis_id='urn:ogf:network:domain=escps.bnl.gov:node=qtr1:port=unrouted-VLAN-3562') PeriscopePortProperties.objects.create(parent=p, shape=PeriscopeShape.objects.create( shape="circle", x=285, y=195, width=5, height=5, fill="aliceblue", text_xdisp="-10", text_ydisp="-10", text_align="middle" ))
from django.conf import settings from periscope.topology.models import * from periscope.topology.lib.topology import create_from_xml_file from periscope.topology.lib.util import save_parsed_elements t = create_from_xml_file(settings.PERISCOPE_ROOT + "examples/escps-unis.xml") save_parsed_elements(t[0])