openmano first code upload
[osm/RO.git] / database_utils / mano_db_structure.sql
1 /**
2 * Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
3 * This file is part of openmano
4 * All Rights Reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may
7 * not use this file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations
16 * under the License.
17 *
18 * For those usages not covered by the Apache License, Version 2.0 please
19 * contact with: nfvlabs@tid.es
20 **/
21 -- MySQL dump 10.13 Distrib 5.5.35, for debian-linux-gnu (x86_64)
22 --
23 -- Host: localhost Database: mano_db
24 -- ------------------------------------------------------
25 -- Server version 5.5.35-1ubuntu1
26
27 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
28 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
29 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
30 /*!40101 SET NAMES utf8 */;
31 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
32 /*!40103 SET TIME_ZONE='+00:00' */;
33 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
34 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
35 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
36 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
37
38 --
39 -- Current Database: `mano_db`
40 --
41
42 /*!40000 DROP DATABASE IF EXISTS `mano_db`*/;
43
44 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mano_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
45
46 USE `mano_db`;
47
48 --
49 -- Table structure for table `datacenter_nets`
50 --
51
52 DROP TABLE IF EXISTS `datacenter_nets`;
53 /*!40101 SET @saved_cs_client = @@character_set_client */;
54 /*!40101 SET character_set_client = utf8 */;
55 CREATE TABLE `datacenter_nets` (
56 `uuid` varchar(36) NOT NULL,
57 `name` varchar(36) NOT NULL COMMENT 'To match with sce_nets',
58 `vim_net_id` varchar(36) NOT NULL,
59 `datacenter_id` varchar(36) NOT NULL,
60 `type` enum('bridge','data','ptp') NOT NULL DEFAULT 'data' COMMENT 'Type of network',
61 `multipoint` enum('true','false') NOT NULL DEFAULT 'true',
62 `shared` enum('true','false') NOT NULL DEFAULT 'false' COMMENT 'If can be shared with serveral scenarios',
63 `description` varchar(100) DEFAULT NULL,
64 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
65 `modified_at` timestamp NULL DEFAULT NULL,
66 PRIMARY KEY (`uuid`),
67 UNIQUE KEY `name_datacenter_id` (`name`,`datacenter_id`),
68 KEY `FK_datacenter_nets_datacenters` (`datacenter_id`),
69 CONSTRAINT `FK_datacenter_nets_datacenters` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
70 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Contain the external nets of a datacenter';
71 /*!40101 SET character_set_client = @saved_cs_client */;
72
73 --
74 -- Table structure for table `datacenters`
75 --
76
77 DROP TABLE IF EXISTS `datacenters`;
78 /*!40101 SET @saved_cs_client = @@character_set_client */;
79 /*!40101 SET character_set_client = utf8 */;
80 CREATE TABLE `datacenters` (
81 `uuid` varchar(36) NOT NULL,
82 `name` varchar(36) NOT NULL,
83 `description` varchar(100) DEFAULT NULL,
84 `type` enum('openvim','openstack') NOT NULL DEFAULT 'openvim',
85 `vim_url` varchar(150) NOT NULL COMMENT 'URL of the VIM for the REST API',
86 `vim_url_admin` varchar(150) DEFAULT NULL,
87 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
88 `modified_at` timestamp NULL DEFAULT NULL,
89 PRIMARY KEY (`uuid`),
90 UNIQUE KEY `name` (`name`)
91 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Datacenters managed by the NFVO.';
92 /*!40101 SET character_set_client = @saved_cs_client */;
93
94 --
95 -- Table structure for table `instance_interfaces`
96 --
97
98 DROP TABLE IF EXISTS `instance_interfaces`;
99 /*!40101 SET @saved_cs_client = @@character_set_client */;
100 /*!40101 SET character_set_client = utf8 */;
101 CREATE TABLE `instance_interfaces` (
102 `uuid` varchar(36) NOT NULL,
103 `instance_vm_id` varchar(36) NOT NULL,
104 `instance_net_id` varchar(36) NOT NULL,
105 `interface_id` varchar(36) NOT NULL,
106 `vim_interface_id` varchar(36) NOT NULL COMMENT 'vim identity for that interface',
107 `type` enum('internal','external') NOT NULL COMMENT 'Indicates if this interface is external to a vnf, or internal',
108 PRIMARY KEY (`uuid`),
109 KEY `FK_instance_vms` (`instance_vm_id`),
110 KEY `FK_instance_nets` (`instance_net_id`),
111 KEY `FK_instance_ids` (`interface_id`),
112 CONSTRAINT `FK_instance_ids` FOREIGN KEY (`interface_id`) REFERENCES `interfaces` (`uuid`),
113 CONSTRAINT `FK_instance_nets` FOREIGN KEY (`instance_net_id`) REFERENCES `instance_nets` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
114 CONSTRAINT `FK_instance_vms` FOREIGN KEY (`instance_vm_id`) REFERENCES `instance_vms` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
115 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Table with all running associattion among VM instances and net instances';
116 /*!40101 SET character_set_client = @saved_cs_client */;
117
118 --
119 -- Table structure for table `instance_nets`
120 --
121
122 DROP TABLE IF EXISTS `instance_nets`;
123 /*!40101 SET @saved_cs_client = @@character_set_client */;
124 /*!40101 SET character_set_client = utf8 */;
125 CREATE TABLE `instance_nets` (
126 `uuid` varchar(36) NOT NULL,
127 `vim_net_id` varchar(36) NOT NULL COMMENT 'Network ID in the VIM DB',
128 `instance_scenario_id` varchar(36) NOT NULL,
129 `status` enum('ACTIVE','DOWN','BUILD','ERROR') NOT NULL DEFAULT 'BUILD',
130 `multipoint` enum('true','false') NOT NULL DEFAULT 'true',
131 `external` enum('true','false') NOT NULL DEFAULT 'false' COMMENT 'If external, means that it already exists at VIM',
132 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
133 `modified_at` timestamp NULL DEFAULT NULL,
134 PRIMARY KEY (`uuid`),
135 UNIQUE KEY `vim_net_id_instance_scenario_id` (`vim_net_id`,`instance_scenario_id`),
136 KEY `FK_instance_nets_instance_scenarios` (`instance_scenario_id`),
137 CONSTRAINT `FK_instance_nets_instance_scenarios` FOREIGN KEY (`instance_scenario_id`) REFERENCES `instance_scenarios` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
138 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Instances of networks';
139 /*!40101 SET character_set_client = @saved_cs_client */;
140
141 --
142 -- Table structure for table `instance_scenarios`
143 --
144
145 DROP TABLE IF EXISTS `instance_scenarios`;
146 /*!40101 SET @saved_cs_client = @@character_set_client */;
147 /*!40101 SET character_set_client = utf8 */;
148 CREATE TABLE `instance_scenarios` (
149 `uuid` varchar(36) NOT NULL,
150 `name` varchar(36) NOT NULL,
151 `scenario_id` varchar(36) NOT NULL,
152 `nfvo_tenant_id` varchar(36) NOT NULL,
153 `vim_tenant_id` varchar(36) NOT NULL,
154 `datacenter_id` varchar(36) NOT NULL,
155 `description` varchar(100) DEFAULT NULL,
156 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
157 `modified_at` timestamp NULL DEFAULT NULL,
158 PRIMARY KEY (`uuid`),
159 UNIQUE KEY `name` (`name`),
160 KEY `FK_scenarios_nfvo_tenants` (`nfvo_tenant_id`),
161 KEY `FK_instance_scenarios_vim_tenants` (`vim_tenant_id`),
162 KEY `FK_instance_scenarios_datacenters` (`datacenter_id`),
163 KEY `FK_instance_scenarios_scenarios` (`scenario_id`),
164 CONSTRAINT `FK_instance_scenarios_datacenters` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`uuid`),
165 CONSTRAINT `FK_instance_scenarios_nfvo_tenants` FOREIGN KEY (`nfvo_tenant_id`) REFERENCES `nfvo_tenants` (`uuid`),
166 CONSTRAINT `FK_instance_scenarios_scenarios` FOREIGN KEY (`scenario_id`) REFERENCES `scenarios` (`uuid`),
167 CONSTRAINT `FK_instance_scenarios_vim_tenants` FOREIGN KEY (`vim_tenant_id`) REFERENCES `vim_tenants` (`uuid`)
168 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Instances of scenarios defined by the user';
169 /*!40101 SET character_set_client = @saved_cs_client */;
170
171 --
172 -- Table structure for table `instance_vms`
173 --
174
175 DROP TABLE IF EXISTS `instance_vms`;
176 /*!40101 SET @saved_cs_client = @@character_set_client */;
177 /*!40101 SET character_set_client = utf8 */;
178 CREATE TABLE `instance_vms` (
179 `uuid` varchar(36) NOT NULL,
180 `instance_vnf_id` varchar(36) NOT NULL,
181 `vm_id` varchar(36) NOT NULL,
182 `vim_vm_id` varchar(36) NOT NULL COMMENT 'VM ID in the VIM DB',
183 `status` enum('ACTIVE','PAUSED','INACTIVE','CREATING','ERROR','DELETING') NOT NULL DEFAULT 'CREATING',
184 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
185 `modified_at` timestamp NULL DEFAULT NULL,
186 PRIMARY KEY (`uuid`),
187 UNIQUE KEY `vim_vm_id` (`vim_vm_id`),
188 KEY `FK_instance_vms_vms` (`vm_id`),
189 KEY `FK_instance_vms_instance_vnfs` (`instance_vnf_id`),
190 CONSTRAINT `FK_instance_vms_instance_vnfs` FOREIGN KEY (`instance_vnf_id`) REFERENCES `instance_vnfs` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
191 CONSTRAINT `FK_instance_vms_vms` FOREIGN KEY (`vm_id`) REFERENCES `vms` (`uuid`)
192 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Instances of VMs as part of VNF instances';
193 /*!40101 SET character_set_client = @saved_cs_client */;
194
195 --
196 -- Table structure for table `instance_vnfs`
197 --
198
199 DROP TABLE IF EXISTS `instance_vnfs`;
200 /*!40101 SET @saved_cs_client = @@character_set_client */;
201 /*!40101 SET character_set_client = utf8 */;
202 CREATE TABLE `instance_vnfs` (
203 `uuid` varchar(36) NOT NULL,
204 `instance_scenario_id` varchar(36) NOT NULL,
205 `vnf_id` varchar(36) NOT NULL,
206 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
207 `modified_at` timestamp NULL DEFAULT NULL,
208 PRIMARY KEY (`uuid`),
209 KEY `FK_instance_vnfs_vnfs` (`vnf_id`),
210 KEY `FK_instance_vnfs_instance_scenarios` (`instance_scenario_id`),
211 CONSTRAINT `FK_instance_vnfs_instance_scenarios` FOREIGN KEY (`instance_scenario_id`) REFERENCES `instance_scenarios` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
212 CONSTRAINT `FK_instance_vnfs_vnfs` FOREIGN KEY (`vnf_id`) REFERENCES `vnfs` (`uuid`)
213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Instances of VNFs as part of a scenario';
214 /*!40101 SET character_set_client = @saved_cs_client */;
215
216 --
217 -- Table structure for table `interfaces`
218 --
219
220 DROP TABLE IF EXISTS `interfaces`;
221 /*!40101 SET @saved_cs_client = @@character_set_client */;
222 /*!40101 SET character_set_client = utf8 */;
223 CREATE TABLE `interfaces` (
224 `uuid` varchar(36) NOT NULL,
225 `internal_name` varchar(25) NOT NULL,
226 `external_name` varchar(25) DEFAULT NULL COMMENT 'NULL if the interface is not an external interface',
227 `vm_id` varchar(36) NOT NULL,
228 `net_id` varchar(36) DEFAULT NULL,
229 `type` enum('mgmt','bridge','data') NOT NULL DEFAULT 'data' COMMENT 'Type of network',
230 `vpci` char(12) DEFAULT NULL,
231 `bw` mediumint(8) unsigned DEFAULT NULL COMMENT 'BW expressed in Mbits/s. Maybe this field is not necessary.',
232 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
233 `modified_at` timestamp NULL DEFAULT NULL,
234 `model` varchar(12) DEFAULT NULL,
235 PRIMARY KEY (`uuid`),
236 UNIQUE KEY `internal_name_vm_id` (`internal_name`,`vm_id`),
237 KEY `FK_interfaces_vms` (`vm_id`),
238 KEY `FK_interfaces_nets` (`net_id`),
239 CONSTRAINT `FK_interfaces_nets` FOREIGN KEY (`net_id`) REFERENCES `nets` (`uuid`) ON DELETE CASCADE,
240 CONSTRAINT `FK_interfaces_vms` FOREIGN KEY (`vm_id`) REFERENCES `vms` (`uuid`) ON DELETE CASCADE
241 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='VM interfaces';
242 /*!40101 SET character_set_client = @saved_cs_client */;
243
244 --
245 -- Table structure for table `logs`
246 --
247
248 DROP TABLE IF EXISTS `logs`;
249 /*!40101 SET @saved_cs_client = @@character_set_client */;
250 /*!40101 SET character_set_client = utf8 */;
251 CREATE TABLE `logs` (
252 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
253 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
254 `nfvo_tenant_id` varchar(36) DEFAULT NULL,
255 `related` enum('nfvo_tenants','datacenters','vim_tenants','tenants_datacenters','vnfs','vms','interfaces','nets','scenarios','sce_vnfs','sce_interfaces','sce_nets','instance_scenarios','instance_vnfs','instance_vms','instance_nets','instance_interfaces') NOT NULL COMMENT 'Relevant element for the log',
256 `uuid` varchar(36) DEFAULT NULL COMMENT 'Uuid of vnf, scenario, etc. that log relates to',
257 `level` enum('panic','error','info','debug','verbose') NOT NULL,
258 `description` varchar(200) NOT NULL,
259 PRIMARY KEY (`id`)
260 ) ENGINE=InnoDB AUTO_INCREMENT=3286 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
261 /*!40101 SET character_set_client = @saved_cs_client */;
262
263 --
264 -- Table structure for table `nets`
265 --
266
267 DROP TABLE IF EXISTS `nets`;
268 /*!40101 SET @saved_cs_client = @@character_set_client */;
269 /*!40101 SET character_set_client = utf8 */;
270 CREATE TABLE `nets` (
271 `uuid` varchar(36) NOT NULL,
272 `vnf_id` varchar(36) NOT NULL,
273 `name` varchar(36) NOT NULL,
274 `type` enum('bridge','data','ptp') NOT NULL DEFAULT 'data' COMMENT 'Type of network',
275 `multipoint` enum('true','false') NOT NULL DEFAULT 'false',
276 `description` varchar(100) DEFAULT NULL,
277 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
278 `modified_at` timestamp NULL DEFAULT NULL,
279 PRIMARY KEY (`uuid`),
280 UNIQUE KEY `vnf_id_name` (`vnf_id`,`name`),
281 CONSTRAINT `FK_nets_vnfs` FOREIGN KEY (`vnf_id`) REFERENCES `vnfs` (`uuid`) ON DELETE CASCADE
282 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Networks in a VNF definition. These are only the internal networks among VMs of the same VNF.';
283 /*!40101 SET character_set_client = @saved_cs_client */;
284
285 --
286 -- Table structure for table `nfvo_tenants`
287 --
288
289 DROP TABLE IF EXISTS `nfvo_tenants`;
290 /*!40101 SET @saved_cs_client = @@character_set_client */;
291 /*!40101 SET character_set_client = utf8 */;
292 CREATE TABLE `nfvo_tenants` (
293 `uuid` varchar(36) NOT NULL,
294 `name` varchar(36) NOT NULL,
295 `description` varchar(100) DEFAULT NULL,
296 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
297 `modified_at` timestamp NULL DEFAULT NULL,
298 PRIMARY KEY (`uuid`),
299 UNIQUE KEY `name` (`name`)
300 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Scenarios defined by the user';
301 /*!40101 SET character_set_client = @saved_cs_client */;
302
303 --
304 -- Table structure for table `sce_interfaces`
305 --
306
307 DROP TABLE IF EXISTS `sce_interfaces`;
308 /*!40101 SET @saved_cs_client = @@character_set_client */;
309 /*!40101 SET character_set_client = utf8 */;
310 CREATE TABLE `sce_interfaces` (
311 `uuid` varchar(36) NOT NULL,
312 `sce_vnf_id` varchar(36) NOT NULL,
313 `sce_net_id` varchar(36) DEFAULT NULL,
314 `interface_id` varchar(36) DEFAULT NULL,
315 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
316 `modified_at` timestamp NULL DEFAULT NULL,
317 PRIMARY KEY (`uuid`),
318 KEY `FK_sce_interfaces_sce_vnfs` (`sce_vnf_id`),
319 KEY `FK_sce_interfaces_sce_nets` (`sce_net_id`),
320 KEY `FK_sce_interfaces_interfaces` (`interface_id`),
321 CONSTRAINT `FK_sce_interfaces_interfaces` FOREIGN KEY (`interface_id`) REFERENCES `interfaces` (`uuid`),
322 CONSTRAINT `FK_sce_interfaces_sce_nets` FOREIGN KEY (`sce_net_id`) REFERENCES `sce_nets` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
323 CONSTRAINT `FK_sce_interfaces_sce_vnfs` FOREIGN KEY (`sce_vnf_id`) REFERENCES `sce_vnfs` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
324 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='VNF interfaces in a scenario definition.';
325 /*!40101 SET character_set_client = @saved_cs_client */;
326
327 --
328 -- Table structure for table `sce_nets`
329 --
330
331 DROP TABLE IF EXISTS `sce_nets`;
332 /*!40101 SET @saved_cs_client = @@character_set_client */;
333 /*!40101 SET character_set_client = utf8 */;
334 CREATE TABLE `sce_nets` (
335 `uuid` varchar(36) NOT NULL,
336 `name` varchar(36) DEFAULT NULL,
337 `scenario_id` varchar(36) DEFAULT NULL COMMENT 'NULL if net is matched to several scenarios',
338 `type` enum('bridge','data','ptp') NOT NULL DEFAULT 'data' COMMENT 'Type of network',
339 `multipoint` enum('true','false') NOT NULL DEFAULT 'true',
340 `external` enum('true','false') NOT NULL DEFAULT 'false' COMMENT 'If external, net is already present at VIM',
341 `description` varchar(100) DEFAULT NULL,
342 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
343 `modified_at` timestamp NULL DEFAULT NULL,
344 `graph` varchar(200) DEFAULT NULL,
345 PRIMARY KEY (`uuid`),
346 KEY `FK_sce_nets_scenarios` (`scenario_id`),
347 CONSTRAINT `FK_sce_nets_scenarios` FOREIGN KEY (`scenario_id`) REFERENCES `scenarios` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE
348 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Networks in a scenario definition. It only considers networks among VNFs. Networks among internal VMs are only considered in tble ''nets''.';
349 /*!40101 SET character_set_client = @saved_cs_client */;
350
351 --
352 -- Table structure for table `sce_vnfs`
353 --
354
355 DROP TABLE IF EXISTS `sce_vnfs`;
356 /*!40101 SET @saved_cs_client = @@character_set_client */;
357 /*!40101 SET character_set_client = utf8 */;
358 CREATE TABLE `sce_vnfs` (
359 `uuid` varchar(36) NOT NULL,
360 `name` varchar(36) NOT NULL,
361 `scenario_id` varchar(36) NOT NULL,
362 `vnf_id` varchar(36) NOT NULL,
363 `description` varchar(100) DEFAULT NULL,
364 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
365 `modified_at` timestamp NULL DEFAULT NULL,
366 `graph` varchar(200) DEFAULT NULL,
367 PRIMARY KEY (`uuid`),
368 UNIQUE KEY `name_scenario_id` (`name`,`scenario_id`),
369 KEY `FK_sce_vnfs_scenarios` (`scenario_id`),
370 KEY `FK_sce_vnfs_vnfs` (`vnf_id`),
371 CONSTRAINT `FK_sce_vnfs_scenarios` FOREIGN KEY (`scenario_id`) REFERENCES `scenarios` (`uuid`) ON DELETE CASCADE ON UPDATE CASCADE,
372 CONSTRAINT `FK_sce_vnfs_vnfs` FOREIGN KEY (`vnf_id`) REFERENCES `vnfs` (`uuid`)
373 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='VNFs in scenario definitions. This table also contains the Physical Network Functions and the external elements such as MAN, Core, etc.\r\n';
374 /*!40101 SET character_set_client = @saved_cs_client */;
375
376 --
377 -- Table structure for table `scenarios`
378 --
379
380 DROP TABLE IF EXISTS `scenarios`;
381 /*!40101 SET @saved_cs_client = @@character_set_client */;
382 /*!40101 SET character_set_client = utf8 */;
383 CREATE TABLE `scenarios` (
384 `uuid` varchar(36) NOT NULL,
385 `name` varchar(36) NOT NULL,
386 `nfvo_tenant_id` varchar(36) DEFAULT NULL,
387 `description` varchar(100) DEFAULT NULL,
388 `public` enum('true','false') NOT NULL DEFAULT 'false',
389 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
390 `modified_at` timestamp NULL DEFAULT NULL,
391 PRIMARY KEY (`uuid`),
392 UNIQUE KEY `name` (`name`),
393 KEY `FK_scenarios_nfvo_tenants` (`nfvo_tenant_id`),
394 CONSTRAINT `FK_scenarios_nfvo_tenants` FOREIGN KEY (`nfvo_tenant_id`) REFERENCES `nfvo_tenants` (`uuid`)
395 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Scenarios defined by the user';
396 /*!40101 SET character_set_client = @saved_cs_client */;
397
398 --
399 -- Table structure for table `tenants_datacenters`
400 --
401
402 DROP TABLE IF EXISTS `tenants_datacenters`;
403 /*!40101 SET @saved_cs_client = @@character_set_client */;
404 /*!40101 SET character_set_client = utf8 */;
405 CREATE TABLE `tenants_datacenters` (
406 `id` int(11) NOT NULL AUTO_INCREMENT,
407 `nfvo_tenant_id` varchar(36) NOT NULL,
408 `datacenter_id` varchar(36) NOT NULL,
409 `vim_tenant_id` varchar(36) NOT NULL,
410 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
411 `modified_at` timestamp NULL DEFAULT NULL,
412 PRIMARY KEY (`id`),
413 UNIQUE KEY `datacenter_nfvo_tenant` (`datacenter_id`,`nfvo_tenant_id`),
414 KEY `FK_nfvo_tenants_datacenters` (`datacenter_id`),
415 KEY `FK_nfvo_tenants_vim_tenants` (`vim_tenant_id`),
416 KEY `FK_tenants_datacenters_nfvo_tenants` (`nfvo_tenant_id`),
417 CONSTRAINT `FK_tenants_datacenters_datacenters` FOREIGN KEY (`datacenter_id`) REFERENCES `datacenters` (`uuid`),
418 CONSTRAINT `FK_tenants_datacenters_nfvo_tenants` FOREIGN KEY (`nfvo_tenant_id`) REFERENCES `nfvo_tenants` (`uuid`),
419 CONSTRAINT `FK_tenants_datacenters_vim_tenants` FOREIGN KEY (`vim_tenant_id`) REFERENCES `vim_tenants` (`uuid`)
420 ) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Scenarios defined by the user';
421 /*!40101 SET character_set_client = @saved_cs_client */;
422
423 --
424 -- Table structure for table `uuids`
425 --
426
427 DROP TABLE IF EXISTS `uuids`;
428 /*!40101 SET @saved_cs_client = @@character_set_client */;
429 /*!40101 SET character_set_client = utf8 */;
430 CREATE TABLE `uuids` (
431 `uuid` varchar(36) NOT NULL,
432 `root_uuid` varchar(36) DEFAULT NULL COMMENT 'Some related UUIDs can be grouped by this field, so that they can be deleted at once',
433 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
434 `used_at` enum('nfvo_tenants','datacenters','vim_tenants','vnfs','vms','interfaces','nets','scenarios','sce_vnfs','sce_interfaces','sce_nets','instance_scenarios','instance_vnfs','instance_vms','instance_nets','instance_interfaces') DEFAULT NULL COMMENT 'Table that uses this UUID',
435 PRIMARY KEY (`uuid`)
436 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Table with all unique IDs used to avoid UUID repetitions among different elements';
437 /*!40101 SET character_set_client = @saved_cs_client */;
438
439 --
440 -- Table structure for table `vim_tenants`
441 --
442
443 DROP TABLE IF EXISTS `vim_tenants`;
444 /*!40101 SET @saved_cs_client = @@character_set_client */;
445 /*!40101 SET character_set_client = utf8 */;
446 CREATE TABLE `vim_tenants` (
447 `uuid` varchar(36) NOT NULL,
448 `name` varchar(36) NOT NULL,
449 `vim_tenant_id` varchar(36) NOT NULL COMMENT 'Tenant ID in the VIM DB',
450 `created` enum('true','false') NOT NULL DEFAULT 'false' COMMENT 'Indicates if this tenant has been created by openmano, or it existed on VIM',
451 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
452 `modified_at` timestamp NULL DEFAULT NULL,
453 PRIMARY KEY (`uuid`),
454 UNIQUE KEY `name` (`name`),
455 UNIQUE KEY `vim_tenant_id` (`vim_tenant_id`)
456 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='Scenarios defined by the user';
457 /*!40101 SET character_set_client = @saved_cs_client */;
458
459 --
460 -- Table structure for table `vms`
461 --
462
463 DROP TABLE IF EXISTS `vms`;
464 /*!40101 SET @saved_cs_client = @@character_set_client */;
465 /*!40101 SET character_set_client = utf8 */;
466 CREATE TABLE `vms` (
467 `uuid` varchar(36) NOT NULL,
468 `name` varchar(36) NOT NULL,
469 `vnf_id` varchar(36) NOT NULL,
470 `vim_flavor_id` varchar(36) NOT NULL COMMENT 'Flavor ID in the VIM DB',
471 `vim_image_id` varchar(36) NOT NULL COMMENT 'Image ID in the VIM DB',
472 `image_path` varchar(100) NOT NULL COMMENT 'Path where the image of the VM is located',
473 `description` varchar(100) DEFAULT NULL,
474 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
475 `modified_at` timestamp NULL DEFAULT NULL,
476 PRIMARY KEY (`uuid`),
477 UNIQUE KEY `name_vnf_id` (`name`,`vnf_id`),
478 KEY `FK_vms_vnfs` (`vnf_id`),
479 CONSTRAINT `FK_vms_vnfs` FOREIGN KEY (`vnf_id`) REFERENCES `vnfs` (`uuid`) ON DELETE CASCADE
480 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='VM definitions. It contains the set of VMs used by the VNF definitions.';
481 /*!40101 SET character_set_client = @saved_cs_client */;
482
483 --
484 -- Table structure for table `vnfs`
485 --
486
487 DROP TABLE IF EXISTS `vnfs`;
488 /*!40101 SET @saved_cs_client = @@character_set_client */;
489 /*!40101 SET character_set_client = utf8 */;
490 CREATE TABLE `vnfs` (
491 `uuid` varchar(36) NOT NULL,
492 `name` varchar(36) NOT NULL,
493 `path` varchar(100) DEFAULT NULL COMMENT 'Path where the YAML descriptor of the VNF can be found. NULL if it is a physical network function.',
494 `physical` enum('true','false') NOT NULL DEFAULT 'false',
495 `public` enum('true','false') NOT NULL DEFAULT 'true',
496 `description` varchar(100) DEFAULT NULL,
497 `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
498 `modified_at` timestamp NULL DEFAULT NULL,
499 `class` varchar(36) DEFAULT 'MISC',
500 PRIMARY KEY (`uuid`),
501 UNIQUE KEY `name` (`name`),
502 UNIQUE KEY `path` (`path`)
503 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='VNF definitions. This is the catalogue of VNFs. It also includes Physical Network Functions or Physical Elements.\r\n';
504 /*!40101 SET character_set_client = @saved_cs_client */;
505
506 --
507 -- Dumping routines for database 'mano_db'
508 --
509 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
510
511 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
512 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
513 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
514 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
515 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
516 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
517 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
518
519 -- Dump completed on 2015-03-11 17:34:28