blob: b2906035e9220dfd13af1a3bfa2a91c8d3c32377 [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 (
32 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 CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
46
47);
48
49CREATE TABLE PARAMETERS (
50 KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY,
51 VALUE VARCHAR(4096) NOT NULL
52);
53
54CREATE TABLE LOG_RECORDS (
55 TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL,
56 EVENT_TIME BIGINT NOT NULL, /* time of the publish request */
57 PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */
58 FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */
59 REQURI VARCHAR(256) NOT NULL, /* request URI */
60 METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */
61 CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */
62 CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */
63
64 FEED_FILEID VARCHAR(256), /* file ID of published file */
65 REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */
66 USER VARCHAR(50), /* user name of publishing endpoint */
67 STATUS SMALLINT, /* status code returned to delivering agent */
68
69 DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */
70 DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */
71 RESULT SMALLINT, /* result received from subscribing agent */
72
73 ATTEMPTS INT, /* deliveries attempted */
74 REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'),
75
76 RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */
77 CONTENT_LENGTH_2 BIGINT,
EmmettCox5da50e92019-02-05 16:16:40 +000078 FILENAME VARCHAR(256), /* Name of the file being published on DR */
econwar8ef486f2018-08-31 11:36:11 +000079
80 INDEX (FEEDID) USING BTREE,
81 INDEX (DELIVERY_SUBID) USING BTREE,
82 INDEX (RECORD_ID) USING BTREE
83) ENGINE = MyISAM;
84
85CREATE TABLE INGRESS_ROUTES (
86 SEQUENCE INT UNSIGNED NOT NULL,
87 FEEDID INT UNSIGNED NOT NULL,
88 USERID VARCHAR(20),
89 SUBNET VARCHAR(44),
90 NODESET INT UNSIGNED NOT NULL
91);
92
93CREATE TABLE EGRESS_ROUTES (
94 SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
95 NODEID INT UNSIGNED NOT NULL
96);
97
98CREATE TABLE NETWORK_ROUTES (
99 FROMNODE INT UNSIGNED NOT NULL,
100 TONODE INT UNSIGNED NOT NULL,
101 VIANODE INT UNSIGNED NOT NULL
102);
103
104CREATE TABLE NODESETS (
105 SETID INT UNSIGNED NOT NULL,
106 NODEID INT UNSIGNED NOT NULL
107);
108
109CREATE TABLE NODES (
110 NODEID INT UNSIGNED NOT NULL PRIMARY KEY,
111 NAME VARCHAR(255) NOT NULL,
112 ACTIVE BOOLEAN DEFAULT TRUE
113);
114
115CREATE TABLE GROUPS (
116 GROUPID INT UNSIGNED NOT NULL PRIMARY KEY,
117 AUTHID VARCHAR(100) NOT NULL,
118 NAME VARCHAR(50) NOT NULL,
119 DESCRIPTION VARCHAR(255),
120 CLASSIFICATION VARCHAR(20) NOT NULL,
121 MEMBERS TINYTEXT,
122 LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP
123);
124
125INSERT INTO PARAMETERS VALUES
126 ('ACTIVE_POD', 'dmaap-dr-prov'),
127 ('PROV_ACTIVE_NAME', 'dmaap-dr-prov'),
128 ('STANDBY_POD', ''),
129 ('PROV_NAME', 'dmaap-dr-prov'),
130 ('NODES', 'dmaap-dr-node'),
131 ('PROV_DOMAIN', ''),
132 ('DELIVERY_INIT_RETRY_INTERVAL', '10'),
133 ('DELIVERY_MAX_AGE', '86400'),
134 ('DELIVERY_MAX_RETRY_INTERVAL', '3600'),
135 ('DELIVERY_RETRY_RATIO', '2'),
136 ('LOGROLL_INTERVAL', '300'),
137 ('PROV_AUTH_ADDRESSES', 'dmaap-dr-prov|dmaap-dr-node'),
138 ('PROV_AUTH_SUBJECTS', ''),
139 ('PROV_MAXFEED_COUNT', '10000'),
140 ('PROV_MAXSUB_COUNT', '100000'),
141 ('PROV_REQUIRE_CERT', 'false'),
econward3c00d22018-08-31 14:48:53 +0000142 ('PROV_REQUIRE_SECURE', 'true'),
econwar8ef486f2018-08-31 11:36:11 +0000143 ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE')
144 ;
145
146INSERT INTO GROUPS(GROUPID, AUTHID, NAME, DESCRIPTION, CLASSIFICATION, MEMBERS)
147VALUES (1, 'Basic dXNlcjE6cGFzc3dvcmQx', 'Group1', 'First Group for testing', 'Class1', 'Member1');
esobmarc2d7dbe2018-09-03 14:58:01 +0100148
econwar7f93b3d2018-09-03 09:24:00 +0000149INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID)
150VALUES (1, 1, 'https://172.100.0.5:8080', 'user1', 'password1', true, false, 'user1', false, 1);
151
esobmarc2d7dbe2018-09-03 14:58:01 +0100152INSERT INTO SUBSCRIPTIONS(SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, SUBSCRIBER, SELF_LINK, LOG_LINK)
153VALUES (23, 1, 'http://delivery_url', 'user1', 'somepassword', 'sub123', 'selflink', 'loglink');
Emmett Cox096e9772018-09-03 11:43:13 +0100154
Emmett Cox5cbbe742018-09-05 10:33:05 +0100155INSERT INTO FEED_ENDPOINT_IDS(FEEDID, USERID, PASSWORD)
156VALUES (1, 'USER', 'PASSWORD');
157
Emmett Cox096e9772018-09-03 11:43:13 +0100158INSERT INTO FEEDS(FEEDID, GROUPID, NAME, VERSION, DESCRIPTION, BUSINESS_DESCRIPTION, AUTH_CLASS, PUBLISHER, SELF_LINK, PUBLISH_LINK, SUBSCRIBE_LINK, LOG_LINK)
159VALUES (1, 1,'Feed1','v0.1', 'First Feed for testing', 'First Feed for testing', 'auth_class', 'pub','self_link','publish_link','subscribe_link','log_link');
160
161insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET)
162VALUES (1,1,'user',null,2);
163
164insert into INGRESS_ROUTES(SEQUENCE, FEEDID , USERID, SUBNET, NODESET)
165VALUES (2,1,'user',null,2);
166
167insert into NODESETS(SETID, NODEID)
esobmar8f2e78c2018-09-07 16:39:17 +0100168VALUES (2,2);
Emmett Cox1d971022018-09-06 13:58:27 +0100169
170insert 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)
171VALUES(1,'pub',2536159564422,'ID',1,'URL','GET','application/vnd.att-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other');
172
173CREATE ALIAS IF NOT EXISTS `SUBSTRING_INDEX` AS $$
174 String Function(String one, String two, String three){
175 return "url";
176 }
esobmar8f2e78c2018-09-07 16:39:17 +0100177$$;
178
179insert into NETWORK_ROUTES(FROMNODE, TONODE, VIANODE)
180VALUES (1, 3, 2);
181
182insert into NODES(NODEID, NAME) values
183 (1, 'stub_from.'),
184 (2, 'stub_via.'),
185 (3, 'stub_to.'),
186 (4, 'node01.'),
187 (5, 'node02.'),
188 (6, 'node03.')
189;
190insert into EGRESS_ROUTES(SUBID, NODEID) values (1, 1);
191