changes to support better type checking for retrieving an arbitrary node from a session, get_node now requires an expected class that the node would be an instance of, if the returned node is not an instance a CoreError is thrown, this also helps editors pick up expected types to account for variable/function usage better as well
This commit is contained in:
parent
19ee367dc5
commit
d5254e6a91
21 changed files with 149 additions and 126 deletions
|
@ -9,6 +9,7 @@ from core.emulator.coreemu import CoreEmu
|
|||
from core.emulator.emudata import IpPrefixes, NodeOptions
|
||||
from core.emulator.enumerations import EventTypes, NodeTypes
|
||||
from core.location.mobility import BasicRangeModel
|
||||
from core.nodes.base import CoreNode
|
||||
|
||||
NODES = 2
|
||||
|
||||
|
@ -40,8 +41,8 @@ def main():
|
|||
session.instantiate()
|
||||
|
||||
# get nodes for example run
|
||||
first_node = session.get_node(1)
|
||||
last_node = session.get_node(NODES)
|
||||
first_node = session.get_node(1, CoreNode)
|
||||
last_node = session.get_node(NODES, CoreNode)
|
||||
address = prefixes.ip4_address(first_node)
|
||||
logging.info("node %s pinging %s", last_node.name, address)
|
||||
output = last_node.cmd(f"ping -c 3 {address}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue