cd ~/tfs-ctrl/src/nbi/service/rest_server/nbi_plugins/ietf_network

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
print(pybindJSON.dumps(ietf_link_obj, mode='ietf'))
