Fix integration markdown errors for linter
[integration.git] / test / mocks / datafilecollector-testharness / dr-sim / README.md
1 # Run DR simulators as docker container
2
3 1. Build docker container with `docker build -t drsim_common:latest .`
4 2. Run the container `docker-compose up`
5 3. For specific behavior of of the simulators, add arguments to the `command` entries in the `docker-compose.yml`.
6
7 For example `command: node dmaapDR.js --tc no_publish` . (No argument will assume '--tc normal'). Run `node dmaapDR.js --printtc`
8 and `node dmaapDR-redir.js --printtc` for details or see further below for the list of possible arg to the simulator
9
10 # Run DR simulators and all other simulators as one group
11
12 See the README in the 'simulator-group' dir.
13
14 # Run DR simulators from cmd line
15
16 1. install nodejs
17 2. install npm
18
19 Make sure that you run these commands in the application directory "dr-sim"
20
21 3. `npm install express`
22 4. `npm install argparse`
23 5. `node dmaapDR.js`   #keep it in the foreground, see below for a list for arg to the simulator
24 6. `node dmaapDR_redir.js`  #keep it in the foreground, see below for a list for arg to the simulator
25
26 # Arg to control the behavior of the simulators
27
28 ## DR
29
30 \--tc tc_normal                      Normal case, query response based on published files. Publish respond with ok/redirect depending on if file is published or not.</br>
31
32 \--tc tc_none_published              Query respond 'ok'. Publish respond with redirect.</br>
33
34 \--tc tc_all_published               Query respond with filename. Publish respond with 'ok'.</br>
35
36 \--tc tc_10p_no_response             10% % no response for query and publish. Otherwise normal case.</br>
37
38 \--tc tc_10first_no_response         10 first queries and requests gives no response for query and publish. Otherwise normal case.</br>
39
40 \--tc tc_100first_no_response        100 first queries and requests gives no response for query and publish. Otherwise normal case.</br>
41
42 \--tc tc_all_delay_1s                All responses delayed 1s (both query and publish).</br>
43
44 \--tc tc_all_delay_10s               All responses delayed 10s (both query and publish).</br>
45
46 \--tc tc_10p_delay_10s               10% of responses delayed 10s, (both query and publish).</br>
47
48 \--tc tc_10p_error_response          10% error response for query and publish. Otherwise normal case.</br>
49
50 \--tc tc_10first_error_response      10 first queries and requests gives no response for query and publish. Otherwise normal case.</br>
51
52 \--tc tc_100first_error_response     100 first queries and requests gives no response for query and publish. Otherwise normal case.</br>
53
54 ## DR Redirect
55
56 \--tc_normal                         Normal case, all files publish and DR updated.</br>
57
58 \--tc_no_publish                     Ok response but no files published.</br>
59
60 \--tc_10p_no_response                10% % no response (file not published).</br>
61
62 \--tc_10first_no_response            10 first requests give no response (files not published).</br>
63
64 \--tc_100first_no_response           100 first requests give no response (files not published).</br>
65
66 \--tc_all_delay_1s                   All responses delayed 1s, normal publish.</br>
67
68 \--tc_all_delay_10s                  All responses delayed 10s, normal publish.</br>
69
70 \--tc_10p_delay_10s                  10% of responses delayed 10s, normal publish.</br>
71
72 \--tc_10p_error_response             10% error response (file not published).</br>
73
74 \--tc_10first_error_response         10 first requests give error response (file not published).</br>
75
76 \--tc_100first_error_response        100 first requests give error responses (file not published).</br>
77
78 # Needed environment
79
80 ## DR
81
82 ```
83 DRR_SIM_IP     Set to host name of the DR Redirect simulator "drsim_redir" if running the simulators in a docker private network. Otherwise to "localhost"
84 DR_FEEDS       A comma separated list of configured feednames and filetypes. Example "1:A,2:B:C" - Feed 1 for filenames beginning with A and feed2 for filenames beginning with B or C.
85 ```
86
87 `DRR_SIM_IP` is needed for the redirected publish request to be redirected to the DR redirect server.
88
89 ## DR Redirect (DRR for short)
90
91 ```
92 DR_SIM_IP      Set to host name of the DR simulator "drsim" if running the simulators in a docker private network. Otherwise to "localhost"
93 DR_REDIR_FEEDS Same contentd as DR_FEEDS for DR.
94 ```
95
96 The DR Redirect server send callback to DR server to update the list of successfully published files.
97 When running as container (using an ip address from the `dfc_net` docker network) the env shall be set to 'drsim'. . When running the servers from command line, set the env variable `DR_SIM_IP=localhost`
98
99 # APIs for statistic readout
100
101 The simulator can be queried for statistics (use curl from cmd line or open in browser, curl used below):
102
103 ## DR
104
105 `curl localhost:3906/` - returns 'ok'
106
107 `curl localhost:3906/tc_info` - returns the tc id
108
109 `curl localhost:3906/execution_time` - returns the execution time in the format mm_ss
110
111 `curl localhost:3906/feeds` - returns the list of configured feeds
112
113 `curl localhost:3906/ctr_publish_query` - returns the number of publish queries for all feeds
114
115 `curl localhost:3906/feeds/ctr_publish_query` -returns a list of number of publish queries in each feed
116
117 `curl localhost:3906/ctr_publish_query/<feed>` - returns the number of publish queries for a feed
118
119 `curl localhost:3906/ctr_publish_query_published` - returns the number of query responses for all feeds where the files were published
120
121 `curl localhost:3906/feeds/ctr_publish_query_published` - returns a list of the number of query responses for each feed where the files were published
122
123 `curl localhost:3906/ctr_publish_query_published/<feed>` - returns the number of query responses for a feed where the files were published
124
125 `curl localhost:3906/ctr_publish_query_not_published` - returns the number of query responses for all feed where the files were not published
126
127 `curl localhost:3906/feeds/ctr_publish_query_not_published` - returns a list of the number of query responses for each feed where the files were not published
128
129 `curl localhost:3906/ctr_publish_query_not_published/<feed>` - returns the number of query responses for a feed where the files were not published
130
131 `curl localhost:3906/ctr_publish_req` - returns the number of publish requests for all feeds
132
133 `curl localhost:3906/feeds/ctr_publish_req` - returns a list of the number of publish requests for each feed
134
135 `curl localhost:3906/ctr_publish_req/<feed>` - returns the number of publish requests for feed
136
137 `curl localhost:3906/ctr_publish_req_redirect` - returns the number of publish responses with redirect for all feeds
138
139 `curl localhost:3906/feeds/ctr_publish_req_redirect` - returns a list of the number of publish responses with redirect for each feed
140
141 `curl localhost:3906/ctr_publish_req_redirect/<feed>` - returns the number of publish responses with redirect for a feed
142
143 `curl localhost:3906/ctr_publish_req_published` - returns the number of publish responses where files have been published (no redirect) for all feeds
144
145 `curl localhost:3906/feeds/ctr_publish_req_published` - returns a list of the number of publish responses where files have been published (no redirect) for each feeds
146
147 `curl localhost:3906/ctr_publish_req_published/<feed>` - returns the number of publish responses where files have been published (no redirect) for a feed
148
149 `curl localhost:3906/ctr_published_files` - returns the number of published files for all feeds
150
151 `curl localhost:3906/feeds/ctr_published_files` -  returns  a list of the number of published files for each feed
152
153 `curl localhost:3906/ctr_published_files/<feed>` - returns the number of published files for a feed
154
155 `curl localhost:3906/ctr_double_publish` - returns the number of double published files for all feeds
156
157 `curl localhost:3906/feeds/ctr_double_publish` -  returns  a list of the number of double published files for each feed
158
159 `curl localhost:3906/ctr_double_publish/<feed>` -  returns  a list of the number of double published files for a feed
160
161 `curl localhost:3906/ctr_publish_query_bad_file_prefix` - returns the number of publish queries with bad file prefix for all feeds
162
163 `curl localhost:3906/feeds/ctr_publish_query_bad_file_prefix` -  returns  a list of the number of publish queries with bad file prefix for each feed
164
165 `curl localhost:3906/ctr_publish_query_bad_file_prefix/<feed>` -  returns  a list of the number of publish queries with bad file prefix for a feed
166
167 ## DR Redirect
168
169 `curl localhost:3908/` - returns 'ok'
170
171 `curl localhost:3908/tc_info` - returns the tc id
172
173 `curl localhost:3908/execution_time` - returns the execution time in the format mm:ss
174
175 `curl localhost:3908/feeds` - returns the list of configured feeds
176
177 `curl localhost:3908/speed` - returns the speed in published files per second
178
179 `curl localhost:3908/ctr_publish_requests` - returns the number of publish requests for all feeds
180
181 `curl localhost:3908/feeds/ctr_publish_requests` - returns a list of the number of publish requests for each feed
182
183 `curl localhost:3908/ctr_publish_requests/<feed>` - returns the number of publish requests for a feed
184
185 `curl localhost:3908/ctr_publish_requests_bad_file_prefix` - returns the number of publish requests with bad file prefix for all feeds
186
187 `curl localhost:3908/feeds/ctr_publish_requests_bad_file_prefix` - returns a list of the number of publish requests with bad file prefix for each feed
188
189 `curl localhost:3908/ctr_publish_requests_bad_file_prefix/<feed>` - returns the number of publish requests with bad file prefix for a feed
190
191 `curl localhost:3908/ctr_publish_responses` - returns the number of publish responses for all feeds
192
193 `curl localhost:3908/feeds/ctr_publish_responses` - returns a list of the number of publish responses for each feed
194
195 `curl localhost:3908/ctr_publish_responses/<feed>` - returns the number of publish responses for a feed
196
197 `curl localhost:3908/time_lastpublish` - returns the time of the last successful publish in the format mm:ss for any feed
198
199 `curl localhost:3908/feeds/time_lastpublish` - returns a list of the time of the last successful publish in the format mm:ss for each feed
200
201 `curl localhost:3908/time_lastpublish/<feed>` - returns the time of the last successful publish in the format mm:ss for a feed
202
203 `curl localhost:3908/dwl_volume` - returns the number of bytes of published files for all feeds
204
205 `curl localhost:3908/feeds/dwl_volume` - returns a list of the number of bytes of the published files for each feed
206
207 `curl localhost:3908/dwl_volume/<feed>` - returns the number of bytes of the published files for a feed