Commit 07c246ab authored by Adrian Pino's avatar Adrian Pino
Browse files

Bring main and manage conflicts. Update test config. Satisfy linters

parents aec4787f f180830d
Loading
Loading
Loading
Loading
+85 −59
Original line number Diff line number Diff line
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/actions/workflows/ci.yaml" title="CI Status">
  <img src="https://github.com/SunriseOpenOperatorPlatform/open-sdk/actions/workflows/ci.yaml/badge.svg">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/commits/" title="Last Commit">
  <img src="https://img.shields.io/github/last-commit/SunriseOpenOperatorPlatform/open-sdk?style=plastic">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/issues" title="Open Issues">
  <img src="https://img.shields.io/github/issues/SunriseOpenOperatorPlatform/open-sdk?style=plastic">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/pulls" title="Open Pull Requests">
  <img src="https://img.shields.io/github/issues-pr/SunriseOpenOperatorPlatform/open-sdk?style=plastic">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/graphs/contributors" title="Contributors">
  <img src="https://img.shields.io/github/contributors/SunriseOpenOperatorPlatform/open-sdk?style=plastic">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/blob/main/LICENSE" title="License">
  <img src="https://img.shields.io/badge/License-Apache%202.0-green.svg?style=plastic">
</a>
<a href="https://github.com/SunriseOpenOperatorPlatform/open-sdk/releases/latest" title="Latest Release">
  <img src="https://img.shields.io/github/release/SunriseOpenOperatorPlatform/open-sdk?style=plastic">
</a>


# OpenSDK

Open source SDK to abstract CAMARA/GSMA Transformation Functions (TFs) for Edge Cloud platforms, 5G network cores and O-RAN solutions.

## Features

- Unified SDK for interacting with Edge Cloud platforms, 5G Core solutions, and O-RAN solutions.
- Abstract CAMARA Transformation Functions (TFs)
- Unified Python SDK for interacting with Edge Cloud platforms, 5G Core solutions, and O-RAN solutions.
- Modular and extensible adapter structure
- Conforms to CAMARA/GSMA API standards.


---

@@ -15,27 +39,27 @@ Open source SDK to abstract CAMARA/GSMA Transformation Functions (TFs) for Edge
### CAMARA APIs

| API Name                  | Version |
|----------------------|--------------|
| Edge Application Management            | v0.9.3-wip   |
| Quality-on-Demand    | v1.0.0       |
| Location Retrieval   | v1.0.0       |
| Traffic Influence    | v0.8.1       |
|---------------------------|---------|
| Edge Application Management | [v0.9.3-wip](https://raw.githubusercontent.com/camaraproject/EdgeCloud/main/code/API_definitions/Edge-Application-Management.yaml) |
| Quality-on-Demand         | [v1.0.0](https://raw.githubusercontent.com/camaraproject/QualityOnDemand/refs/tags/r2.2/code/API_definitions/quality-on-demand.yaml) |
| Location Retrieval        | [v0.4.0](https://raw.githubusercontent.com/camaraproject/DeviceLocation/refs/tags/r2.2/code/API_definitions/location-retrieval.yaml) |
| Traffic Influence         | [v0.8.1](https://raw.githubusercontent.com/camaraproject/EdgeCloud/v0.8.1/code/API_definitions/Traffic_Influence.yaml) |

### EdgeCloud Platforms

| Platform   | Status     |
|------------|------------|
| Kubernetes | To be supported soon |
| i2Edge     | Supported  |
| aerOS      | Supported  |
| Kubernetes |  |
| i2Edge     |   |
| aerOS      |   |

### Network Adapters

| Platform     | NEF Version | QoD | Location Retrieval | Traffic Influence |
|--------------|-------------|-----|---------------------|--------------------|
| Open5GS      | v1.2.3      | ✅  | ✅                  | ❌                 |
| Open5GCore   | v1.2.3      | ✅  | ❌                  | ❌                 |
| OAI          | v1.2.3      | ✅  | ❌                  | ✅                 |
| Open5GS      | [v1.2.3](https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-hc0.zip) TS 29.122 (v17.12.0) | ✅  | ✅                  | ❌                 |
| Open5GCore   | [v1.2.3](https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-hc0.zip) TS 29.122 (v17.12.0) | ✅  | ❌                  | ❌                 |
| OAI          | [v1.2.3](https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-hc0.zip) TS 29.122 (v17.12.0) | ✅  | ❌                  | ✅                 |

---

@@ -54,45 +78,24 @@ pip install sunrise6g-opensdk
If you plan to modify the SDK:

```bash
git clone https://github.com/<your-org>/sunrise6g-opensdk.git
cd sunrise6g-opensdk
git clone https://github.com/SunriseOpenOperatorPlatform/open-sdk.git
cd open-sdk
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
```

### Basic Usage

You can use the SDK by simply specifying the adapters to be used. E.g. i2Edge and Open5gs
You can use the SDK by simply specifying the adapters to be used. E.g. Edge Cloud Platform: i2Edge, 5G core: Open5Gs

Example available in [`/examples/example.py`](examples/example.py)

```python
from sunrise6g_opensdk import Sdk as sdkclient

def main():
    client_specs = {
        "edgecloud": {
            "client_name": "i2edge",
            "base_url": "http://IP:PORT",
        },
        "network": {
            "client_name": "open5gs",
            "base_url": "http://IP:PORT",
            "scs_as_id": "id_example",
        },
    }

    clients = sdkclient.create_clients_from(client_specs)
    edgecloud_client = clients.get("edgecloud")
    network_client = clients.get("network")

    print(edgecloud_client.get_edge_cloud_zones())
    print(network_client.get_qod_session(session_id="example_session_id"))


if __name__ == "__main__":
    main()
python3 -m examples.example
```

Example available in [`/examples/example.py`](examples/example.py)

---

## How to Contribute
@@ -107,16 +110,11 @@ To get started:
4. Ensure all tests and pre-commit checks pass.
5. Submit a pull request with a clear description.

Please follow our full [Contributing Guidelines](docs/CONTRIBUTING.md) for details on:
- Directory structure
- Branch naming conventions
- Coding standards (PEP8, docstrings)
- Pre-commit setup
- Reporting issues
Please follow our full [Contributing Guidelines](docs/CONTRIBUTING.md) for further details.

---

## Example Workflow (Mermaid)
## Example Workflow #1: App deployment over Kubernetes

```mermaid
sequenceDiagram
@@ -129,23 +127,51 @@ box Module implementing CAMARA APIs
end
participant K8s as Kubernetes

note over SDK: [configuration] Edge Cloud platform: Kubernetes
API ->> SDK: edgecloud_client = clients.get("edgecloud")
API ->> SDK: sdkclient.create_clients_from(configuration)
note over SDK: [Config] Edge Cloud platform: Kubernetes, IP, Port
API ->> SDK: from sunrise6g_opensdk import Sdk as sdkclient
API ->> SDK: sdkclient.create_adapters_from(configuration)
API ->> SDK: edgecloud_client = adapters.get("edgecloud")
SDK ->> SDK: SDK initialized and ready to be used
note over AP,API: Platform ready to receive CAMARA calls
AP ->> API: POST /app (APP_ONBOARD_MANIFEST)
API ->> SDK: edgecloud_client.onboard_app(APP_ONBOARD_MANIFEST)
SDK ->> K8s: POST /onboard
SDK ->> K8s: Equivalent dedicated endpoint
AP ->> API: POST /appinstances (APP_ID, APP_ZONES)
API ->> SDK: edgecloud_client.deploy_app(APP_ID, APP_ZONES)
SDK ->> K8s: POST /deploy
SDK ->> K8s: Equivalent dedicated endpoint
```

## Example Workflow #2: QoS Session Creation over Open5Gs

```mermaid
sequenceDiagram
title QoS Session Creation over Open5GS

actor AP as Application Vertical Provider
box Module implementing CAMARA APIs
    participant API as CAMARA QoS Management API
    participant SDK as Open SDK
end
participant NEF as NEF
participant 5GS as Open5GS

note over SDK: [Config] Network core: Open5Gs, IP, Port
API ->> SDK: from sunrise6g_opensdk import Sdk as sdkclient
API ->> SDK: sdkclient.create_adapters_from(configuration)
API ->> SDK: network_client = adapters.get("network")
SDK ->> SDK: SDK initialized and ready to be used
note over AP,API: Platform ready to receive CAMARA calls
AP ->> API: POST /sessions (QOS_SESSION_REQUEST)
API ->> SDK: network_client.create_qos_session(QOS_SESSION_REQUEST)
SDK ->> NEF: Equivalent endpoint
NEF ->> 5GS: QoS session creation
```
---

## Roadmap
## Roadmap for Open SDK 2nd release

- [ ] Add support to GSMA OPG.02 TFs (WIP)
- [ ] Include JUNIPER O-RAN adapter (WIP)
- [ ] Add support to GSMA OPG.02 TFs
- [ ] Include JUNIPER O-RAN adapter

---

+3 −3
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@ To contribute:

1. Fork the repository and create a feature branch from `main`.
2. Develop your changes in the appropriate adapter directory:
   - `src/sunrise6g_opensdk/edgecloud/clients/`
   - `src/sunrise6g_opensdk/network/clients/`
   - `src/sunrise6g_opensdk/oran/clients/`
   - `src/sunrise6g_opensdk/edgecloud/adapters/`
   - `src/sunrise6g_opensdk/network/adapters/`
   - `src/sunrise6g_opensdk/oran/adapters/`
3. Follow the coding guidelines below.
4. Write or update unit tests for your changes.
5. Ensure all tests pass.
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ To run tests for the Edge Cloud adapters:
pytest tests/edgecloud/
```

To run tests for the Network adapters (WIP):
To run tests for the Network adapters:
```bash
pytest tests/network/
```
+0 −26
Original line number Diff line number Diff line
```mermaid
sequenceDiagram
title Retrieve Edge Cloud Zones
actor AP as App Vertical Provider
participant CE as Capabilities Exposure
box Service Resource Manager
    participant API
    participant SDK as EdgeCloudSDK
end
participant i2Edge
participant PiEdge
participant aerOS

note over AP,CE: CAMARA EdgeCloud API
AP ->> CE: GET /edge-cloud-zones
CE ->> API: GET /av. zones
API ->> SDK: sbi = EdgeCloudFactory.create_edgecloud_client(i2Edge)
API ->> SDK: sbi.get_edge_cloud_zones()
SDK ->> i2Edge: GET /zones/list
API ->> SDK: sbi = EdgeCloudFactory.create_edgecloud_client(PiEdge)
API ->> SDK: sbi.get_edge_cloud_zones()
SDK ->> PiEdge: GET /nodes
API ->> SDK: sbi = EdgeCloudFactory.create_edgecloud_client(aerOS)
API ->> SDK: sbi.get_edge_cloud_zones()
SDK ->> aerOS: GET /entities?type=Domain
```
+7 −6
Original line number Diff line number Diff line
from sunrise6g_opensdk import Sdk as sdkclient
# from sunrise6g_opensdk import Sdk as sdkclient # For PyPI users
from sunrise6g_opensdk.common.sdk import Sdk as sdkclient  # For developers


def main():
    # The module that imports the SDK package, must specify which adapters will be used:
    client_specs = {
    adapter_specs = {
        "edgecloud": {
            "client_name": "i2edge",
            "client_name": "kubernetes",
            "base_url": "http://IP:PORT",
        },
        "network": {
@@ -15,9 +16,9 @@ def main():
        },
    }

    clients = sdkclient.create_clients_from(client_specs)
    edgecloud_client = clients.get("edgecloud")
    network_client = clients.get("network")
    adapters = sdkclient.create_adapters_from(adapter_specs)
    edgecloud_client = adapters.get("edgecloud")
    network_client = adapters.get("network")

    print("EdgeCloud client ready to be used:", edgecloud_client)
    print("Network client ready to be used:", network_client)
Loading