open5gs-k8s

Add subscribers using CLI

Using the CLI to add subscribers and slices is particularly efficient when dealing with multiple slices (e.g., 10 or more). This method enables batch additions and can be adjusted via the configuration options described below.

Configuration File (mongo-tools/generate-data.py)

The default configuration (mongo-tools/generate-data.py) is shown below:

DEFAULT_CONFIG = {
    "NUM_SLICES": 2,  # Number of network slices to create
    "NUM_COTS_SUBSCRIBERS": 0,  # Number of COTS subscribers
    "NUM_SAMPLE_SUBSCRIBERS": 2,  # Number of simulated subscribers
    "NUM_AUTO_GENERATED_SUBSCRIBERS": 0,  # Number of auto-generated subscribers (for MSD deployment only)
}

Types of Subscribers

Our setup supports three types of subscribers:

[!CAUTION] The default Open5GS configuration in the project root supports up to 2 slices. For additional slices, refer to the multi-slice deployment (msd) sub-directory.

Adding subscribers

Ensure your virtual environment is active as described in as described in Set up a virtual environment.

  1. Run the generate-data.py script, generates two files: data/slices.yaml and data/subscribers.yaml.

     (venv) dev@workshop-vm:~/open5gs-k8s$ python mongo-tools/generate-data.py 
    

    You should see output similar to the one below.

     2024-11-06 16:36:02 |     INFO | Loading existing data...
     2024-11-06 16:36:02 |     INFO | Creating 2 slices ...
     2024-11-06 16:36:02 |     INFO | Generating 0 new slices...
     2024-11-06 16:36:02 |     INFO | Saving slices to data/slices.yaml
     2024-11-06 16:36:02 |     INFO | Adding 2 sample subscribers ...
     2024-11-06 16:36:02 |     INFO | Saving subscribers to data/subscribers.yaml
     2024-11-06 16:36:02 |     INFO | Slice and subscriber creation complete.
    
  2. Run add-subscribers.py to add the generated subscribers.

     (venv) dev@workshop-vm:~/open5gs-k8s$ python mongo-tools/add-subscribers.py 
    

    Expected output:

     2024-10-31 11:54:22 |     INFO | Added subscriber_1
     2024-10-31 11:54:22 |     INFO | Added subscriber_2
    

[!NOTE] The default configuration will add 2 sample subscribers. To add a third sample subsciber, edit the configuration variable NUM_SAMPLE_SUBSCRIBERS to 3, then re-run generate.py and add-subscribers.py

  1. You can verify if the subscribers were added with
    (venv) dev@workshop-vm:~/open5gs-k8s$ python mongo-tools/list-subscribers.py 
    

    You should see output similar to the one below.

    2024-10-31 11:55:36 |     INFO | subscriber_1
    2024-10-31 11:55:36 |     INFO | subscriber_2
    
  2. To delete all subscribers, use delete-subscribers.py.
    (venv) dev@workshop-vm:~/open5gs-k8s$ python mongo-tools/delete-subscribers.py 
    

    Example output:

    2024-10-31 11:56:55 |     INFO | Deleted 001010000000001
    2024-10-31 11:56:55 |     INFO | Deleted 001010000000002