mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 02:57:52 +00:00
OFC 2021 demo: config generators and their output
The original topology (`original-gnpy.json`) comes from the past demos we've done. What's new is all that YANG work. Change-Id: I9940a6a620ae9c6f0948d5c5ff7d788f66277571
This commit is contained in:
87
gnpy/example-data/2021-demo/README.md
Normal file
87
gnpy/example-data/2021-demo/README.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# The GNPy YANG demo at OFC 2021
|
||||
|
||||
The demo needs one piece of YANG-formatted data which includes all settings for GNPy as well as the ONOS topology.
|
||||
This is generated via:
|
||||
```console-session
|
||||
$ python gnpy/example-data/2021-demo/generate-demo.py
|
||||
```
|
||||
...which puts files into `gnpy/example-data/2021-demo/`.
|
||||
|
||||
```console-session
|
||||
$ FLASK_APP=gnpy.tools.rest_server.app flask run
|
||||
$ curl -v -X POST -H "Content-Type: application/json" -d @gnpy/example-data/2021-demo/yang.json http://localhost:5000/gnpy-experimental/topology
|
||||
```
|
||||
|
||||
ONOS-formatted `devices.json` and `links.json` are available from the topology:
|
||||
|
||||
- `http://localhost:5000/gnpy-experimental/onos/devices`
|
||||
- `http://localhost:5000/gnpy-experimental/onos/links`
|
||||
|
||||
## Misc notes
|
||||
|
||||
The version of ONOS I used cannot configure the TX power on our transponders:
|
||||
|
||||
```
|
||||
19:06:08.347 INFO [GnpyManager] Configuring egress with power 0.0 for DefaultDevice{id=netconf:10.0.254.103:830, type=TERMINAL_DEVICE, manufacturer=Infinera, hwVersion=Groove, swVersion=4.0.3, serialNumber=, driver=groove}
|
||||
19:06:08.348 INFO [TerminalDevicePowerConfig] Setting power <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><running/></target><config><components xmlns="http://openconfig.net/yang/platform"><component><name>OCH-1-1-L1</name><optical-channel xmlns="http://openconfig.net/yang/terminal-device"><config><target-output-power>0.0</target-output-power></config></optical-channel></component></components></config></edit-config></rpc>
|
||||
19:06:08.349 DEBUG [TerminalDevicePowerConfig] Request <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
|
||||
<edit-config>
|
||||
<target>
|
||||
<running/>
|
||||
</target>
|
||||
<config>
|
||||
<components xmlns="http://openconfig.net/yang/platform">
|
||||
<component>
|
||||
<name>OCH-1-1-L1</name>
|
||||
<optical-channel xmlns="http://openconfig.net/yang/terminal-device">
|
||||
<config>
|
||||
<target-output-power>0.0</target-output-power>
|
||||
</config>
|
||||
</optical-channel>
|
||||
</component>
|
||||
</components>
|
||||
</config>
|
||||
</edit-config>
|
||||
</rpc>
|
||||
|
||||
19:06:08.701 DEBUG [TerminalDevicePowerConfig] Response <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
|
||||
<ok/>
|
||||
</rpc-reply>
|
||||
|
||||
19:06:08.705 WARN [NetconfSessionMinaImpl] Device netconf:administrator@10.0.254.103:830 has error in reply <?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
|
||||
<rpc-error>
|
||||
<error-type>application</error-type>
|
||||
<error-tag>operation-not-supported</error-tag>
|
||||
<error-severity>error</error-severity>
|
||||
<error-message>Request could not be completed because the requested operation is not supported by this implementation.</error-message>
|
||||
</rpc-error>
|
||||
</rpc-reply>
|
||||
19:06:08.706 ERROR [TerminalDevicePowerConfig] error committing channel power
|
||||
org.onosproject.netconf.NetconfException: Request not successful with device netconf:administrator@10.0.254.103:830 with reply <?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="18">
|
||||
<rpc-error>
|
||||
<error-type>application</error-type>
|
||||
<error-tag>operation-not-supported</error-tag>
|
||||
<error-severity>error</error-severity>
|
||||
<error-message>Request could not be completed because the requested operation is not supported by this implementation.</error-message>
|
||||
</rpc-error>
|
||||
</rpc-reply>
|
||||
at org.onosproject.netconf.ctl.impl.NetconfSessionMinaImpl.requestSync(NetconfSessionMinaImpl.java:516) ~[?:?]
|
||||
at org.onosproject.netconf.ctl.impl.NetconfSessionMinaImpl.requestSync(NetconfSessionMinaImpl.java:509) ~[?:?]
|
||||
at org.onosproject.netconf.AbstractNetconfSession.commit(AbstractNetconfSession.java:336) ~[?:?]
|
||||
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig$ComponentType.setTargetPower(TerminalDevicePowerConfig.java:401) ~[?:?]
|
||||
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig$ComponentType$1.setTargetPower(TerminalDevicePowerConfig.java:315) ~[?:?]
|
||||
at org.onosproject.drivers.odtn.openconfig.TerminalDevicePowerConfig.setTargetPower(TerminalDevicePowerConfig.java:222) ~[?:?]
|
||||
at org.onosproject.odtn.impl.GnpyManager.setPathPower(GnpyManager.java:562) ~[?:?]
|
||||
at org.onosproject.odtn.impl.GnpyManager$InternalIntentListener.lambda$event$0(GnpyManager.java:509) ~[?:?]
|
||||
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736) [?:?]
|
||||
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
|
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
|
||||
at java.lang.Thread.run(Thread.java:834) [?:?]
|
||||
```
|
||||
|
||||
Filter out launch power settings.
|
||||
It's not needed anyway, the very first node after a transponder is a ROADM.
|
||||
11
gnpy/example-data/2021-demo/default_edfa_config.json
Normal file
11
gnpy/example-data/2021-demo/default_edfa_config.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"nf_ripple": [
|
||||
0.0
|
||||
],
|
||||
"gain_ripple": [
|
||||
0.0
|
||||
],
|
||||
"dgt": [
|
||||
1.0
|
||||
]
|
||||
}
|
||||
116
gnpy/example-data/2021-demo/equipment.json
Normal file
116
gnpy/example-data/2021-demo/equipment.json
Normal file
@@ -0,0 +1,116 @@
|
||||
{ "Edfa":[
|
||||
|
||||
{
|
||||
"type_variety": "fixed27",
|
||||
"type_def": "fixed_gain",
|
||||
"gain_flatmax": 27,
|
||||
"gain_min": 27,
|
||||
"p_max": 21,
|
||||
"nf0": 5.5,
|
||||
"allowed_for_design": false
|
||||
},
|
||||
|
||||
{
|
||||
"type_variety": "fixed22",
|
||||
"type_def": "fixed_gain",
|
||||
"gain_flatmax": 22,
|
||||
"gain_min": 22,
|
||||
"p_max": 21,
|
||||
"nf0": 5.5,
|
||||
"allowed_for_design": false
|
||||
}
|
||||
],
|
||||
"Fiber":[{
|
||||
"type_variety": "SSMF",
|
||||
"dispersion": 1.67e-05,
|
||||
"gamma": 0.00127,
|
||||
"pmd_coef": 1.265e-15
|
||||
}
|
||||
],
|
||||
"Span":[{
|
||||
"power_mode": false,
|
||||
"delta_power_range_db": [-2,3,0.5],
|
||||
"max_fiber_lineic_loss_for_raman": 0.25,
|
||||
"target_extended_gain": 2.5,
|
||||
"max_length": 150,
|
||||
"length_units": "km",
|
||||
"max_loss": 28,
|
||||
"padding": 10,
|
||||
"EOL": 0,
|
||||
"con_in": 0,
|
||||
"con_out": 0
|
||||
}
|
||||
],
|
||||
"Roadm":[{
|
||||
"target_pch_out_db": -25,
|
||||
"add_drop_osnr": 30.00,
|
||||
"pmd": 0,
|
||||
"restrictions": {
|
||||
"preamp_variety_list":[],
|
||||
"booster_variety_list":[]
|
||||
}
|
||||
}],
|
||||
"SI":[{
|
||||
"f_min": 191.6e12,
|
||||
"baud_rate": 32e9,
|
||||
"f_max":195.1e12,
|
||||
"spacing": 50e9,
|
||||
"power_dbm": 0,
|
||||
"power_range_db": [0,0,1],
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"sys_margins": 2
|
||||
}],
|
||||
"Transceiver":[
|
||||
{
|
||||
"type_variety": "Cassini",
|
||||
"frequency":{
|
||||
"min": 191.35e12,
|
||||
"max": 196.1e12
|
||||
},
|
||||
"mode":[
|
||||
{
|
||||
|
||||
"format": "dp-qpsk",
|
||||
"baud_rate": 32e9,
|
||||
"OSNR": 11,
|
||||
"bit_rate": 100e9,
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"min_spacing": 37.5e9,
|
||||
"cost":1
|
||||
},
|
||||
{
|
||||
"format": "16-qam",
|
||||
"baud_rate": 66e9,
|
||||
"OSNR": 15,
|
||||
"bit_rate": 200e9,
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"min_spacing": 75e9,
|
||||
"cost":1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type_variety": "Voyager",
|
||||
"frequency":{
|
||||
"min": 191.35e12,
|
||||
"max": 196.1e12
|
||||
},
|
||||
"mode":[
|
||||
{
|
||||
"format": "mode 1",
|
||||
"baud_rate": 32e9,
|
||||
"OSNR": 12,
|
||||
"bit_rate": 100e9,
|
||||
"roll_off": 0.15,
|
||||
"tx_osnr": 40,
|
||||
"min_spacing": 37.5e9,
|
||||
"cost":1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
291
gnpy/example-data/2021-demo/expected-reply.json
Normal file
291
gnpy/example-data/2021-demo/expected-reply.json
Normal file
@@ -0,0 +1,291 @@
|
||||
{
|
||||
"result": {
|
||||
"response": [
|
||||
{
|
||||
"path-properties": {
|
||||
"path-metric": [
|
||||
{
|
||||
"accumulative-value": 19.38,
|
||||
"metric-type": "SNR-bandwidth"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 23.46,
|
||||
"metric-type": "SNR-0.1nm"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 19.38,
|
||||
"metric-type": "OSNR-bandwidth"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 23.47,
|
||||
"metric-type": "OSNR-0.1nm"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 100000000000,
|
||||
"metric-type": "path_bandwidth"
|
||||
}
|
||||
],
|
||||
"path-route-objects": [
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 0,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "transceiver",
|
||||
"gnpy-nodes": [
|
||||
"trx-Bremen"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.103:830",
|
||||
"node-id": "netconf:10.0.254.103:830",
|
||||
"transponder": {
|
||||
"transponder-mode": "dp-qpsk",
|
||||
"transponder-type": "Cassini"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 1,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Bremen-AD"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.225:830",
|
||||
"node-id": "netconf:10.0.254.225:830",
|
||||
"target-channel-power": -12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 5,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Bremen-L2"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.102:830",
|
||||
"node-id": "netconf:10.0.254.102:830",
|
||||
"target-channel-power": -23
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 9,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Amsterdam-L1"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.78:830",
|
||||
"node-id": "netconf:10.0.254.78:830",
|
||||
"target-channel-power": -12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 13,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Amsterdam-AD"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.107:830",
|
||||
"node-id": "netconf:10.0.254.107:830",
|
||||
"target-channel-power": -13
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 14,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "transceiver",
|
||||
"gnpy-nodes": [
|
||||
"trx-Amsterdam"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.105:830",
|
||||
"node-id": "netconf:10.0.254.105:830",
|
||||
"transponder": {
|
||||
"transponder-mode": "dp-qpsk",
|
||||
"transponder-type": "Cassini"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"reversed-path-route-objects": [
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 0,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "transceiver",
|
||||
"gnpy-nodes": [
|
||||
"trx-Amsterdam"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.105:830",
|
||||
"node-id": "netconf:10.0.254.105:830",
|
||||
"transponder": {
|
||||
"transponder-mode": "dp-qpsk",
|
||||
"transponder-type": "Cassini"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 1,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Amsterdam-AD"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.107:830",
|
||||
"node-id": "netconf:10.0.254.107:830",
|
||||
"target-channel-power": -12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 6,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "EDFA",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Amsterdam-L1-booster"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.78:830",
|
||||
"node-id": "netconf:10.0.254.78:830",
|
||||
"target-channel-power": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 9,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Bremen-L2"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.102:830",
|
||||
"node-id": "netconf:10.0.254.102:830",
|
||||
"target-channel-power": -12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 13,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "ROADM",
|
||||
"gnpy-nodes": [
|
||||
"roadm-Bremen-AD"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.225:830",
|
||||
"node-id": "netconf:10.0.254.225:830",
|
||||
"target-channel-power": -13
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path-route-object": {
|
||||
"index": 14,
|
||||
"label-hop": {
|
||||
"M": 4,
|
||||
"N": -236
|
||||
},
|
||||
"num-unnum-hop": {
|
||||
"gnpy-node-type": "transceiver",
|
||||
"gnpy-nodes": [
|
||||
"trx-Bremen"
|
||||
],
|
||||
"link-tp-id": "netconf:10.0.254.103:830",
|
||||
"node-id": "netconf:10.0.254.103:830",
|
||||
"transponder": {
|
||||
"transponder-mode": "dp-qpsk",
|
||||
"transponder-type": "Cassini"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"z-a-path-metric": [
|
||||
{
|
||||
"accumulative-value": 19.38,
|
||||
"metric-type": "SNR-bandwidth"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 23.46,
|
||||
"metric-type": "SNR-0.1nm"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 19.38,
|
||||
"metric-type": "OSNR-bandwidth"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 23.47,
|
||||
"metric-type": "OSNR-0.1nm"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 0.001,
|
||||
"metric-type": "reference_power"
|
||||
},
|
||||
{
|
||||
"accumulative-value": 100000000000,
|
||||
"metric-type": "path_bandwidth"
|
||||
}
|
||||
]
|
||||
},
|
||||
"response-id": "onos-3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
447
gnpy/example-data/2021-demo/generate-demo.py
Normal file
447
gnpy/example-data/2021-demo/generate-demo.py
Normal file
@@ -0,0 +1,447 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from gnpy.tools.json_io import load_equipment, load_network
|
||||
from gnpy.yang.io import save_to_json
|
||||
|
||||
# How many nodes in the ring topology? Up to eight is supported, then I ran out of cities..
|
||||
HOW_MANY = 3
|
||||
|
||||
# city names
|
||||
ALL_CITIES = [
|
||||
'Amsterdam',
|
||||
'Bremen',
|
||||
'Cologne',
|
||||
'Dueseldorf',
|
||||
'Eindhoven',
|
||||
'Frankfurt',
|
||||
'Ghent',
|
||||
'Hague',
|
||||
]
|
||||
# end of configurable parameters
|
||||
|
||||
|
||||
J = {
|
||||
"elements": [],
|
||||
"connections": [],
|
||||
}
|
||||
|
||||
def unidir_join(a, b):
|
||||
global J
|
||||
J["connections"].append(
|
||||
{"from_node": a, "to_node": b}
|
||||
)
|
||||
|
||||
def mk_edfa(name, gain, voa=0.0):
|
||||
global J
|
||||
J["elements"].append(
|
||||
{"uid": name, "type": "Edfa", "type_variety": f"fixed{gain}", "operational": {"gain_target": gain, "out_voa": voa}}
|
||||
)
|
||||
|
||||
def add_att(a, b, att):
|
||||
global J
|
||||
if att > 0:
|
||||
uid = f"att-({a})-({b})"
|
||||
else:
|
||||
uid = f"splice-({a})-({b})"
|
||||
J["elements"].append(
|
||||
{"uid": uid, "type": "Fused", "params": {"loss": att}},
|
||||
)
|
||||
unidir_join(a, uid)
|
||||
unidir_join(uid, b)
|
||||
return uid
|
||||
|
||||
def build_fiber(city1, city2):
|
||||
global J
|
||||
J["elements"].append(
|
||||
{
|
||||
"uid": f"fiber-{city1}-{city2}",
|
||||
"type": "Fiber",
|
||||
"type_variety": "SSMF",
|
||||
"params": {
|
||||
"length": 50,
|
||||
"length_units": "km",
|
||||
"loss_coef": 0.2,
|
||||
"con_in": 1.5,
|
||||
"con_out": 1.5,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
def unidir_patch(a, b):
|
||||
global J
|
||||
uid = f"patch-({a})-({b})"
|
||||
J["elements"].append(
|
||||
{
|
||||
"uid": uid,
|
||||
"type": "Fiber",
|
||||
"type_variety": "SSMF",
|
||||
"params": {
|
||||
"length": 0,
|
||||
"length_units": "km",
|
||||
"loss_coef": 0.2,
|
||||
"con_in": 0.5,
|
||||
"con_out": 0.5,
|
||||
}
|
||||
}
|
||||
)
|
||||
add_att(a, uid, 0.0)
|
||||
add_att(uid, b, 0.0)
|
||||
|
||||
for CITY in (ALL_CITIES[x] for x in range(0, HOW_MANY)):
|
||||
J["elements"].append(
|
||||
{"uid": f"trx-{CITY}", "type_variety": "Cassini", "type": "Transceiver"}
|
||||
)
|
||||
target_pwr = {
|
||||
f"trx-{CITY}": -8,
|
||||
f"splice-(roadm-{CITY}-AD)-(patch-(roadm-{CITY}-AD)-(roadm-{CITY}-L1))": -12,
|
||||
f"splice-(roadm-{CITY}-AD)-(patch-(roadm-{CITY}-AD)-(roadm-{CITY}-L2))": -12,
|
||||
}
|
||||
J["elements"].append(
|
||||
{"uid": f"roadm-{CITY}-AD", "type": "Roadm", "params": {"target_pch_out_db": -2.0, "per_degree_pch_out_db": target_pwr}}
|
||||
)
|
||||
unidir_join(f"trx-{CITY}", f"roadm-{CITY}-AD")
|
||||
unidir_join(f"roadm-{CITY}-AD", f"trx-{CITY}")
|
||||
|
||||
for n in (1,2):
|
||||
target_pwr = {
|
||||
f"roadm-{CITY}-L{n}-booster": -23,
|
||||
f"splice-(roadm-{CITY}-L{n})-(patch-(roadm-{CITY}-L{n})-(roadm-{CITY}-AD))": -12,
|
||||
}
|
||||
for m in (1,2):
|
||||
if m == n:
|
||||
continue
|
||||
target_pwr[f"splice-(roadm-{CITY}-L{n})-(patch-(roadm-{CITY}-L{n})-(roadm-{CITY}-L{m}))"] = -12
|
||||
J["elements"].append(
|
||||
{"uid": f"roadm-{CITY}-L{n}", "type": "Roadm", "params": {"target_pch_out_db": -23.0, "per_degree_pch_out_db": target_pwr}}
|
||||
)
|
||||
mk_edfa(f"roadm-{CITY}-L{n}-booster", 22)
|
||||
mk_edfa(f"roadm-{CITY}-L{n}-preamp", 27)
|
||||
unidir_join(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-L{n}-booster")
|
||||
unidir_join(f"roadm-{CITY}-L{n}-preamp", f"roadm-{CITY}-L{n}")
|
||||
|
||||
unidir_patch(f"roadm-{CITY}-AD", f"roadm-{CITY}-L{n}")
|
||||
unidir_patch(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-AD")
|
||||
for m in (1,2):
|
||||
if m == n:
|
||||
continue
|
||||
unidir_patch(f"roadm-{CITY}-L{n}", f"roadm-{CITY}-L{m}")
|
||||
|
||||
for city1, city2 in ((ALL_CITIES[i], ALL_CITIES[i + 1] if i < HOW_MANY - 1 else ALL_CITIES[0]) for i in range(0, HOW_MANY)):
|
||||
build_fiber(city1, city2)
|
||||
unidir_join(f"roadm-{city1}-L1-booster", f"fiber-{city1}-{city2}")
|
||||
unidir_join(f"fiber-{city1}-{city2}", f"roadm-{city2}-L2-preamp")
|
||||
build_fiber(city2, city1)
|
||||
unidir_join(f"roadm-{city2}-L2-booster", f"fiber-{city2}-{city1}")
|
||||
unidir_join(f"fiber-{city2}-{city1}", f"roadm-{city1}-L1-preamp")
|
||||
|
||||
|
||||
for _, E in enumerate(J["elements"]):
|
||||
uid = E["uid"]
|
||||
if uid.startswith("roadm-") and (uid.endswith("-L1-booster") or uid.endswith("-L2-booster")):
|
||||
E["operational"]["out_voa"] = 12.0
|
||||
|
||||
with open('gnpy/example-data/2021-demo/original-gnpy.json', 'w') as f:
|
||||
json.dump(J, f, indent=2)
|
||||
|
||||
equipment = load_equipment('gnpy/example-data/2021-demo/equipment.json')
|
||||
network = load_network(Path('gnpy/example-data/2021-demo/original-gnpy.json'), equipment)
|
||||
yang_bundle = save_to_json(equipment, network)
|
||||
with open('gnpy/example-data/2021-demo/yang-without-onos.json', 'w') as f:
|
||||
json.dump(yang_bundle, f, indent=2)
|
||||
yang_bundle['ietf-network:networks']['network'].append({
|
||||
"network-id": "ONOS",
|
||||
"network-types": {
|
||||
"tip-onos-topology:onos-topology": {
|
||||
}
|
||||
},
|
||||
"node": [
|
||||
{
|
||||
"node-id": "netconf:10.0.254.105:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "trx-Amsterdam"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Amsterdam TXP (g30-horni)",
|
||||
"driver": "groove",
|
||||
"grid-x": -150,
|
||||
"grid-y": 350,
|
||||
"netconf": {
|
||||
"username": "administrator",
|
||||
"password": "e2e!Net4u#"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.78:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L1"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L1-preamp"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L1-booster"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Amsterdam L1 to Bremen (line-QR79)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 225,
|
||||
"grid-y": 320,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.79:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L2"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L2-boster"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-L2-preamp"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Amsterdam L2 to Cologne (line-Q7JS)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 225,
|
||||
"grid-y": 380,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.107:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Amsterdam-AD"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Amsterdam Add/Drop (coh-a-d-v9u)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 175,
|
||||
"grid-y": 350,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.99:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L1"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L1-preamp"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L1-booster"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Cologne L1 to Amsterdam (line-TQQ)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 420,
|
||||
"grid-y": 550,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.104:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L2"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L2-boster"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Cologne-L2-preamp"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Cologne L2 to Bremen (line-QLK6)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 480,
|
||||
"grid-y": 550,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.100:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L1"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L1-preamp"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L1-booster"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Bremen L1 to Cologne (line-WKP)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 700,
|
||||
"grid-y": 380,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.102:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L2"
|
||||
},
|
||||
# try removing the following section to see how a wrong power config affects the results
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L2-booster"
|
||||
},
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-L2-preamp"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Bremen L2 to Amsterdam (line-QCP9)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 700,
|
||||
"grid-y": 320,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.225:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "roadm-Bremen-AD"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Bremen Add/Drop (add-drop-SPI)",
|
||||
"driver": "czechlight-roadm",
|
||||
"grid-x": 750,
|
||||
"grid-y": 350,
|
||||
"netconf": {
|
||||
"idle-timeout": 0,
|
||||
"username": "dwdm",
|
||||
"password": "dwdm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"node-id": "netconf:10.0.254.103:830",
|
||||
"supporting-node": [
|
||||
{
|
||||
"network-ref": "GNPy",
|
||||
"node-ref": "trx-Bremen"
|
||||
}
|
||||
],
|
||||
"tip-onos-topology:device": {
|
||||
"name": "Amsterdam TXP (g30-spodni)",
|
||||
"driver": "groove",
|
||||
"grid-x": 1050,
|
||||
"grid-y": 350,
|
||||
"netconf": {
|
||||
"username": "administrator",
|
||||
"password": "e2e!Net4u#"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"ietf-network-topology:link": [
|
||||
{
|
||||
"link-id": "netconf:10.0.254.105:830/10101-netconf:10.0.254.107:830/1"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.107:830/100-netconf:10.0.254.78:830/1"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.107:830/100-netconf:10.0.254.79:830/2"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.79:830/1-netconf:10.0.254.78:830/2"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.99:830/1-netconf:10.0.254.104:830/1"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.79:830/100-netconf:10.0.254.99:830/100"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.104:830/100-netconf:10.0.254.100:830/100"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.102:830/100-netconf:10.0.254.78:830/100"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.100:830/1-netconf:10.0.254.225:830/100"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.102:830/2-netconf:10.0.254.225:830/100"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.102:830/1-netconf:10.0.254.100:830/2"
|
||||
},
|
||||
{
|
||||
"link-id": "netconf:10.0.254.103:830/10101-netconf:10.0.254.225:830/1"
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
with open('gnpy/example-data/2021-demo/yang.json', 'w') as f:
|
||||
json.dump(yang_bundle, f, indent=2)
|
||||
1
gnpy/example-data/2021-demo/onos-real-request.json
Normal file
1
gnpy/example-data/2021-demo/onos-real-request.json
Normal file
@@ -0,0 +1 @@
|
||||
{"path-request":[{"request-id":"onos-3","source":"netconf:10.0.254.103:830","destination":"netconf:10.0.254.105:830","src-tp-id":"netconf:10.0.254.103:830","dst-tp-id":"netconf:10.0.254.105:830","bidirectional":true,"path-constraints":{"te-bandwidth":{"technology":"flexi-grid","trx_type":"Cassini","trx_mode":null,"effective-freq-slot":[{"N":"null","M":"null"}],"spacing":5.0E10,"max-nb-of-channel":null,"output-power":null,"path_bandwidth":1.0E11}}}]}
|
||||
1185
gnpy/example-data/2021-demo/original-gnpy.json
Normal file
1185
gnpy/example-data/2021-demo/original-gnpy.json
Normal file
File diff suppressed because it is too large
Load Diff
1518
gnpy/example-data/2021-demo/yang-without-onos.json
Normal file
1518
gnpy/example-data/2021-demo/yang-without-onos.json
Normal file
File diff suppressed because it is too large
Load Diff
1810
gnpy/example-data/2021-demo/yang.json
Normal file
1810
gnpy/example-data/2021-demo/yang.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,12 @@ def _yangson_datamodel():
|
||||
return create_datamodel
|
||||
|
||||
|
||||
@pytest.mark.parametrize("filename", (Path(__file__).parent / 'yang').glob('*.json'), ids=_get_basename)
|
||||
@pytest.mark.parametrize("filename",
|
||||
list((Path(__file__).parent / 'yang').glob('*.json')) + [
|
||||
SRC_ROOT / 'gnpy' / 'example-data' / '2021-demo' / 'yang-without-onos.json',
|
||||
SRC_ROOT / 'gnpy' / 'example-data' / '2021-demo' / 'yang.json',
|
||||
],
|
||||
ids=_get_basename)
|
||||
def test_validate_yang_data(_yangson_datamodel, filename: Path):
|
||||
'''Validate a JSON file against our YANG models'''
|
||||
dm = _yangson_datamodel()
|
||||
|
||||
Reference in New Issue
Block a user