econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 1 | CREATE TABLE FEEDS ( |
| 2 | FEEDID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 3 | GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
efiacor | 0fa0198 | 2019-04-08 14:52:08 +0000 | [diff] [blame^] | 4 | NAME VARCHAR(256) NOT NULL, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 5 | VERSION VARCHAR(20) NULL, |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 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, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 17 | CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| 18 | AAF_INSTANCE VARCHAR(256) |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 19 | ); |
| 20 | |
| 21 | CREATE TABLE FEED_ENDPOINT_IDS ( |
| 22 | FEEDID INT UNSIGNED NOT NULL, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 23 | USERID VARCHAR(60) NOT NULL, |
| 24 | PASSWORD VARCHAR(100) NOT NULL |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 25 | ); |
| 26 | |
| 27 | CREATE TABLE FEED_ENDPOINT_ADDRS ( |
| 28 | FEEDID INT UNSIGNED NOT NULL, |
| 29 | ADDR VARCHAR(44) NOT NULL |
| 30 | ); |
| 31 | |
| 32 | CREATE TABLE SUBSCRIPTIONS ( |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 33 | SUBID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 34 | FEEDID INT UNSIGNED NOT NULL, |
| 35 | GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, |
| 36 | DELIVERY_URL VARCHAR(256), |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 37 | FOLLOW_REDIRECTS TINYINT(1) NOT NULL DEFAULT 0, |
| 38 | DELIVERY_USER VARCHAR(60), |
| 39 | DELIVERY_PASSWORD VARCHAR(100), |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 40 | DELIVERY_USE100 BOOLEAN DEFAULT FALSE, |
| 41 | METADATA_ONLY BOOLEAN DEFAULT FALSE, |
| 42 | SUBSCRIBER VARCHAR(8) NOT NULL, |
| 43 | SELF_LINK VARCHAR(256), |
| 44 | LOG_LINK VARCHAR(256), |
| 45 | LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
| 46 | SUSPENDED BOOLEAN DEFAULT FALSE, |
| 47 | PRIVILEGED_SUBSCRIBER BOOLEAN DEFAULT FALSE, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 48 | CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
edepaul | 58553dd | 2019-03-13 11:54:41 +0000 | [diff] [blame] | 49 | DECOMPRESS BOOLEAN DEFAULT FALSE, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 50 | AAF_INSTANCE VARCHAR(256) |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 51 | |
| 52 | ); |
| 53 | |
| 54 | CREATE TABLE PARAMETERS ( |
| 55 | KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY, |
| 56 | VALUE VARCHAR(4096) NOT NULL |
| 57 | ); |
| 58 | |
| 59 | CREATE TABLE LOG_RECORDS ( |
| 60 | TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL, |
| 61 | EVENT_TIME BIGINT NOT NULL, /* time of the publish request */ |
| 62 | PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */ |
| 63 | FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */ |
| 64 | REQURI VARCHAR(256) NOT NULL, /* request URI */ |
| 65 | METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */ |
| 66 | CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */ |
| 67 | CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */ |
| 68 | |
| 69 | FEED_FILEID VARCHAR(256), /* file ID of published file */ |
| 70 | REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */ |
| 71 | USER VARCHAR(50), /* user name of publishing endpoint */ |
| 72 | STATUS SMALLINT, /* status code returned to delivering agent */ |
| 73 | |
| 74 | DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */ |
| 75 | DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */ |
| 76 | RESULT SMALLINT, /* result received from subscribing agent */ |
| 77 | |
| 78 | ATTEMPTS INT, /* deliveries attempted */ |
| 79 | REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'), |
| 80 | |
| 81 | RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */ |
| 82 | CONTENT_LENGTH_2 BIGINT, |
EmmettCox | 5da50e9 | 2019-02-05 16:16:40 +0000 | [diff] [blame] | 83 | FILENAME VARCHAR(256), /* Name of the file being published on DR */ |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 84 | |
| 85 | INDEX (FEEDID) USING BTREE, |
| 86 | INDEX (DELIVERY_SUBID) USING BTREE, |
| 87 | INDEX (RECORD_ID) USING BTREE |
| 88 | ) ENGINE = MyISAM; |
| 89 | |
| 90 | CREATE TABLE INGRESS_ROUTES ( |
| 91 | SEQUENCE INT UNSIGNED NOT NULL, |
| 92 | FEEDID INT UNSIGNED NOT NULL, |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 93 | USERID VARCHAR(50), |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 94 | SUBNET VARCHAR(44), |
| 95 | NODESET INT UNSIGNED NOT NULL |
| 96 | ); |
| 97 | |
| 98 | CREATE TABLE EGRESS_ROUTES ( |
| 99 | SUBID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 100 | NODEID INT UNSIGNED NOT NULL |
| 101 | ); |
| 102 | |
| 103 | CREATE TABLE NETWORK_ROUTES ( |
| 104 | FROMNODE INT UNSIGNED NOT NULL, |
| 105 | TONODE INT UNSIGNED NOT NULL, |
| 106 | VIANODE INT UNSIGNED NOT NULL |
| 107 | ); |
| 108 | |
| 109 | CREATE TABLE NODESETS ( |
| 110 | SETID INT UNSIGNED NOT NULL, |
| 111 | NODEID INT UNSIGNED NOT NULL |
| 112 | ); |
| 113 | |
| 114 | CREATE TABLE NODES ( |
| 115 | NODEID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 116 | NAME VARCHAR(255) NOT NULL, |
| 117 | ACTIVE BOOLEAN DEFAULT TRUE |
| 118 | ); |
| 119 | |
| 120 | CREATE TABLE GROUPS ( |
| 121 | GROUPID INT UNSIGNED NOT NULL PRIMARY KEY, |
| 122 | AUTHID VARCHAR(100) NOT NULL, |
| 123 | NAME VARCHAR(50) NOT NULL, |
| 124 | DESCRIPTION VARCHAR(255), |
| 125 | CLASSIFICATION VARCHAR(20) NOT NULL, |
| 126 | MEMBERS TINYTEXT, |
| 127 | LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
| 128 | ); |
| 129 | |
| 130 | INSERT INTO PARAMETERS VALUES |
| 131 | ('ACTIVE_POD', 'dmaap-dr-prov'), |
| 132 | ('PROV_ACTIVE_NAME', 'dmaap-dr-prov'), |
| 133 | ('STANDBY_POD', ''), |
| 134 | ('PROV_NAME', 'dmaap-dr-prov'), |
| 135 | ('NODES', 'dmaap-dr-node'), |
| 136 | ('PROV_DOMAIN', ''), |
| 137 | ('DELIVERY_INIT_RETRY_INTERVAL', '10'), |
| 138 | ('DELIVERY_MAX_AGE', '86400'), |
| 139 | ('DELIVERY_MAX_RETRY_INTERVAL', '3600'), |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 140 | ('DELIVERY_FILE_PROCESS_INTERVAL', '600'), |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 141 | ('DELIVERY_RETRY_RATIO', '2'), |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 142 | ('LOGROLL_INTERVAL', '30'), |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 143 | ('PROV_AUTH_ADDRESSES', 'dmaap-dr-prov|dmaap-dr-node'), |
| 144 | ('PROV_AUTH_SUBJECTS', ''), |
| 145 | ('PROV_MAXFEED_COUNT', '10000'), |
| 146 | ('PROV_MAXSUB_COUNT', '100000'), |
| 147 | ('PROV_REQUIRE_CERT', 'false'), |
econwar | d3c00d2 | 2018-08-31 14:48:53 +0000 | [diff] [blame] | 148 | ('PROV_REQUIRE_SECURE', 'true'), |
econwar | c503747 | 2019-02-14 09:37:44 +0000 | [diff] [blame] | 149 | ('_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') |
econwar | 8ef486f | 2018-08-31 11:36:11 +0000 | [diff] [blame] | 150 | ; |
| 151 | |
| 152 | INSERT INTO GROUPS(GROUPID, AUTHID, NAME, DESCRIPTION, CLASSIFICATION, MEMBERS) |
| 153 | VALUES (1, 'Basic dXNlcjE6cGFzc3dvcmQx', 'Group1', 'First Group for testing', 'Class1', 'Member1'); |
esobmar | c2d7dbe | 2018-09-03 14:58:01 +0100 | [diff] [blame] | 154 | |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 155 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER, AAF_INSTANCE, DECOMPRESS) |
| 156 | VALUES (1, 1, 'https://172.100.0.5:8080', 0, 'user1', 'password1', true, false, 'user1', false, 1, false, 'legacy', false); |
econwar | 7f93b3d | 2018-09-03 09:24:00 +0000 | [diff] [blame] | 157 | |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 158 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, AAF_INSTANCE) |
| 159 | VALUES (2, 1, 'https://172.100.0.5:8080', 0, 'user2', 'password2', true, true, 'subsc2', false, 1, '*'); |
| 160 | |
| 161 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, FOLLOW_REDIRECTS, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, AAF_INSTANCE) |
| 162 | VALUES (3, 1, 'https://172.100.0.5:8080', 0, 'user3', 'password3', true, true, 'subsc3', false, 1, '*'); |
| 163 | |
| 164 | INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK, AAF_INSTANCE) |
| 165 | VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink', 'legacy'); |
Emmett Cox | 096e977 | 2018-09-03 11:43:13 +0100 | [diff] [blame] | 166 | |
Emmett Cox | 5cbbe74 | 2018-09-05 10:33:05 +0100 | [diff] [blame] | 167 | INSERT INTO FEED_ENDPOINT_IDS(FEEDID, USERID, PASSWORD) |
| 168 | VALUES (1, 'USER', 'PASSWORD'); |
| 169 | |
EmmettCox | 51f0b1c | 2019-03-22 17:19:56 +0000 | [diff] [blame] | 170 | INSERT INTO FEED_ENDPOINT_ADDRS(FEEDID, ADDR) |
| 171 | VALUES (1, '172.0.0.1'); |
| 172 | |
Emmett Cox | 096e977 | 2018-09-03 11:43:13 +0100 | [diff] [blame] | 173 | INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK) |
| 174 | VALUES (1, 1,'Feed1','v0.1', 'First Feed for testing', 'First Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link'); |
| 175 | |
efiacor | 5775de7 | 2019-03-26 14:29:01 +0000 | [diff] [blame] | 176 | INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, AAF_INSTANCE) |
| 177 | VALUES (2, 1,'AafFeed','v0.1', 'AAF Feed for testing', 'AAF Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link','*'); |
| 178 | |
| 179 | INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK, AAF_INSTANCE) |
| 180 | VALUES (3, 1,'DeleteableAafFeed','v0.1', 'AAF Feed3 for testing', 'AAF Feed3 for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link','*'); |
| 181 | |
Emmett Cox | 096e977 | 2018-09-03 11:43:13 +0100 | [diff] [blame] | 182 | insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET) |
| 183 | VALUES (1,1,'user',null,2); |
| 184 | |
| 185 | insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET) |
| 186 | VALUES (2,1,'user',null,2); |
| 187 | |
| 188 | insert into NODESETS(SETID, NODEID) |
esobmar | 8f2e78c | 2018-09-07 16:39:17 +0100 | [diff] [blame] | 189 | VALUES (2,2); |
Emmett Cox | 1d97102 | 2018-09-06 13:58:27 +0100 | [diff] [blame] | 190 | |
EmmettCox | efa3dec | 2019-02-18 12:24:01 +0000 | [diff] [blame] | 191 | insert 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) |
| 192 | VALUES(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 Cox | 1d97102 | 2018-09-06 13:58:27 +0100 | [diff] [blame] | 193 | |
| 194 | CREATE ALIAS IF NOT EXISTS `SUBSTRING_INDEX` AS $$ |
| 195 | String Function(String one, String two, String three){ |
| 196 | return "url"; |
| 197 | } |
esobmar | 8f2e78c | 2018-09-07 16:39:17 +0100 | [diff] [blame] | 198 | $$; |
| 199 | |
| 200 | insert into NETWORK_ROUTES(FROMNODE, TONODE, VIANODE) |
| 201 | VALUES (1, 3, 2); |
| 202 | |
| 203 | insert into NODES(NODEID, NAME) values |
| 204 | (1, 'stub_from.'), |
| 205 | (2, 'stub_via.'), |
| 206 | (3, 'stub_to.'), |
| 207 | (4, 'node01.'), |
| 208 | (5, 'node02.'), |
| 209 | (6, 'node03.') |
| 210 | ; |
| 211 | insert into EGRESS_ROUTES(SUBID, NODEID) values (1, 1); |
| 212 | |