cleanup for organizing how some parameters are passed around, merging logic into central places, avoiding things like needing to requery a session multiple times for joining
This commit is contained in:
parent
01d3a3158a
commit
0e5d7a6f80
10 changed files with 100 additions and 173 deletions
|
@ -1,8 +1,6 @@
|
|||
import logging
|
||||
import tkinter as tk
|
||||
|
||||
import coretk.appcache as appcache
|
||||
import coretk.images as images
|
||||
from coretk.coregrpc import CoreGrpc
|
||||
from coretk.coremenubar import CoreMenubar
|
||||
from coretk.coretoolbar import CoreToolbar
|
||||
|
@ -14,28 +12,25 @@ from coretk.menuaction import MenuAction
|
|||
class Application(tk.Frame):
|
||||
def __init__(self, master=None):
|
||||
super().__init__(master)
|
||||
appcache.cache_variable(self)
|
||||
print(self.is_open_xml)
|
||||
self.load_images()
|
||||
self.setup_app()
|
||||
Images.load_all()
|
||||
self.menubar = None
|
||||
self.core_menu = None
|
||||
self.canvas = None
|
||||
self.core_editbar = None
|
||||
self.core_grpc = None
|
||||
|
||||
self.is_open_xml = False
|
||||
self.size_and_scale = None
|
||||
self.set_wallpaper = None
|
||||
self.wallpaper_id = None
|
||||
self.current_wallpaper = None
|
||||
self.radiovar = tk.IntVar(value=1)
|
||||
self.show_grid_var = tk.IntVar(value=1)
|
||||
self.adjust_to_dim_var = tk.IntVar(value=0)
|
||||
self.core_grpc = CoreGrpc(self)
|
||||
self.setup_app()
|
||||
self.create_menu()
|
||||
self.create_widgets()
|
||||
self.draw_canvas()
|
||||
self.start_grpc()
|
||||
# self.try_make_table()
|
||||
|
||||
def load_images(self):
|
||||
"""
|
||||
Load core images
|
||||
:return:
|
||||
"""
|
||||
images.load_core_images(Images)
|
||||
self.core_grpc.set_up()
|
||||
|
||||
def setup_app(self):
|
||||
self.master.title("CORE")
|
||||
|
@ -59,10 +54,7 @@ class Application(tk.Frame):
|
|||
|
||||
def draw_canvas(self):
|
||||
self.canvas = CanvasGraph(
|
||||
master=self,
|
||||
grpc=self.core_grpc,
|
||||
background="#cccccc",
|
||||
scrollregion=(0, 0, 1200, 1000),
|
||||
self, self.core_grpc, background="#cccccc", scrollregion=(0, 0, 1200, 1000)
|
||||
)
|
||||
self.canvas.pack(fill=tk.BOTH, expand=True)
|
||||
|
||||
|
@ -86,31 +78,9 @@ class Application(tk.Frame):
|
|||
b = tk.Button(status_bar, text="Button 3")
|
||||
b.pack(side=tk.LEFT, padx=1)
|
||||
|
||||
def start_grpc(self):
|
||||
"""
|
||||
Conect client to grpc, query sessions and prompt use to choose an existing session if there exist any
|
||||
|
||||
:return: nothing
|
||||
"""
|
||||
self.master.update()
|
||||
self.core_grpc = CoreGrpc(self)
|
||||
self.core_grpc.set_up()
|
||||
self.canvas.core_grpc = self.core_grpc
|
||||
self.canvas.grpc_manager.core_grpc = self.core_grpc
|
||||
self.canvas.grpc_manager.update_preexisting_ids()
|
||||
self.canvas.draw_existing_component()
|
||||
|
||||
def on_closing(self):
|
||||
menu_action = MenuAction(self, self.master)
|
||||
menu_action.on_quit()
|
||||
# self.quit()
|
||||
|
||||
def try_make_table(self):
|
||||
f = tk.Frame(self.master)
|
||||
for i in range(3):
|
||||
e = tk.Entry(f)
|
||||
e.grid(row=0, column=1, stick="nsew")
|
||||
f.pack(side=tk.TOP)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
"""
|
||||
stores some information helpful for setting starting values for some tables
|
||||
like size and scale, set wallpaper, etc
|
||||
"""
|
||||
import tkinter as tk
|
||||
|
||||
|
||||
def cache_variable(application):
|
||||
# for menubar
|
||||
application.is_open_xml = False
|
||||
|
||||
application.size_and_scale = None
|
||||
application.set_wallpaper = None
|
||||
|
||||
# set wallpaper variables
|
||||
|
||||
# canvas id of the wallpaper
|
||||
application.wallpaper_id = None
|
||||
|
||||
# current image for wallpaper
|
||||
application.current_wallpaper = None
|
||||
|
||||
# wallpaper option
|
||||
application.radiovar = tk.IntVar()
|
||||
application.radiovar.set(1)
|
||||
|
||||
# show grid option
|
||||
application.show_grid_var = tk.IntVar()
|
||||
application.show_grid_var.set(1)
|
||||
|
||||
# adjust canvas to image dimension variable
|
||||
application.adjust_to_dim_var = tk.IntVar()
|
||||
application.adjust_to_dim_var.set(0)
|
|
@ -7,8 +7,7 @@ from collections import OrderedDict
|
|||
|
||||
from core.api.grpc import client, core_pb2
|
||||
from coretk.dialogs.sessions import SessionsDialog
|
||||
from coretk.linkinfo import Throughput
|
||||
from coretk.wirelessconnection import WirelessConnection
|
||||
from coretk.grpcmanagement import GrpcManager
|
||||
|
||||
|
||||
class CoreGrpc:
|
||||
|
@ -22,15 +21,14 @@ class CoreGrpc:
|
|||
self.app = app
|
||||
self.master = app.master
|
||||
self.interface_helper = None
|
||||
self.throughput_draw = Throughput(app.canvas, self)
|
||||
self.wireless_draw = WirelessConnection(app.canvas, self)
|
||||
self.manager = GrpcManager(self)
|
||||
|
||||
def log_event(self, event):
|
||||
def handle_events(self, event):
|
||||
logging.info("event: %s", event)
|
||||
if event.link_event is not None:
|
||||
self.wireless_draw.hangle_link_event(event.link_event)
|
||||
self.app.canvas.wireless_draw.hangle_link_event(event.link_event)
|
||||
|
||||
def log_throughput(self, event):
|
||||
def handle_throughputs(self, event):
|
||||
interface_throughputs = event.interface_throughputs
|
||||
for i in interface_throughputs:
|
||||
print("")
|
||||
|
@ -44,6 +42,30 @@ class CoreGrpc:
|
|||
throughputs_belong_to_session
|
||||
)
|
||||
|
||||
def join_session(self, session_id):
|
||||
# query session and set as current session
|
||||
self.session_id = session_id
|
||||
response = self.core.get_session(self.session_id)
|
||||
logging.info("joining session(%s): %s", self.session_id, response)
|
||||
self.core.events(self.session_id, self.app.core_grpc.handle_events)
|
||||
|
||||
# determine next node id and reusable nodes
|
||||
session = response.session
|
||||
self.manager.reusable.clear()
|
||||
self.manager.preexisting.clear()
|
||||
max_id = 1
|
||||
for node in session.nodes:
|
||||
if node.id > max_id:
|
||||
max_id = node.id
|
||||
self.manager.preexisting.add(node.id)
|
||||
self.manager.id = max_id
|
||||
for i in range(1, self.manager.id):
|
||||
if i not in self.manager.preexisting:
|
||||
self.manager.reusable.append(i)
|
||||
|
||||
# draw session
|
||||
self.app.canvas.draw_existing_component(session)
|
||||
|
||||
def create_new_session(self):
|
||||
"""
|
||||
Create a new session
|
||||
|
@ -56,7 +78,7 @@ class CoreGrpc:
|
|||
# handle events session may broadcast
|
||||
self.session_id = response.session_id
|
||||
self.master.title("CORE Session ID " + str(self.session_id))
|
||||
self.core.events(self.session_id, self.log_event)
|
||||
self.core.events(self.session_id, self.handle_events)
|
||||
# self.core.throughputs(self.log_throughput)
|
||||
|
||||
def delete_session(self, custom_sid=None):
|
||||
|
@ -114,6 +136,7 @@ class CoreGrpc:
|
|||
else:
|
||||
sid = custom_session_id
|
||||
|
||||
response = None
|
||||
if state == "configuration":
|
||||
response = self.core.set_session_state(
|
||||
sid, core_pb2.SessionState.CONFIGURATION
|
||||
|
@ -229,15 +252,6 @@ class CoreGrpc:
|
|||
response = self.core.add_link(self.session_id, id1, id2, if1, if2)
|
||||
logging.info("created link: %s", response)
|
||||
|
||||
# self.core.get_node_links(self.session_id, id1)
|
||||
|
||||
# def get_session(self):
|
||||
# response = self.core.get_session(self.session_id)
|
||||
# nodes = response.session.nodes
|
||||
# for node in nodes:
|
||||
# r = self.core.get_node_links(self.session_id, node.id)
|
||||
# logging.info(r)
|
||||
|
||||
def launch_terminal(self, node_id):
|
||||
response = self.core.get_node_terminal(self.session_id, node_id)
|
||||
logging.info("get terminal %s", response.terminal)
|
||||
|
@ -252,7 +266,7 @@ class CoreGrpc:
|
|||
"""
|
||||
response = self.core.save_xml(self.session_id, file_path)
|
||||
logging.info("coregrpc.py save xml %s", response)
|
||||
self.core.events(self.session_id, self.log_event)
|
||||
self.core.events(self.session_id, self.handle_events)
|
||||
|
||||
def open_xml(self, file_path):
|
||||
"""
|
||||
|
|
|
@ -4,18 +4,17 @@ CoreToolbar help to draw on canvas, and make grpc client call
|
|||
|
||||
|
||||
class CoreToolbarHelp:
|
||||
def __init__(self, application):
|
||||
self.application = application
|
||||
self.core_grpc = application.core_grpc
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
|
||||
def add_nodes(self):
|
||||
"""
|
||||
add the nodes stored in grpc manager
|
||||
:return: nothing
|
||||
"""
|
||||
grpc_manager = self.application.canvas.grpc_manager
|
||||
for node in grpc_manager.nodes.values():
|
||||
self.application.core_grpc.add_node(
|
||||
manager = self.app.core_grpc.manager
|
||||
for node in manager.nodes.values():
|
||||
self.app.core_grpc.add_node(
|
||||
node.type, node.model, int(node.x), int(node.y), node.name, node.node_id
|
||||
)
|
||||
|
||||
|
@ -24,8 +23,8 @@ class CoreToolbarHelp:
|
|||
add the edges stored in grpc manager
|
||||
:return:
|
||||
"""
|
||||
grpc_manager = self.application.canvas.grpc_manager
|
||||
for edge in grpc_manager.edges.values():
|
||||
self.application.core_grpc.add_link(
|
||||
manager = self.app.core_grpc.manager
|
||||
for edge in manager.edges.values():
|
||||
self.app.core_grpc.add_link(
|
||||
edge.id1, edge.id2, edge.type1, edge.type2, edge
|
||||
)
|
||||
|
|
|
@ -142,10 +142,7 @@ class SessionsDialog(Dialog):
|
|||
logging.error("querysessiondrawing.py invalid state")
|
||||
|
||||
def join_session(self, session_id):
|
||||
response = self.app.core_grpc.core.get_session(session_id)
|
||||
self.app.core_grpc.session_id = session_id
|
||||
self.app.core_grpc.core.events(session_id, self.app.core_grpc.log_event)
|
||||
logging.info("entering session_id %s.... Result: %s", session_id, response)
|
||||
self.app.core_grpc.join_session(session_id)
|
||||
self.destroy()
|
||||
|
||||
def on_selected(self, event):
|
||||
|
|
|
@ -4,11 +4,11 @@ import tkinter as tk
|
|||
|
||||
from core.api.grpc import core_pb2
|
||||
from coretk.graph_helper import GraphHelper, WlanAntennaManager
|
||||
from coretk.grpcmanagement import GrpcManager
|
||||
from coretk.images import Images
|
||||
from coretk.interface import Interface
|
||||
from coretk.linkinfo import LinkInfo
|
||||
from coretk.linkinfo import LinkInfo, Throughput
|
||||
from coretk.nodeconfigtable import NodeConfig
|
||||
from coretk.wirelessconnection import WirelessConnection
|
||||
|
||||
|
||||
class GraphMode(enum.Enum):
|
||||
|
@ -20,7 +20,7 @@ class GraphMode(enum.Enum):
|
|||
|
||||
|
||||
class CanvasGraph(tk.Canvas):
|
||||
def __init__(self, master=None, grpc=None, cnf=None, **kwargs):
|
||||
def __init__(self, master, core_grpc, cnf=None, **kwargs):
|
||||
if cnf is None:
|
||||
cnf = {}
|
||||
kwargs["highlightthickness"] = 0
|
||||
|
@ -33,20 +33,15 @@ class CanvasGraph(tk.Canvas):
|
|||
self.nodes = {}
|
||||
self.edges = {}
|
||||
self.drawing_edge = None
|
||||
|
||||
self.grid = None
|
||||
self.meters_per_pixel = 1.5
|
||||
self.setup_menus()
|
||||
self.setup_bindings()
|
||||
self.draw_grid()
|
||||
|
||||
self.core_grpc = grpc
|
||||
self.grpc_manager = GrpcManager(grpc)
|
||||
|
||||
self.helper = GraphHelper(self, grpc)
|
||||
# self.core_id_to_canvas_id = {}
|
||||
# self.core_map = CoreToCanvasMapping()
|
||||
# self.draw_existing_component()
|
||||
self.core_grpc = core_grpc
|
||||
self.helper = GraphHelper(self, core_grpc)
|
||||
self.throughput_draw = Throughput(self, core_grpc)
|
||||
self.wireless_draw = WirelessConnection(self, core_grpc)
|
||||
|
||||
def setup_menus(self):
|
||||
self.node_context = tk.Menu(self.master)
|
||||
|
@ -56,7 +51,9 @@ class CanvasGraph(tk.Canvas):
|
|||
|
||||
def canvas_reset_and_redraw(self, new_grpc):
|
||||
"""
|
||||
Reset the private variables CanvasGraph object, redraw nodes given the new grpc client
|
||||
Reset the private variables CanvasGraph object, redraw nodes given the new grpc
|
||||
client.
|
||||
|
||||
:param new_grpc:
|
||||
:return:
|
||||
"""
|
||||
|
@ -73,15 +70,11 @@ class CanvasGraph(tk.Canvas):
|
|||
self.nodes = {}
|
||||
self.edges = {}
|
||||
self.drawing_edge = None
|
||||
|
||||
print("graph.py create a new grpc manager")
|
||||
self.grpc_manager = GrpcManager(new_grpc)
|
||||
|
||||
# new grpc
|
||||
self.core_grpc = new_grpc
|
||||
print("grpah.py draw existing component")
|
||||
self.draw_existing_component()
|
||||
print(self.grpc_manager.edges)
|
||||
print(self.core_grpc.manager.edges)
|
||||
|
||||
def setup_bindings(self):
|
||||
"""
|
||||
|
@ -119,16 +112,13 @@ class CanvasGraph(tk.Canvas):
|
|||
for i in range(0, height, 27):
|
||||
self.create_line(0, i, width, i, dash=(2, 4), tags="gridline")
|
||||
|
||||
def draw_existing_component(self):
|
||||
def draw_existing_component(self, session):
|
||||
"""
|
||||
Draw existing node and update the information in grpc manager to match
|
||||
|
||||
:return: nothing
|
||||
"""
|
||||
core_id_to_canvas_id = {}
|
||||
|
||||
session_id = self.core_grpc.session_id
|
||||
session = self.core_grpc.core.get_session(session_id).session
|
||||
# redraw existing nodes
|
||||
for node in session.nodes:
|
||||
# peer to peer node is not drawn on the GUI
|
||||
|
@ -145,9 +135,7 @@ class CanvasGraph(tk.Canvas):
|
|||
core_id_to_canvas_id[node.id] = n.id
|
||||
|
||||
# store the node in grpc manager
|
||||
self.grpc_manager.add_preexisting_node(n, session_id, node, name)
|
||||
|
||||
self.grpc_manager.update_reusable_id()
|
||||
self.core_grpc.manager.add_preexisting_node(n, session.id, node, name)
|
||||
|
||||
# draw existing links
|
||||
for link in session.links:
|
||||
|
@ -179,7 +167,7 @@ class CanvasGraph(tk.Canvas):
|
|||
n1.edges.add(e)
|
||||
n2.edges.add(e)
|
||||
self.edges[e.token] = e
|
||||
self.grpc_manager.add_edge(session_id, e.token, n1.id, n2.id)
|
||||
self.core_grpc.manager.add_edge(session.id, e.token, n1.id, n2.id)
|
||||
|
||||
self.helper.redraw_antenna(link, n1, n2)
|
||||
|
||||
|
@ -208,12 +196,12 @@ class CanvasGraph(tk.Canvas):
|
|||
# TODO will include throughput and ipv6 in the future
|
||||
if1 = Interface(grpc_if1.name, grpc_if1.ip4, ifid=grpc_if1.id)
|
||||
if2 = Interface(grpc_if2.name, grpc_if2.ip4, ifid=grpc_if2.id)
|
||||
self.grpc_manager.edges[e.token].interface_1 = if1
|
||||
self.grpc_manager.edges[e.token].interface_2 = if2
|
||||
self.grpc_manager.nodes[
|
||||
self.core_grpc.manager.edges[e.token].interface_1 = if1
|
||||
self.core_grpc.manager.edges[e.token].interface_2 = if2
|
||||
self.core_grpc.manager.nodes[
|
||||
core_id_to_canvas_id[link.node_one_id]
|
||||
].interfaces.append(if1)
|
||||
self.grpc_manager.nodes[
|
||||
self.core_grpc.manager.nodes[
|
||||
core_id_to_canvas_id[link.node_two_id]
|
||||
].interfaces.append(if2)
|
||||
|
||||
|
@ -316,13 +304,13 @@ class CanvasGraph(tk.Canvas):
|
|||
node_dst = self.nodes[edge.dst]
|
||||
node_dst.edges.add(edge)
|
||||
|
||||
self.grpc_manager.add_edge(
|
||||
self.core_grpc.manager.add_edge(
|
||||
self.core_grpc.session_id, edge.token, node_src.id, node_dst.id
|
||||
)
|
||||
|
||||
# draw link info on the edge
|
||||
if1 = self.grpc_manager.edges[edge.token].interface_1
|
||||
if2 = self.grpc_manager.edges[edge.token].interface_2
|
||||
if1 = self.core_grpc.manager.edges[edge.token].interface_1
|
||||
if2 = self.core_grpc.manager.edges[edge.token].interface_2
|
||||
ip4_and_prefix_1 = None
|
||||
ip4_and_prefix_2 = None
|
||||
if if1 is not None:
|
||||
|
@ -382,10 +370,10 @@ class CanvasGraph(tk.Canvas):
|
|||
image=image,
|
||||
node_type=node_name,
|
||||
canvas=self,
|
||||
core_id=self.grpc_manager.peek_id(),
|
||||
core_id=self.core_grpc.manager.peek_id(),
|
||||
)
|
||||
self.nodes[node.id] = node
|
||||
self.grpc_manager.add_node(
|
||||
self.core_grpc.manager.add_node(
|
||||
self.core_grpc.session_id, node.id, x, y, node_name
|
||||
)
|
||||
return node
|
||||
|
@ -477,7 +465,7 @@ class CanvasNode:
|
|||
self.moving = None
|
||||
|
||||
def double_click(self, event):
|
||||
node_id = self.canvas.grpc_manager.nodes[self.id].node_id
|
||||
node_id = self.canvas.core_grpc.manager.nodes[self.id].node_id
|
||||
state = self.canvas.core_grpc.get_session_state()
|
||||
if state == core_pb2.SessionState.RUNTIME:
|
||||
self.canvas.core_grpc.launch_terminal(node_id)
|
||||
|
@ -496,7 +484,7 @@ class CanvasNode:
|
|||
def click_release(self, event):
|
||||
logging.debug(f"click release {self.name}: {event}")
|
||||
self.update_coords()
|
||||
self.canvas.grpc_manager.update_node_location(
|
||||
self.canvas.core_grpc.manager.update_node_location(
|
||||
self.id, self.x_coord, self.y_coord
|
||||
)
|
||||
self.moving = None
|
||||
|
|
|
@ -57,17 +57,14 @@ class GrpcManager:
|
|||
def __init__(self, grpc):
|
||||
self.nodes = {}
|
||||
self.edges = {}
|
||||
self.id = None
|
||||
self.id = 1
|
||||
# A list of id for re-use, keep in increasing order
|
||||
self.reusable = []
|
||||
|
||||
self.preexisting = []
|
||||
self.core_grpc = None
|
||||
|
||||
self.preexisting = set()
|
||||
self.core_grpc = grpc
|
||||
# self.update_preexisting_ids()
|
||||
# self.core_id_to_canvas_id = {}
|
||||
self.interfaces_manager = InterfaceManager()
|
||||
|
||||
# map tuple(core_node_id, interface_id) to and edge
|
||||
# self.node_id_and_interface_to_edge_token = {}
|
||||
self.core_mapping = CoreToCanvasMapping()
|
||||
|
@ -172,7 +169,7 @@ class GrpcManager:
|
|||
print(core_id)
|
||||
if self.id is None or core_id >= self.id:
|
||||
self.id = core_id + 1
|
||||
self.preexisting.append(core_id)
|
||||
self.preexisting.add(core_id)
|
||||
n = Node(
|
||||
session_id,
|
||||
core_id,
|
||||
|
@ -219,8 +216,8 @@ class GrpcManager:
|
|||
"""
|
||||
try:
|
||||
self.nodes.pop(canvas_id)
|
||||
self.reuseable.append(canvas_id)
|
||||
self.reuseable.sort()
|
||||
self.reusable.append(canvas_id)
|
||||
self.reusable.sort()
|
||||
except KeyError:
|
||||
logging.error("grpcmanagement.py INVALID NODE CANVAS ID")
|
||||
|
||||
|
|
|
@ -13,6 +13,13 @@ ICONS_DIR = os.path.join(PATH, "icons")
|
|||
class Images:
|
||||
images = {}
|
||||
|
||||
@classmethod
|
||||
def load_all(cls):
|
||||
for file_name in os.listdir(ICONS_DIR):
|
||||
file_path = os.path.join(ICONS_DIR, file_name)
|
||||
name = file_name.split(".")[0]
|
||||
cls.load(name, file_path)
|
||||
|
||||
@classmethod
|
||||
def load(cls, name, file_path):
|
||||
# file_path = os.path.join(PATH, file_path)
|
||||
|
@ -91,10 +98,3 @@ class ImageEnum(Enum):
|
|||
FILEOPEN = "fileopen"
|
||||
EDITDELETE = "edit-delete"
|
||||
ANTENNA = "antenna"
|
||||
|
||||
|
||||
def load_core_images(images):
|
||||
for file_name in os.listdir(ICONS_DIR):
|
||||
file_path = os.path.join(ICONS_DIR, file_name)
|
||||
name = file_name.split(".")[0]
|
||||
images.load(name, file_path)
|
||||
|
|
|
@ -11,7 +11,7 @@ class LinkInfo:
|
|||
def __init__(self, canvas, edge, ip4_src, ip6_src, ip4_dst, ip6_dst):
|
||||
"""
|
||||
create an instance of LinkInfo object
|
||||
:param tkinter.Canvas canvas: canvas object
|
||||
:param coretk.graph.Graph canvas: canvas object
|
||||
:param coretk.graph.CanvasEdge edge: canvas edge onject
|
||||
:param ip4_src:
|
||||
:param ip6_src:
|
||||
|
@ -104,29 +104,25 @@ class LinkInfo:
|
|||
|
||||
|
||||
class Throughput:
|
||||
def __init__(self, canvas, grpc):
|
||||
def __init__(self, canvas, core_grpc):
|
||||
"""
|
||||
create an instance of Throughput object
|
||||
:param tkinter.Canvas canvas: canvas object
|
||||
:param coretk.coregrpc,CoreGrpc grpc: grpc object
|
||||
:param coretk.app.Application app: application
|
||||
"""
|
||||
self.canvas = canvas
|
||||
self.core_grpc = grpc
|
||||
self.grpc_manager = canvas.grpc_manager
|
||||
|
||||
self.core_grpc = core_grpc
|
||||
# edge canvas id mapped to throughput value
|
||||
self.tracker = {}
|
||||
|
||||
# map an edge canvas id to a throughput canvas id
|
||||
self.map = {}
|
||||
|
||||
self.edge_id_to_token = {}
|
||||
|
||||
def load_throughput_info(self, interface_throughputs):
|
||||
"""
|
||||
load all interface throughouts from an event
|
||||
|
||||
:param repeated core_bp2.InterfaceThroughputinterface_throughputs: interface throughputs
|
||||
:param repeated core_bp2.InterfaceThroughputinterface_throughputs: interface
|
||||
throughputs
|
||||
:return: nothing
|
||||
"""
|
||||
for t in interface_throughputs:
|
||||
|
@ -134,7 +130,7 @@ class Throughput:
|
|||
iid = t.interface_id
|
||||
tp = t.throughput
|
||||
# token = self.grpc_manager.node_id_and_interface_to_edge_token[nid, iid]
|
||||
token = self.grpc_manager.core_mapping.get_token_from_node_and_interface(
|
||||
token = self.core_grpc.manager.core_mapping.get_token_from_node_and_interface(
|
||||
nid, iid
|
||||
)
|
||||
print(token)
|
||||
|
|
|
@ -8,8 +8,7 @@ class WirelessConnection:
|
|||
def __init__(self, canvas, grpc):
|
||||
self.canvas = canvas
|
||||
self.core_grpc = grpc
|
||||
self.core_mapping = canvas.grpc_manager.core_mapping
|
||||
|
||||
self.core_mapping = grpc.manager.core_mapping
|
||||
# map a (node_one_id, node_two_id) to a wlan canvas id
|
||||
self.map = {}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue