Skip to content

Commit

Permalink
Add NextMN-UPF
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Jul 12, 2024
1 parent 45e8d4c commit 44d2d86
Show file tree
Hide file tree
Showing 2 changed files with 198 additions and 8 deletions.
8 changes: 6 additions & 2 deletions scripts/jinja/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def container(name: str, image: str, enable_ipv6: typing.Optional[bool] = False,
srv6: typing.Optional[bool] = False, iface_tun: typing.Optional[bool] = False,
command: typing.Optional[str|bool] = None, init: typing.Optional[bool] = False,
cap_net_admin: typing.Optional[bool] = False, restart: typing.Optional[str] = None,
ipv4_forward: typing.Optional[bool] = False,
debug: typing.Optional[bool] = False) -> str:
'''Add a container'''
containers = {}
Expand All @@ -374,10 +375,13 @@ def container(name: str, image: str, enable_ipv6: typing.Optional[bool] = False,
containers[name]['command'] = [' ']
if restart is not None:
containers[name]['restart'] = restart
if enable_ipv6:
if enable_ipv6 or ipv4_forward:
containers[name]['sysctls'] = {
'net.ipv6.conf.all.disable_ipv6': 0,
}
if enable_ipv6:
containers[name]['sysctls']['net.ipv6.conf.all.disable_ipv6'] = 0
if ipv4_forward:
containers[name]['sysctls']['net.ipv4.ip_forward'] = 1
if srv6:
containers[name]['sysctls'] = {
'net.ipv6.conf.all.disable_ipv6': 0,
Expand Down
198 changes: 192 additions & 6 deletions templates/compose.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
DEFAULT_NSSAI: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
Expand All @@ -25,6 +28,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
SESSIONS: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
Expand All @@ -39,6 +45,12 @@ services:
slice:
sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- type: "IPv4"
apn: "nextmn-upf"
slice:
sst: 1
sd: 000002
#~ endif
networks:
ran: # automatic allocation by docker compose
Expand All @@ -56,6 +68,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
DEFAULT_NSSAI: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
Expand All @@ -64,6 +79,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
SESSIONS: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
Expand All @@ -78,6 +96,12 @@ services:
slice:
sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- type: "IPv4"
apn: "nextmn-upf"
slice:
sst: 1
sd: 000003
#~ endif
networks:
ran: # automatic allocation by docker compose
Expand All @@ -99,6 +123,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
MCC: "001"
MNC: "01"
Expand Down Expand Up @@ -137,6 +164,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
MCC: "001"
MNC: "01"
Expand Down Expand Up @@ -179,6 +209,8 @@ services:
- srv6
#~ elif config["topology"]["dataplane"] == "free5gc"
- free5gc
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- nextmn-upf
#~ endif
SNSSAI_LIST: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
Expand All @@ -187,6 +219,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
TAC: "000001"
secrets:
Expand Down Expand Up @@ -378,6 +413,15 @@ services:
dns:
ipv4: 9.9.9.9 # TODO: replace with local dns
ipv6: 2620:fe::fe
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sNssai:
sst: 1
sd: 000003
dnnInfos:
- dnn: nextmn-upf
dns:
ipv4: 9.9.9.9 # TODO: replace with local dns
ipv6: 2620:fe::fe
#~ endif
UP_NODES: |-
GNB:
Expand Down Expand Up @@ -467,13 +511,77 @@ services:
networkInstances:
- free5gc
#~ endif
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
UPFI:
type: UPF
nodeID: "{{ ipv4('upfi', 'control') }}"
addr: "{{ ipv4('upfi', 'control') }}"
sNssaiUpfInfos:
- sNssai:
sst: 1
sd: 000003
dnnUpfInfoList:
- dnn: nextmn-upf
interfaces:
- interfaceType: N3
endpoints:
- {{ ipv4('upfi', 'dataplane') }}
networkInstances:
- nextmn-upf
- interfaceType: N9
endpoints:
- {{ ipv4('upfi', 'dataplane') }}
networkInstances:
- nextmn-upf
UPFA1:
type: UPF
nodeID: "{{ ipv4('upfa1', 'control') }}"
addr: "{{ ipv4('upfa1', 'control') }}"
sNssaiUpfInfos:
- sNssai:
sst: 1
sd: 000003
dnnUpfInfoList:
- dnn: nextmn-upf
pools:
- cidr: {{ ipv4_subnet('slice1-e1') }}
staticPools:
- cidr: {{ ipv4_subnet('slice1-e1-static') }}
interfaces:
- interfaceType: N9
endpoints:
- {{ ipv4('upfa1', 'dataplane') }}
networkInstances:
- nextmn-upf
#~ if config["topology"]["nb_edges"] > 1
UPFA2:
type: UPF
nodeID: "{{ ipv4('upfa2', 'control') }}"
addr: "{{ ipv4('upfa2', 'control') }}"
sNssaiUpfInfos:
- sNssai:
sst: 1
sd: 000003
dnnUpfInfoList:
- dnn: nextmn-upf
pools:
- cidr: {{ ipv4_subnet('slice1-e2') }}
staticPools:
- cidr: {{ ipv4_subnet('slice1-e2-static') }}
interfaces:
- interfaceType: N9
endpoints:
- {{ ipv4('upfa2', 'dataplane') }}
networkInstances:
- nextmn-upf
#~ endif
#~ endif
ULCL: "true"
LINKS: |-
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
- A: GNB
B: UPF
#~ elif config["topology"]["dataplane"] == "free5gc"
#~ elif config["topology"]["dataplane"] in ("free5gc", "nextmn-upf")
- A: GNB
B: UPFI
- A: UPFI
Expand All @@ -494,7 +602,7 @@ services:
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
- A: GNB
B: UPF
#~ elif config["topology"]["dataplane"] == "free5gc"
#~ elif config["topology"]["dataplane"] in ("free5gc", "nextmn-upf")
- A: GNB
B: UPFI
- A: UPFI
Expand Down Expand Up @@ -533,6 +641,11 @@ services:
sd: 000002
varqi: 9
dnn: free5gc
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
varqi: 9
dnn: nextmn-upf
#~ endif
IMSI: |-
- imsi-001010000000001
Expand Down Expand Up @@ -568,6 +681,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
NSI_LIST: |-
- snssai:
Expand All @@ -593,6 +709,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif
AMF_LIST: |-
- nfId: 469de254-2fe5-4ca0-8381-af3f500af77c
Expand All @@ -609,6 +728,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif

TA_LIST: |-
Expand All @@ -625,6 +747,9 @@ services:
#~ elif config["topology"]["dataplane"] == "free5gc"
- sst: 1
sd: 000002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- sst: 1
sd: 000003
#~ endif

MAPPING_LIST_FROM_PLMN: |-
Expand All @@ -647,6 +772,13 @@ services:
homeSnssai:
sst: 1
sd: 00002
#~ elif config["topology"]["dataplane"] == "nextmn-upf"
- servingSnssai:
sst: 1
sd: 00003
homeSnssai:
sst: 1
sd: 00003
#~ endif
secrets:
{{ openssl_secrets_pem_s('nrf', 'sbi') | indent(2) }}
Expand Down Expand Up @@ -898,9 +1030,9 @@ services:
environment:
ONESHOT: "true"
ROUTES_INIT: |-
#~ if config["topology"]["dataplane"] == "nextmn-upf"
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
- add {{ ipv4_subnet('slice0') }} via {{ ipv4('r0', 'edge') }}
#~ elif config["topology"]["dataplane"] == "free5gc"
#~ elif config["topology"]["dataplane"] in ("free5gc", "nextmn-upf")
- add {{ ipv4_subnet('slice1') }} via {{ ipv4('upfa1', 'edge') }}
#~ endif
PRE_INIT_HOOK: "ip"
Expand All @@ -924,9 +1056,9 @@ services:
environment:
ONESHOT: "true"
ROUTES_INIT: |-
#~ if config["topology"]["dataplane"] == "nextmn-upf"
#~ if config["topology"]["dataplane"] == "nextmn-srv6"
- add {{ ipv4_subnet('slice0') }} via {{ ipv4('r1', 'edge') }}
#~ elif config["topology"]["dataplane"] == "free5gc"
#~ elif config["topology"]["dataplane"] in ("free5gc", "nextmn-upf")
- add {{ ipv4_subnet('slice1') }} via {{ ipv4('upfa2', 'edge') }}
#~ endif
PRE_INIT_HOOK: "ip"
Expand Down Expand Up @@ -1005,6 +1137,60 @@ services:
#~ endif
#~ endif

#~ if config["topology"]["dataplane"] == "nextmn-upf"
{{ container_s(name='upfi', image='louisroyer/dev-nextmn-upf', restart='always', iface_tun=True, ipv4_forward=True, cap_net_admin=True, debug=True) }}
environment:
N4: "{{ ipv4('upfi', 'control') }}"
GTPU_ENTITIES_LIST: |-
- "{{ ipv4('upfi', 'dataplane') }}"
- "{{ ipv4('upfi', 'dataplane') }}"
DNN_LIST: |-
- dnn: free5gc
cidr: {{ ipv4_subnet('slice1') }}
ROUTES_INIT: |-
- add {{ ipv4('s', 'service') }} via {{ ipv4('s1', 'edge') }}
networks:
control:
ipv4_address: "{{ ipv4('upfi', 'control') }}"
dataplane:
ipv4_address: "{{ ipv4('upfi', 'dataplane') }}"
{{ container_s(name='upfa1', image='louisroyer/dev-nextmn-upf', restart='always', iface_tun=True, ipv4_forward=True, cap_net_admin=True, debug=True) }}
environment:
N4: "{{ ipv4('upfa1', 'control') }}"
GTPU_ENTITIES_LIST: |-
- "{{ ipv4('upfa1', 'dataplane') }}"
DNN_LIST: |-
- dnn: free5gc
cidr: {{ ipv4_subnet('slice1') }}
ROUTES_INIT: |-
- add {{ ipv4('s', 'service') }} via {{ ipv4('s0', 'edge') }}
networks:
control:
ipv4_address: "{{ ipv4('upfa1', 'control') }}"
dataplane:
ipv4_address: "{{ ipv4('upfa1', 'dataplane') }}"
edge:
ipv4_address: "{{ ipv4('upfa1', 'edge') }}"
#~ if config["topology"]["nb_edges"] > 1
{{ container_s(name='upfa2', image='louisroyer/dev-nextmn-upf', restart='always', iface_tun=True, ipv4_forward=True, cap_net_admin=True, debug=True) }}
environment:
N4: "{{ ipv4('upfa2', 'control') }}"
GTPU_ENTITIES_LIST: |-
- "{{ ipv4('upfa2', 'dataplane') }}"
DNN_LIST: |-
- dnn: free5gc
cidr: {{ ipv4_subnet('slice1') }}
ROUTES_INIT: |-
- add {{ ipv4('s', 'service') }} via {{ ipv4('s1', 'edge') }}
networks:
control:
ipv4_address: "{{ ipv4('upfa2', 'control') }}"
dataplane:
ipv4_address: "{{ ipv4('upfa2', 'dataplane') }}"
edge:
ipv4_address: "{{ ipv4('upfa2', 'edge') }}"
#~ endif
#~ endif
secrets:
{{ openssl_s('amf', 'sbi') }}
{{ openssl_s('ausf', 'sbi') }}
Expand Down

0 comments on commit 44d2d86

Please sign in to comment.