-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
75 lines (60 loc) · 2.07 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
# SPDX-FileCopyrightText: Copyright 2020-present Open Networking Foundation.
# SPDX-License-Identifier: Apache-2.0
.PHONY: stratum-replay
current_dir=$(abspath $(dir $(MAKEFILE_LIST)))
IMAGE:=stratumproject/testvectors:ptf
SERVER_ADDR?=10.128.13.27
SWITCH_ADDR?=10.128.13.29
TEST?=int_single_flow
TREX_CONFIG:=$(current_dir)/trex-configs
TREX_SCRIPTS:=$(current_dir)/trex-scripts
default:
@echo "Nothing here"
.venv:
@python3 -m venv .venv
set-up-dev-env: .venv
@. $(current_dir)/.venv/bin/activate; pip3 install -r requirements.txt
-docker rm set_up_dev_env
@docker run -d --name set_up_dev_env $(IMAGE) sh
@docker cp set_up_dev_env:/trex_python .
@cp -r trex_python/* .venv/lib/python3.8/site-packages/
@rm -rf trex_python
@docker rm set_up_dev_env
dev:
@docker run --rm \
-it \
-v $(current_dir)/trex-configs:/workspace/trex-configs \
-v $(current_dir)/trex-scripts:/workspace/trex-scripts \
-v $(current_dir)/tmp:/tmp \
--entrypoint sh \
$(IMAGE)
stratum-replay:
@docker run --rm \
-v $(current_dir)/stratum-replay/$(TEST):/configs \
-w /configs \
stratumproject/stratum-replay \
-grpc-addr=$(SWITCH_ADDR):9339 \
-pipeline-cfg /configs/pipeline_cfg.pb.txt \
/configs/p4_writes.pb.txt
# Temporary key to login to the ONOS karaf
tmp/keys/id_rsa:
@mkdir -p tmp/keys
@ssh-keygen -q -t rsa -N '' -f tmp/keys/id_rsa
onos-start: tmp/keys/id_rsa
@docker-compose -f tost/docker-compose.yaml up -d
$(eval KEY := $(shell cut -d\ -f2 tmp/keys/id_rsa.pub))
@docker exec tost bash -c 'echo "$(USER)=$(KEY),_g_:admingroup" >> apache-karaf-*/etc/keys.properties'
onos-stop:
@docker-compose -f tost/docker-compose.yaml down -t 0
onos-logs:
@docker-compose -f tost/docker-compose.yaml logs -f
onos-cli: tmp/keys/id_rsa
@ssh -o StrictHostKeyChecking=no -p 18101 -i tmp/keys/id_rsa $(USER)@127.0.0.1
onos-ui:
open http://127.0.0.1:18181/onos/ui
netcfg:
@curl --fail -sSL --user onos:rocks --noproxy localhost \
-X POST -H 'Content-Type:application/json' \
http://localhost:18181/onos/v1/network/configuration -d@./tost/netcfg.json
clean:
-rm -rf tmp