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,
jitter: float = None,
netif2: CoreInterface = None,
devname: str = None,
) -> None:
"""
Generate CommEffect events when a Link Message is received having

View file

@ -163,7 +163,6 @@ class EmaneModel(WirelessModel):
duplicate: float = None,
jitter: float = None,
netif2: CoreInterface = None,
devname: str = None,
) -> None:
"""
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 jitter: jitter to set to
:param netif2: interface two
:param devname: device name
:return: nothing
"""
logging.warning(
"emane model(%s) does not support link configuration", self.name
)
logging.warning("emane model(%s) does not support link config", self.name)

View file

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

View file

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

View file

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

View file

@ -1174,7 +1174,6 @@ class CoreNetworkBase(NodeBase):
duplicate: float = None,
jitter: float = None,
netif2: float = None,
devname: str = None,
) -> None:
"""
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 jitter: jitter to set to
:param netif2: interface two
:param devname: device name
:return: nothing
"""
raise NotImplementedError

View file

@ -448,7 +448,6 @@ class CoreNetwork(CoreNetworkBase):
duplicate: float = None,
jitter: float = None,
netif2: float = None,
devname: str = None,
) -> None:
"""
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 jitter: jitter to set to
:param netif2: interface two
:param devname: device name
:return: nothing
"""
if devname is None:
devname = netif.localname
tc = f"{TC_BIN} qdisc replace dev {devname}"
parent = "root"

View file

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