-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
101 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,136 @@ | ||
# A Simple CLI tool for free5GC | ||
# Freecli - An interactive CLI for free5GC | ||
|
||
**/!\ Still under development, use it at your own risks, no support provided yet** | ||
 | ||
|
||
 | ||
 | ||
|
||
- [Disclaimer](#disclaimer) | ||
- [Installation](#installation) | ||
|
||
- [Description](#description) | ||
- [Download and build](#download-and-build) | ||
- [Configuration](#configuration) | ||
- [Usage](#usage) | ||
- [Subscriber management](#subscriber-management) | ||
- [Run Freecli](#run-freecli) | ||
- [Modules](#modules) | ||
- [Subscriber module](#subscriber-module) | ||
- [Add a fixed number of subscribers](#add-a-fixed-number-of-subscribers) | ||
- [Add a subscriber with a specific supi to a plmn](#add-a-subscriber-with-a-specific-supi-to-a-plmn) | ||
- [List all the subscribers](#list-all-the-subscribers) | ||
- [Delete a subscriber from a plmn](#delete-a-subscriber-from-a-plmn) | ||
- [Flush the database from every subscriber](#flush-the-database-from-every-subscriber) | ||
- [gNB module](#gnb-module) | ||
- [Acknowledgment](#acknowledgment) | ||
|
||
## Description | ||
|
||
## Disclaimer | ||
Freecli is an interactive cli utility to manage free5gc. It currently includes the following modules: | ||
|
||
This project provides an unofficial repository for the free5gc project as the official webconsole does not cover all use-cases. free5gc-cli is a simple cli utility to interact with free5gc. I use it mainly to manage subscribers when I can't have access to the WEBUI. This CLI is based on the webconsole and rely on free5gc lib. It is also subject to changes and further evolutions. | ||
- Subscriber: manage the subscriber of free5gc in a fashion way | ||
- 5G gNB: emulate a 5G gNB **/!\ Still under development** | ||
|
||
## Installation | ||
## Download and build | ||
|
||
The cli works as a standalone CLI. Clone the repository and build the cli | ||
To compile into a binary file | ||
|
||
``` bash | ||
git clone --recursive https://github.com/Srajdax/free5gc-cli.git | ||
git clone https://github.com/Srajdax/free5gc-cli.git | ||
cd free5gc-cli | ||
go mod download | ||
go build -o freecli -x freecli.go | ||
``` | ||
|
||
or to run it like an interpreter would do | ||
|
||
``` bash | ||
git clone https://github.com/Srajdax/free5gc-cli.git | ||
cd free5gc-cli | ||
go run freecli.go | ||
``` | ||
|
||
## Configuration | ||
|
||
The gNB `freecli.cfg` configuration file is located in `free5gc/config` folder. A sample is also present into `free5gc-cli/config` folder. | ||
Freecli uses free5gc lib under the hood with some modifications. Each freecli module is located into the `module` folder. Each module has its own configuration files located in the `config` folder. Each module is described below. | ||
|
||
## Run Freecli | ||
|
||
Each module is independent in freecli, at launch you can load the module by typing their name, e.g. to load the subscriber module and access all its functionalities: | ||
|
||
``` yaml | ||
info: | ||
version: 1.0.0 | ||
description: free5gc-cli initial local configuration | ||
```bash | ||
./freecli | ||
|
||
configuration: | ||
mongodb: | ||
name: free5gc | ||
url: mongodb://localhost:27017 | ||
# Load the module | ||
freecli> subscriber | ||
2020-11-21T23:22:41Z [INFO][Freecli][Freecli] Loading subscriber module... | ||
2020-11-21T23:22:41Z [INFO][Freecli][Subscriber Module] Successfully load module configuration config/subscriber.yaml | ||
2020-11-21T23:22:41Z [INFO][Freecli][Subscriber Module] Successfully load ue configuration config/subscriber_ue.yaml | ||
|
||
subscriber# The module is successfuly loaded | ||
|
||
# Exit the module | ||
subscriber# exit | ||
2020-11-22T00:41:12+01:00 [INFO][Freecli][Freecli] Exiting Module... | ||
``` | ||
|
||
## Usage | ||
## Modules | ||
|
||
``` bash | ||
./freecli | ||
### Subscriber module | ||
|
||
This module is used to add, delete and flush subscribers of free5gc database. It has 2 configuration files. `subscriber.yaml` holds the configuration of the module and `subsriber_ue.yaml` holds the global configuration of the subscribers to add. | ||
|
||
#### Add a fixed number of subscribers | ||
|
||
command | ||
``` | ||
subscriber# user random --range <number_to_add> --plmn <plmnid> | ||
``` | ||
|
||
### Subscriber management | ||
example | ||
``` | ||
subscriber# user random --range 10 --plmn 20893 | ||
``` | ||
|
||
Add a subscriber | ||
#### Add a subscriber with a specific supi to a plmn | ||
|
||
```bash | ||
./freecli --add <subscriber_configuration.yaml> | ||
command | ||
``` | ||
subscriber# user register --supi <supi> --plmn <plmnid> | ||
``` | ||
|
||
Remove a subscriber | ||
example | ||
``` | ||
subscriber# user register --supi imsi-2089300000013 --plmn 20893 | ||
``` | ||
|
||
```bash | ||
./freecli --remove <imsi> <plmn> | ||
#### List all the subscribers | ||
|
||
command | ||
``` | ||
subscriber# user list | ||
``` | ||
|
||
Update a subscriber | ||
Note: this will also populate the auto-complete for the delete command | ||
|
||
```bash | ||
./freecli --update <imsi> <plmn> <subscriber_configuration.yaml> | ||
#### Delete a subscriber from a plmn | ||
|
||
command | ||
``` | ||
subscriber# user delete <supi>/<plmnId> | ||
``` | ||
|
||
Get all the subscribers | ||
example | ||
``` | ||
subscriber# user delete imsi-2089300000000/20893 | ||
``` | ||
|
||
```bash | ||
./freecli --subscribers | ||
``` | ||
#### Flush the database from every subscriber | ||
|
||
command | ||
``` | ||
subscriber# user flush | ||
``` | ||
|
||
### gNB module | ||
|
||
Currently under development | ||
|
||
## Acknowledgment | ||
|
||
Thanks to the free5gc team for their efforts and their open source 5G Core Network |