Internet of Things resource management service for OpenStack clouds.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iotronic.sql 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. -- MySQL Script generated by MySQL Workbench
  2. -- lun 04 apr 2016 15:41:37 CEST
  3. -- Model: New Model Version: 1.0
  4. -- MySQL Workbench Forward Engineering
  5. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
  6. SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
  7. SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
  8. -- -----------------------------------------------------
  9. -- Schema iotronic
  10. -- -----------------------------------------------------
  11. DROP SCHEMA IF EXISTS `iotronic` ;
  12. -- -----------------------------------------------------
  13. -- Schema iotronic
  14. -- -----------------------------------------------------
  15. CREATE SCHEMA IF NOT EXISTS `iotronic` DEFAULT CHARACTER SET utf8 ;
  16. USE `iotronic` ;
  17. -- -----------------------------------------------------
  18. -- Table `iotronic`.`conductors`
  19. -- -----------------------------------------------------
  20. DROP TABLE IF EXISTS `iotronic`.`conductors` ;
  21. CREATE TABLE IF NOT EXISTS `iotronic`.`conductors` (
  22. `created_at` DATETIME NULL DEFAULT NULL,
  23. `updated_at` DATETIME NULL DEFAULT NULL,
  24. `id` INT(11) NOT NULL AUTO_INCREMENT,
  25. `hostname` VARCHAR(255) NOT NULL,
  26. `online` TINYINT(1) NULL DEFAULT NULL,
  27. PRIMARY KEY (`id`),
  28. UNIQUE INDEX `uniq_conductors0hostname` (`hostname` ASC))
  29. ENGINE = InnoDB
  30. AUTO_INCREMENT = 6
  31. DEFAULT CHARACTER SET = utf8;
  32. -- -----------------------------------------------------
  33. -- Table `iotronic`.`wampagents`
  34. -- -----------------------------------------------------
  35. DROP TABLE IF EXISTS `iotronic`.`wampagents` ;
  36. CREATE TABLE IF NOT EXISTS `iotronic`.`wampagents` (
  37. `created_at` DATETIME NULL DEFAULT NULL,
  38. `updated_at` DATETIME NULL DEFAULT NULL,
  39. `id` INT(11) NOT NULL AUTO_INCREMENT,
  40. `hostname` VARCHAR(255) NOT NULL,
  41. `wsurl` VARCHAR(255) NOT NULL,
  42. `online` TINYINT(1) NULL DEFAULT NULL,
  43. `ragent` TINYINT(1) NULL DEFAULT NULL,
  44. PRIMARY KEY (`id`),
  45. UNIQUE INDEX `uniq_wampagents0hostname` (`hostname` ASC))
  46. ENGINE = InnoDB
  47. AUTO_INCREMENT = 6
  48. DEFAULT CHARACTER SET = utf8;
  49. -- -----------------------------------------------------
  50. -- Table `iotronic`.`boards`
  51. -- -----------------------------------------------------
  52. DROP TABLE IF EXISTS `iotronic`.`boards` ;
  53. CREATE TABLE IF NOT EXISTS `iotronic`.`boards` (
  54. `created_at` DATETIME NULL DEFAULT NULL,
  55. `updated_at` DATETIME NULL DEFAULT NULL,
  56. `id` INT(11) NOT NULL AUTO_INCREMENT,
  57. `uuid` VARCHAR(36) NOT NULL,
  58. `code` VARCHAR(25) NOT NULL,
  59. `status` VARCHAR(15) NULL DEFAULT NULL,
  60. `name` VARCHAR(255) NULL DEFAULT NULL,
  61. `type` VARCHAR(255) NOT NULL,
  62. `agent` VARCHAR(255) NULL DEFAULT NULL,
  63. `owner` VARCHAR(36) NOT NULL,
  64. `project` VARCHAR(36) NOT NULL,
  65. `mobile` TINYINT(1) NOT NULL DEFAULT '0',
  66. `config` TEXT NULL DEFAULT NULL,
  67. `extra` TEXT NULL DEFAULT NULL,
  68. PRIMARY KEY (`id`),
  69. UNIQUE INDEX `uuid` (`uuid` ASC),
  70. UNIQUE INDEX `code` (`code` ASC))
  71. ENGINE = InnoDB
  72. AUTO_INCREMENT = 132
  73. DEFAULT CHARACTER SET = utf8;
  74. -- -----------------------------------------------------
  75. -- Table `iotronic`.`locations`
  76. -- -----------------------------------------------------
  77. DROP TABLE IF EXISTS `iotronic`.`locations` ;
  78. CREATE TABLE IF NOT EXISTS `iotronic`.`locations` (
  79. `created_at` DATETIME NULL DEFAULT NULL,
  80. `updated_at` DATETIME NULL DEFAULT NULL,
  81. `id` INT(11) NOT NULL AUTO_INCREMENT,
  82. `longitude` VARCHAR(18) NULL DEFAULT NULL,
  83. `latitude` VARCHAR(18) NULL DEFAULT NULL,
  84. `altitude` VARCHAR(18) NULL DEFAULT NULL,
  85. `board_id` INT(11) NOT NULL,
  86. PRIMARY KEY (`id`),
  87. INDEX `board_id` (`board_id` ASC),
  88. CONSTRAINT `location_ibfk_1`
  89. FOREIGN KEY (`board_id`)
  90. REFERENCES `iotronic`.`boards` (`id`)
  91. ON DELETE CASCADE
  92. ON UPDATE CASCADE)
  93. ENGINE = InnoDB
  94. AUTO_INCREMENT = 6
  95. DEFAULT CHARACTER SET = utf8;
  96. -- -----------------------------------------------------
  97. -- Table `iotronic`.`sessions`
  98. -- -----------------------------------------------------
  99. DROP TABLE IF EXISTS `iotronic`.`sessions` ;
  100. CREATE TABLE IF NOT EXISTS `iotronic`.`sessions` (
  101. `created_at` DATETIME NULL DEFAULT NULL,
  102. `updated_at` DATETIME NULL DEFAULT NULL,
  103. `id` INT(11) NOT NULL AUTO_INCREMENT,
  104. `valid` TINYINT(1) NOT NULL DEFAULT '1',
  105. `session_id` VARCHAR(18) NOT NULL,
  106. `board_uuid` VARCHAR(36) NOT NULL,
  107. `board_id` INT(11) NOT NULL,
  108. PRIMARY KEY (`id`),
  109. UNIQUE INDEX `session_id` (`session_id` ASC),
  110. INDEX `session_board_id` (`board_id` ASC),
  111. CONSTRAINT `session_board_id`
  112. FOREIGN KEY (`board_id`)
  113. REFERENCES `iotronic`.`boards` (`id`)
  114. ON DELETE CASCADE
  115. ON UPDATE CASCADE)
  116. ENGINE = InnoDB
  117. AUTO_INCREMENT = 10
  118. DEFAULT CHARACTER SET = utf8;
  119. -- -----------------------------------------------------
  120. -- Table `iotronic`.`services`
  121. -- -----------------------------------------------------
  122. DROP TABLE IF EXISTS `iotronic`.`services` ;
  123. CREATE TABLE IF NOT EXISTS `iotronic`.`services` (
  124. `created_at` DATETIME NULL DEFAULT NULL,
  125. `updated_at` DATETIME NULL DEFAULT NULL,
  126. `id` INT(11) NOT NULL AUTO_INCREMENT,
  127. `uuid` VARCHAR(36) NOT NULL,
  128. `name` VARCHAR(255) NULL DEFAULT NULL,
  129. `port` INT(5) NOT NULL,
  130. `project` VARCHAR(36) NOT NULL,
  131. `protocol` VARCHAR(3) NOT NULL,
  132. `extra` TEXT NULL DEFAULT NULL,
  133. PRIMARY KEY (`id`),
  134. UNIQUE INDEX `uuid` (`uuid` ASC))
  135. ENGINE = InnoDB
  136. AUTO_INCREMENT = 132
  137. DEFAULT CHARACTER SET = utf8;
  138. -- -----------------------------------------------------
  139. -- Table `iotronic`.`exposed_services`
  140. -- -----------------------------------------------------
  141. DROP TABLE IF EXISTS `iotronic`.`exposed_services` ;
  142. CREATE TABLE IF NOT EXISTS `iotronic`.`exposed_services` (
  143. `created_at` DATETIME NULL DEFAULT NULL,
  144. `updated_at` DATETIME NULL DEFAULT NULL,
  145. `id` INT(11) NOT NULL AUTO_INCREMENT,
  146. `board_uuid` VARCHAR(36) NOT NULL,
  147. `service_uuid` VARCHAR(36) NOT NULL,
  148. `public_port` INT(5) NOT NULL,
  149. PRIMARY KEY (`id`),
  150. INDEX `board_uuid` (`board_uuid` ASC),
  151. CONSTRAINT `fk_board_uuid`
  152. FOREIGN KEY (`board_uuid`)
  153. REFERENCES `iotronic`.`boards` (`uuid`)
  154. ON DELETE CASCADE
  155. ON UPDATE CASCADE,
  156. INDEX `service_uuid` (`service_uuid` ASC),
  157. CONSTRAINT `service_uuid`
  158. FOREIGN KEY (`service_uuid`)
  159. REFERENCES `iotronic`.`services` (`uuid`)
  160. ON DELETE CASCADE
  161. ON UPDATE CASCADE)
  162. ENGINE = InnoDB
  163. AUTO_INCREMENT = 132
  164. DEFAULT CHARACTER SET = utf8;
  165. SET SQL_MODE=@OLD_SQL_MODE;
  166. SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
  167. SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
  168. -- insert testing boards
  169. INSERT INTO `boards` VALUES
  170. ('2017-02-20 10:38:26',NULL,'','f3961f7a-c937-4359-8848-fb64aa8eeaaa','12345','registered','laptop-14','server',NULL,'eee383360cc14c44b9bf21e1e003a4f3','4adfe95d49ad41398e00ecda80257d21',0,'{}','{}'),
  171. ('2017-02-20 10:38:45',NULL,'','e9bee8d9-7270-5323-d3e9-9875ba9c5753','yunyun','registered','yun-22','yun',NULL,'13ae14174aa1424688a75253ef814261','3c1e2e2c4bac40da9b4b1d694da6e2a1',0,'{}','{}'),
  172. ('2017-02-20 10:38:45',NULL,'','96b69f1f-0188-48cc-abdc-d10674144c68','567','registered','yun-30','yun',NULL,'13ae14174aa1424688a75253ef814261','3c1e2e2c4bac40da9b4b1d694da6e2a1',0,'{}','{}'),
  173. ('2017-02-20 10:39:08',NULL,'','65f9db36-9786-4803-b66f-51dcdb60066e','test','registered','test','server',NULL,'eee383360cc14c44b9bf21e1e003a4f3','4adfe95d49ad41398e00ecda80257d21',0,'{}','{}');
  174. INSERT INTO `locations` VALUES
  175. ('2017-02-20 10:38:26',NULL,'','2','1','3',132),
  176. ('2017-02-20 10:38:45',NULL,'','15.5966863','38.2597708','70',133),
  177. ('2017-02-20 10:38:45',NULL,'','15.5948288','38.259486','18',134),
  178. ('2017-02-20 10:39:08',NULL,'','2','1','3',135);
  179. # INSERT INTO `plugins` VALUES
  180. # ('2017-02-20 10:38:26',NULL,132,'edff22cd-9148-4ad8-b35b-51dcdb60066e','runner','0','V# Copyright 2017 MDSLAB - University of Messina\u000a# All Rights Reserved.\u000a#\u000a# Licensed under the Apache License, Version 2.0 (the "License"); you may\u000a# not use this file except in compliance with the License. You may obtain\u000a# a copy of the License at\u000a#\u000a# http://www.apache.org/licenses/LICENSE-2.0\u000a#\u000a# Unless required by applicable law or agreed to in writing, software\u000a# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\u000a# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\u000a# License for the specific language governing permissions and limitations\u000a# under the License.\u000a\u000afrom iotronic_lightningrod.plugins import Plugin\u000a\u000afrom oslo_log import log as logging\u000aLOG = logging.getLogger(__name__)\u000a\u000a# User imports\u000aimport time\u000a\u000a\u000a\u000aclass Worker(Plugin.Plugin):\u000a def __init__(self, name, th_result, plugin_conf=None):\u000a super(Worker, self).__init__(name, th_result, plugin_conf)\u000a\u000a def run(self):\u000a LOG.info("Plugin " + self.name + " starting...")\u000a while(self._is_running):\u000a print(self.plugin_conf[''message''])\u000a time.sleep(1) \u000a
  181. # p1
  182. # .',0,'{}','eee383360cc14c44b9bf21e1e003a4f3')
  183. # ('2017-02-20 10:38:26',NULL,133,'edff22cd-9148-4ad8-b35b-c0c80abf1e8a','zero','0','Vfrom iotronic_lightningrod.plugins import Plugin\u000a\u000afrom oslo_log import log as logging\u000a\u000aLOG = logging.getLogger(__name__)\u000a\u000a\u000a# User imports\u000a\u000a\u000aclass Worker(Plugin.Plugin):\u000a def __init__(self, name, is_running):\u000a super(Worker, self).__init__(name, is_running)\u000a\u000a def run(self):\u000a LOG.info("Plugin process completed!")\u000a #self.Done()
  184. # p1
  185. # .',1,'{}','eee383360cc14c44b9bf21e1e003a4f3');