本文整理汇总了Python中ion.agents.platform.util.network_util.NetworkUtil._dump_pnode方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkUtil._dump_pnode方法的具体用法?Python NetworkUtil._dump_pnode怎么用?Python NetworkUtil._dump_pnode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.agents.platform.util.network_util.NetworkUtil
的用法示例。
在下文中一共展示了NetworkUtil._dump_pnode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import _dump_pnode [as 别名]
def __init__(self, pnode, evt_recv):
"""
Creates a PlatformDriver instance.
@param pnode Root PlatformNode defining the platform network rooted at
this platform.
@param evt_recv Listener of events generated by this driver
"""
assert pnode, "pnode must be given"
assert evt_recv, "evt_recv parameter must be given"
self._pnode = pnode
self._send_event = evt_recv
self._platform_id = self._pnode.platform_id
if self._pnode.parent:
self._parent_platform_id = self._pnode.parent.platform_id
else:
self._parent_platform_id = None
self._platform_attributes = \
dict((a.attr_id, a.defn) for a in self._pnode.attrs.itervalues())
if log.isEnabledFor(logging.DEBUG):
log.debug("%r: PlatformDriver constructor called: pnode:\n%s\n"
"_platform_attributes=%s",
self._platform_id,
NetworkUtil._dump_pnode(self._pnode, include_subplatforms=False),
self._platform_attributes)
self._driver_config = None
# construct FSM and start it with initial state UNCONFIGURED:
self._construct_fsm()
self._fsm.start(PlatformDriverState.UNCONFIGURED)
示例2: __init__
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import _dump_pnode [as 别名]
def __init__(self, pnode, event_callback,
create_event_subscriber, destroy_event_subscriber):
"""
Creates a PlatformDriver instance.
@param pnode Root PlatformNode defining the platform network
rooted at this platform.
@param event_callback Callback to notify platform agent about events
generated by this driver.
This is captured in self._send_event for this
class and subclasses to call as needed.
@param create_event_subscriber
@param destroy_event_subscriber
functions to create/destroy any needed EventSubscriber's,
in particular regarding the Managed Endpoint API.
"""
#
# NOTE the "pnode" parameter may be not very "standard" but it is the
# current convenient mechanism that captures the overall definition
# of the corresponding platform (most of which coming from configuration)
#
self._pnode = pnode
self._send_event = event_callback
self._create_event_subscriber = create_event_subscriber
self._destroy_event_subscriber = destroy_event_subscriber
self._platform_id = self._pnode.platform_id
if self._pnode.parent:
self._parent_platform_id = self._pnode.parent.platform_id
else:
self._parent_platform_id = None
self._platform_attributes = \
dict((a.attr_id, a.defn) for a in self._pnode.attrs.itervalues())
if log.isEnabledFor(logging.DEBUG):
log.debug("%r: PlatformDriver constructor called: pnode:\n%s\n"
"_platform_attributes=%s",
self._platform_id,
NetworkUtil._dump_pnode(self._pnode, include_subplatforms=False),
self._platform_attributes)
self._driver_config = None
self._resource_schema = {}
# The parameter dictionary.
self._param_dict = {}
# construct FSM and start it with initial state UNCONFIGURED:
self._construct_fsm()
self._fsm.start(PlatformDriverState.UNCONFIGURED)
示例3: gen_diagrams
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import _dump_pnode [as 别名]
def gen_diagrams(name, pnode):
yml_name = '%s.yml' % name
file(yml_name, 'w').write(NetworkUtil._gen_yaml(pnode))
dot_name = '%s.dot' % name
pml_name = '%s.puml' % name
file(dot_name, 'w').write(NetworkUtil._gen_diagram(pnode, style="dot"))
file(pml_name, 'w').write(NetworkUtil._gen_diagram(pnode, style="plantuml"))
print "topology =\n%s" % NetworkUtil._dump_pnode(pnode, only_topology=True)
try:
dot_cmd = 'dot -Tpng %s.dot -o %s.png' % (name,name)
open_cmd = 'open %s.png' % name
import subprocess
subprocess.call(dot_cmd.split())
subprocess.call(open_cmd.split())
except Exception, e:
print "error generating diagrams: %s" % str(e)
示例4: __init__
# 需要导入模块: from ion.agents.platform.util.network_util import NetworkUtil [as 别名]
# 或者: from ion.agents.platform.util.network_util.NetworkUtil import _dump_pnode [as 别名]
def __init__(self, pnode, event_callback):
"""
Creates a PlatformDriver instance.
@param pnode Root PlatformNode defining the platform network
rooted at this platform.
@param event_callback Listener of events generated by this driver
"""
#
# NOTE the "pnode" parameter may be not very "standard" but it is the
# current convenient mechanism that captures the overall definition
# of the corresponding platform (most of which coming from configuration)
#
assert pnode, "pnode must be given"
assert event_callback, "event_callback parameter must be given"
self._pnode = pnode
self._send_event = event_callback
self._platform_id = self._pnode.platform_id
if self._pnode.parent:
self._parent_platform_id = self._pnode.parent.platform_id
else:
self._parent_platform_id = None
self._platform_attributes = \
dict((a.attr_id, a.defn) for a in self._pnode.attrs.itervalues())
if log.isEnabledFor(logging.DEBUG):
log.debug("%r: PlatformDriver constructor called: pnode:\n%s\n"
"_platform_attributes=%s",
self._platform_id,
NetworkUtil._dump_pnode(self._pnode, include_subplatforms=False),
self._platform_attributes)
self._driver_config = None
self._resource_schema = {}
# The parameter dictionary.
self._param_dict = {}
# construct FSM and start it with initial state UNCONFIGURED:
self._construct_fsm()
self._fsm.start(PlatformDriverState.UNCONFIGURED)