change to account for importing slightly older bindings for emane link monitor
This commit is contained in:
parent
16cc73c070
commit
7b29f6bb82
1 changed files with 11 additions and 3 deletions
|
@ -5,13 +5,21 @@ import time
|
||||||
from typing import TYPE_CHECKING, Dict, List, Tuple
|
from typing import TYPE_CHECKING, Dict, List, Tuple
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from emane import shell as emanesh
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from core.emulator.data import LinkData
|
from core.emulator.data import LinkData
|
||||||
from core.emulator.enumerations import LinkTypes, MessageFlags
|
from core.emulator.enumerations import LinkTypes, MessageFlags
|
||||||
from core.nodes.network import CtrlNet
|
from core.nodes.network import CtrlNet
|
||||||
|
|
||||||
|
try:
|
||||||
|
from emane import shell
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from emanesh import shell
|
||||||
|
except ImportError:
|
||||||
|
logging.debug("compatible emane python bindings not installed")
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from core.emane.emanemanager import EmaneManager
|
from core.emane.emanemanager import EmaneManager
|
||||||
|
|
||||||
|
@ -70,7 +78,7 @@ class EmaneLink:
|
||||||
class EmaneClient:
|
class EmaneClient:
|
||||||
def __init__(self, address: str) -> None:
|
def __init__(self, address: str) -> None:
|
||||||
self.address = address
|
self.address = address
|
||||||
self.client = emanesh.ControlPortClient(self.address, DEFAULT_PORT)
|
self.client = shell.ControlPortClient(self.address, DEFAULT_PORT)
|
||||||
self.nems = {}
|
self.nems = {}
|
||||||
self.setup()
|
self.setup()
|
||||||
|
|
||||||
|
@ -214,7 +222,7 @@ class EmaneLinkMonitor:
|
||||||
for client in self.clients:
|
for client in self.clients:
|
||||||
try:
|
try:
|
||||||
client.check_links(self.links, self.loss_threshold)
|
client.check_links(self.links, self.loss_threshold)
|
||||||
except emanesh.ControlPortException:
|
except shell.ControlPortException:
|
||||||
if self.running:
|
if self.running:
|
||||||
logging.exception("link monitor error")
|
logging.exception("link monitor error")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue