Commit 57c46720 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

- Add gitlab-ci file

- Add tests for api, database, nbi_processor, mapper, utils
- Add e2e integration tests
- Add initialization tests
- Correct minor bugs
- Update documentation
parent 86a871f4
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+17 −0
Original line number Diff line number Diff line
image: python:3.12

stages:
  - build
  - test

before_script:
  - pip3 install -r requirements.txt

build:
  stage: build
  script:
    - python3 app.py
test:
  stage: test
  script:
    - python3 -m pytest  
 No newline at end of file
+10 −11
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ It is accessed at `{ip}:{NSC_PORT}/webui`

## Configuration

In the `.env` file, several constants can be adjusted to customize the Network Slice Controller (NSC) behavior:
In the `src/config/.env.example` file, several constants can be adjusted to customize the Network Slice Controller (NSC) behaviour:

### Logging
- `DEFAULT_LOGGING_LEVEL`: Sets logging verbosity
@@ -133,6 +133,13 @@ In the `.env` file, several constants can be adjusted to customize the Network S
  - Default: `false`
- `PCE_EXTERNAL`: Flag to determine if external PCE is used
  - Default: `false`
- `PLANNER_TYPE`:  Type of planner to be used
  - Default: `ENERGY`
  - Options: `ENERGY`, `HRAT`, `TFS_OPTICAL`
- `HRAT_IP`: HRAT planner IP
  - Default: `10.0.0.1`
- `OPTICAL_PLANNER_IP`: Optical planner IP
  - Default: `10.0.0.1`

## Realizer
- `DUMMY_MODE`: If true, no config sent to controllers
@@ -159,19 +166,11 @@ In the `.env` file, several constants can be adjusted to customize the Network S

To deploy and execute the NSC, follow these steps:

0. **Preparation**
1. **Deploy**
    ```
    git clone https://labs.etsi.org/rep/tfs/nsc.git
    cd nsc
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    cp ./src/config/.env.example ./.env
    ```

1. **Start NSC Server**:
    ```
    python3 app.py
    ./deploy.sh
    ```

2. **Send Slice Requests**:
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ class Api:
                message="Slice modified successfully",
                data=result
            )
        except ValueError as e:
            # Handle case where no slices are found
            return send_response(False, code=404, message=str(e))
        except Exception as e:
            # Handle unexpected errors
            return send_response(False, code=500, message=str(e))
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ def slo_viability(slice_slos, nrp_slos):
                "one-way-packet-loss", "two-way-packet-loss"],
        "min": ["one-way-bandwidth", "two-way-bandwidth", "shared-bandwidth"]
    }
    score = 0
    flexibility_scores = []
    for slo in slice_slos:
        for nrp_slo in nrp_slos['slos']:
+2 −2
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ def hrat_planner(data: str, ip: str, action: str = "create") -> dict:
                    ]
                }
            }
            response = requests.delete(url, headers=headers, json=payload, timeout=15)
            response = requests.delete(url, headers=headers, json=payload, timeout=1)
        elif action == "create":
            response = requests.post(url, headers=headers, json=data, timeout=15)
            response = requests.post(url, headers=headers, json=data, timeout=1)
        else:
            logging.error("Invalid action. Use 'create' or 'delete'.")
            return data_static
Loading