Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config refactor #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

gravestench
Copy link

@gravestench gravestench commented Mar 1, 2022

depends on #33!

  • config global state removed from the config module
  • config global state now resides in main, TODO to remove it
  • config now creates a default if none are found
  • added command line option for specifying the config file
  • added command line option to specify the log level
  • config directory now looks in user dir, in a platform agnostic way.
    ex: on linux, will typically look in ~/.config/my5g/RANTester for file
    config.yml
  • updated go.mod to use go v1.16
  • embedded default config file data
  • errors are now bubbled up appropriately

* moved `~/cmd/app.go` to `~/cmd/my5g-RANTester/main.go`
* refactored logging, command declaration
* split into multiple files
* switched to using constants and fmt.Sprintf for formatting stuff
@gravestench
Copy link
Author

gravestench commented Mar 1, 2022

running now looks like this:

go run ./cmd/my5g-RANTester/
NAME:
   my5g-RANTester - A new cli application

USAGE:
   my5g-RANTester [global options] command [command options] [arguments...]

COMMANDS:
   ue         Testing an UE attached with configuration
   gnb        Testing a GNB attached with configuration
   load-test  Load endurance stress tests.
              Example for testing multiple UEs: load-test -n 5
              
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --loglevel value, -l value  set the log level of the app, (6 is most verbose) (default: 4)
   --config value, -c value    set the config file to use
   --help, -h                  show help (default: false)
exit status 1

@gravestench
Copy link
Author

gravestench commented Mar 1, 2022

here's what running with a command looks like:

go run ./cmd/my5g-RANTester/ -l=6 ue
DEBU[0000] setting log level to trace                   
INFO[0000] using config file at: /home/dk/.config/my5g/RANTester/config.yml 
DEBU[0000] config loaded successfully                   
INFO[0000] ---------------------------------------      
INFO[0000] [TESTER] Starting test function: Testing an ue attached with configuration 
INFO[0000] [TESTER][UE] Number of UEs: 1                
INFO[0000] [TESTER][GNB] Control interface IP/Port: 192.168.10.108/9487 
INFO[0000] [TESTER][GNB] Data interface IP/Port: 192.168.10.108/2152 
INFO[0000] [TESTER][GNB] AMF IP/Port: 192.168.122.83/38412 
INFO[0000] ---------------------------------------      
FATA[0000] Error incannot assign requested address

@gravestench
Copy link
Author

gravestench commented Mar 1, 2022

here's what default verbosity looks like, with an invalid config path specified:

go run ./cmd/my5g-RANTester/ --config=/foo/bar.yaml ue
WARN[0000] could not find config file '/foo/bar.yaml'   
INFO[0000] config file exists                           
INFO[0000] using config file at: /home/dk/.config/my5g/RANTester/config.yml 
INFO[0000] ---------------------------------------      
INFO[0000] [TESTER] Starting test function: Testing an ue attached with configuration 
INFO[0000] [TESTER][UE] Number of UEs: 1                
INFO[0000] [TESTER][GNB] Control interface IP/Port: 192.168.10.108/9487 
INFO[0000] [TESTER][GNB] Data interface IP/Port: 192.168.10.108/2152 
INFO[0000] [TESTER][GNB] AMF IP/Port: 192.168.122.83/38412 
INFO[0000] ---------------------------------------      
FATA[0000] Error incannot assign requested address      
exit status 1

* config global state removed from the config module
* config global state now resides in main, TODO to remove it
* config now creates a default if none are found
* added command line option for specifying the config file
* added command line option to specify the log level
* config directory now looks in user dir, in a platform agnostic way.
ex: on linux, will typically look in `~/.config/my5g/RANTester` for file
`config.yml`
* updated go.mod to use go v1.16
* embedded default config file data
* errors are now bubbled up appropriately
* depends on my5G#33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant