try:
    import emane.shell.remotecontrolportapi_pb2 as remotecontrolportapi_pb2
except:
    import emanesh.remotecontrolportapi_pb2 as remotecontrolportapi_pb2

# create a socket
sock = socket.socket()

# connect to a running emulator instance
sock.connect(('node-1', 47000))

# set the Request sequence number
sequence = 1

# retrieve the manifest from the running emulator instance
manifest = getManifest(sock, sequence)

# create a Request message
request = remotecontrolportapi_pb2.Request()

# set the Request sequence number
sequence += 1
request.sequence = sequence

# set the Request type
request.type = remotecontrolportapi_pb2.Request.TYPE_REQUEST_QUERY

# set the Request Query type
request.query.type = remotecontrolportapi_pb2.TYPE_QUERY_STATISTIC

# for this example, set the target build id to the smallest build id
示例#2
0
try:
    import emane.shell.remotecontrolportapi_pb2 as remotecontrolportapi_pb2
except:
    import emanesh.remotecontrolportapi_pb2 as remotecontrolportapi_pb2

# create a socket
sock = socket.socket()

# connect to a running emulator instance
sock.connect(('node-1', 47000))

# set the Request sequence number
sequence = 1

# retrieve the manifest from the running emulator instance
manifest = helpers.getManifest(sock, sequence)

# create a Request message
request = remotecontrolportapi_pb2.Request()

# set the Request type
request.type = remotecontrolportapi_pb2.Request.TYPE_REQUEST_UPDATE

# set the Request Update type
request.update.type = remotecontrolportapi_pb2.TYPE_UPDATE_STATISTICCLEAR

# set the target build id to the smallest build id component contained
# in the smallest NEM id running in the emulator
request.update.statisticClear.buildId = min(
    [x.buildId for x in manifest[min(manifest)]])