-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
148 lines (110 loc) · 4 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
SHELL = /bin/bash
KENG_Controller = "ghcr.io/open-traffic-generator/keng-controller:1.17.0-9"
OTG_gNMI = "ghcr.io/open-traffic-generator/otg-gnmi-server:1.14.18"
IxiaC_TE = "ghcr.io/open-traffic-generator/ixia-c-traffic-engine:1.8.0.193"
IxiaC_PE = "ghcr.io/open-traffic-generator/ixia-c-protocol-engine:1.00.0.419"
export OTG_PORT1 = veth0
export OTG_PORT2 = veth1
.PHONY: all
all: install pull deploy start run
.PHONY: clean
clean: stop undeploy
.PHONY: clean-all
clean-all: clean clean-pull uninstall
create-go-cache:
mkdir -p $$HOME/.cache/go-build
###############################
# Install components
###############################
.PHONY: install
install: install-envsubst
install-envsubst: /usr/bin/envsubst
/usr/bin/envsubst:
sudo apt install gettext-base -y
uninstall:
-sudo apt remove gettext-base -y
###############################
# Pull images
###############################
.PHONY: pull
pull: pull-keng
pull-keng: pull-keng-controller pull-otg-gnmi-server pull-ixia-c-traffic-engine pull-ixia-c-protocol-engine
clean-pull: remove-keng
remove-keng: remove-keng-controller remove-otg-gnmi-server remove-ixia-c-traffic-engine remove-ixia-c-protocol-engine
pull-ixia-c-operator:
sudo -E docker compose pull operator
pull-keng-controller:
ifeq ($(shell sudo docker images -q keng-controller:latest 2> /dev/null),)
-docker pull $(KENG_Controller)
docker tag $(KENG_Controller) keng-controller:latest
endif
remove-keng-controller:
ifneq ($(shell sudo docker images -q keng-controller:latest 2> /dev/null),)
docker rmi `docker images -q keng-controller:latest 2> /dev/null` --force
endif
pull-otg-gnmi-server:
ifeq ($(shell sudo docker images -q otg-gnmi-server:latest 2> /dev/null),)
-docker pull $(OTG_gNMI)
docker tag $(OTG_gNMI) otg-gnmi-server:latest
endif
remove-otg-gnmi-server:
ifneq ($(shell sudo docker images -q otg-gnmi-server:latest 2> /dev/null),)
docker rmi `docker images -q otg-gnmi-server:latest 2> /dev/null` --force
endif
pull-ixia-c-traffic-engine:
ifeq ($(shell sudo docker images -q ixia-c-traffic-engine:latest 2> /dev/null),)
-docker pull $(IxiaC_TE)
docker tag $(IxiaC_TE) ixia-c-traffic-engine:latest
endif
remove-ixia-c-traffic-engine:
ifneq ($(shell sudo docker images -q ixia-c-traffic-engine:latest 2> /dev/null),)
docker rmi `docker images -q ixia-c-traffic-engine:latest 2> /dev/null` --force
endif
pull-ixia-c-protocol-engine:
ifeq ($(shell sudo docker images -q ixia-c-protocol-engine:latest 2> /dev/null),)
-docker pull $(IxiaC_PE)
docker tag $(IxiaC_PE) ixia-c-protocol-engine:latest
endif
remove-ixia-c-protocol-engine:
ifneq ($(shell sudo docker images -q ixia-c-protocol-engine:latest 2> /dev/null),)
docker rmi `docker images -q ixia-c-protocol-engine:latest 2> /dev/null` --force
endif
###############################
# Deploy operator
###############################
.PHONY: deploy
deploy: deploy-operator
undeploy: remove-operator
deploy-operator:
sudo -E docker compose up -d
sleep 10
curl --data-binary @"ixiatg-configmap.yml" http://localhost:35000/config
remove-operator:
sudo -E docker compose down
###############################
# Start lab
###############################
.PHONY: start
start: start-network start-ixia-c
stop: stop-ixia-c stop-network
start-network:OTG_PORT1
OTG_PORT1: /sys/class/net/$(OTG_PORT1)
/sys/class/net/veth0:
sudo ip link add name $(OTG_PORT1) type veth peer name $(OTG_PORT2)
sudo ip link set dev $(OTG_PORT1) up
sudo ip link set dev $(OTG_PORT2) up
stop-network: OTG_PORT1-clean
OTG_PORT1-clean:
-sudo ip link del name $(OTG_PORT1) type veth peer name $(OTG_PORT2)
start-ixia-c:
cat "ixia-c-hybrid.yml" | envsubst | curl --data-binary @- http://localhost:35000/create
stop-ixia-c:
-cat "ixia-c-hybrid.yml" | envsubst | curl --data-binary @- http://localhost:35000/delete
###############################
# Run tests
###############################
.PHONY: run
run: run-fp-otg-b2b
run-fp-otg-b2b:
cd featureprofiles/feature/experimental/otg_only && \
go test -v otgb2b_test.go -testbed otgb2b.testbed -binding "../../../../otgb2b.binding"