updated docs for python files
This commit is contained in:
parent
4381615f1d
commit
89877ffe6f
3 changed files with 45 additions and 18 deletions
|
@ -32,7 +32,7 @@ def create_interface(node, network, interface_data):
|
|||
Create an interface for a node on a network using provided interface data.
|
||||
|
||||
:param node: node to create interface for
|
||||
:param network: network to associate interface with
|
||||
:param core.nodes.base.CoreNetworkBase network: network to associate interface with
|
||||
:param core.emulator.emudata.InterfaceData interface_data: interface data
|
||||
:return: created interface
|
||||
"""
|
||||
|
@ -134,7 +134,7 @@ class LinkOptions(object):
|
|||
"""
|
||||
Create a LinkOptions object.
|
||||
|
||||
:param core.enumerations.LinkTypes _type: type of link, defaults to wired
|
||||
:param core.emulator.enumerations.LinkTypes _type: type of link, defaults to wired
|
||||
"""
|
||||
self.type = _type
|
||||
self.session = None
|
||||
|
@ -206,7 +206,7 @@ class IpPrefixes(object):
|
|||
Creates interface data for linking nodes, using the nodes unique id for generation, along with a random
|
||||
mac address, unless provided.
|
||||
|
||||
:param core.coreobj.PyCoreNode node: node to create interface for
|
||||
:param core.nodes.base.CoreNode node: node to create interface for
|
||||
:param str name: name to set for interface, default is eth{id}
|
||||
:param str mac: mac address to use for this interface, default is random generation
|
||||
:return: new interface data for the provided node
|
||||
|
@ -255,7 +255,7 @@ class InterfaceData(object):
|
|||
|
||||
:param int _id: interface id
|
||||
:param str name: name for interface
|
||||
:param core.misc.ipaddress.MacAddress mac: mac address
|
||||
:param core.nodes.ipaddress.MacAddress mac: mac address
|
||||
:param str ip4: ipv4 address
|
||||
:param int ip4_mask: ipv4 bit mask
|
||||
:param str ip6: ipv6 address
|
||||
|
@ -270,24 +270,50 @@ class InterfaceData(object):
|
|||
self.ip6_mask = ip6_mask
|
||||
|
||||
def has_ip4(self):
|
||||
"""
|
||||
Determines if interface has an ip4 address.
|
||||
|
||||
:return: True if has ip4, False otherwise
|
||||
"""
|
||||
return all([self.ip4, self.ip4_mask])
|
||||
|
||||
def has_ip6(self):
|
||||
"""
|
||||
Determines if interface has an ip6 address.
|
||||
|
||||
:return: True if has ip6, False otherwise
|
||||
"""
|
||||
return all([self.ip6, self.ip6_mask])
|
||||
|
||||
def ip4_address(self):
|
||||
"""
|
||||
Retrieve a string representation of the ip4 address and netmask.
|
||||
|
||||
:return: ip4 string or None
|
||||
"""
|
||||
if self.has_ip4():
|
||||
return "%s/%s" % (self.ip4, self.ip4_mask)
|
||||
else:
|
||||
return None
|
||||
|
||||
def ip6_address(self):
|
||||
"""
|
||||
Retrieve a string representation of the ip6 address and netmask.
|
||||
|
||||
:return: ip4 string or None
|
||||
"""
|
||||
if self.has_ip6():
|
||||
return "%s/%s" % (self.ip6, self.ip6_mask)
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_addresses(self):
|
||||
"""
|
||||
Returns a list of ip4 and ip6 address when present.
|
||||
|
||||
:return: list of addresses
|
||||
:rtype: list
|
||||
"""
|
||||
ip4 = self.ip4_address()
|
||||
ip6 = self.ip6_address()
|
||||
return [i for i in [ip4, ip6] if i]
|
||||
|
|
|
@ -314,7 +314,7 @@ class Session(object):
|
|||
:param int node_two_id: node two id
|
||||
:param int interface_one_id: interface id for node one
|
||||
:param int interface_two_id: interface id for node two
|
||||
:param core.enumerations.LinkTypes link_type: link type to delete
|
||||
:param core.emulator.enumerations.LinkTypes link_type: link type to delete
|
||||
:return: nothing
|
||||
"""
|
||||
# get node objects identified by link data
|
||||
|
@ -452,7 +452,7 @@ class Session(object):
|
|||
"""
|
||||
Add a node to the session, based on the provided node data.
|
||||
|
||||
:param core.enumerations.NodeTypes _type: type of node to create
|
||||
:param core.emulator.enumerations.NodeTypes _type: type of node to create
|
||||
:param int _id: id for node, defaults to None for generated id
|
||||
:param core.emulator.emudata.NodeOptions node_options: data to create node with
|
||||
:return: created node
|
||||
|
@ -574,7 +574,7 @@ class Session(object):
|
|||
"""
|
||||
Broadcast node location to all listeners.
|
||||
|
||||
:param core.netns.nodes.PyCoreObj node: node to broadcast location for
|
||||
:param core.nodes.base.NodeBase node: node to broadcast location for
|
||||
:return: nothing
|
||||
"""
|
||||
node_data = NodeData(
|
||||
|
@ -688,7 +688,7 @@ class Session(object):
|
|||
"""
|
||||
Handle a mobility event.
|
||||
|
||||
:param core.data.EventData event_data: event data to handle
|
||||
:param core.emulator.data.EventData event_data: event data to handle
|
||||
:return: nothing
|
||||
"""
|
||||
self.mobility.handleevent(event_data)
|
||||
|
@ -700,7 +700,7 @@ class Session(object):
|
|||
:param int _id: int for node, defaults to None and will be generated
|
||||
:param core.emulator.emudata.NodeOptions node_options: options for emane node, model will always be "mdr"
|
||||
:return: new emane node
|
||||
:rtype: core.netns.nodes.CoreNode
|
||||
:rtype: core.nodes.network.WlanNode
|
||||
"""
|
||||
if not node_options:
|
||||
node_options = NodeOptions()
|
||||
|
@ -768,7 +768,7 @@ class Session(object):
|
|||
"""
|
||||
Handle exception data that should be provided to exception handlers.
|
||||
|
||||
:param core.data.ExceptionData exception_data: exception data to send out
|
||||
:param core.emulator.data.ExceptionData exception_data: exception data to send out
|
||||
:return: nothing
|
||||
"""
|
||||
|
||||
|
@ -779,7 +779,7 @@ class Session(object):
|
|||
"""
|
||||
Handle node data that should be provided to node handlers.
|
||||
|
||||
:param core.data.ExceptionData node_data: node data to send out
|
||||
:param core.emulator.data.ExceptionData node_data: node data to send out
|
||||
:return: nothing
|
||||
"""
|
||||
|
||||
|
@ -801,7 +801,7 @@ class Session(object):
|
|||
"""
|
||||
Handle config data that should be provided to config handlers.
|
||||
|
||||
:param core.data.ConfigData config_data: config data to send out
|
||||
:param core.emulator.data.ConfigData config_data: config data to send out
|
||||
:return: nothing
|
||||
"""
|
||||
|
||||
|
@ -812,7 +812,7 @@ class Session(object):
|
|||
"""
|
||||
Handle link data that should be provided to link handlers.
|
||||
|
||||
:param core.data.ExceptionData link_data: link data to send out
|
||||
:param core.emulator.data.ExceptionData link_data: link data to send out
|
||||
:return: nothing
|
||||
"""
|
||||
|
||||
|
@ -889,7 +889,7 @@ class Session(object):
|
|||
:param str hook_type: hook type
|
||||
:param str file_name: file name for hook
|
||||
:param str source_name: source name
|
||||
:param data: hook data
|
||||
:param str data: hook data
|
||||
:return: nothing
|
||||
"""
|
||||
logging.info("setting state hook: %s - %s from %s", hook_type, file_name, source_name)
|
||||
|
@ -1018,7 +1018,8 @@ class Session(object):
|
|||
variables.
|
||||
|
||||
:param bool state: flag to determine if session state should be included
|
||||
:return:
|
||||
:return: environment variables
|
||||
:rtype: dict
|
||||
"""
|
||||
env = os.environ.copy()
|
||||
env["SESSION"] = "%s" % self.id
|
||||
|
@ -1532,7 +1533,7 @@ class Session(object):
|
|||
If conf_reqd is False, the control network may be built even
|
||||
when the user has not configured one (e.g. for EMANE.)
|
||||
|
||||
:param core.netns.vnode.CoreNode node: node to add or remove control interface
|
||||
:param core.nodes.base.CoreNode node: node to add or remove control interface
|
||||
:param int net_index: network index
|
||||
:param bool remove: flag to check if it should be removed
|
||||
:param bool conf_required: flag to check if conf is required
|
||||
|
@ -1615,7 +1616,7 @@ class Session(object):
|
|||
start of the runtime state.
|
||||
|
||||
:param event_time: event time
|
||||
:param core.netns.vnode.CoreNode node: node to add event for
|
||||
:param core.nodes.base.CoreNode node: node to add event for
|
||||
:param str name: name of event
|
||||
:param data: data for event
|
||||
:return: nothing
|
||||
|
|
|
@ -611,7 +611,7 @@ class WayPointMobility(WirelessModel):
|
|||
"""
|
||||
Create a WayPointMobility instance.
|
||||
|
||||
:param core.session.Session session: CORE session instance
|
||||
:param core.emulator.session.Session session: CORE session instance
|
||||
:param int _id: object id
|
||||
:return:
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue