removed devname from linkconfig as the only usage was of it was using a parametr that was already being passed in

This commit is contained in:
Blake Harnden 2020-05-23 00:00:40 -07:00
parent dd13bc8379
commit 26b0868f65
8 changed files with 9 additions and 45 deletions

View file

@ -121,7 +121,6 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: CoreInterface = None, netif2: CoreInterface = None,
devname: str = None,
) -> None: ) -> None:
""" """
Generate CommEffect events when a Link Message is received having Generate CommEffect events when a Link Message is received having

View file

@ -163,7 +163,6 @@ class EmaneModel(WirelessModel):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: CoreInterface = None, netif2: CoreInterface = None,
devname: str = None,
) -> None: ) -> None:
""" """
Invoked when a Link Message is received. Default is unimplemented. Invoked when a Link Message is received. Default is unimplemented.
@ -175,9 +174,6 @@ class EmaneModel(WirelessModel):
:param duplicate: duplicate percentage to set to :param duplicate: duplicate percentage to set to
:param jitter: jitter to set to :param jitter: jitter to set to
:param netif2: interface two :param netif2: interface two
:param devname: device name
:return: nothing :return: nothing
""" """
logging.warning( logging.warning("emane model(%s) does not support link config", self.name)
"emane model(%s) does not support link configuration", self.name
)

View file

@ -62,16 +62,13 @@ class EmaneNet(CoreNetworkBase):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: CoreInterface = None, netif2: CoreInterface = None,
devname: str = None,
) -> None: ) -> None:
""" """
The CommEffect model supports link configuration. The CommEffect model supports link configuration.
""" """
if not self.model: if not self.model:
return return
self.model.linkconfig( self.model.linkconfig(netif, bw, delay, loss, duplicate, jitter, netif2)
netif, bw, delay, loss, duplicate, jitter, netif2, devname
)
def config(self, conf: str) -> None: def config(self, conf: str) -> None:
self.conf = conf self.conf = conf

View file

@ -23,7 +23,6 @@ def link_config(
node: Union[CoreNetworkBase, PhysicalNode], node: Union[CoreNetworkBase, PhysicalNode],
interface: CoreInterface, interface: CoreInterface,
link_options: LinkOptions, link_options: LinkOptions,
devname: str = None,
interface_two: CoreInterface = None, interface_two: CoreInterface = None,
) -> None: ) -> None:
""" """
@ -32,7 +31,6 @@ def link_config(
:param node: network to configure link for :param node: network to configure link for
:param interface: interface to configure :param interface: interface to configure
:param link_options: data to configure link with :param link_options: data to configure link with
:param devname: device name, default is None
:param interface_two: other interface associated, default is None :param interface_two: other interface associated, default is None
:return: nothing :return: nothing
""" """
@ -44,7 +42,6 @@ def link_config(
link_options.dup, link_options.dup,
link_options.jitter, link_options.jitter,
interface_two, interface_two,
devname,
) )

View file

@ -394,9 +394,7 @@ class Session:
if not link_options.unidirectional: if not link_options.unidirectional:
interface.swapparams("_params_up") interface.swapparams("_params_up")
link_config( link_config(net_two, interface, link_options)
net_two, interface, link_options, devname=interface.name
)
interface.swapparams("_params_up") interface.swapparams("_params_up")
# a tunnel node was found for the nodes # a tunnel node was found for the nodes
@ -606,9 +604,7 @@ class Session:
if upstream: if upstream:
interface.swapparams("_params_up") interface.swapparams("_params_up")
link_config( link_config(net_one, interface, link_options)
net_one, interface, link_options, devname=interface.name
)
interface.swapparams("_params_up") interface.swapparams("_params_up")
else: else:
link_config(net_one, interface, link_options) link_config(net_one, interface, link_options)
@ -618,12 +614,7 @@ class Session:
link_config(net_two, interface, link_options) link_config(net_two, interface, link_options)
else: else:
interface.swapparams("_params_up") interface.swapparams("_params_up")
link_config( link_config(net_two, interface, link_options)
net_two,
interface,
link_options,
devname=interface.name,
)
interface.swapparams("_params_up") interface.swapparams("_params_up")
else: else:
raise CoreError("modify link for unknown nodes") raise CoreError("modify link for unknown nodes")
@ -647,18 +638,10 @@ class Session:
): ):
continue continue
link_config( link_config(net_one, interface_one, link_options, interface_two)
net_one,
interface_one,
link_options,
interface_two=interface_two,
)
if not link_options.unidirectional: if not link_options.unidirectional:
link_config( link_config(
net_one, net_one, interface_two, link_options, interface_one
interface_two,
link_options,
interface_two=interface_one,
) )
finally: finally:
if node_one: if node_one:

View file

@ -1174,7 +1174,6 @@ class CoreNetworkBase(NodeBase):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: float = None, netif2: float = None,
devname: str = None,
) -> None: ) -> None:
""" """
Configure link parameters by applying tc queuing disciplines on the interface. Configure link parameters by applying tc queuing disciplines on the interface.
@ -1186,7 +1185,6 @@ class CoreNetworkBase(NodeBase):
:param duplicate: duplicate percentage to set to :param duplicate: duplicate percentage to set to
:param jitter: jitter to set to :param jitter: jitter to set to
:param netif2: interface two :param netif2: interface two
:param devname: device name
:return: nothing :return: nothing
""" """
raise NotImplementedError raise NotImplementedError

View file

@ -448,7 +448,6 @@ class CoreNetwork(CoreNetworkBase):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: float = None, netif2: float = None,
devname: str = None,
) -> None: ) -> None:
""" """
Configure link parameters by applying tc queuing disciplines on the interface. Configure link parameters by applying tc queuing disciplines on the interface.
@ -460,10 +459,8 @@ class CoreNetwork(CoreNetworkBase):
:param duplicate: duplicate percentage to set to :param duplicate: duplicate percentage to set to
:param jitter: jitter to set to :param jitter: jitter to set to
:param netif2: interface two :param netif2: interface two
:param devname: device name
:return: nothing :return: nothing
""" """
if devname is None:
devname = netif.localname devname = netif.localname
tc = f"{TC_BIN} qdisc replace dev {devname}" tc = f"{TC_BIN} qdisc replace dev {devname}"
parent = "root" parent = "root"

View file

@ -151,16 +151,13 @@ class PhysicalNode(CoreNodeBase):
duplicate: float = None, duplicate: float = None,
jitter: float = None, jitter: float = None,
netif2: CoreInterface = None, netif2: CoreInterface = None,
devname: str = None,
) -> None: ) -> None:
""" """
Apply tc queing disciplines using linkconfig. Apply tc queing disciplines using linkconfig.
""" """
linux_bridge = CoreNetwork(session=self.session, start=False) linux_bridge = CoreNetwork(session=self.session, start=False)
linux_bridge.up = True linux_bridge.up = True
linux_bridge.linkconfig( linux_bridge.linkconfig(netif, bw, delay, loss, duplicate, jitter, netif2)
netif, bw, delay, loss, duplicate, jitter, netif2, devname
)
del linux_bridge del linux_bridge
def newifindex(self) -> int: def newifindex(self) -> int: