grpc: grpc get_session will no longer return peer to peer nodes, they should be invisible to users, updated core-cli to print human readable links better
This commit is contained in:
parent
d480a1dd4c
commit
ab17cb1053
3 changed files with 9 additions and 5 deletions
|
@ -114,7 +114,7 @@ from core.emulator.session import NT, Session
|
|||
from core.errors import CoreCommandError, CoreError
|
||||
from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility
|
||||
from core.nodes.base import CoreNode, CoreNodeBase, NodeBase
|
||||
from core.nodes.network import WlanNode
|
||||
from core.nodes.network import PtpNet, WlanNode
|
||||
from core.services.coreservices import ServiceManager
|
||||
|
||||
_ONE_DAY_IN_SECONDS: int = 60 * 60 * 24
|
||||
|
@ -543,7 +543,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
nodes = []
|
||||
for _id in session.nodes:
|
||||
node = session.nodes[_id]
|
||||
if not isinstance(node.id, int):
|
||||
if isinstance(node, PtpNet):
|
||||
continue
|
||||
node_proto = grpcutils.get_node_proto(session, node)
|
||||
nodes.append(node_proto)
|
||||
|
|
|
@ -62,7 +62,7 @@ class NodeUtils:
|
|||
IMAGE_NODES: Set[NodeType] = {NodeType.DOCKER, NodeType.LXC}
|
||||
WIRELESS_NODES: Set[NodeType] = {NodeType.WIRELESS_LAN, NodeType.EMANE}
|
||||
RJ45_NODES: Set[NodeType] = {NodeType.RJ45}
|
||||
IGNORE_NODES: Set[NodeType] = {NodeType.CONTROL_NET, NodeType.PEER_TO_PEER}
|
||||
IGNORE_NODES: Set[NodeType] = {NodeType.CONTROL_NET}
|
||||
NODE_MODELS: Set[str] = {"router", "host", "PC", "mdr", "prouter"}
|
||||
ROUTER_NODES: Set[str] = {"router", "mdr"}
|
||||
ANTENNA_ICON: PhotoImage = None
|
||||
|
|
|
@ -150,12 +150,16 @@ def query_session(args: Namespace) -> None:
|
|||
n2 = names[link.node2_id]
|
||||
print(f"Node | ", end="")
|
||||
print_iface_header()
|
||||
print(f"{n1:<6} | ", end="")
|
||||
if link.HasField("iface1"):
|
||||
print(f"{n1:<6} | ", end="")
|
||||
print_iface(link.iface1)
|
||||
else:
|
||||
print()
|
||||
print(f"{n2:<6} | ", end="")
|
||||
if link.HasField("iface2"):
|
||||
print(f"{n2:<6} | ", end="")
|
||||
print_iface(link.iface2)
|
||||
else:
|
||||
print()
|
||||
print()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue