diff --git a/src/nbi/service/rest_server/nbi_plugins/ietf_network/ComposeNode.py b/src/nbi/service/rest_server/nbi_plugins/ietf_network/ComposeNode.py index 3f000f2d896977724328eb456edac7d62eb68b94..7467abb0eb20a0bdad94d9f70438bb5eed5d7eab 100644 --- a/src/nbi/service/rest_server/nbi_plugins/ietf_network/ComposeNode.py +++ b/src/nbi/service/rest_server/nbi_plugins/ietf_network/ComposeNode.py @@ -49,3 +49,45 @@ def compose_node( ietf_tp_obj = ietf_node_obj.termination_point.add(endpoint_name) compose_term_point(ietf_tp_obj, device, endpoint, name_mappings, network_type) + + if network_type == NetworkTypeEnum.TE_OTN_TOPOLOGY: + if device_name in {'10.0.30.1', '10.0.40.1'}: + ntaw = ietf_node_obj.te.tunnel_termination_point.add('NTAw') + ntaw.admin_status = 'up' + ntaw.encoding = 'ietf-te-types:lsp-encoding-oduk' + ntaw_llc = ntaw.local_link_connectivities.local_link_connectivity.add('500') + ntaw_llc.is_allowed = True + ntaw.name = '1-1-1-1-1' + ntaw._set_oper_status('up') + ntaw.protection_type = 'ietf-te-types:lsp-protection-unprotected' + ntaw.switching_capability = 'ietf-te-types:switching-otn' + + ntax = ietf_node_obj.te.tunnel_termination_point.add('NTAx') + ntax.admin_status = 'up' + ntax.encoding = 'ietf-te-types:lsp-encoding-oduk' + ntax_llc = ntax.local_link_connectivities.local_link_connectivity.add('501') + ntax_llc.is_allowed = True + ntax.name = '1-1-1-1-1' + ntax._set_oper_status('up') + ntax.protection_type = 'ietf-te-types:lsp-protection-unprotected' + ntax.switching_capability = 'ietf-te-types:switching-otn' + elif device_name in {'10.0.10.1', '10.0.20.1'}: + ntax = ietf_node_obj.te.tunnel_termination_point.add('NTAx') + ntax.admin_status = 'up' + ntax.encoding = 'ietf-te-types:lsp-encoding-oduk' + ntax_llc = ntax.local_link_connectivities.local_link_connectivity.add('501') + ntax_llc.is_allowed = True + ntax.name = '1-1-1-1-1' + ntax._set_oper_status('up') + ntax.protection_type = 'ietf-te-types:lsp-protection-unprotected' + ntax.switching_capability = 'ietf-te-types:switching-otn' + + ntaw = ietf_node_obj.te.tunnel_termination_point.add('NTAw') + ntaw.admin_status = 'up' + ntaw.encoding = 'ietf-te-types:lsp-encoding-oduk' + ntaw_llc = ntaw.local_link_connectivities.local_link_connectivity.add('500') + ntaw_llc.is_allowed = True + ntaw.name = '1-1-1-1-1' + ntaw._set_oper_status('up') + ntaw.protection_type = 'ietf-te-types:lsp-protection-unprotected' + ntaw.switching_capability = 'ietf-te-types:switching-otn' diff --git a/src/nbi/service/rest_server/nbi_plugins/ietf_network/TODO.txt b/src/nbi/service/rest_server/nbi_plugins/ietf_network/TODO.txt index dc03b0623d70d78b45fe81084151e81f24c4ced6..12d35c01cd9e78675daa655dc4cf679aa55ee30a 100644 --- a/src/nbi/service/rest_server/nbi_plugins/ietf_network/TODO.txt +++ b/src/nbi/service/rest_server/nbi_plugins/ietf_network/TODO.txt @@ -1,73 +1,25 @@ -WARNING src.nbi.tests.test_ietf_network:PrepareTestScenario.py:90 Request: GET http://admin:admin@127.0.0.1:18080/restconf/data/ietf-network:networks -INFO nbi.service.rest_server.RestServer:GenericRestServer.py:27 [2023-Dec-13 18:33] 127.0.0.1 GET /restconf/data/ietf-network:networks? 308 PERMANENT REDIRECT -INFO nbi.service.rest_server.nbi_plugins.ietf_network.Networks:Networks.py:41 Request: <Request 'http://127.0.0.1:18080/restconf/data/ietf-network:networks/' [GET]> -INFO nbi.service.rest_server.RestServer:GenericRestServer.py:27 [2023-Dec-13 18:33] 127.0.0.1 GET /restconf/data/ietf-network:networks/? 200 OK -WARNING src.nbi.tests.test_ietf_network:PrepareTestScenario.py:93 Reply: {"ietf-network:networks":{"network":[{"ietf-network-topology:link":[{"destination":{"dest-node":"10.0.20.1","dest-tp":"501"},"link-id":"10.0.10.1-501","source":{"source-node":"10.0.10.1","source-tp":"501"}},{"destination":{"dest-node":"10.0.10.1","dest-tp":"501"},"link-id":"10.0.20.1-501","source":{"source-node":"10.0.20.1","source-tp":"501"}},{"destination":{"dest-node":"10.0.40.1","dest-tp":"500"},"link-id":"10.0.10.1-500","source":{"source-node":"10.0.10.1","source-tp":"500"}},{"destination":{"dest-node":"10.0.10.1","dest-tp":"500"},"link-id":"10.0.40.1-500","source":{"source-node":"10.0.40.1","source-tp":"500"}},{"destination":{"dest-node":"10.0.30.1","dest-tp":"500"},"link-id":"10.0.20.1-500","source":{"source-node":"10.0.20.1","source-tp":"500"}},{"destination":{"dest-node":"10.0.20.1","dest-tp":"500"},"link-id":"10.0.30.1-500","source":{"source-node":"10.0.30.1","source-tp":"500"}},{"destination":{"dest-node":"10.0.30.1","dest-tp":"501"},"link-id":"10.0.40.1-501","source":{"source-node":"10.0.40.1","source-tp":"501"}},{"destination":{"dest-node":"10.0.40.1","dest-tp":"501"},"link-id":"10.0.30.1-501","source":{"source-node":"10.0.30.1","source-tp":"501"}}],"ietf-te-topology:te":{"name":"Huawei-Network"},"ietf-te-topology:te-topology-identifier":{"client-id":0,"provider-id":10,"topology-id":"1"},"network-id":"providerId-10-clientId-0-topologyId-1","network-types":{"ietf-te-topology:te-topology":{"ietf-otn-topology:otn-topology":{}}},"node":[{"ietf-network-topology:termination-point":[{"tp-id":"200"},{"tp-id":"500"},{"tp-id":"501"}],"ietf-te-topology:te-node-id":"10.0.30.1","node-id":"10.0.30.1"},{"ietf-network-topology:termination-point":[{"tp-id":"501"},{"tp-id":"500"}],"ietf-te-topology:te-node-id":"10.0.40.1","node-id":"10.0.40.1"},{"ietf-network-topology:termination-point":[{"tp-id":"501"},{"tp-id":"200"},{"tp-id":"500"}],"ietf-te-topology:te-node-id":"10.0.10.1","node-id":"10.0.10.1"},{"ietf-network-topology:termination-point":[{"tp-id":"500"},{"tp-id":"501"}],"ietf-te-topology:te-node-id":"10.0.20.1","node-id":"10.0.20.1"}]},{"ietf-te-topology:te":{"name":"Huawei-Network"},"ietf-te-topology:te-topology-identifier":{"client-id":0,"provider-id":10,"topology-id":"2"},"network-id":"providerId-10-clientId-0-topologyId-2","network-types":{"ietf-te-topology:te-topology":{"ietf-eth-te-topology:eth-tran-topology":{}}},"node":[{"ietf-network-topology:termination-point":[{"tp-id":"200"},{"tp-id":"500"},{"tp-id":"501"}],"ietf-te-topology:te-node-id":"10.0.30.1","node-id":"10.0.30.1"},{"ietf-network-topology:termination-point":[{"tp-id":"501"},{"tp-id":"200"},{"tp-id":"500"}],"ietf-te-topology:te-node-id":"10.0.10.1","node-id":"10.0.10.1"}]}]}} +cd ~/tfs-ctrl/src/nbi/service/rest_server/nbi_plugins/ietf_network -ERROR src.nbi.tests.test_ietf_network:test_ietf_network.py:85 Differences: -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][2]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][3]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][4]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][5]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][6]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['ietf-network-topology:link'][7]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][3]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['ietf-network-topology:link'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][0]['ietf-eth-te-topology:eth-svc'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][1]['ietf-eth-te-topology:eth-svc'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][2]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][2]['ietf-eth-te-topology:eth-svc'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][2]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][0]['ietf-eth-te-topology:eth-svc'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][0]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te-tp-id'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][1]['ietf-eth-te-topology:eth-svc'] removed from dictionary. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][1]['ietf-te-topology:te'] removed from dictionary. -Item root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][2] added to iterable. -Item root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][2] added to iterable. -Item root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][2] added to iterable. -Item root['ietf-network:networks']['network'][1]['node'][2] removed from iterable. -Item root['ietf-network:networks']['network'][1]['node'][3] removed from iterable. -Item root['ietf-network:networks']['network'][1]['node'][4] removed from iterable. -Item root['ietf-network:networks']['network'][1]['node'][5] removed from iterable. -Item root['ietf-network:networks']['network'][1]['node'][6] removed from iterable. -Value of root['ietf-network:networks']['network'][0]['node'][0]['ietf-network-topology:termination-point'][1]['tp-id'] changed from "500" to "200". -Value of root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][0]['tp-id'] changed from "501" to "500". -Value of root['ietf-network:networks']['network'][0]['node'][1]['ietf-network-topology:termination-point'][1]['tp-id'] changed from "500" to "501". -Value of root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][0]['tp-id'] changed from "500" to "200". -Value of root['ietf-network:networks']['network'][0]['node'][2]['ietf-network-topology:termination-point'][1]['tp-id'] changed from "501" to "500". -Value of root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][0]['tp-id'] changed from "500" to "501". -Value of root['ietf-network:networks']['network'][0]['node'][3]['ietf-network-topology:termination-point'][1]['tp-id'] changed from "501" to "500". -Value of root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][0]['tp-id'] changed from "200" to "501". -Value of root['ietf-network:networks']['network'][1]['node'][0]['ietf-network-topology:termination-point'][1]['tp-id'] changed from "501" to "200". -Value of root['ietf-network:networks']['network'][1]['node'][1]['ietf-network-topology:termination-point'][0]['tp-id'] changed from "501" to "200". -Value of root['ietf-network:networks']['network'][1]['node'][1]['ietf-te-topology:te-node-id'] changed from "10.0.20.1" to "10.0.30.1". -Value of root['ietf-network:networks']['network'][1]['node'][1]['node-id'] changed from "10.0.20.1" to "10.0.30.1". +python + +from bindings import ietf_network +import pyangbind.lib.pybindJSON as pybindJSON + +ietf_nets_obj = ietf_network() +ietf_net_obj = ietf_nets_obj.networks.network.add('my-topo') + +ietf_node_obj = ietf_net_obj.node.add('my-node') +ietf_tp_obj = ietf_node_obj.termination_point.add('my-tp') + +ietf_link_obj = ietf_net_obj.link.add('my-link') + +ietf_link_obj.te._set_oper_status('up') +print(pybindJSON.dumps(ietf_nets_obj, mode='ietf')) + +ietf_link_obj.te.te_link_attributes.admin_status = 'down' +print(pybindJSON.dumps(ietf_nets_obj, mode='ietf')) + + +ietf_link_obj.te.te_link_attributes.max_link_bandwidth.te_bandwidth.eth_bandwidth = 10_000_000 # Kbps +unresv_bw = ietf_link_obj.te.te_link_attributes.unreserved_bandwidth.add(7) +unresv_bw.te_bandwidth.eth_bandwidth = 10_000_000 # Kbps