-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
387 lines (292 loc) · 14.1 KB
/
Makefile
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
SHELL:=/usr/bin/env bash -O globstar
# units
temp:
mkdir temp
# ci / cd
clean:
find . -name '*.pyc' -exec sudo rm -f {} +
find . -name '*.pyo' -exec sudo rm -f {} +
find . -name '*~' -exec sudo rm -f {} +
find . -name '__pycache__' -exec sudo rm -fr {} +
sudo rm -rf temp storage tests-files/downloads
clean-all: clean
rm -rf .venv poetry.lock
black:
poetry run black ./src/
isort:
poetry run isort ./src/
fix: isort black
flake8:
poetry run flake8
mypy:
poetry run mypy src
lint:
make flake8
poetry run black --check --diff ./
make mypy
fix-lint: fix lint
# scripts
scripts-create-big-file:
PYTHONPATH=. poetry run python src/scripts/create_big_file.py
# testing
scripts-tc-disable:
sudo tc qdisc del dev lo root netem
scripts-tc-10:
sudo tc qdisc add dev lo root netem loss 10%
scripts-tc-15:
sudo tc qdisc add dev lo root netem loss 15%
scripts-tc-20:
sudo tc qdisc add dev lo root netem loss 20%
# start applications
start-app:
PYTHONPATH=. poetry run python src/app/main.py
start-app-profile:
PYTHONPATH=. poetry run python src/app/main.py --with-profiler
start-dhcp:
sudo ./.venv/bin/python3 src/dhcp/main.py
start-dns:
sudo ./.venv/bin/python3 src/dns/main.py
# testing
test-client-help:
PYTHONPATH=. poetry run python src/client/main.py --help
test-client-upload:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/A.md
test-client-upload-100:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/100.txt
test-client-upload-1000:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/1K.txt
test-client-upload-1000-multi:
for i in {1..10..1}; do \
PYTHONPATH=. poetry run python src/client/main.py upload uploads/1K.txt ;\
done;
test-client-upload-10000:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/10K.txt
test-client-upload-10000-2:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/10K.txt --dest 10K-2.txt
test-client-upload-child:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/B.txt --dest child-dir/B.txt
test-client-upload-child-100:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest child-dir/100.txt
test-client-upload-child-1000:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/1K.txt --dest child-dir/1K.txt
test-client-upload-child-10000:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/10K.txt --dest child-dir/10K.txt
test-client-upload-multi:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/net.jpg
PYTHONPATH=. poetry run python src/client/main.py upload uploads/dir
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest a/100.txt
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest b/100.txt
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest b/c/100.txt
test-client-upload-range:
for i in {1..10..2}; do \
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest range/$$i-$$i/$$i.txt ;\
for j in {1..10..1}; do \
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest range/$$i-$$j.txt ;\
done; \
done;
test-client-upload-all:
make test-client-upload
make test-client-upload-child
make test-client-upload-100
make test-client-upload-child-100
make test-client-upload-1000
make test-client-upload-child-1000
make test-client-upload-multi
test-client-upload-not-found:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/other/100.txt --dest ../100.txt
PYTHONPATH=. poetry run python src/client/main.py upload uploads/abdasda
test-client-upload-user:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent upload uploads/A.md
test-client-upload-user-without-password:
PYTHONPATH=. poetry run python src/client/main.py --user bar upload uploads/A.md
test-client-upload-user-multi:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent upload uploads/other/100.txt --dest a/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent upload uploads/other/100.txt --dest b/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent upload uploads/other/100.txt --dest a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent upload uploads/other/100.txt --dest b/c/100.txt
test-client-upload-final:
PYTHONPATH=. poetry run python src/client/main.py upload uploads/A.md
PYTHONPATH=. poetry run python src/client/main.py upload uploads/block.txt
PYTHONPATH=. poetry run python src/client/main.py upload uploads/block.txt --dest "ceptain america/block.txt"
PYTHONPATH=. poetry run python src/client/main.py upload uploads/dir
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" upload uploads/block.txt
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" upload uploads/dir
test-client-download: temp
PYTHONPATH=. poetry run python src/client/main.py download A.md ./temp/A.md
test-client-download-100: temp
PYTHONPATH=. poetry run python src/client/main.py download 100.txt ./temp/100.txt
test-client-download-1000: temp
PYTHONPATH=. poetry run python src/client/main.py download 1K.txt ./temp/1K.txt
test-client-download-10000: temp
PYTHONPATH=. poetry run python src/client/main.py download 10K.txt ./temp/10K.txt
test-client-download-child: temp
PYTHONPATH=. poetry run python src/client/main.py download child-dir/A.txt ./temp/child/A.txt
test-client-download-child-100: temp
PYTHONPATH=. poetry run python src/client/main.py download child-dir/100.txt ./temp/child/100.txt
test-client-download-child-1000: temp
PYTHONPATH=. poetry run python src/client/main.py download child-dir/1K.txt ./temp/child/1K.txt
test-client-download-child-10000: temp
PYTHONPATH=. poetry run python src/client/main.py download child-dir/10K.txt ./temp/child/10K.txt
test-client-download-multi: temp
PYTHONPATH=. poetry run python src/client/main.py download net.jpg ./temp/net.jpg
PYTHONPATH=. poetry run python src/client/main.py download dir ./temp/dir
PYTHONPATH=. poetry run python src/client/main.py download a/100.txt ./temp/a/100.txt
PYTHONPATH=. poetry run python src/client/main.py download b/100.txt ./temp/b/100.txt
PYTHONPATH=. poetry run python src/client/main.py download a/c/100.txt ./temp/a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py download b/c/100.txt ./temp/b/c/100.txt
test-client-download-all: temp
make test-client-download
make test-client-download-child
make test-client-download-100
make test-client-download-child-100
make test-client-download-1000
make test-client-download-child-1000
make test-client-download-multi
test-client-download-not-found: temp
PYTHONPATH=. poetry run python src/client/main.py download ../.env ./temp/.enve
PYTHONPATH=. poetry run python src/client/main.py download abdasda ./temp/abdasda
test-client-download-user: temp
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent download A.md ./temp/A.md
test-client-download-user-without-password: temp
PYTHONPATH=. poetry run python src/client/main.py --user bar download A.md ./temp/A.md
test-client-download-user-multi: temp
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent download a/100.txt ./temp/a/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent download b/100.txt ./temp/b/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent download a/c/100.txt ./temp/a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent download b/c/100.txt ./temp/b/c/100.txt
test-client-download-final: temp
PYTHONPATH=. poetry run python src/client/main.py download A.md ./temp/A.md
PYTHONPATH=. poetry run python src/client/main.py download block.txt ./temp/block.txt
PYTHONPATH=. poetry run python src/client/main.py download "ceptain america/block.txt" "./temp/ceptain america block.txt"
PYTHONPATH=. poetry run python src/client/main.py download dir ./temp/dir
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" download block.txt ./temp/user-block.txt
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" download dir ./temp/user-dir
test-client-list:
PYTHONPATH=. poetry run python src/client/main.py list
test-client-list-recursive:
PYTHONPATH=. poetry run python src/client/main.py list --recursive
test-client-list-child:
PYTHONPATH=. poetry run python src/client/main.py list child-dir
test-client-list-a:
PYTHONPATH=. poetry run python src/client/main.py list a
test-client-list-b:
PYTHONPATH=. poetry run python src/client/main.py list b
test-client-list-a-c:
PYTHONPATH=. poetry run python src/client/main.py list a/c
test-client-list-range:
PYTHONPATH=. poetry run python src/client/main.py list range
test-client-list-not-found:
PYTHONPATH=. poetry run python src/client/main.py list ..
PYTHONPATH=. poetry run python src/client/main.py list abdasda
test-client-list-user:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent list
test-client-list-user-without-password:
PYTHONPATH=. poetry run python src/client/main.py --user bar list .
test-client-list-user-multi:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent list
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent list a
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent list b
test-client-list-user-recursive:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent list --recursive
PYTHONPATH=. poetry run python src/client/main.py --user bar list --recursive
test-client-list-final:
PYTHONPATH=. poetry run python src/client/main.py list
PYTHONPATH=. poetry run python src/client/main.py list --recursive
PYTHONPATH=. poetry run python src/client/main.py list dir
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" list
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" list --recursive
test-client-delete:
PYTHONPATH=. poetry run python src/client/main.py delete A.md
test-client-delete-100:
PYTHONPATH=. poetry run python src/client/main.py delete 100.txt
test-client-delete-child:
PYTHONPATH=. poetry run python src/client/main.py delete child-dir
test-client-delete-multi:
PYTHONPATH=. poetry run python src/client/main.py delete net.jpg
PYTHONPATH=. poetry run python src/client/main.py delete dir
PYTHONPATH=. poetry run python src/client/main.py delete a/100.txt
PYTHONPATH=. poetry run python src/client/main.py delete b/100.txt
PYTHONPATH=. poetry run python src/client/main.py delete a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py delete b/c/100.txt
test-client-delete-range:
for i in {1..10..2}; do \
PYTHONPATH=. poetry run python src/client/main.py delete range/$$i-$$i/$$i.txt ;\
for j in {1..10..1}; do \
PYTHONPATH=. poetry run python src/client/main.py delete range/$$i-$$j.txt ;\
done; \
done;
test-client-delete-all:
make test-client-delete
make test-client-delete-child
make test-client-delete-100
make test-client-delete-multi
test-client-delete-not-found:
PYTHONPATH=. poetry run python src/client/main.py delete ../100.txt
PYTHONPATH=. poetry run python src/client/main.py delete abdasda
test-client-delete-user:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete A.md
test-client-delete-user-without-password:
PYTHONPATH=. poetry run python src/client/main.py --user bar delete A.md
test-client-delete-user-multi:
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete a/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete b/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete a/c/100.txt
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete b/c/100.txt
test-client-delete-root:
PYTHONPATH=. poetry run python src/client/main.py delete .
PYTHONPATH=. poetry run python src/client/main.py --user bar delete .
PYTHONPATH=. poetry run python src/client/main.py --user clark --password kent delete .
test-client-delete-final:
PYTHONPATH=. poetry run python src/client/main.py delete block.txt
PYTHONPATH=. poetry run python src/client/main.py delete dir
PYTHONPATH=. poetry run python src/client/main.py delete .
PYTHONPATH=. poetry run python src/client/main.py --user superman --password "clark kent" delete .
test-client-not-found: test-client-upload-not-found test-client-download-not-found test-client-list-not-found test-client-delete-not-found
test-dhcp-release:
sudo dhclient -r
test-dhcp-get-ip:
sudo dhclient
test-dhcp-renew:
sudo dhclient -r
sudo dhclient
dhcp-show-my-ip:
ip a
dhcp-show-apps-on-ports:
sudo lsof -i -P -n | grep :67
sudo lsof -i -P -n | grep :68
dhcp-kill-dhclient:
sudo killall dhclient
dhcp-stop-dnsmasq:
sudo killall dnsmasq
dhcp-edit-config-file:
sudo nano /etc/dhcp/dhclient.conf
dhcp-edit-leases-file:
sudo nano /var/lib/dhcp/dhclient.leases
test-dns-ask-google:
nslookup google.com localhost
test-dns-ask-youtube:
nslookup www.youtube.com localhost
test-dns-ask-wikipedia:
nslookup en.wikipedia.org localhost
test-dns-ask-facebook:
nslookup www.facebook.com localhost
test-dns-ask-app:
nslookup app.final.project.local localhost
test-dns-all:
nslookup app.final.project.local localhost
nslookup google.com localhost
nslookup google.com localhost
sleep 300
nslookup google.com localhost
nslookup www.youtube.com localhost
test-dns-all-origin:
nslookup google.com localhost
nslookup google.com localhost
nslookup google.com localhost
nslookup www.youtube.com localhost
nslookup www.youtube.com localhost
nslookup en.wikipedia.org localhost
nslookup www.facebook.com localhost
nslookup app.final.project.local localhost
nslookup app.final.project.local localhost