Skip to content

Commit

Permalink
Add ran subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Nov 7, 2024
1 parent ac8b045 commit eae350f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ set/ran/%: $(BCONFIG)
@./scripts/config_edit.py $(BCONFIG) --ran=$(@F)

.PHONY: set/handover
set/handover:
set/handover: $(BCONFIG)
@echo Set handover to true
@./scripts/config_edit.py $(BCONFIG) --handover=true
@$(MAKE) set/dataplane/free5gc
@$(MAKE) set/nb-ue/2
@$(MAKE) set/nb-edges/1
Expand Down Expand Up @@ -161,6 +163,11 @@ e/%:
@# enter container
docker exec -it $(@F) bash

.PHONY: ran
ran/%:
@# exec nr-cli inside container
docker exec -it $(@F) bash -c 'nr-cli $$(nr-cli --dump)'

.PHONY: db
db/%:
@# enter database of a container
Expand Down
1 change: 1 addition & 0 deletions default-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ config:
ran:
version: "stable" # ( stable | dev )
dev_build_path: ../../ueransim/build/ # relative to the root of the testbed, not to the testbed build directory
handover: false
dataplane: # ( nextmn-srv6 | free5gc | nextmn-upf)
- "nextmn-srv6"
log_level: "info"
Expand Down
5 changes: 5 additions & 0 deletions scripts/config_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def increase_indent(self, flow=False, indentless=False):
parser.add_argument('--log-level')
parser.add_argument('--full-debug')
parser.add_argument('--ran')
parser.add_argument('--handover')
args = parser.parse_args()
ran = ('stable', 'dev')
dataplane = ('free5gc', 'nextmn-upf', 'nextmn-srv6')
Expand All @@ -47,6 +48,8 @@ def increase_indent(self, flow=False, indentless=False):
raise ConfigException(f'Invalid log level: use one from {log_levels}')
if args.full_debug and (args.full_debug.lower() not in ('true', 'false')):
raise ConfigException('Invalid value for full debug: must be a boolean')
if args.handover and (args.handover.lower() not in ('true', 'false')):
raise ConfigException('Invalid value for handover: must be a boolean')
if args.ran and (args.ran not in ran):
raise ConfigException(f'Invalid ran config: use one from {ran}')
except ConfigException as e:
Expand All @@ -66,6 +69,8 @@ def increase_indent(self, flow=False, indentless=False):
c['config']['topology']['log_level'] = args.log_level
if args.full_debug is not None:
c['config']['topology']['full_debug'] = args.full_debug.lower() == 'true'
if args.handover is not None:
c['config']['topology']['ran']['handover'] = args.handover.lower() == 'true'
if args.ran:
c['config']['topology']['ran']['version'] = args.ran
with open(args.buildconfig, 'w', encoding='utf-8') as f2:
Expand Down
9 changes: 9 additions & 0 deletions templates/compose.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ services:
MSISDN: "0000000001"
GNBS: |-
- "{{ ipv6('gnb1', 'ran') }}"
#~ if config["topology"]["ran"]["handover"]
- "{{ ipv6('gnb2', 'ran') }}"
#~ endif
CONFIGURED_NSSAI: |-
- sst: 1
sd: 000001
Expand Down Expand Up @@ -79,6 +82,9 @@ services:
MSISDN: "0000000003"
GNBS: |-
- "{{ ipv6('gnb1', 'ran') }}"
#~ if config["topology"]["ran"]["handover"]
- "{{ ipv6('gnb2', 'ran') }}"
#~ endif
CONFIGURED_NSSAI: |-
- sst: 1
sd: 000002
Expand Down Expand Up @@ -139,6 +145,9 @@ services:
MSISDN: "0000000005"
GNBS: |-
- "{{ ipv6('gnb1', 'ran') }}"
#~ if config["topology"]["ran"]["handover"]
- "{{ ipv6('gnb2', 'ran') }}"
#~ endif
CONFIGURED_NSSAI: |-
- sst: 1
sd: 000003
Expand Down

0 comments on commit eae350f

Please sign in to comment.