本文整理匯總了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)