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 src/api/main.py +3 −0 Original line number Diff line number Diff line Loading @@ -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)) Loading src/mapper/slo_viability.py +1 −0 Original line number Diff line number Diff line Loading @@ -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']: Loading src/planner/hrat_planner/hrat.py +2 −3 Original line number Diff line number Diff line Loading @@ -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 Loading src/planner/tfs_optical_planner/tfs_optical.py +1 −1 Original line number Diff line number Diff line Loading @@ -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 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
src/api/main.py +3 −0 Original line number Diff line number Diff line Loading @@ -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)) Loading
src/mapper/slo_viability.py +1 −0 Original line number Diff line number Diff line Loading @@ -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']: Loading
src/planner/hrat_planner/hrat.py +2 −3 Original line number Diff line number Diff line Loading @@ -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 Loading
src/planner/tfs_optical_planner/tfs_optical.py +1 −1 Original line number Diff line number Diff line Loading @@ -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