-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (54 loc) · 2.27 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
# Copyright 2020 Daniele Moro <daniele.moro@polimi.it>
# Davide Sanvito <davide.sanvito@neclab.eu>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include util/docker/Makefile.vars
curr_dir := $(shell pwd)
deps: _docker_pull
_docker_pull:
docker pull ${P4C_IMG}
docker pull ${FLASK_IMG}
docker pull ${P4MN_IMG}
start_gui_docker:
$(info *** Starting GUI Docker container...)
@docker run --rm -d --name gui_flowblaze \
-v ${curr_dir}/gui:/flowblazeGui \
-v ${curr_dir}/p4src:/p4src \
-p 8000:8000 \
-w /flowblazeGui ${FLASK_IMG} \
sh -c 'python gui.py --p4_file /p4src/rate_limiter/rate_limiter.p4 --json_file /p4src/rate_limiter/p4build/bmv2.json'
@echo "*** The GUI is accessible from http://localhost:8000"
stop_gui_docker:
$(info *** Stopping GUI Docker container...)
@docker stop -t0 gui_flowblaze
start_gui_local:
$(info *** Starting GUI without Docker container...)
cd gui/; \
python3 gui.py --p4_file ../p4src/rate_limiter/rate_limiter.p4 --json_file ../p4src/rate_limiter/p4build/bmv2.json
test_efsm_interpreter:
$(info *** Running EFSM interpreter with rate_limiter JSON example...)
@docker run --rm --name test_efsm_interpreter \
-v ${curr_dir}/:/flowblaze \
-w /flowblaze ${FLASK_IMG} \
python ./gui/efsm_interpreter.py --input_file ./gui/examples/rate_limiter.json --output_file /dev/null --debug
test_p4_json_parser:
$(info *** Running P4 JSON parser with rate_limiter...)
@docker run --rm --name test_efsm_interpreter \
-v ${curr_dir}/:/flowblaze \
-w /flowblaze ${FLASK_IMG} \
sh -c 'cd ./gui && python p4_json_parser.py ../p4src/rate_limiter/rate_limiter.p4 ../p4src/rate_limiter/p4build/bmv2.json'
gui-test:
docker run --rm --name test_gui \
-v ${curr_dir}/gui:/gui \
-w /gui/tests ${FLASK_IMG} \
sh -c 'python -m unittest efsm_interpreter_test'