daemon: updated IpPrefixes and InterfaceHelper to remove duplicate code
This commit is contained in:
parent
21da670698
commit
d71d84fae7
4 changed files with 53 additions and 106 deletions
|
@ -32,7 +32,7 @@ _DIR = os.path.dirname(os.path.abspath(__file__))
|
|||
def ping(
|
||||
from_node: CoreNode, to_node: CoreNode, ip_prefixes: IpPrefixes, count: int = 3
|
||||
):
|
||||
address = ip_prefixes.ip4_address(to_node)
|
||||
address = ip_prefixes.ip4_address(to_node.id)
|
||||
try:
|
||||
from_node.cmd(f"ping -c {count} {address}")
|
||||
status = 0
|
||||
|
|
|
@ -22,7 +22,7 @@ _WIRED = [PtpNet, HubNode, SwitchNode]
|
|||
|
||||
|
||||
def ping(from_node: CoreNode, to_node: CoreNode, ip_prefixes: IpPrefixes):
|
||||
address = ip_prefixes.ip4_address(to_node)
|
||||
address = ip_prefixes.ip4_address(to_node.id)
|
||||
try:
|
||||
from_node.cmd(f"ping -c 1 {address}")
|
||||
status = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue