fix configuring newly added services

This commit is contained in:
Huy Pham 2019-12-06 15:06:35 -08:00
parent 6a08bff7de
commit 2add215704
3 changed files with 14 additions and 4 deletions

View file

@ -432,6 +432,14 @@ class CoreClient:
) )
process_time = time.perf_counter() - start process_time = time.perf_counter() - start
logging.debug("start session(%s), result: %s", self.session_id, response.result) logging.debug("start session(%s), result: %s", self.session_id, response.result)
# # print(self.client.get_node_service(self.session_id, 1, "DefaultRoute"))
# # print(self.client.set_service_defaults(self.session_id, {"router": ["DefaultRouter"]}))
# print(self.client.set_node_service(self.session_id, 1, "DefaultRoute", ["echo hello"], [], []))
#
# # print(self.client.get_service_defaults(self.session_id))
#
# # print(self.client.get_node_service(self.session_id, 1, "DefaultRoute"))
# # print(self.client.get_node_service_file(self.session_id, 1, "DefaultRoute", "defaultroute.sh"))
self.app.statusbar.start_session_callback(process_time) self.app.statusbar.start_session_callback(process_time)
# display mobility players # display mobility players
@ -516,8 +524,11 @@ class CoreClient:
self.client.set_session_state( self.client.set_session_state(
self.session_id, core_pb2.SessionState.DEFINITION self.session_id, core_pb2.SessionState.DEFINITION
) )
# temp
self.client.set_session_state(self.session_id, core_pb2.SessionState.DEFINITION)
for node_proto in node_protos: for node_proto in node_protos:
if node_proto.id not in self.created_nodes: if node_proto.id not in self.created_nodes or True:
response = self.client.add_node(self.session_id, node_proto) response = self.client.add_node(self.session_id, node_proto)
logging.debug("create node: %s", response) logging.debug("create node: %s", response)
self.created_nodes.add(node_proto.id) self.created_nodes.add(node_proto.id)
@ -525,6 +536,7 @@ class CoreClient:
if ( if (
tuple([link_proto.node_one_id, link_proto.node_two_id]) tuple([link_proto.node_one_id, link_proto.node_two_id])
not in self.created_links not in self.created_links
or True
): ):
response = self.client.add_link( response = self.client.add_link(
self.session_id, self.session_id,

View file

@ -87,6 +87,7 @@ class NodeService(Dialog):
self.current.listbox.delete(0, tk.END) self.current.listbox.delete(0, tk.END)
for name in sorted(self.current_services): for name in sorted(self.current_services):
self.current.listbox.insert(tk.END, name) self.current.listbox.insert(tk.END, name)
self.canvas_node.core_node.services[:] = self.current_services
def click_configure(self): def click_configure(self):
current_selection = self.current.listbox.curselection() current_selection = self.current.listbox.curselection()

View file

@ -144,9 +144,6 @@ class CanvasNode:
def on_leave(self, event): def on_leave(self, event):
self.tooltip.on_leave(event) self.tooltip.on_leave(event)
def click(self, event):
print("click")
def double_click(self, event): def double_click(self, event):
if self.app.core.is_runtime(): if self.app.core.is_runtime():
self.canvas.core.launch_terminal(self.core_node.id) self.canvas.core.launch_terminal(self.core_node.id)