Exemplo n.º 1
0
    def draw(self) -> None:
        self.columnconfigure(0, weight=1)
        link = self.edge.link
        options = link.options
        src_node = self.app.core.session.nodes[link.node1_id]
        dst_node = self.app.core.session.nodes[link.node2_id]

        frame = DetailsFrame(self)
        frame.grid(sticky=tk.EW)
        frame.add_detail("Source", src_node.name)
        iface1 = link.iface1
        if iface1:
            mac = iface1.mac if iface1.mac else "auto"
            frame.add_detail("MAC", mac)
            ip4 = f"{iface1.ip4}/{iface1.ip4_mask}" if iface1.ip4 else ""
            frame.add_detail("IP4", ip4)
            ip6 = f"{iface1.ip6}/{iface1.ip6_mask}" if iface1.ip6 else ""
            frame.add_detail("IP6", ip6)

        frame.add_separator()
        frame.add_detail("Destination", dst_node.name)
        iface2 = link.iface2
        if iface2:
            mac = iface2.mac if iface2.mac else "auto"
            frame.add_detail("MAC", mac)
            ip4 = f"{iface2.ip4}/{iface2.ip4_mask}" if iface2.ip4 else ""
            frame.add_detail("IP4", ip4)
            ip6 = f"{iface2.ip6}/{iface2.ip6_mask}" if iface2.ip6 else ""
            frame.add_detail("IP6", ip6)

        if link.options:
            frame.add_separator()
            bandwidth = bandwidth_text(options.bandwidth)
            frame.add_detail("Bandwidth", bandwidth)
            frame.add_detail("Delay", f"{options.delay} us")
            frame.add_detail("Jitter", f"\u00B1{options.jitter} us")
            frame.add_detail("Loss", f"{options.loss}%")
            frame.add_detail("Duplicate", f"{options.dup}%")
Exemplo n.º 2
0
    def draw(self) -> None:
        link = self.edge.link
        src_canvas_node = self.app.canvas.nodes[self.edge.src]
        src_node = src_canvas_node.core_node
        dst_canvas_node = self.app.canvas.nodes[self.edge.dst]
        dst_node = dst_canvas_node.core_node

        # find interface for each node connected to network
        net_id = link.network_id
        iface1 = get_iface(src_canvas_node, net_id)
        iface2 = get_iface(dst_canvas_node, net_id)

        frame = DetailsFrame(self)
        frame.grid(sticky=tk.EW)
        frame.add_detail("Source", src_node.name)
        if iface1:
            mac = iface1.mac if iface1.mac else "auto"
            frame.add_detail("MAC", mac)
            ip4 = f"{iface1.ip4}/{iface1.ip4_mask}" if iface1.ip4 else ""
            frame.add_detail("IP4", ip4)
            ip6 = f"{iface1.ip6}/{iface1.ip6_mask}" if iface1.ip6 else ""
            frame.add_detail("IP6", ip6)

        frame.add_separator()
        frame.add_detail("Destination", dst_node.name)
        if iface2:
            mac = iface2.mac if iface2.mac else "auto"
            frame.add_detail("MAC", mac)
            ip4 = f"{iface2.ip4}/{iface2.ip4_mask}" if iface2.ip4 else ""
            frame.add_detail("IP4", ip4)
            ip6 = f"{iface2.ip6}/{iface2.ip6_mask}" if iface2.ip6 else ""
            frame.add_detail("IP6", ip6)
Exemplo n.º 3
0
 def draw(self) -> None:
     self.columnconfigure(0, weight=1)
     node = self.canvas_node.core_node
     frame = DetailsFrame(self)
     frame.grid(sticky=tk.EW)
     frame.add_detail("ID", node.id)
     frame.add_detail("Name", node.name)
     if NodeUtils.is_model_node(node.type):
         frame.add_detail("Type", node.model)
     if NodeUtils.is_container_node(node.type):
         for index, service in enumerate(sorted(node.services)):
             if index == 0:
                 frame.add_detail("Services", service)
             else:
                 frame.add_detail("", service)
     if node.type == NodeType.EMANE:
         emane = node.emane.split("_")[1:]
         frame.add_detail("EMANE", emane)
     if NodeUtils.is_image_node(node.type):
         frame.add_detail("Image", node.image)
     if NodeUtils.is_container_node(node.type):
         server = node.server if node.server else "localhost"
         frame.add_detail("Server", server)