def setUp(self): db.setupDatabase() self.requester = common.DUDRequester() self.clock = task.Clock() nrm_map = StringIO.StringIO(topology.ARUBA_TOPOLOGY) nrm_ports, nml_network, link_vector = setup.setupTopology(nrm_map, self.network, 'aruba.net') self.backend = dud.DUDNSIBackend(self.network, nrm_ports, self.requester, {}) self.backend.scheduler.clock = self.clock pl = plugin.BasePlugin() pl.init( { config.NETWORK_NAME: self.network }, None ) pr = provreg.ProviderRegistry( { self.provider_agent.urn() : self.backend }, {} ) self.provider = aggregator.Aggregator(self.network, self.provider_agent, nml_network, link_vector, self.requester, pr, [], pl) # set parent for backend, we need to create the aggregator before this can be done self.backend.parent_requester = self.provider self.backend.startService() # request stuff self.start_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=2) self.end_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=10) self.schedule = nsa.Schedule(self.start_time, self.end_time) self.sd = nsa.Point2PointService(self.source_stp, self.dest_stp, self.bandwidth, cnt.BIDIRECTIONAL, False, None) self.criteria = nsa.Criteria(0, self.schedule, self.sd)
def setUp(self): self.clock = task.Clock() self.requester = common.DUDRequester() nrm_ports = nrm.parsePortSpec(StringIO.StringIO(topology.ARUBA_TOPOLOGY)) self.backend = dud.DUDNSIBackend(self.network, nrm_ports, self.requester, {}) self.provider = self.backend self.provider.scheduler.clock = self.clock self.provider.startService() db.setupDatabase() # request stuff self.start_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=2) self.end_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=10) self.schedule = nsa.Schedule(self.start_time, self.end_time) self.sd = nsa.Point2PointService(self.source_stp, self.dest_stp, self.bandwidth, cnt.BIDIRECTIONAL, False ,None) self.criteria = nsa.Criteria(0, self.schedule, self.sd) return self.backend.restore_defer
def setUp(self): from twisted.web import resource, server from twisted.application import internet from opennsa.protocols import nsi2 from opennsa.protocols.shared import soapresource from opennsa.protocols.nsi2 import requesterservice, requesterclient db.setupDatabase() self.requester = common.DUDRequester() self.clock = task.Clock() nrm_map = StringIO.StringIO(topology.ARUBA_TOPOLOGY) nrm_ports, nml_network, link_vector = setup.setupTopology(nrm_map, self.network, 'aruba.net') self.backend = dud.DUDNSIBackend(self.network, nrm_ports, None, {}) # we set the parent later self.backend.scheduler.clock = self.clock pl = plugin.BasePlugin() pl.init( { config.NETWORK_NAME: self.network }, None ) pr = provreg.ProviderRegistry( { self.provider_agent.urn() : self.backend }, {} ) self.aggregator = aggregator.Aggregator(self.network, self.provider_agent, nml_network, link_vector, None, pr, [], pl) # we set the parent later self.backend.parent_requester = self.aggregator # provider protocol http_top_resource = resource.Resource() cs2_prov = nsi2.setupProvider(self.aggregator, http_top_resource) self.aggregator.parent_requester = cs2_prov provider_factory = server.Site(http_top_resource) self.provider_service = internet.TCPServer(self.PROVIDER_PORT, provider_factory) # requester protocol requester_top_resource = resource.Resource() soap_resource = soapresource.setupSOAPResource(requester_top_resource, 'RequesterService2') self.provider = requesterclient.RequesterClient(self.provider_agent.endpoint, self.requester_agent.endpoint) requester_service = requesterservice.RequesterService(soap_resource, self.requester) # this is the important part requester_factory = server.Site(requester_top_resource, logPath='/dev/null') # start engines! self.backend.startService() self.provider_service.startService() self.requester_iport = reactor.listenTCP(self.REQUESTER_PORT, requester_factory) # request stuff self.start_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=2) self.end_time = datetime.datetime.utcnow() + datetime.timedelta(seconds=10) self.schedule = nsa.Schedule(self.start_time, self.end_time) self.sd = nsa.Point2PointService(self.source_stp, self.dest_stp, self.bandwidth) self.criteria = nsa.Criteria(0, self.schedule, self.sd)
def setUp(self): self.backend = dud.DUDNSIBackend('TestDUD') source_stp = nsa.STP('Aruba', 'A1') dest_stp = nsa.STP('Aruba', 'A3') start_time = datetime.datetime.utcfromtimestamp(time.time() + 0.1) end_time = datetime.datetime.utcfromtimestamp(time.time() + 10) bwp = nsa.BandwidthParameters(200) self.service_params = nsa.ServiceParameters(start_time, end_time, source_stp, dest_stp, bandwidth=bwp)
def setUp(self): tcf = os.path.expanduser('~/.opennsa-test.json') tc = json.load(open(tcf)) database.setupDatabase(tc['database'], tc['database-user'], tc['database-password']) self.requester = common.DUDRequester() self.clock = task.Clock() nrm_ports = nrm.parsePortSpec( StringIO.StringIO(topology.ARUBA_TOPOLOGY)) network_topology = nml.createNMLNetwork(nrm_ports, self.network, self.network) self.backend = dud.DUDNSIBackend(self.network, nrm_ports, self.requester, {}) self.backend.scheduler.clock = self.clock route_vectors = gns.RouteVectors([cnt.URN_OGF_PREFIX + self.network]) route_vectors.updateVector(self.provider_agent.identity, 0, [self.network], {}) pl = plugin.BasePlugin() pl.init({config.NETWORK_NAME: self.network}, None) pr = provreg.ProviderRegistry( {self.provider_agent.urn(): self.backend}, {}) self.provider = aggregator.Aggregator(self.network, self.provider_agent, network_topology, route_vectors, self.requester, pr, [], pl) # set parent for backend, we need to create the aggregator before this can be done self.backend.parent_requester = self.provider self.backend.startService() # request stuff self.start_time = datetime.datetime.utcnow() + datetime.timedelta( seconds=2) self.end_time = datetime.datetime.utcnow() + datetime.timedelta( seconds=10) self.schedule = nsa.Schedule(self.start_time, self.end_time) self.sd = nsa.Point2PointService(self.source_stp, self.dest_stp, self.bandwidth, cnt.BIDIRECTIONAL, False, None) self.criteria = nsa.Criteria(0, self.schedule, self.sd)
def setUp(self): db.setupDatabase() self.requester = common.DUDRequester() self.clock = task.Clock() nrm_ports = nrm.parsePortSpec(StringIO(topology.ARUBA_TOPOLOGY)) network_topology = nml.createNMLNetwork(nrm_ports, self.network, self.network) self.backend = dud.DUDNSIBackend(self.network, nrm_ports, None, {}) # we set the parent later self.backend.scheduler.clock = self.clock link_vector = linkvector.LinkVector([self.network]) pl = plugin.BasePlugin() pl.init({config.NETWORK_NAME: self.network}, None) pr = provreg.ProviderRegistry( {self.provider_agent.urn(): self.backend}, {}) self.aggregator = aggregator.Aggregator(self.network, self.provider_agent, network_topology, link_vector, None, pr, [], pl) # we set the parent later self.backend.parent_requester = self.aggregator # provider protocol http_top_resource = resource.Resource() rest.setupService(self.aggregator, http_top_resource) # we need this for the aggregator not to blow up cs2_prov = nsi2.setupProvider(self.aggregator, http_top_resource) self.aggregator.parent_requester = cs2_prov provider_factory = server.Site(http_top_resource) self.provider_service = internet.TCPServer(self.PORT, provider_factory) # start engines! self.backend.startService() self.provider_service.startService()
def setUp(self): self.iports = [] HOST = 'localhost' WSDL_DIR = os.path.realpath( os.path.normpath(os.path.join(os.path.dirname(__file__), '../wsdl'))) #WSDL_DIR = os.path.join(os.getcwd(), '..', 'wsdl') # service SERVICES = [('Aruba', 9080), ('Bonaire', 9081), ('Curacao', 9082)] for network, port in SERVICES: topo_source = StringIO.StringIO(testtopology.TEST_TOPOLOGY) backend = dud.DUDNSIBackend(network) topo, _ = gole.parseTopology([topo_source]) factory = setup.createService(network, backend, topo, HOST, port, WSDL_DIR) iport = reactor.listenTCP(port, factory, interface='localhost') self.iports.append(iport) # client CLIENT_PORT = 7080 self.client, client_factory = setup.createClient( HOST, CLIENT_PORT, WSDL_DIR) self.client_nsa = nsa.NetworkServiceAgent( 'OpenNSA-Test-Client', 'http://localhost:%i/NSI/services/ConnectionService' % CLIENT_PORT) client_iport = reactor.listenTCP(CLIENT_PORT, client_factory) self.iports.append(client_iport)
def setupBackend(backend_conf, network_name, internal_topology): backends = {} for backend_name, cfg in backend_conf.items(): backend_type = cfg['_backend_type'] bc = cfg.copy() del bc['_backend_type'] if backend_type == config.BLOCK_DUD: from opennsa.backends import dud backends[backend_name] = dud.DUDNSIBackend(network_name) elif backend_type == config.BLOCK_JUNOS: from opennsa.backends import junos backends[backend_name] = junos.JunOSBackend(network_name, bc.items()) elif backend_type == config.BLOCK_FORCE10: from opennsa.backends import force10 backends[backend_name] = force10.Force10Backend(network_name, bc.items()) elif backend_type == config.BLOCK_ARGIA: from opennsa.backends import argia backends[backend_name] = argia.ArgiaBackend(network_name, bc.items()) elif backend_type == config.BLOCK_BROCADE: from opennsa.backends import brocade backends[backend_name] = brocade.BrocadeBackend(network_name, bc.items()) if len(backends) == 1: backend = backends.values()[0] else: from opennsa.backends import multi backend = multi.MultiBackendNSIBackend(network_name, backends, internal_topology) return backend
def setUp(self): from twisted.web import resource, server from twisted.application import internet from opennsa.protocols import nsi2 from opennsa.protocols.shared import resource as soapresource from opennsa.protocols.nsi2 import requesterservice, requesterclient tcf = os.path.expanduser('~/.opennsa-test.json') tc = json.load(open(tcf)) database.setupDatabase(tc['database'], tc['database-user'], tc['database-password']) self.requester = common.DUDRequester() self.clock = task.Clock() nrm_ports = nrm.parsePortSpec( StringIO.StringIO(topology.ARUBA_TOPOLOGY)) network_topology = nml.createNMLNetwork(nrm_ports, self.network, self.network) self.backend = dud.DUDNSIBackend(self.network, nrm_ports, None, {}) # we set the parent later self.backend.scheduler.clock = self.clock route_vectors = gns.RouteVectors([cnt.URN_OGF_PREFIX + self.network]) route_vectors.updateVector(self.provider_agent.identity, 0, [self.network], {}) pl = plugin.BasePlugin() pl.init({config.NETWORK_NAME: self.network}, None) pr = provreg.ProviderRegistry( {self.provider_agent.urn(): self.backend}, {}) self.aggregator = aggregator.Aggregator(self.network, self.provider_agent, network_topology, route_vectors, None, pr, [], pl) # we set the parent later self.backend.parent_requester = self.aggregator # provider protocol http_top_resource = resource.Resource() cs2_prov = nsi2.setupProvider(self.aggregator, http_top_resource) self.aggregator.parent_requester = cs2_prov provider_factory = server.Site(http_top_resource) self.provider_service = internet.TCPServer(self.PROVIDER_PORT, provider_factory) # requester protocol requester_top_resource = resource.Resource() soap_resource = soapresource.setupSOAPResource(requester_top_resource, 'RequesterService2') self.provider = requesterclient.RequesterClient( self.provider_agent.endpoint, self.requester_agent.endpoint) requester_service = requesterservice.RequesterService( soap_resource, self.requester) # this is the important part requester_factory = server.Site(requester_top_resource, logPath='/dev/null') # start engines! self.backend.startService() self.provider_service.startService() self.requester_iport = reactor.listenTCP(self.REQUESTER_PORT, requester_factory) # request stuff self.start_time = datetime.datetime.utcnow() + datetime.timedelta( seconds=2) self.end_time = datetime.datetime.utcnow() + datetime.timedelta( seconds=10) self.schedule = nsa.Schedule(self.start_time, self.end_time) self.sd = nsa.Point2PointService(self.source_stp, self.dest_stp, self.bandwidth) self.criteria = nsa.Criteria(0, self.schedule, self.sd)