Commit 875c9627 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 4e756df9
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
+3 −0
Original line number Diff line number Diff line
@@ -134,6 +134,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 −3
Original line number Diff line number Diff line
@@ -63,10 +63,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":
            # Send creation request with full intent data
            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
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ def send_request(source, destination, ip):
    logging.debug(f"Payload for path computation: {json.dumps(payload, indent=2)}")

    try:
        response = requests.post(url, headers=headers, data=json.dumps(payload), timeout=15)
        response = requests.post(url, headers=headers, data=json.dumps(payload), timeout=1)
        return json.loads(response.text)
    except requests.exceptions.RequestException:
        logging.warning("Error connecting to the Optical Planner service. Skipping optical planning.")
Loading