initial coreapi2 specification and legacy to api2 translation

This commit is contained in:
Rod A Santiago 2016-07-26 17:55:29 -07:00
parent e9c0730c12
commit d710eb3734
2 changed files with 860 additions and 0 deletions

778
daemon/core/api/core_pb2.py Normal file
View file

@ -0,0 +1,778 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: core.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
DESCRIPTOR = _descriptor.FileDescriptor(
name='core.proto',
package='core_proto',
serialized_pb='\n\ncore.proto\x12\ncore_proto\"\xe5\x01\n\x05\x45vent\x12\x10\n\x08node_idx\x18\x01 \x01(\x05\x12\x0f\n\x07\x64\x65v_idx\x18\x02 \x01(\x05\x12\x0f\n\x07net_idx\x18\x03 \x01(\x05\x12\x13\n\x0b\x63hannel_idx\x18\x04 \x01(\x05\x12\x10\n\x08oldstate\x18\x05 \x01(\x05\x12\x10\n\x08newstate\x18\x06 \x01(\x05\"8\n\x08msg_type\x12\x08\n\x04node\x10\x00\x12\n\n\x06\x64\x65vice\x10\x01\x12\x0b\n\x07\x63hannel\x10\x02\x12\t\n\x05state\x10\x03\"5\n\x08mod_type\x12\x07\n\x03\x61\x64\x64\x10\x00\x12\n\n\x06\x64\x65lete\x10\x01\x12\n\n\x06modify\x10\x02\x12\x08\n\x04move\x10\x03\"-\n\x08\x45ndpoint\x12\x0f\n\x07\x64\x65v_idx\x18\x01 \x02(\x05\x12\x10\n\x08intf_idx\x18\x02 \x02(\x05\"?\n\x07\x43hannel\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\'\n\tendpoints\x18\x02 \x03(\x0b\x32\x14.core_proto.Endpoint\"K\n\x07Network\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12%\n\x08\x63hannels\x18\x03 \x03(\x0b\x32\x13.core_proto.Channel\"\x8d\x01\n\x07Service\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\x10\n\x08standard\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x14\n\x0cstart_script\x18\x04 \x01(\t\x12\x13\n\x0bstop_script\x18\x05 \x01(\t\x12\x15\n\rconfiguration\x18\x06 \x01(\t\x12\x13\n\x0b\x64irectories\x18\x07 \x01(\t\"I\n\tInterface\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08mac_addr\x18\x03 \x01(\t\x12\x0f\n\x07ip_addr\x18\x04 \x01(\t\"`\n\x06\x44\x65vice\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12)\n\ninterfaces\x18\x03 \x03(\x0b\x32\x15.core_proto.Interface\x12\x10\n\x08location\x18\x04 \x01(\t\"\x85\x01\n\x04Node\x12\x0b\n\x03idx\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12)\n\ninterfaces\x18\x03 \x03(\x0b\x32\x15.core_proto.Interface\x12%\n\x08services\x18\x04 \x03(\x0b\x32\x13.core_proto.Service\x12\x10\n\x08location\x18\x05 \x01(\t\"\x9d\x01\n\nExperiment\x12\x14\n\x0c\x65xperimentId\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x1f\n\x05nodes\x18\x03 \x03(\x0b\x32\x10.core_proto.Node\x12#\n\x07\x64\x65vices\x18\x04 \x03(\x0b\x32\x12.core_proto.Device\x12%\n\x08networks\x18\x05 \x03(\x0b\x32\x13.core_proto.Network\"Y\n\x07Session\x12\x10\n\x08\x63lientId\x18\x01 \x02(\t\x12\x10\n\x08port_num\x18\x02 \x01(\x05\x12*\n\nexperiment\x18\x03 \x01(\x0b\x32\x16.core_proto.Experiment\")\n\x0c\x45rrorMessage\x12\x0c\n\x04\x63ode\x18\x01 \x02(\x05\x12\x0b\n\x03msg\x18\x02 \x01(\t\"\xee\x01\n\x0b\x43oreMessage\x12$\n\x07session\x18\x01 \x01(\x0b\x32\x13.core_proto.Session\x12*\n\nexperiment\x18\x02 \x01(\x0b\x32\x16.core_proto.Experiment\x12\x1e\n\x04node\x18\x03 \x01(\x0b\x32\x10.core_proto.Node\x12\"\n\x06\x64\x65vice\x18\x04 \x01(\x0b\x32\x12.core_proto.Device\x12 \n\x05\x65vent\x18\x05 \x01(\x0b\x32\x11.core_proto.Event\x12\'\n\x05\x65rror\x18\x06 \x01(\x0b\x32\x18.core_proto.ErrorMessage')
_EVENT_MSG_TYPE = _descriptor.EnumDescriptor(
name='msg_type',
full_name='core_proto.Event.msg_type',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='node', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='device', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='channel', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='state', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=145,
serialized_end=201,
)
_EVENT_MOD_TYPE = _descriptor.EnumDescriptor(
name='mod_type',
full_name='core_proto.Event.mod_type',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='add', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='delete', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='modify', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='move', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=203,
serialized_end=256,
)
_EVENT = _descriptor.Descriptor(
name='Event',
full_name='core_proto.Event',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='node_idx', full_name='core_proto.Event.node_idx', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dev_idx', full_name='core_proto.Event.dev_idx', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='net_idx', full_name='core_proto.Event.net_idx', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='channel_idx', full_name='core_proto.Event.channel_idx', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='oldstate', full_name='core_proto.Event.oldstate', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='newstate', full_name='core_proto.Event.newstate', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_EVENT_MSG_TYPE,
_EVENT_MOD_TYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=27,
serialized_end=256,
)
_ENDPOINT = _descriptor.Descriptor(
name='Endpoint',
full_name='core_proto.Endpoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='dev_idx', full_name='core_proto.Endpoint.dev_idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='intf_idx', full_name='core_proto.Endpoint.intf_idx', index=1,
number=2, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=258,
serialized_end=303,
)
_CHANNEL = _descriptor.Descriptor(
name='Channel',
full_name='core_proto.Channel',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Channel.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='endpoints', full_name='core_proto.Channel.endpoints', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=305,
serialized_end=368,
)
_NETWORK = _descriptor.Descriptor(
name='Network',
full_name='core_proto.Network',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Network.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Network.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='channels', full_name='core_proto.Network.channels', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=370,
serialized_end=445,
)
_SERVICE = _descriptor.Descriptor(
name='Service',
full_name='core_proto.Service',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Service.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='standard', full_name='core_proto.Service.standard', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Service.name', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_script', full_name='core_proto.Service.start_script', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stop_script', full_name='core_proto.Service.stop_script', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='configuration', full_name='core_proto.Service.configuration', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='directories', full_name='core_proto.Service.directories', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=448,
serialized_end=589,
)
_INTERFACE = _descriptor.Descriptor(
name='Interface',
full_name='core_proto.Interface',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Interface.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Interface.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='mac_addr', full_name='core_proto.Interface.mac_addr', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ip_addr', full_name='core_proto.Interface.ip_addr', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=591,
serialized_end=664,
)
_DEVICE = _descriptor.Descriptor(
name='Device',
full_name='core_proto.Device',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Device.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Device.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='interfaces', full_name='core_proto.Device.interfaces', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='location', full_name='core_proto.Device.location', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=666,
serialized_end=762,
)
_NODE = _descriptor.Descriptor(
name='Node',
full_name='core_proto.Node',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='idx', full_name='core_proto.Node.idx', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Node.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='interfaces', full_name='core_proto.Node.interfaces', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='services', full_name='core_proto.Node.services', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='location', full_name='core_proto.Node.location', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=765,
serialized_end=898,
)
_EXPERIMENT = _descriptor.Descriptor(
name='Experiment',
full_name='core_proto.Experiment',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='experimentId', full_name='core_proto.Experiment.experimentId', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='core_proto.Experiment.name', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='nodes', full_name='core_proto.Experiment.nodes', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='devices', full_name='core_proto.Experiment.devices', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='networks', full_name='core_proto.Experiment.networks', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=901,
serialized_end=1058,
)
_SESSION = _descriptor.Descriptor(
name='Session',
full_name='core_proto.Session',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='clientId', full_name='core_proto.Session.clientId', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='port_num', full_name='core_proto.Session.port_num', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='experiment', full_name='core_proto.Session.experiment', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=1060,
serialized_end=1149,
)
_ERRORMESSAGE = _descriptor.Descriptor(
name='ErrorMessage',
full_name='core_proto.ErrorMessage',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='code', full_name='core_proto.ErrorMessage.code', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='msg', full_name='core_proto.ErrorMessage.msg', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=unicode("", "utf-8"),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=1151,
serialized_end=1192,
)
_COREMESSAGE = _descriptor.Descriptor(
name='CoreMessage',
full_name='core_proto.CoreMessage',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='session', full_name='core_proto.CoreMessage.session', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='experiment', full_name='core_proto.CoreMessage.experiment', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='node', full_name='core_proto.CoreMessage.node', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device', full_name='core_proto.CoreMessage.device', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='event', full_name='core_proto.CoreMessage.event', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='error', full_name='core_proto.CoreMessage.error', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=1195,
serialized_end=1433,
)
_EVENT_MSG_TYPE.containing_type = _EVENT;
_EVENT_MOD_TYPE.containing_type = _EVENT;
_CHANNEL.fields_by_name['endpoints'].message_type = _ENDPOINT
_NETWORK.fields_by_name['channels'].message_type = _CHANNEL
_DEVICE.fields_by_name['interfaces'].message_type = _INTERFACE
_NODE.fields_by_name['interfaces'].message_type = _INTERFACE
_NODE.fields_by_name['services'].message_type = _SERVICE
_EXPERIMENT.fields_by_name['nodes'].message_type = _NODE
_EXPERIMENT.fields_by_name['devices'].message_type = _DEVICE
_EXPERIMENT.fields_by_name['networks'].message_type = _NETWORK
_SESSION.fields_by_name['experiment'].message_type = _EXPERIMENT
_COREMESSAGE.fields_by_name['session'].message_type = _SESSION
_COREMESSAGE.fields_by_name['experiment'].message_type = _EXPERIMENT
_COREMESSAGE.fields_by_name['node'].message_type = _NODE
_COREMESSAGE.fields_by_name['device'].message_type = _DEVICE
_COREMESSAGE.fields_by_name['event'].message_type = _EVENT
_COREMESSAGE.fields_by_name['error'].message_type = _ERRORMESSAGE
DESCRIPTOR.message_types_by_name['Event'] = _EVENT
DESCRIPTOR.message_types_by_name['Endpoint'] = _ENDPOINT
DESCRIPTOR.message_types_by_name['Channel'] = _CHANNEL
DESCRIPTOR.message_types_by_name['Network'] = _NETWORK
DESCRIPTOR.message_types_by_name['Service'] = _SERVICE
DESCRIPTOR.message_types_by_name['Interface'] = _INTERFACE
DESCRIPTOR.message_types_by_name['Device'] = _DEVICE
DESCRIPTOR.message_types_by_name['Node'] = _NODE
DESCRIPTOR.message_types_by_name['Experiment'] = _EXPERIMENT
DESCRIPTOR.message_types_by_name['Session'] = _SESSION
DESCRIPTOR.message_types_by_name['ErrorMessage'] = _ERRORMESSAGE
DESCRIPTOR.message_types_by_name['CoreMessage'] = _COREMESSAGE
class Event(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _EVENT
# @@protoc_insertion_point(class_scope:core_proto.Event)
class Endpoint(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _ENDPOINT
# @@protoc_insertion_point(class_scope:core_proto.Endpoint)
class Channel(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _CHANNEL
# @@protoc_insertion_point(class_scope:core_proto.Channel)
class Network(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _NETWORK
# @@protoc_insertion_point(class_scope:core_proto.Network)
class Service(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _SERVICE
# @@protoc_insertion_point(class_scope:core_proto.Service)
class Interface(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _INTERFACE
# @@protoc_insertion_point(class_scope:core_proto.Interface)
class Device(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _DEVICE
# @@protoc_insertion_point(class_scope:core_proto.Device)
class Node(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _NODE
# @@protoc_insertion_point(class_scope:core_proto.Node)
class Experiment(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _EXPERIMENT
# @@protoc_insertion_point(class_scope:core_proto.Experiment)
class Session(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _SESSION
# @@protoc_insertion_point(class_scope:core_proto.Session)
class ErrorMessage(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _ERRORMESSAGE
# @@protoc_insertion_point(class_scope:core_proto.ErrorMessage)
class CoreMessage(_message.Message):
__metaclass__ = _reflection.GeneratedProtocolMessageType
DESCRIPTOR = _COREMESSAGE
# @@protoc_insertion_point(class_scope:core_proto.CoreMessage)
# @@protoc_insertion_point(module_scope)

View file

@ -0,0 +1,82 @@
#
# CORE
# Copyright (c)2016 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# authors: Rod Santiago
# John Kharouta
#
import core_pb2
import struct
from core.api.coreapi import *
class CoreMessage(object):
hdrfmt = "H"
hdrsiz = struct.calcsize(hdrfmt)
@staticmethod
def toLegacyApi(data):
message = core_pb2.CoreMessage()
message.ParseFromString(data)
if message.HasField('session'):
return CoreMessage.translateSessionMsg(message.session)
if message.HasField('experiment'):
return CoreMessage.translateExperimentMsg(message.experiment)
if message.HasField('event'):
return CoreMessage.translateEvent(message.event)
@staticmethod
def toApi2(messages):
for msg in messages:
msgtype, msgflags, msglen = coreapi.CoreMessage.unpackhdr(msg)
data = msg[coreapi.CoreMessage.hdrsiz:]
if msgtype == coreapi.CORE_API_REG_MSG:
pass
elif msgtype == coreapi.CORE_API_SESS_MSG:
@staticmethod
def translateSessionMsg(message):
print 'Received session request message'
msgs = []
msgs.append(CoreMessage.createRegisterMessage(0, gui='true'))
return msgs
@staticmethod
def translateExperimentMsg(message):
print 'Received experiment message'
@staticmethod
def translateEvent(event):
print 'Received event'
@staticmethod
def createRegisterMessage(flags, wireless=None, mobility=None, utility=None, execsrv=None,
gui=None, emulsrv=None, session=None):
tlvdata = ""
if wireless is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_WIRELESS,wireless)
if mobility is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_MOBILITY,mobility)
if utility is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_UTILITY,utility)
if execsrv is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_EXECSRV,execsrv)
if gui is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_GUI,gui)
if emulsrv is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_EMULSRV,emulsrv)
if session is not None:
tlvdata = tlvdata + CoreRegTlv.pack(CORE_TLV_REG_SESSION,session)
hdr = struct.pack(CoreRegMessage.hdrfmt, CoreRegMessage.msgtype, flags, len(tlvdata))
return CoreRegMessage(flags, hdr, tlvdata)