Files
oopt-gnpy/tests/data/network_per_frequency_loss_expected.json
EstherLerouzic 2132ba8ab2 fix: do not crash when exporting loss_coeff per frequency lists
to_json export includes a round that makes the export crash when
loss_coef is an array. This patch includes a test on the data to
correctly export per frequency loss coeff.

legacy format supports
"loss_coef": {"value": [0.29, 0.28, 0.29], "frequency": [186.3e12, 194e12, 197e12]},
yang format should be:
"loss_coef_per_frequency": [
{"frequency": "186300000000000.0", "loss_coef_value": "0.29"},
{"frequency": "194000000000000.0", "loss_coef_value": "0.28"},
{"frequency": "197000000000000.0", "loss_coef_value": "0.29"}]

Signed-off-by: EstherLerouzic <esther.lerouzic@orange.com>
Change-Id: Id4e49d2b3cce22b85228fe790c15c5a93dea7e06
2025-12-04 09:33:23 +00:00

165 lines
3.2 KiB
JSON

{
"elements": [
{
"uid": "Site_A",
"type": "Transceiver",
"metadata": {
"location": {
"latitude": 0.0,
"longitude": 0.0,
"city": "Site A",
"region": ""
}
}
},
{
"uid": "Span1",
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"att_in": 0,
"con_in": 0,
"con_out": 0,
"loss_coef": 0.25
},
"metadata": {
"location": {
"latitude": 1.0,
"longitude": 0.0,
"city": null,
"region": ""
}
}
},
{
"uid": "Edfa1",
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 20.5,
"delta_p": 0.5,
"tilt_target": 0,
"out_voa": 0,
"in_voa": 0
},
"metadata": {
"location": {
"latitude": 2.0,
"longitude": 0.0,
"city": null,
"region": ""
}
}
},
{
"uid": "Span2",
"type": "Fiber",
"type_variety": "SSMF",
"params": {
"length": 80.0,
"length_units": "km",
"att_in": 0,
"con_in": 0,
"con_out": 0,
"loss_coef_per_frequency": [
{
"frequency": 186300000000000.0,
"loss_coef_value": 0.29
},
{
"frequency": 194000000000000.0,
"loss_coef_value": 0.28
},
{
"frequency": 197000000000000.0,
"loss_coef_value": 0.29
}
]
},
"metadata": {
"location": {
"latitude": 1.0,
"longitude": 0.0,
"city": null,
"region": ""
}
}
},
{
"uid": "Edfa2",
"type": "Edfa",
"type_variety": "std_low_gain",
"operational": {
"gain_target": 20.960832,
"delta_p": -1.0,
"tilt_target": 0,
"out_voa": 0,
"in_voa": 0
},
"metadata": {
"location": {
"latitude": 2.0,
"longitude": 0.0,
"city": null,
"region": ""
}
}
},
{
"uid": "Att_B",
"type": "Fused",
"params": {
"loss": 16.0
},
"metadata": {
"location": {
"latitude": 2.0,
"longitude": 1.0,
"city": "Corlay",
"region": "RLD"
}
}
},
{
"uid": "Site_B",
"type": "Transceiver",
"metadata": {
"location": {
"latitude": 3.0,
"longitude": 0.0,
"city": "Site B",
"region": ""
}
}
}
],
"connections": [
{
"from_node": "Site_A",
"to_node": "Span1"
},
{
"from_node": "Span1",
"to_node": "Edfa1"
},
{
"from_node": "Edfa1",
"to_node": "Span2"
},
{
"from_node": "Span2",
"to_node": "Edfa2"
},
{
"from_node": "Edfa2",
"to_node": "Att_B"
},
{
"from_node": "Att_B",
"to_node": "Site_B"
}
],
"network_name": "EDFA Example Network - P2P"
}