daemon: updated xml to write and read session configured distributed servers, updated pygui to send servers before session start or saving xml
This commit is contained in:
parent
bb4514b93e
commit
43b586a1a1
2 changed files with 27 additions and 0 deletions
|
@ -510,6 +510,10 @@ class CoreClient:
|
|||
except grpc.RpcError as e:
|
||||
self.app.show_grpc_exception("Edit Node Error", e)
|
||||
|
||||
def send_servers(self) -> None:
|
||||
for server in self.servers.values():
|
||||
self.client.add_session_server(self.session_id, server.name, server.address)
|
||||
|
||||
def start_session(self) -> StartSessionResponse:
|
||||
self.ifaces_manager.reset_mac()
|
||||
nodes = [x.core_node for x in self.canvas_nodes.values()]
|
||||
|
@ -538,6 +542,7 @@ class CoreClient:
|
|||
emane_config = None
|
||||
response = StartSessionResponse(result=False)
|
||||
try:
|
||||
self.send_servers()
|
||||
response = self.client.start_session(
|
||||
self.session_id,
|
||||
nodes,
|
||||
|
@ -749,6 +754,7 @@ class CoreClient:
|
|||
"""
|
||||
Send to daemon all session info, but don't start the session
|
||||
"""
|
||||
self.send_servers()
|
||||
self.create_nodes_and_links()
|
||||
for config_proto in self.get_wlan_configs_proto():
|
||||
self.client.set_wlan_config(
|
||||
|
|
|
@ -284,6 +284,7 @@ class CoreXmlWriter:
|
|||
self.write_service_configs()
|
||||
self.write_configservice_configs()
|
||||
self.write_session_origin()
|
||||
self.write_servers()
|
||||
self.write_session_hooks()
|
||||
self.write_session_options()
|
||||
self.write_session_metadata()
|
||||
|
@ -318,6 +319,15 @@ class CoreXmlWriter:
|
|||
add_attribute(origin, "y", y)
|
||||
add_attribute(origin, "z", z)
|
||||
|
||||
def write_servers(self) -> None:
|
||||
servers = etree.Element("servers")
|
||||
for server in self.session.distributed.servers.values():
|
||||
server_element = etree.SubElement(servers, "server")
|
||||
add_attribute(server_element, "name", server.name)
|
||||
add_attribute(server_element, "address", server.host)
|
||||
if servers.getchildren():
|
||||
self.scenario.append(servers)
|
||||
|
||||
def write_session_hooks(self) -> None:
|
||||
# hook scripts
|
||||
hooks = etree.Element("session_hooks")
|
||||
|
@ -572,6 +582,7 @@ class CoreXmlReader:
|
|||
self.read_session_metadata()
|
||||
self.read_session_options()
|
||||
self.read_session_hooks()
|
||||
self.read_servers()
|
||||
self.read_session_origin()
|
||||
self.read_service_configs()
|
||||
self.read_mobility_configs()
|
||||
|
@ -635,6 +646,16 @@ class CoreXmlReader:
|
|||
logging.info("reading hook: state(%s) name(%s)", state, name)
|
||||
self.session.add_hook(state, name, data)
|
||||
|
||||
def read_servers(self) -> None:
|
||||
servers = self.scenario.find("servers")
|
||||
if servers is None:
|
||||
return
|
||||
for server in servers.iterchildren():
|
||||
name = server.get("name")
|
||||
address = server.get("address")
|
||||
logging.info("reading server: name(%s) address(%s)", name, address)
|
||||
self.session.distributed.add_server(name, address)
|
||||
|
||||
def read_session_origin(self) -> None:
|
||||
session_origin = self.scenario.find("session_origin")
|
||||
if session_origin is None:
|
||||
|
|
Loading…
Reference in a new issue