-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.yml
481 lines (452 loc) · 13.8 KB
/
core.yml
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
services:
hss:
image: open5gs
command: /opt/bin/open5gs-hssd -c /etc/hss/open5gs.yaml -t
configs:
- source: hss.yaml
target: /etc/hss/open5gs.yaml
- source: hss.diameter
target: /etc/hss/diameter.conf
volumes:
- cert-hss:/var/hss
expose:
- 3868/tcp
depends_on:
cert-hss:
condition: service_completed_successfully
subscribers:
condition: service_completed_successfully
build:
context: .
dockerfile_inline: |
FROM alpine AS build
RUN apk add alpine-sdk bison flex git cmake meson bash sudo linux-headers bsd-compat-headers yaml-dev lksctp-tools-dev gnutls-dev libgcrypt-dev libidn-dev mongo-c-driver-dev libmicrohttpd-dev curl-dev nghttp2-dev talloc-dev
RUN wget -qO- https://github.com/open5gs/open5gs/archive/refs/tags/v2.7.2.tar.gz | tar -xzf-
WORKDIR open5gs-2.7.2
RUN meson build --prefix=/opt
RUN ninja -C build install
FROM alpine
RUN apk add yaml lksctp-tools gnutls libgcrypt libidn mongo-c-driver libmicrohttpd curl nghttp2 talloc
COPY --from=build /opt /opt
cert-hss:
image: certificate
command: openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out crt.pem -keyout key.pem -subj /CN=hss.epc.${REALM}
working_dir: /var/hss
volumes:
- cert-hss:/var/hss
build:
context: .
dockerfile_inline: |
FROM alpine
RUN apk add openssl
subscribers:
image: mongo:8.0
entrypoint: mongosh --host mongo --file /opt/subscribers.js
configs:
- source: subscribers
target: /opt/subscribers.js
tmpfs:
- /data/configdb
- /data/db
depends_on:
mongo:
condition: service_started
restart: on-failure
ui:
profiles:
- ui
working_dir: /open5gs/webui
command: npm run dev
environment:
DB_URI: mongodb://mongo/open5gs
HOSTNAME: 0.0.0.0
ports:
- 9999:9999
depends_on:
subscribers:
condition: service_completed_successfully
build:
context: .
dockerfile_inline: |
FROM alpine AS build
RUN apk add git
RUN git clone https://github.com/open5gs/open5gs
FROM alpine
RUN apk add nodejs npm
COPY --from=build /open5gs/webui /open5gs/webui
RUN cd /open5gs/webui && npm ci
pcrf:
image: open5gs
command: /opt/bin/open5gs-pcrfd -c /etc/pcrf/open5gs.yaml -t
configs:
- source: pcrf.yaml
target: /etc/pcrf/open5gs.yaml
- source: pcrf.diameter
target: /etc/pcrf/diameter.conf
volumes:
- cert-pcrf:/var/pcrf
expose:
- 3868/tcp
depends_on:
cert-pcrf:
condition: service_completed_successfully
cert-pcrf:
image: certificate
command: openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out crt.pem -keyout key.pem -subj /CN=pcrf.epc.${REALM}
working_dir: /var/pcrf
volumes:
- cert-pcrf:/var/pcrf
smf:
image: open5gs
command: /opt/bin/open5gs-smfd -c /etc/smf/open5gs.yaml -t
configs:
- source: smf.yaml
target: /etc/smf/open5gs.yaml
- source: smf.diameter
target: /etc/smf/diameter.conf
volumes:
- cert-smf:/var/smf
expose:
- 3868/tcp
depends_on:
cert-smf:
condition: service_completed_successfully
upf:
condition: service_started
pcrf:
condition: service_started
cert-smf:
image: certificate
command: openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out crt.pem -keyout key.pem -subj /CN=smf.epc.${REALM}
working_dir: /var/smf
volumes:
- cert-smf:/var/smf
upf:
image: open5gs
command: /opt/bin/open5gs-upfd -c /etc/upf/open5gs.yaml -t
configs:
- source: upf.yaml
target: /etc/upf/open5gs.yaml
expose:
- 8805/udp
- 2152/udp
networks:
default:
ipv4_address: ${UPFIP}
devices:
- /dev/net/tun
cap_add:
- NET_ADMIN
upftun:
image: alpine
command:
- sh
- -c
- |
sleep 3
ip addr add ${UEGW}/16 dev tunue;
ip link set tunue up
network_mode: service:upf
cap_add:
- NET_ADMIN
mongo:
image: mongo:8.0
command: --bind_ip 0.0.0.0
tmpfs:
- /data/configdb
- /data/db
expose:
- 27017/udp
- 27017/tcp
configs:
hss.yaml:
content: |
db_uri: mongodb://mongo/open5gs
hss:
freeDiameter: /etc/hss/diameter.conf
#identity: hss.epc.${REALM}
#load_extension:
#- module: /opt/lib/freeDiameter/dbg_msg_dumps.fdx
# conf: 0x4444
#- module: /opt/lib/freeDiameter/dict_rfc5777.fdx
#- module: /opt/lib/freeDiameter/dict_mip6i.fdx
#- module: /opt/lib/freeDiameter/dict_nasreq.fdx
#- module: /opt/lib/freeDiameter/dict_nas_mipv6.fdx
#- module: /opt/lib/freeDiameter/dict_dcca.fdx
#- module: /opt/lib/freeDiameter/dict_dcca_3gpp.fdx
metrics:
server:
- address: 0.0.0.0
port: 9090
sms_over_ims: "sip:smsc.epc.${REALM}"
logger:
file:
path: /var/log/hss.log
global:
max:
ue: 1024
hss.diameter:
content: |
Identity = "hss.epc.${REALM}";
No_SCTP;
TLS_Cred = "/var/hss/crt.pem", "/var/hss/key.pem";
TLS_CA = "/var/hss/crt.pem";
LoadExtension = "/opt/lib/freeDiameter/dbg_msg_dumps.fdx" : "0x4444";
LoadExtension = "/opt/lib/freeDiameter/dict_rfc5777.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_mip6i.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nasreq.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nas_mipv6.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca_3gpp.fdx";
ConnectPeer = "icscf.ims.${REALM}" { No_TLS; };
ConnectPeer = "scscf.ims.${REALM}" { No_TLS; };
pcrf.yaml:
content: |
logger:
file:
path: /var/log/pcrf.log
global:
max:
ue: 1024
pcrf:
freeDiameter: /etc/pcrf/diameter.conf
metrics:
server:
- address: 0.0.0.0
port: 9090
session:
- name: internet
type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6
ambr:
downlink:
value: 1
unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 1
unit: 3
qos:
index: 9
arp:
priority_level: 8
pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled
pre_emption_capability: 1 # 1: Disabled, 2:Enabled
- name: ims
type: 3 # 1:IPv4, 2:IPv6, 3:IPv4v6
ambr:
downlink:
value: 1
unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 1
unit: 3 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
qos:
index: 5
arp:
priority_level: 1
pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled
pre_emption_capability: 1 # 1: Disabled, 2:Enabled
pcc_rule:
- qos:
index: 1
arp:
priority_level: 1
pre_emption_vulnerability: 1 # 1: Disabled, 2:Enabled
pre_emption_capability: 1 # 1: Disabled, 2:Enabled
mbr:
downlink:
value: 82
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 82
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
gbr:
downlink:
value: 82
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 82
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
flow:
- direction: 2
description: "permit out icmp from any to assigned"
- direction: 1
description: "permit out icmp from any to assigned"
- direction: 2
description: "permit out udp from 10.200.136.98/32 23455 to assigned 1-65535"
- direction: 1
description: "permit out udp from 10.200.136.98/32 1-65535 to assigned 50021"
- qos:
index: 2
arp:
priority_level: 4
pre_emption_vulnerability: 2 # 1: Disabled, 2:Enabled
pre_emption_capability: 2 # 1: Disabled, 2:Enabled
mbr:
downlink:
value: 802
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 802
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
gbr:
downlink:
value: 802
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
uplink:
value: 802
unit: 1 # 0:bps, 1:Kbps, 2:Mbps, 3:Gbps, 4:Tbps
pcrf.diameter:
content: |
Identity = "pcrf.epc.${REALM}";
No_SCTP;
TLS_Cred = "/var/pcrf/crt.pem", "/var/pcrf/key.pem";
TLS_CA = "/var/pcrf/crt.pem";
LoadExtension = "/opt/lib/freeDiameter/dbg_msg_dumps.fdx" : "0x4444";
LoadExtension = "/opt/lib/freeDiameter/dict_rfc5777.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_mip6i.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nasreq.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nas_mipv6.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca_3gpp.fdx";
ConnectPeer = "pcscf.ims.${REALM}" { No_TLS; };
ConnectPeer = "smf.epc.${REALM}" { No_TLS; };
smf.yaml:
content: |
logger:
file:
path: /var/log/smf.log
global:
max:
ue: 1024
smf:
freeDiameter: /etc/smf/diameter.conf
metrics:
server:
- address: 0.0.0.0
port: 9091
pfcp:
server:
- address: 0.0.0.0
client:
upf:
- address: upf
gtpc:
server:
- address: 0.0.0.0
gtpu:
server:
- address: 0.0.0.0
advertise: upf
session:
- subnet: ${UENET}
gateway: ${UEGW}
dnn: ims
dns:
- ${DNSIP}
p-cscf:
- ${IPSEC}
smf.diameter:
content: |
Identity = "smf.epc.${REALM}";
No_SCTP;
TLS_Cred = "/var/smf/crt.pem", "/var/smf/key.pem";
TLS_CA = "/var/smf/crt.pem";
LoadExtension = "/opt/lib/freeDiameter/dbg_msg_dumps.fdx" : "0x4444";
LoadExtension = "/opt/lib/freeDiameter/dict_rfc5777.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_mip6i.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nasreq.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_nas_mipv6.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca.fdx";
LoadExtension = "/opt/lib/freeDiameter/dict_dcca_3gpp.fdx";
ConnectPeer = "pcrf.epc.${REALM}" { ConnectTo = "pcrf"; No_TLS; };
upf.yaml:
content: |
logger:
file:
path: /var/log/upf.log
global:
max:
ue: 1024
upf:
metrics:
server:
- address: 0.0.0.0
port: 9091
pfcp:
server:
- address: 0.0.0.0
client:
smf:
- address: smf
gtpu:
server:
- address: 0.0.0.0
advertise: upf
session:
- subnet: ${UENET}
gateway: ${UEGW}
dnn: ims
dev: tunue
subscribers:
content: |
db = db.getSiblingDB('open5gs')
for(i = 1; i <= ${SCALE}; i++){
db.subscribers.insertOne(
{
_id: new ObjectId(),
schema_version: NumberInt(1),
imsi: '${MCC}${MNC}'+'000000000000000'.substring('${MCC}${MNC}'.length+`$${i}`.length)+`$${i}`,
msisdn: ['${DIAL}'+'000000000'.substring(`$${i}`.length)+`$${i}`],
imeisv: [],
mme_host: [],
mm_realm: [],
purge_flag: [],
slice:[
{
sst: NumberInt(1),
default_indicator: true,
session: [
{
name : 'internet',
type : NumberInt(3),
qos : {
index: NumberInt(9),
arp: {
priority_level : NumberInt(8),
pre_emption_capability: NumberInt(1),
pre_emption_vulnerability: NumberInt(2)
}
},
ambr: {
downlink: { value: NumberInt(1000000000), unit: NumberInt(0) },
uplink: { value: NumberInt(1000000000), unit: NumberInt(0) }
},
pcc_rule: [],
_id: new ObjectId(),
}],
_id: new ObjectId(),
}],
security:
{
k : '${K}',
op : null,
opc : '${OPC}',
amf : '8000',
},
ambr :
{
downlink : { value: NumberInt(1000000000), unit: NumberInt(0)},
uplink : { value: NumberInt(1000000000), unit: NumberInt(0)}
},
access_restriction_data: 32,
network_access_mode: 0,
subscriber_status: 0,
operator_determined_barring: 0,
subscribed_rau_tau_timer: 12,
__v: 0
})
}
volumes:
cert-hss:
cert-pcrf:
cert-smf: