mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
Adding a no-path case for test coverage
add a no path case (request 6) in requests and expected responses. response is also generated if path is not feasible: checks that it is correctly handled in csv and json responses Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
This commit is contained in:
Binary file not shown.
@@ -857,6 +857,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"response-id": "6",
|
||||
"no-path": "Response without path information, due to failure performing the path computation"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4,3 +4,4 @@ response-id,source,destination,path_bandwidth,Pass?,nb of tsp pairs,total cost,t
|
||||
3,trx Lannion_CAS,trx Rennes_STA,60.0,True,1,1,vendorA_trx-type1,mode 1,28.29,25.85,21.77,32.0,1.0,trx Lannion_CAS | roadm Lannion_CAS | east edfa in Lannion_CAS to Stbrieuc | fiber (Lannion_CAS → Stbrieuc)-F056 | east edfa in Stbrieuc to Rennes_STA | fiber (Stbrieuc → Rennes_STA)-F057 | Edfa0_fiber (Stbrieuc → Rennes_STA)-F057 | roadm Rennes_STA | trx Rennes_STA
|
||||
4,trx Rennes_STA,trx Lannion_CAS,150.0,True,1,1,vendorA_trx-type1,mode 2,22.27,22.15,15.05,64.0,0.0,trx Rennes_STA | roadm Rennes_STA | Edfa1_roadm Rennes_STA | fiber (Rennes_STA → Ploermel)- | east edfa in Ploermel to Vannes_KBE | fiber (Ploermel → Vannes_KBE)- | Edfa0_fiber (Ploermel → Vannes_KBE)- | roadm Vannes_KBE | Edfa0_roadm Vannes_KBE | fiber (Vannes_KBE → Lorient_KMA)-F055 | Edfa0_fiber (Vannes_KBE → Lorient_KMA)-F055 | roadm Lorient_KMA | Edfa0_roadm Lorient_KMA | fiber (Lorient_KMA → Loudeac)-F054 | east fused spans in Loudeac | fiber (Loudeac → Corlay)-F010 | east fused spans in Corlay | fiber (Corlay → Lannion_CAS)-F061 | west edfa in Lannion_CAS to Corlay | roadm Lannion_CAS | trx Lannion_CAS
|
||||
5,trx Rennes_STA,trx Lannion_CAS,20.0,True,1,1,vendorA_trx-type1,mode 2,30.79,28.77,21.68,64.0,3.0,trx Rennes_STA | roadm Rennes_STA | Edfa0_roadm Rennes_STA | fiber (Rennes_STA → Stbrieuc)-F057 | Edfa0_fiber (Rennes_STA → Stbrieuc)-F057 | fiber (Stbrieuc → Lannion_CAS)-F056 | Edfa0_fiber (Stbrieuc → Lannion_CAS)-F056 | roadm Lannion_CAS | trx Lannion_CAS
|
||||
6,,,,False,0,,,,,,,,,
|
||||
|
||||
|
@@ -159,6 +159,30 @@
|
||||
"path_bandwidth": 20000000000.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"request-id": "6",
|
||||
"source": "trx Lannion_CAS",
|
||||
"destination": "trx a",
|
||||
"src-tp-id": "trx Lannion_CAS",
|
||||
"dst-tp-id": "trx a",
|
||||
"path-constraints": {
|
||||
"te-bandwidth": {
|
||||
"technology": "flexi-grid",
|
||||
"trx_type": "vendorA_trx-type1",
|
||||
"trx_mode": "mode 2",
|
||||
"effective-freq-slot": [
|
||||
{
|
||||
"N": "null",
|
||||
"M": "null"
|
||||
}
|
||||
],
|
||||
"spacing": 75000000000.0,
|
||||
"max-nb-of-channel": null,
|
||||
"output-power": null,
|
||||
"path_bandwidth": 100000000000.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"synchronization": [
|
||||
|
||||
@@ -215,7 +215,9 @@ def test_csv_response_generation(json_input, csv_output):
|
||||
resp_header = list(resp.head(0))
|
||||
expected_resp_header = list(expected_resp.head(0))
|
||||
# check that headers are the same
|
||||
if not resp_header.sort() == expected_resp_header.sort():
|
||||
if resp_header.sort() != expected_resp_header.sort():
|
||||
print(resp_header.sort())
|
||||
print(expected_resp_header.sort())
|
||||
raise AssertionError('headers are differents')
|
||||
|
||||
# for each header checks that the output are as expected
|
||||
@@ -223,10 +225,12 @@ def test_csv_response_generation(json_input, csv_output):
|
||||
expected_resp.sort_values(by=['response-id'])
|
||||
|
||||
for column in expected_resp:
|
||||
if list(resp[column]) != list(expected_resp[column]):
|
||||
if list(resp[column].fillna('')) != list(expected_resp[column].fillna('')):
|
||||
print(list(resp[column]))
|
||||
print(list(expected_resp[column]))
|
||||
print(type(list(resp[column])[-1]))
|
||||
raise AssertionError('results are different')
|
||||
|
||||
|
||||
def compare_response(exp_resp, act_resp):
|
||||
""" False if the keys are different in the nested dicts as well
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user