blob: 9412adf2857717466f724d83de05dc9fc83c13b8 [file] [log] [blame]
econwar8ef486f2018-08-31 11:36:11 +00001CREATE TABLE FEEDS (
2 FEEDID INT UNSIGNED NOT NULL PRIMARY KEY,
3 GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
4 NAME VARCHAR(255) NOT NULL,
5 VERSION VARCHAR(20) NOT NULL,
6 DESCRIPTION VARCHAR(1000),
7 BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL,
8 AUTH_CLASS VARCHAR(32) NOT NULL,
9 PUBLISHER VARCHAR(8) NOT NULL,
10 SELF_LINK VARCHAR(256),
11 PUBLISH_LINK VARCHAR(256),
12 SUBSCRIBE_LINK VARCHAR(256),
13 LOG_LINK VARCHAR(256),
14 DELETED BOOLEAN DEFAULT FALSE,
15 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
16 SUSPENDED BOOLEAN DEFAULT FALSE,
17 CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
18);
19
20CREATE TABLE FEED_ENDPOINT_IDS (
21 FEEDID INT UNSIGNED NOT NULL,
22 USERID VARCHAR(20) NOT NULL,
23 PASSWORD VARCHAR(32) NOT NULL
24);
25
26CREATE TABLE FEED_ENDPOINT_ADDRS (
27 FEEDID INT UNSIGNED NOT NULL,
28 ADDR VARCHAR(44) NOT NULL
29);
30
31CREATE TABLE SUBSCRIPTIONS (
econwarc5037472019-02-14 09:37:44 +000032 SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
33 FEEDID INT UNSIGNED NOT NULL,
34 GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
35 DELIVERY_URL VARCHAR(256),
36 DELIVERY_USER VARCHAR(20),
37 DELIVERY_PASSWORD VARCHAR(32),
38 DELIVERY_USE100 BOOLEAN DEFAULT FALSE,
39 METADATA_ONLY BOOLEAN DEFAULT FALSE,
40 SUBSCRIBER VARCHAR(8) NOT NULL,
41 SELF_LINK VARCHAR(256),
42 LOG_LINK VARCHAR(256),
43 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
44 SUSPENDED BOOLEAN DEFAULT FALSE,
45 PRIVILEGED_SUBSCRIBER BOOLEAN DEFAULT FALSE,
edepaul58553dd2019-03-13 11:54:41 +000046 DECOMPRESS BOOLEAN DEFAULT FALSE,
econwarc5037472019-02-14 09:37:44 +000047 CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
econwar8ef486f2018-08-31 11:36:11 +000048
49);
50
51CREATE TABLE PARAMETERS (
52 KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY,
53 VALUE VARCHAR(4096) NOT NULL
54);
55
56CREATE TABLE LOG_RECORDS (
57 TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL,
58 EVENT_TIME BIGINT NOT NULL, /* time of the publish request */
59 PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */
60 FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */
61 REQURI VARCHAR(256) NOT NULL, /* request URI */
62 METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */
63 CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */
64 CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */
65
66 FEED_FILEID VARCHAR(256), /* file ID of published file */
67 REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */
68 USER VARCHAR(50), /* user name of publishing endpoint */
69 STATUS SMALLINT, /* status code returned to delivering agent */
70
71 DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */
72 DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */
73 RESULT SMALLINT, /* result received from subscribing agent */
74
75 ATTEMPTS INT, /* deliveries attempted */
76 REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'),
77
78 RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */
79 CONTENT_LENGTH_2 BIGINT,
EmmettCox5da50e92019-02-05 16:16:40 +000080 FILENAME VARCHAR(256), /* Name of the file being published on DR */
econwar8ef486f2018-08-31 11:36:11 +000081
82 INDEX (FEEDID) USING BTREE,
83 INDEX (DELIVERY_SUBID) USING BTREE,
84 INDEX (RECORD_ID) USING BTREE
85) ENGINE = MyISAM;
86
87CREATE TABLE INGRESS_ROUTES (
88 SEQUENCE INT UNSIGNED NOT NULL,
89 FEEDID INT UNSIGNED NOT NULL,
90 USERID VARCHAR(20),
91 SUBNET VARCHAR(44),
92 NODESET INT UNSIGNED NOT NULL
93);
94
95CREATE TABLE EGRESS_ROUTES (
96 SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
97 NODEID INT UNSIGNED NOT NULL
98);
99
100CREATE TABLE NETWORK_ROUTES (
101 FROMNODE INT UNSIGNED NOT NULL,
102 TONODE INT UNSIGNED NOT NULL,
103 VIANODE INT UNSIGNED NOT NULL
104);
105
106CREATE TABLE NODESETS (
107 SETID INT UNSIGNED NOT NULL,
108 NODEID INT UNSIGNED NOT NULL
109);
110
111CREATE TABLE NODES (
112 NODEID INT UNSIGNED NOT NULL PRIMARY KEY,
113 NAME VARCHAR(255) NOT NULL,
114 ACTIVE BOOLEAN DEFAULT TRUE
115);
116
117CREATE TABLE GROUPS (
118 GROUPID INT UNSIGNED NOT NULL PRIMARY KEY,
119 AUTHID VARCHAR(100) NOT NULL,
120 NAME VARCHAR(50) NOT NULL,
121 DESCRIPTION VARCHAR(255),
122 CLASSIFICATION VARCHAR(20) NOT NULL,
123 MEMBERS TINYTEXT,
124 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP
125);
126
127INSERT INTO PARAMETERS VALUES
128 ('ACTIVE_POD', 'dmaap-dr-prov'),
129 ('PROV_ACTIVE_NAME', 'dmaap-dr-prov'),
130 ('STANDBY_POD', ''),
131 ('PROV_NAME', 'dmaap-dr-prov'),
132 ('NODES', 'dmaap-dr-node'),
133 ('PROV_DOMAIN', ''),
134 ('DELIVERY_INIT_RETRY_INTERVAL', '10'),
135 ('DELIVERY_MAX_AGE', '86400'),
136 ('DELIVERY_MAX_RETRY_INTERVAL', '3600'),
econwarc5037472019-02-14 09:37:44 +0000137 ('DELIVERY_FILE_PROCESS_INTERVAL', '600'),
econwar8ef486f2018-08-31 11:36:11 +0000138 ('DELIVERY_RETRY_RATIO', '2'),
139 ('LOGROLL_INTERVAL', '300'),
140 ('PROV_AUTH_ADDRESSES', 'dmaap-dr-prov|dmaap-dr-node'),
141 ('PROV_AUTH_SUBJECTS', ''),
142 ('PROV_MAXFEED_COUNT', '10000'),
143 ('PROV_MAXSUB_COUNT', '100000'),
144 ('PROV_REQUIRE_CERT', 'false'),
econward3c00d22018-08-31 14:48:53 +0000145 ('PROV_REQUIRE_SECURE', 'true'),
econwarc5037472019-02-14 09:37:44 +0000146 ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE|DELIVERY_FILE_PROCESS_INTERVAL')
econwar8ef486f2018-08-31 11:36:11 +0000147 ;
148
149INSERT INTO GROUPS(GROUPID, AUTHID, NAME, DESCRIPTION, CLASSIFICATION, MEMBERS)
150VALUES (1, 'Basic dXNlcjE6cGFzc3dvcmQx', 'Group1', 'First Group for testing', 'Class1', 'Member1');
esobmarc2d7dbe2018-09-03 14:58:01 +0100151
edepaul58553dd2019-03-13 11:54:41 +0000152INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER, DECOMPRESS)
153VALUES (1, 1, 'https://172.100.0.5:8080', 'user1', 'password1', true, false, 'user1', false, 1, false, false);
econwar7f93b3d2018-09-03 09:24:00 +0000154
esobmarc2d7dbe2018-09-03 14:58:01 +0100155INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK)
156VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink');
Emmett Cox096e9772018-09-03 11:43:13 +0100157
Emmett Cox5cbbe742018-09-05 10:33:05 +0100158INSERT INTO FEED_ENDPOINT_IDS(FEEDID, USERID, PASSWORD)
159VALUES (1, 'USER', 'PASSWORD');
160
EmmettCox51f0b1c2019-03-22 17:19:56 +0000161INSERT INTO FEED_ENDPOINT_ADDRS(FEEDID, ADDR)
162VALUES (1, '172.0.0.1');
163
Emmett Cox096e9772018-09-03 11:43:13 +0100164INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK)
165VALUES (1, 1,'Feed1','v0.1', 'First Feed for testing', 'First Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link');
166
167insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET)
168VALUES (1,1,'user',null,2);
169
170insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET)
171VALUES (2,1,'user',null,2);
172
173insert into NODESETS(SETID, NODEID)
esobmar8f2e78c2018-09-07 16:39:17 +0100174VALUES (2,2);
Emmett Cox1d971022018-09-06 13:58:27 +0100175
EmmettCoxefa3dec2019-02-18 12:24:01 +0000176insert into LOG_RECORDS(RECORD_ID,TYPE,EVENT_TIME,PUBLISH_ID,FEEDID,REQURI,METHOD,CONTENT_TYPE,CONTENT_LENGTH,FEED_FILEID,REMOTE_ADDR,USER,STATUS,DELIVERY_SUBID,DELIVERY_FILEID,RESULT,ATTEMPTS,REASON,FILENAME)
177VALUES(1,'pub',2536159564422,'ID',1,'URL/file123','PUT','application/vnd.dmaap-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other','file123');
Emmett Cox1d971022018-09-06 13:58:27 +0100178
179CREATE ALIAS IF NOT EXISTS `SUBSTRING_INDEX` AS $$
180 String Function(String one, String two, String three){
181 return "url";
182 }
esobmar8f2e78c2018-09-07 16:39:17 +0100183$$;
184
185insert into NETWORK_ROUTES(FROMNODE, TONODE, VIANODE)
186VALUES (1, 3, 2);
187
188insert into NODES(NODEID, NAME) values
189 (1, 'stub_from.'),
190 (2, 'stub_via.'),
191 (3, 'stub_to.'),
192 (4, 'node01.'),
193 (5, 'node02.'),
194 (6, 'node03.')
195;
196insert into EGRESS_ROUTES(SUBID, NODEID) values (1, 1);
197