Skip to content
Snippets Groups Projects
Commit b9c52cff authored by Henrik Thostrup Jensen's avatar Henrik Thostrup Jensen
Browse files

update table name for generic backend

parent 35235462
Branches
Tags
No related merge requests found
-- OpenNSA SQL Schema (PostgreSQL) DROPs -- OpenNSA SQL Schema (PostgreSQL) DROPs
-- This is mainly for development -- This is mainly for development
DROP TABLE simplebackendconnections; DROP TABLE generic_backend_connections;
DROP TABLE subconnections; DROP TABLE sub_connections;
DROP TABLE service_connections; DROP TABLE service_connections;
DROP TYPE label; DROP TYPE label;
...@@ -52,7 +52,7 @@ CREATE TABLE sub_connections ( ...@@ -52,7 +52,7 @@ CREATE TABLE sub_connections (
-- move this into the backend sometime -- move this into the backend sometime
CREATE TABLE simplebackendconnections ( CREATE TABLE generic_backend_connections (
id serial PRIMARY KEY, id serial PRIMARY KEY,
connection_id text NOT NULL UNIQUE, connection_id text NOT NULL UNIQUE,
revision integer NOT NULL, revision integer NOT NULL,
......
...@@ -30,7 +30,7 @@ from twistar.dbobject import DBObject ...@@ -30,7 +30,7 @@ from twistar.dbobject import DBObject
class Simplebackendconnection(DBObject): class GenericBackendConnections(DBObject):
pass pass
...@@ -80,7 +80,7 @@ class GenericBackend(service.Service): ...@@ -80,7 +80,7 @@ class GenericBackend(service.Service):
@defer.inlineCallbacks @defer.inlineCallbacks
def buildSchedule(self): def buildSchedule(self):
conns = yield Simplebackendconnection.find(where=['lifecycle_state <> ?', state.TERMINATED]) conns = yield GenericBackendConnections.find(where=['lifecycle_state <> ?', state.TERMINATED])
for conn in conns: for conn in conns:
# avoid race with newly created connections # avoid race with newly created connections
if self.scheduler.hasScheduledCall(conn.connection_id): if self.scheduler.hasScheduledCall(conn.connection_id):
...@@ -129,7 +129,7 @@ class GenericBackend(service.Service): ...@@ -129,7 +129,7 @@ class GenericBackend(service.Service):
defer.returnValue(self.connection_cache[connection_id]) defer.returnValue(self.connection_cache[connection_id])
except KeyError: except KeyError:
pass pass
conns = yield Simplebackendconnection.findBy(connection_id=connection_id) conns = yield GenericBackendConnections.findBy(connection_id=connection_id)
if len(conns) == 0: if len(conns) == 0:
raise error.ConnectionNonExistentError('No connection with id %s' % connection_id) raise error.ConnectionNonExistentError('No connection with id %s' % connection_id)
self.connection_cache[connection_id] = conns[0] self.connection_cache[connection_id] = conns[0]
...@@ -152,7 +152,7 @@ class GenericBackend(service.Service): ...@@ -152,7 +152,7 @@ class GenericBackend(service.Service):
if connection_id: if connection_id:
raise ValueError('Cannot handle cases with existing connection id (yet)') raise ValueError('Cannot handle cases with existing connection id (yet)')
#conns = yield Simplebackendconnection.findBy(connection_id=connection_id) #conns = yield GenericBackendConnections.findBy(connection_id=connection_id)
# need to check schedule # need to check schedule
...@@ -228,13 +228,13 @@ class GenericBackend(service.Service): ...@@ -228,13 +228,13 @@ class GenericBackend(service.Service):
connection_id = self.connection_manager.createConnectionId(source_target, dest_target) connection_id = self.connection_manager.createConnectionId(source_target, dest_target)
# should we save the requester or provider here? # should we save the requester or provider here?
conn = Simplebackendconnection(connection_id=connection_id, revision=0, global_reservation_id=global_reservation_id, description=description, conn = GenericBackendConnections(connection_id=connection_id, revision=0, global_reservation_id=global_reservation_id, description=description,
requester_nsa=requester_nsa.urn(), reserve_time=now, requester_nsa=requester_nsa.urn(), reserve_time=now,
reservation_state=state.INITIAL, provision_state=state.SCHEDULED, activation_state=state.INACTIVE, lifecycle_state=state.INITIAL, reservation_state=state.INITIAL, provision_state=state.SCHEDULED, activation_state=state.INACTIVE, lifecycle_state=state.INITIAL,
source_network=source_stp.network, source_port=source_stp.port, source_labels=[src_label], source_network=source_stp.network, source_port=source_stp.port, source_labels=[src_label],
dest_network=dest_stp.network, dest_port=dest_stp.port, dest_labels=[dst_label], dest_network=dest_stp.network, dest_port=dest_stp.port, dest_labels=[dst_label],
start_time=service_params.start_time, end_time=service_params.end_time, start_time=service_params.start_time, end_time=service_params.end_time,
bandwidth=service_params.bandwidth) bandwidth=service_params.bandwidth)
yield conn.save() yield conn.save()
# this sould really be much earlier, need to save connection before checking # this sould really be much earlier, need to save connection before checking
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment