daemon: xml files will now write and read loss, but fallback to looking for per for compatibility
This commit is contained in:
parent
b74395049a
commit
e18ffaafce
1 changed files with 22 additions and 20 deletions
|
@ -569,7 +569,7 @@ class CoreXmlWriter:
|
|||
options = etree.Element("options")
|
||||
add_attribute(options, "delay", link_data.delay)
|
||||
add_attribute(options, "bandwidth", link_data.bandwidth)
|
||||
add_attribute(options, "per", link_data.loss)
|
||||
add_attribute(options, "loss", link_data.loss)
|
||||
add_attribute(options, "dup", link_data.dup)
|
||||
add_attribute(options, "jitter", link_data.jitter)
|
||||
add_attribute(options, "mer", link_data.mer)
|
||||
|
@ -947,37 +947,39 @@ class CoreXmlReader:
|
|||
interface_two = create_interface_data(interface_two_element)
|
||||
|
||||
options_element = link_element.find("options")
|
||||
link_options = LinkOptions()
|
||||
options = LinkOptions()
|
||||
if options_element is not None:
|
||||
link_options.bandwidth = get_int(options_element, "bandwidth")
|
||||
link_options.burst = get_int(options_element, "burst")
|
||||
link_options.delay = get_int(options_element, "delay")
|
||||
link_options.dup = get_int(options_element, "dup")
|
||||
link_options.mer = get_int(options_element, "mer")
|
||||
link_options.mburst = get_int(options_element, "mburst")
|
||||
link_options.jitter = get_int(options_element, "jitter")
|
||||
link_options.key = get_int(options_element, "key")
|
||||
link_options.loss = get_float(options_element, "per")
|
||||
link_options.unidirectional = get_int(options_element, "unidirectional")
|
||||
link_options.session = options_element.get("session")
|
||||
link_options.emulation_id = get_int(options_element, "emulation_id")
|
||||
link_options.network_id = get_int(options_element, "network_id")
|
||||
link_options.opaque = options_element.get("opaque")
|
||||
link_options.gui_attributes = options_element.get("gui_attributes")
|
||||
options.bandwidth = get_int(options_element, "bandwidth")
|
||||
options.burst = get_int(options_element, "burst")
|
||||
options.delay = get_int(options_element, "delay")
|
||||
options.dup = get_int(options_element, "dup")
|
||||
options.mer = get_int(options_element, "mer")
|
||||
options.mburst = get_int(options_element, "mburst")
|
||||
options.jitter = get_int(options_element, "jitter")
|
||||
options.key = get_int(options_element, "key")
|
||||
options.loss = get_float(options_element, "loss")
|
||||
if options.loss is None:
|
||||
options.loss = get_float(options_element, "per")
|
||||
options.unidirectional = get_int(options_element, "unidirectional")
|
||||
options.session = options_element.get("session")
|
||||
options.emulation_id = get_int(options_element, "emulation_id")
|
||||
options.network_id = get_int(options_element, "network_id")
|
||||
options.opaque = options_element.get("opaque")
|
||||
options.gui_attributes = options_element.get("gui_attributes")
|
||||
|
||||
if link_options.unidirectional == 1 and node_set in node_sets:
|
||||
if options.unidirectional == 1 and node_set in node_sets:
|
||||
logging.info(
|
||||
"updating link node_one(%s) node_two(%s)", node_one, node_two
|
||||
)
|
||||
self.session.update_link(
|
||||
node_one, node_two, interface_one.id, interface_two.id, link_options
|
||||
node_one, node_two, interface_one.id, interface_two.id, options
|
||||
)
|
||||
else:
|
||||
logging.info(
|
||||
"adding link node_one(%s) node_two(%s)", node_one, node_two
|
||||
)
|
||||
self.session.add_link(
|
||||
node_one, node_two, interface_one, interface_two, link_options
|
||||
node_one, node_two, interface_one, interface_two, options
|
||||
)
|
||||
|
||||
node_sets.add(node_set)
|
||||
|
|
Loading…
Reference in a new issue