-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
220 lines (176 loc) · 9.5 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
ifndef IMAGE_TAG
IMAGE_TAG ?= edge
endif
ifndef REPO_NAME
REPO_NAME ?= quay.io/datamattsson/truenas-csp
endif
username = hpe-csi
csp = http://localhost:8080
curl = curl
curl_args = '-v'
all:
python3 -m py_compile truenascsp/*.py
rm -rf truenascsp/__pycache__
docker build -t $(REPO_NAME):$(IMAGE_TAG) .
push:
docker buildx build --platform=linux/amd64,linux/arm64 --progress=plain \
--provenance=false --push -t $(REPO_NAME):$(IMAGE_TAG) .
run:
docker rm -f truenas-csp || true
docker run -d -p8080:8080 --name truenas-csp -e LOG_DEBUG=1 $(REPO_NAME):$(IMAGE_TAG)
test:
# Delete host 1
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db0 -f
# Delete host 2
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db1 -f
# Delete host 3
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db2 -f
# Unpublish volume host 1
- $(curl) $(curl_args) -XPUT -d @tests/csp/unpublish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f
# Unpublish volume host 2
- $(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f
# Unpublish CHAP volume
- $(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-chap.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume377/actions/unpublish -f
# Delete volume
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f
# Delete thick volume
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume18 -f
# Delete CHAP volume
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume377 -f
# "Create" password
$(curl) $(curl_args) -XPOST \
-d '{ "array_ip": "$(backend)", "username": "$(username)", "password": "$(password)"}' \
-H 'Content-Type: application/json' $(csp)/containers/v1/tokens -f
# Delete password
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' $(csp)/containers/v1/tokens/123 -f
# Fail auth
$(curl) $(curl_args) -XGET -H 'Content-Type: application/json' $(csp)/containers/v1/tokens/123 -f || true
# Create host 1
$(curl) $(curl_args) -XPOST -d @tests/csp/initiator.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts -f
# Create host 2
$(curl) $(curl_args) -XPOST -d @tests/csp/initiator-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts -f
# Create volume
$(curl) $(curl_args) -XPOST -d @tests/csp/volume.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f
# Create thick volume
$(curl) $(curl_args) -XPOST -d @tests/csp/volume-thick.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f
# Get volume
$(curl) $(curl_args) -XGET -H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes?name=my-new-volume16 -f
# Mutate volume
$(curl) $(curl_args) -XPUT -d @tests/csp/mutator.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f
$(curl) $(curl_args) -XPUT -d @tests/csp/mutators.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f
$(curl) $(curl_args) -XPUT -d @tests/csp/mutator-negative.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f || true
# Publish volume host 1
$(curl) $(curl_args) -XPUT -d @tests/csp/publish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/publish -f
# Publish volume host 2
$(curl) $(curl_args) -XPUT -d @tests/csp/publish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/publish -f
# Create snapshots
$(curl) $(curl_args) -XPOST -d @tests/csp/snapshot1.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots -f
$(curl) $(curl_args) -XPOST -d @tests/csp/snapshot2.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots -f
# Get snapshots from volume
$(curl) $(curl_args) -XGET -H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots?volume_id=tank_my-new-volume16 -f
$(curl) $(curl_args) -XGET -H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
'$(csp)/containers/v1/snapshots?volume_id=tank_my-new-volume16&name=my-first-snapshot' -f
$(curl) $(curl_args) -XGET -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots/tank_my-new-volume16@my-first-snapshot -f
# Create clone
$(curl) $(curl_args) -XPOST -d @tests/csp/clone.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f
# Delete clone
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' $(csp)/containers/v1/volumes/tank_my-new-volume17 -f
# Delete a snapshot
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots/tank_my-new-volume16@my-first-snapshot -f
# Unpublish volume host 1
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f
# Unpublish volume host 2
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f
# Delete volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f
# Delete thick volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume18 -f
# Create host 3 CHAP
$(curl) $(curl_args) -XPOST -d @tests/csp/initiator-chap.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts -f
# Create CHAP volume
$(curl) $(curl_args) -XPOST -d @tests/csp/volume-chap.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f
# Publish CHAP volume
$(curl) $(curl_args) -XPUT -d @tests/csp/publish-chap.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume377/actions/publish -f
# Unpublish CHAP volume
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-chap.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume377/actions/unpublish -f
# Delete volume CHAP
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume377 -f
# Delete host CHAP
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db2 -f
# Delete host 1
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db0 -f
# Delete host 2
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db1 -f