-
Notifications
You must be signed in to change notification settings - Fork 4
/
schema.sql
328 lines (264 loc) · 10.5 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
-- Host: localhost
-- Generation Time: May 23, 2018 at 10:03 AM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 7.2.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `synet`
--
-- --------------------------------------------------------
--
-- Table structure for table `mikrotik`
--
CREATE TABLE `mikrotik` (
`id` int(11) NOT NULL,
`id_contrato` int(11) NOT NULL,
`usuario` varchar(64) NOT NULL,
`senha` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Login para equipamento se conectar no servidor.';
-- --------------------------------------------------------
--
-- Table structure for table `mikrotik_historico_acesso`
--
CREATE TABLE `mikrotik_historico_acesso` (
`id` int(11) NOT NULL,
`contrato_id` int(11) NOT NULL COMMENT 'relaciona com tabela contrato - opicional',
`data_registro` datetime NOT NULL,
`user` varchar(32) NOT NULL,
`passwd` varchar(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Registra o historico de usuario e senhas da tabela mikrotik.';
-- --------------------------------------------------------
--
-- Table structure for table `mikrotik_ip-arp`
--
CREATE TABLE `mikrotik_ip-arp` (
`id` int(10) NOT NULL,
`ip` varchar(128) NOT NULL,
`mac` varchar(32) NOT NULL,
`interface` varchar(256) NOT NULL,
`server_id` int(10) NOT NULL,
`published` varchar(5) NOT NULL,
`disabled` varchar(5) NOT NULL,
`comment` varchar(256) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='vincula mac a um ip no mikrotik';
-- --------------------------------------------------------
--
-- Table structure for table `mikrotik_ping`
--
CREATE TABLE `mikrotik_ping` (
`id` int(11) NOT NULL,
`serverid` int(6) NOT NULL,
`contratoid` int(11) NOT NULL,
`protocoloid` int(11) NOT NULL,
`ip_client` varchar(32) NOT NULL,
`size` varchar(32) NOT NULL,
`time` varchar(32) NOT NULL,
`ttl` varchar(32) NOT NULL,
`date_time` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='grava historico de pings feito no servidor mk via sistema.';
-- --------------------------------------------------------
--
-- Table structure for table `mikrotik_planos`
--
CREATE TABLE `mikrotik_planos` (
`id` int(11) UNSIGNED NOT NULL,
`plan_id` int(10) NOT NULL COMMENT 'relaciona com a tabela plano - opicional',
`max_limit` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '70K/70K',
`burst_limit` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0K/0K',
`burst_threshold` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0K/0K',
`burst_time` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0s/0s',
`time` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`priority` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '8/8'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='clone da tabela `radgroupreply` no banco radius';
-- --------------------------------------------------------
--
-- Table structure for table `servidor`
--
CREATE TABLE `servidor` (
`id` int(11) NOT NULL,
`empresa` int(11) NOT NULL,
`nome_servidor` varchar(155) DEFAULT NULL,
`servidor_tipo` int(6) NOT NULL COMMENT 'relaciona com a tabela servidor_tipo - opicional',
`ip_servidor` varchar(45) DEFAULT NULL,
`usuario` varchar(50) NOT NULL,
`autenticacao` varchar(255) NOT NULL,
`timestamp` varchar(255) DEFAULT NULL,
`id_torre` int(11) NOT NULL,
`notas` varchar(255) DEFAULT NULL,
`ativo` tinyint(1) NOT NULL COMMENT '1 = ativo - 0 = inativo'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `servidor_services`
--
CREATE TABLE `servidor_services` (
`id` int(10) NOT NULL,
`server_id` int(10) NOT NULL COMMENT 'ID do servidor',
`service_status` tinyint(1) NOT NULL COMMENT 'ativo ou inativo',
`service_name` enum('api','api-ssl','ftp','ssh','telnet','winbox','www','www-ssl') NOT NULL,
`service_port` int(5) NOT NULL,
`service_available_from` varchar(255) NOT NULL COMMENT 'IPs serao gravados separados por virgula',
`service_certificate` text NOT NULL COMMENT 'armazena a chave ou o path para chave'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='guarda os servicos do servidor - usado para mikrotik apenas';
--
-- SAMPLE DATA
--
--
-- Dumping data for table `mikrotik`
--
INSERT INTO `mikrotik` (`id`, `id_contrato`, `usuario`, `senha`) VALUES
(1, 1804, 'AwQ3ytPrgECZuTy', '95f8bb484de09fcddb1faaf6f656674a'),
(2, 4713, 'NJuWytPCLpCZuDB', '65e6e6bc1997c131728a3f414254456a'),
(3, 6052, 'nzIsDZCQ7Skdg27', '23c124e1d2d4138ca5993a80ec9bc301');
--
-- Dumping data for table `mikrotik_historico_acesso`
--
INSERT INTO `mikrotik_historico_acesso` (`id`, `contrato_id`, `data_registro`, `user`, `passwd`) VALUES
(1, 1275, '2017-02-12 10:23:45', 'e1a7sd3w8ui0t', '95f8bb484de09fcddb1faaf6f656674a'),
(2, 2240, '2017-02-15 09:34:50', 'kQPodH1hPdw4sn', '3f673385838685951ba6e53585136463'),
(3, 2438, '2017-03-25 11:13:45', '82ahbBp04BkTY', '5b18cebd7b40c24301c86267df36ed8d');
--
-- Dumping data for table `mikrotik_ip-arp`
-- column `comment` can be used to point the ID (Transceiver or Client)
--
INSERT INTO `mikrotik_ip-arp` (`id`, `ip`, `mac`, `interface`, `server_id`, `published`, `disabled`, `comment`) VALUES
(1, '10.1.211.2', '00:0e:2e:de:57:76', 'bridge1-clientes', 1, 'false', 'false', 'ID DO EQUIPAMENTO CASO DE CLIENT'),
(2, '11.11.11.6', '00:02:38:12:24:6b', 'Teste-Interface', 2, 'false', 'false', 'ID DO EQUIPAMENTO CASO DE TRANSCEIVER');
--
-- Dumping data for table `mikrotik_ping`
--
INSERT INTO `mikrotik_ping` (`id`, `serverid`, `contratoid`, `protocoloid`, `ip_client`, `size`, `time`, `ttl`, `date_time`) VALUES
(1, 1, 1804, 0, '10.0.30.2', '56', '524ms', '255', '2017-09-25 23:01:33'),
(2, 2, 4713, 0, '10.0.30.2', '56', '412ms', '255', '2017-09-27 23:23:50'),
(3, 3, 6052, 824581, '10.0.22.2', '56', '7ms', '255', '2017-10-05 01:34:23');
--
-- Dumping data for table `mikrotik_planos`
--
INSERT INTO `mikrotik_planos` (`id`, `plan_id`, `max_limit`, `burst_limit`, `burst_threshold`, `burst_time`, `time`, `priority`) VALUES
(1, 10, '250K/250K', '400K/750K', '300K/500K', '60', '0h-1d,sun,mon,tue,wed,thu,fri,sat', '7/7'),
(2, 20, '80K/200K', '240K/999K', '400K/600K', '60/60', '0h-1d,sun,mon,tue,wed,thu,fri,sat', '7/7'),
(3, 30, '512K/1024K', '1280K/2560K', '896K/1792K', '60/60', NULL, '7/7'),
(4, 40, '400K/1M', '500K/3M', '450K/2M', '60/60', NULL, '7/7');
--
-- Dumping data for table `servidor`
-- servidor_tipo 1 = Mikrotik, 2 = BFW, 3 = ???, ..
--
INSERT INTO `servidor` (`id`, `empresa`, `nome_servidor`, `servidor_tipo`, `ip_servidor`, `usuario`, `autenticacao`, `timestamp`, `id_torre`, `notas`, `ativo`) VALUES
(1, 1, 'NET-CITY1-MI62', 1, '192.168.100.25', 'userapi', 'u/ndjfhtyHehs22b5ghgy0Og==', '1462235907', 1, 'MK para testes', 1),
(2, 1, 'NET-CITY2-MI62', 1, '192.168.100.24', 'userapi', '4lfjghtuyrhdgo2HX/X5i0rE8MMbsN5XVCnngSSAVfg=', '1462208886', 2, 'Seu comentario aqui', 1),
(3, 1, 'NET-CITY3-MI62', 1, '192.168.100.23', 'userapi', 'ui5P+4gkyu+BJF2k47ecVg==', '1458530493', 3, 'Seu comentario aqui', 1);
--
-- Dumping data for table `servidor_services`
--
INSERT INTO `servidor_services` (`id`, `server_id`, `service_status`, `service_name`, `service_port`, `service_available_from`, `service_certificate`) VALUES
(1, 4, 1, 'api', 8728, '', ''),
(2, 4, 1, 'winbox', 8291, '192.168.1.1,192.168.2.1,192.168.3.1,192.168.4.1,192.168.0.0/24', ''),
(3, 4, 1, 'www', 8080, '192.168.1.1,192.168.2.1,192.168.3.1,192.168.4.1,192.168.0.0/24', ''),
(5, 4, 1, 'api-ssl', 8729, '', ''),
(6, 4, 1, 'ftp', 21, '', ''),
(7, 4, 1, 'ssh', 22, '', ''),
(8, 4, 1, 'telnet', 23, '', ''),
(9, 4, 1, 'www-ssl', 443, '', ''),
(10, 5, 1, 'api', 8728, '', ''),
(11, 5, 1, 'winbox', 8291, '192.168.1.1,192.168.2.1,192.168.3.1,192.168.4.1,192.168.0.0/24', ''),
(12, 5, 1, 'www', 8080, '192.168.1.1,192.168.2.1,192.168.3.1,192.168.4.1,192.168.0.0/24', ''),
(13, 5, 0, 'api-ssl', 0, '', ''),
(14, 5, 0, 'ftp', 0, '', ''),
(15, 5, 0, 'ssh', 0, '', ''),
(16, 5, 0, 'telnet', 0, '', ''),
(17, 5, 0, 'www-ssl', 0, '', '');
--
-- Change datetime to use current_timestamp in case the system
-- not passing the current date as parameter.
--
ALTER TABLE `mikrotik_ping`
CHANGE `date_time` `date_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `mikrotik`
--
ALTER TABLE `mikrotik`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_1` (`id_contrato`);
--
-- Indexes for table `mikrotik_historico_acesso`
--
ALTER TABLE `mikrotik_historico_acesso`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_1` (`contrato_id`);
--
-- Indexes for table `mikrotik_ip-arp`
--
ALTER TABLE `mikrotik_ip-arp`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `mikrotik_ping`
--
ALTER TABLE `mikrotik_ping`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `mikrotik_planos`
--
ALTER TABLE `mikrotik_planos`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `servidor`
--
ALTER TABLE `servidor`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `servidor_services`
--
ALTER TABLE `servidor_services`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `mikrotik`
--
ALTER TABLE `mikrotik`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `mikrotik_historico_acesso`
--
ALTER TABLE `mikrotik_historico_acesso`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `mikrotik_ip-arp`
--
ALTER TABLE `mikrotik_ip-arp`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `mikrotik_ping`
--
ALTER TABLE `mikrotik_ping`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `mikrotik_planos`
--
ALTER TABLE `mikrotik_planos`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `servidor`
--
ALTER TABLE `servidor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `servidor_services`
--
ALTER TABLE `servidor_services`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;