merged latest from develop
This commit is contained in:
commit
1efa1284bb
3 changed files with 36 additions and 36 deletions
|
@ -29,7 +29,6 @@ from core.xml import emanexml
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from core.emulator.session import Session
|
from core.emulator.session import Session
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from emane.events import EventService
|
from emane.events import EventService
|
||||||
from emane.events import LocationEvent
|
from emane.events import LocationEvent
|
||||||
|
@ -845,6 +844,12 @@ class EmaneGlobalModel:
|
||||||
def __init__(self, session: "Session") -> None:
|
def __init__(self, session: "Session") -> None:
|
||||||
self.session = session
|
self.session = session
|
||||||
self.core_config = [
|
self.core_config = [
|
||||||
|
Configuration(
|
||||||
|
_id="platform_id_start",
|
||||||
|
_type=ConfigDataTypes.INT32,
|
||||||
|
default="1",
|
||||||
|
label="Starting Platform ID",
|
||||||
|
),
|
||||||
Configuration(
|
Configuration(
|
||||||
_id="nem_id_start",
|
_id="nem_id_start",
|
||||||
_type=ConfigDataTypes.INT32,
|
_type=ConfigDataTypes.INT32,
|
||||||
|
@ -891,15 +896,6 @@ class EmaneGlobalModel:
|
||||||
"otamanagergroup": "224.1.2.8:45702",
|
"otamanagergroup": "224.1.2.8:45702",
|
||||||
}
|
}
|
||||||
self.emulator_config = emanemanifest.parse(emulator_xml, emulator_defaults)
|
self.emulator_config = emanemanifest.parse(emulator_xml, emulator_defaults)
|
||||||
self.emulator_config.insert(
|
|
||||||
0,
|
|
||||||
Configuration(
|
|
||||||
_id="platform_id_start",
|
|
||||||
_type=ConfigDataTypes.INT32,
|
|
||||||
default="1",
|
|
||||||
label="Starting Platform ID (core)",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
def configurations(self) -> List[Configuration]:
|
def configurations(self) -> List[Configuration]:
|
||||||
return self.emulator_config + self.core_config
|
return self.emulator_config + self.core_config
|
||||||
|
|
|
@ -16,7 +16,6 @@ from core.nodes.network import CtrlNet
|
||||||
from core.services.coreservices import CoreService
|
from core.services.coreservices import CoreService
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from core.emane.emanemanager import EmaneGlobalModel
|
|
||||||
from core.emane.emanemodel import EmaneModel
|
from core.emane.emanemodel import EmaneModel
|
||||||
from core.emulator.session import Session
|
from core.emulator.session import Session
|
||||||
|
|
||||||
|
@ -69,23 +68,17 @@ def create_interface_data(interface_element: etree.Element) -> InterfaceData:
|
||||||
return InterfaceData(interface_id, name, mac, ip4, ip4_mask, ip6, ip6_mask)
|
return InterfaceData(interface_id, name, mac, ip4, ip4_mask, ip6, ip6_mask)
|
||||||
|
|
||||||
|
|
||||||
def create_emane_config(
|
def create_emane_config(session: "Session") -> etree.Element:
|
||||||
node_id: int, emane_config: "EmaneGlobalModel", config: Dict[str, str]
|
emane_configuration = etree.Element("emane_global_configuration")
|
||||||
) -> etree.Element:
|
config = session.emane.get_configs()
|
||||||
emane_configuration = etree.Element("emane_configuration")
|
|
||||||
add_attribute(emane_configuration, "node", node_id)
|
|
||||||
add_attribute(emane_configuration, "model", "emane")
|
|
||||||
|
|
||||||
emulator_element = etree.SubElement(emane_configuration, "emulator")
|
emulator_element = etree.SubElement(emane_configuration, "emulator")
|
||||||
for emulator_config in emane_config.emulator_config:
|
for emulator_config in session.emane.emane_config.emulator_config:
|
||||||
value = config[emulator_config.id]
|
value = config[emulator_config.id]
|
||||||
add_configuration(emulator_element, emulator_config.id, value)
|
add_configuration(emulator_element, emulator_config.id, value)
|
||||||
|
core_element = etree.SubElement(emane_configuration, "core")
|
||||||
nem_element = etree.SubElement(emane_configuration, "nem")
|
for core_config in session.emane.emane_config.core_config:
|
||||||
for core_config in emane_config.core_config:
|
|
||||||
value = config[core_config.id]
|
value = config[core_config.id]
|
||||||
add_configuration(nem_element, core_config.id, value)
|
add_configuration(core_element, core_config.id, value)
|
||||||
|
|
||||||
return emane_configuration
|
return emane_configuration
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,6 +353,9 @@ class CoreXmlWriter:
|
||||||
self.scenario.append(metadata_elements)
|
self.scenario.append(metadata_elements)
|
||||||
|
|
||||||
def write_emane_configs(self) -> None:
|
def write_emane_configs(self) -> None:
|
||||||
|
emane_global_configuration = create_emane_config(self.session)
|
||||||
|
self.scenario.append(emane_global_configuration)
|
||||||
|
|
||||||
emane_configurations = etree.Element("emane_configurations")
|
emane_configurations = etree.Element("emane_configurations")
|
||||||
for node_id in self.session.emane.nodes():
|
for node_id in self.session.emane.nodes():
|
||||||
all_configs = self.session.emane.get_all_configs(node_id)
|
all_configs = self.session.emane.get_all_configs(node_id)
|
||||||
|
@ -371,17 +367,9 @@ class CoreXmlWriter:
|
||||||
logging.debug(
|
logging.debug(
|
||||||
"writing emane config node(%s) model(%s)", node_id, model_name
|
"writing emane config node(%s) model(%s)", node_id, model_name
|
||||||
)
|
)
|
||||||
if model_name == -1:
|
model = self.session.emane.models[model_name]
|
||||||
emane_configuration = create_emane_config(
|
emane_configuration = create_emane_model_config(node_id, model, config)
|
||||||
node_id, self.session.emane.emane_config, config
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
model = self.session.emane.models[model_name]
|
|
||||||
emane_configuration = create_emane_model_config(
|
|
||||||
node_id, model, config
|
|
||||||
)
|
|
||||||
emane_configurations.append(emane_configuration)
|
emane_configurations.append(emane_configuration)
|
||||||
|
|
||||||
if emane_configurations.getchildren():
|
if emane_configurations.getchildren():
|
||||||
self.scenario.append(emane_configurations)
|
self.scenario.append(emane_configurations)
|
||||||
|
|
||||||
|
@ -613,6 +601,7 @@ class CoreXmlReader:
|
||||||
self.read_session_origin()
|
self.read_session_origin()
|
||||||
self.read_service_configs()
|
self.read_service_configs()
|
||||||
self.read_mobility_configs()
|
self.read_mobility_configs()
|
||||||
|
self.read_emane_global_config()
|
||||||
self.read_emane_configs()
|
self.read_emane_configs()
|
||||||
self.read_nodes()
|
self.read_nodes()
|
||||||
self.read_configservice_configs()
|
self.read_configservice_configs()
|
||||||
|
@ -740,6 +729,21 @@ class CoreXmlReader:
|
||||||
files.add(name)
|
files.add(name)
|
||||||
service.configs = tuple(files)
|
service.configs = tuple(files)
|
||||||
|
|
||||||
|
def read_emane_global_config(self) -> None:
|
||||||
|
emane_global_configuration = self.scenario.find("emane_global_configuration")
|
||||||
|
emulator_configuration = emane_global_configuration.find("emulator")
|
||||||
|
configs = {}
|
||||||
|
for config in emulator_configuration.iterchildren():
|
||||||
|
name = config.get("name")
|
||||||
|
value = config.get("value")
|
||||||
|
configs[name] = value
|
||||||
|
core_configuration = emane_global_configuration.find("core")
|
||||||
|
for config in core_configuration.iterchildren():
|
||||||
|
name = config.get("name")
|
||||||
|
value = config.get("value")
|
||||||
|
configs[name] = value
|
||||||
|
self.session.emane.set_configs(config=configs)
|
||||||
|
|
||||||
def read_emane_configs(self) -> None:
|
def read_emane_configs(self) -> None:
|
||||||
emane_configurations = self.scenario.find("emane_configurations")
|
emane_configurations = self.scenario.find("emane_configurations")
|
||||||
if emane_configurations is None:
|
if emane_configurations is None:
|
||||||
|
|
|
@ -1972,7 +1972,7 @@ proc widget_adjacency_init {command} {
|
||||||
array unset adjacency_cache *
|
array unset adjacency_cache *
|
||||||
foreach node $node_list { ;# save router-id node pairs for later lookup
|
foreach node $node_list { ;# save router-id node pairs for later lookup
|
||||||
if { [nodeType $node] != "router" } { continue }
|
if { [nodeType $node] != "router" } { continue }
|
||||||
if {[lsearch [getNodeServices $node true] "zebra"] < 0 &&
|
if {[lsearch -regexp [getNodeServices $node true] "(FRR)?zebra"] < 0 &&
|
||||||
[lsearch [getNodeServices $node true] "OLSR"] < 0 &&
|
[lsearch [getNodeServices $node true] "OLSR"] < 0 &&
|
||||||
[lsearch [getNodeServices $node true] "OLSRv2"] < 0} {
|
[lsearch [getNodeServices $node true] "OLSRv2"] < 0} {
|
||||||
continue
|
continue
|
||||||
|
@ -2041,7 +2041,7 @@ proc widget_adjacency_periodic { now } {
|
||||||
foreach node $node_list {
|
foreach node $node_list {
|
||||||
if { [nodeType $node] != "router" } { continue }
|
if { [nodeType $node] != "router" } { continue }
|
||||||
if { [getNodeCanvas $node] != $curcanvas } { continue }
|
if { [getNodeCanvas $node] != $curcanvas } { continue }
|
||||||
if {[lsearch [getNodeServices $node true] "zebra"] < 0} {
|
if {[lsearch -regexp [getNodeServices $node true] "(FRR)?zebra"] < 0} {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue