1 Commits

Author SHA1 Message Date
‘Renato
49005d8f2c fix: input is now rfc 7951 compliant
Change-Id: I8ef1c7a7da382cfa51d24aff27065fd4a38d5a3a
2025-06-10 17:19:16 -04:00
6 changed files with 6250 additions and 6239 deletions

View File

@@ -13,14 +13,14 @@ PATH_REQUEST_BASE_PATH = '/path-request'
@app.route(API_VERSION + PATH_REQUEST_BASE_PATH, methods=['POST'])
def path_request(path_request_service: PathRequestService):
data = request.json
service = data['gnpy-api:service']
if 'gnpy-api:topology' in data:
topology = data['gnpy-api:topology']
data = request.json["gnpy-api"]
service = data['service']
if 'topology' in data:
topology = data['topology']
else:
raise TopologyError('No topology found in request')
if 'gnpy-api:equipment' in data:
equipment = data['gnpy-api:equipment']
if 'equipment' in data:
equipment = data['equipment']
else:
raise EquipmentError('No equipment found in request')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -24,9 +24,10 @@ def read_json_file(path):
def test_path_request_success():
input_data = read_json_file(TEST_REQ_DIR / "planning_demand_example.json")
expected_response = read_json_file(TEST_RES_DIR / "planning_demand_res.json")
topology = input_data["gnpy-api:topology"]
equipment = input_data["gnpy-api:equipment"]
service = input_data["gnpy-api:service"]
input_data = input_data["gnpy-api"]
topology = input_data["topology"]
equipment = input_data["equipment"]
service = input_data["service"]
result = PathRequestService.path_request(topology, equipment, service)
assert result == expected_response
@@ -34,9 +35,10 @@ def test_path_request_success():
def test_path_request_invalid_equipment():
input_data = read_json_file(TEST_REQ_DIR / "planning_demand_wrong_eqpt.json")
topology = input_data["gnpy-api:topology"]
equipment = input_data["gnpy-api:equipment"]
service = input_data["gnpy-api:service"]
input_data = input_data["gnpy-api"]
topology = input_data["topology"]
equipment = input_data["equipment"]
service = input_data["service"]
with pytest.raises(EquipmentError) as exc:
PathRequestService.path_request(topology, equipment, service)
@@ -46,9 +48,10 @@ def test_path_request_invalid_equipment():
def test_path_request_invalid_topology():
input_data = read_json_file(TEST_REQ_DIR / "planning_demand_wrong_topology.json")
topology = input_data["gnpy-api:topology"]
equipment = input_data["gnpy-api:equipment"]
service = input_data["gnpy-api:service"]
input_data = input_data["gnpy-api"]
topology = input_data["topology"]
equipment = input_data["equipment"]
service = input_data["service"]
with pytest.raises(TopologyError) as exc:
PathRequestService.path_request(topology, equipment, service)