diff --git a/daemon/core/nodes/network.py b/daemon/core/nodes/network.py index b2be9fd8..dd4cbed7 100644 --- a/daemon/core/nodes/network.py +++ b/daemon/core/nodes/network.py @@ -843,7 +843,6 @@ class PtpNet(CoreNetwork): return all_links if1, if2 = self._netif.values() - unidirectional = 0 if if1.getparams() != if2.getparams(): unidirectional = 1 @@ -918,10 +917,11 @@ class PtpNet(CoreNetwork): message_type=0, node1_id=if2.node.id, node2_id=if1.node.id, - delay=if1.getparam("delay"), - bandwidth=if1.getparam("bw"), - dup=if1.getparam("duplicate"), - jitter=if1.getparam("jitter"), + delay=if2.getparam("delay"), + bandwidth=if2.getparam("bw"), + per=if2.getparam("loss"), + dup=if2.getparam("duplicate"), + jitter=if2.getparam("jitter"), unidirectional=1, interface1_id=if2.node.getifindex(if2), interface2_id=if1.node.getifindex(if1) diff --git a/daemon/core/xml/corexml.py b/daemon/core/xml/corexml.py index 83f9f22e..fb99e061 100644 --- a/daemon/core/xml/corexml.py +++ b/daemon/core/xml/corexml.py @@ -792,7 +792,7 @@ class CoreXmlReader(object): if link_options.unidirectional == 1 and node_set in node_sets: logging.info("updating link node_one(%s) node_two(%s): %s", node_one, node_two, link_options) - self.session.update_link(node_one, node_two, interface_one, interface_two, link_options) + self.session.update_link(node_one, node_two, interface_one.id, interface_two.id, link_options) else: logging.info("adding link node_one(%s) node_two(%s): %s", node_one, node_two, link_options) self.session.add_link(node_one, node_two, interface_one, interface_two, link_options) diff --git a/daemon/tests/test_xml.py b/daemon/tests/test_xml.py index 11bb2706..7e8dabd1 100644 --- a/daemon/tests/test_xml.py +++ b/daemon/tests/test_xml.py @@ -480,12 +480,20 @@ class TestXml: # create link link_options_one = LinkOptions() - link_options_one.bandwidth = 5000 link_options_one.unidirectional = 1 + link_options_one.bandwidth = 5000 + link_options_one.delay = 10 + link_options_one.per = 5 + link_options_one.dup = 5 + link_options_one.jitter = 5 session.add_link(node_one.id, node_two.id, interface_one, interface_two, link_options_one) link_options_two = LinkOptions() - link_options_two.bandwidth = 10000 link_options_two.unidirectional = 1 + link_options_two.bandwidth = 10000 + link_options_two.delay = 20 + link_options_two.per = 10 + link_options_two.dup = 10 + link_options_two.jitter = 10 session.update_link(node_two.id, node_one.id, interface_two.id, interface_one.id, link_options_two) # instantiate session @@ -527,4 +535,12 @@ class TestXml: link_one = links[0] link_two = links[1] assert link_options_one.bandwidth == link_one.bandwidth + assert link_options_one.delay == link_one.delay + assert link_options_one.per == link_one.per + assert link_options_one.dup == link_one.dup + assert link_options_one.jitter == link_one.jitter assert link_options_two.bandwidth == link_two.bandwidth + assert link_options_two.delay == link_two.delay + assert link_options_two.per == link_two.per + assert link_options_two.dup == link_two.dup + assert link_options_two.jitter == link_two.jitter