diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-26 17:10:06 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-26 17:10:06 +0200 |
| commit | 44f0bd378763f4c481fb8a87847ca84469b35a67 (patch) | |
| tree | d9517715e54b635ebd068ab3041afc60c2b30c62 /opendc/models | |
| parent | a1589e75358558eada7ffc2efc7e3fa7160d233e (diff) | |
Copy over topology_ids on branch
Diffstat (limited to 'opendc/models')
| -rw-r--r-- | opendc/models/machine.py | 10 | ||||
| -rw-r--r-- | opendc/models/rack.py | 5 | ||||
| -rw-r--r-- | opendc/models/room.py | 5 | ||||
| -rw-r--r-- | opendc/models/tile.py | 5 |
4 files changed, 12 insertions, 13 deletions
diff --git a/opendc/models/machine.py b/opendc/models/machine.py index 0d9fbd54..f233d329 100644 --- a/opendc/models/machine.py +++ b/opendc/models/machine.py @@ -15,14 +15,15 @@ class Machine(Model): 'cpuIds': 'cpu_ids', 'gpuIds': 'gpu_ids', 'memoryIds': 'memory_ids', - 'storageIds': 'storage_ids' + 'storageIds': 'storage_ids', + 'topologyId': 'topology_id' } } PATH = '/v1/tiles/{tileId}/rack/machines' TABLE_NAME = 'machines' - COLUMNS = ['id', 'rack_id', 'position'] + COLUMNS = ['id', 'rack_id', 'position', 'topology_id'] COLUMNS_PRIMARY_KEY = ['id'] device_table_to_attribute = { @@ -37,11 +38,6 @@ class Machine(Model): for device_table in self.device_table_to_attribute.keys(): - # First, create the statements to execute - - statements = [] - values = [] - # First, delete current machine-device links statement = 'DELETE FROM machine_{} WHERE machine_id = %s'.format(device_table) diff --git a/opendc/models/rack.py b/opendc/models/rack.py index 74104fcb..43916490 100644 --- a/opendc/models/rack.py +++ b/opendc/models/rack.py @@ -9,14 +9,15 @@ class Rack(Model): 'id': 'id', 'name': 'name', 'capacity': 'capacity', - 'powerCapacityW': 'power_capacity_w' + 'powerCapacityW': 'power_capacity_w', + 'topologyId': 'topology_id' } } PATH = '/v1/tiles/{tileId}/rack' TABLE_NAME = 'racks' - COLUMNS = ['id', 'name', 'capacity', 'power_capacity_w'] + COLUMNS = ['id', 'name', 'capacity', 'power_capacity_w', 'topology_id'] COLUMNS_PRIMARY_KEY = ['id'] @classmethod diff --git a/opendc/models/room.py b/opendc/models/room.py index 66346bb2..209e4e77 100644 --- a/opendc/models/room.py +++ b/opendc/models/room.py @@ -9,14 +9,15 @@ class Room(Model): 'id': 'id', 'datacenterId': 'datacenter_id', 'name': 'name', - 'roomType': 'type' + 'roomType': 'type', + 'topologyId': 'topology_id' } } PATH = '/v1/datacenters/{datacenterId}/rooms' TABLE_NAME = 'rooms' - COLUMNS = ['id', 'name', 'datacenter_id', 'type'] + COLUMNS = ['id', 'name', 'datacenter_id', 'type', 'topology_id'] COLUMNS_PRIMARY_KEY = ['id'] def google_id_has_at_least(self, google_id, authorization_level): diff --git a/opendc/models/tile.py b/opendc/models/tile.py index 344b6135..e7f64160 100644 --- a/opendc/models/tile.py +++ b/opendc/models/tile.py @@ -12,14 +12,15 @@ class Tile(Model): 'objectId': 'object_id', 'objectType': 'object_type', 'positionX': 'position_x', - 'positionY': 'position_y' + 'positionY': 'position_y', + 'topologyId': 'topology_id' } } PATH = '/v1/rooms/{roomId}/tiles' TABLE_NAME = 'tiles' - COLUMNS = ['id', 'position_x', 'position_y', 'room_id', 'object_id'] + COLUMNS = ['id', 'position_x', 'position_y', 'room_id', 'object_id', 'topology_id'] COLUMNS_PRIMARY_KEY = ['id'] def google_id_has_at_least(self, google_id, authorization_level): |
