Skip to content
Snippets Groups Projects
Commit 6908f606 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Adapted Context to common proto folder:

- Arranged .gitignore & .gitkeep files in common proto folder
- Created specific run_tests_locally script for Context component
- Moved imports from *.proto folder to common.proto folder
- Adapted common.tools.object_factory to new proto definitions for ConfigRule and Constraint
- Extended common.tools.type_checkers to new proto definitions for ConfigRule and Constraint
- Removed context's genproto.sh script
- Adapted Events generated to new timestamp data type
- Minor code and linting fixing
parent 4d33b6b1
No related branches found
No related tags found
1 merge request!54Release 2.0.0
Showing
with 51 additions and 6641 deletions
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: acl.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
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 symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='acl.proto',
package='acl',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\tacl.proto\x12\x03\x61\x63l\"\xaa\x01\n\x08\x41\x63lMatch\x12\x0c\n\x04\x64scp\x18\x01 \x01(\r\x12\x10\n\x08protocol\x18\x02 \x01(\r\x12\x13\n\x0bsrc_address\x18\x03 \x01(\t\x12\x13\n\x0b\x64st_address\x18\x04 \x01(\t\x12\x10\n\x08src_port\x18\x05 \x01(\r\x12\x10\n\x08\x64st_port\x18\x06 \x01(\r\x12\x18\n\x10start_mpls_label\x18\x07 \x01(\r\x12\x16\n\x0e\x65nd_mpls_label\x18\x08 \x01(\r\"i\n\tAclAction\x12\x31\n\x0e\x66orward_action\x18\x01 \x01(\x0e\x32\x19.acl.AclForwardActionEnum\x12)\n\nlog_action\x18\x02 \x01(\x0e\x32\x15.acl.AclLogActionEnum\"r\n\x08\x41\x63lEntry\x12\x13\n\x0bsequence_id\x18\x01 \x01(\r\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1c\n\x05match\x18\x03 \x01(\x0b\x32\r.acl.AclMatch\x12\x1e\n\x06\x61\x63tion\x18\x04 \x01(\x0b\x32\x0e.acl.AclAction\"\x84\x01\n\nAclRuleSet\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\"\n\x04type\x18\x02 \x01(\x0e\x32\x14.acl.AclRuleTypeEnum\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0f\n\x07user_id\x18\x04 \x01(\t\x12\x1e\n\x07\x65ntries\x18\x05 \x03(\x0b\x32\r.acl.AclEntry*\x99\x01\n\x0f\x41\x63lRuleTypeEnum\x12\x19\n\x15\x41\x43LRULETYPE_UNDEFINED\x10\x00\x12\x14\n\x10\x41\x43LRULETYPE_IPV4\x10\x01\x12\x14\n\x10\x41\x43LRULETYPE_IPV6\x10\x02\x12\x12\n\x0e\x41\x43LRULETYPE_L2\x10\x03\x12\x14\n\x10\x41\x43LRULETYPE_MPLS\x10\x04\x12\x15\n\x11\x41\x43LRULETYPE_MIXED\x10\x05*\x97\x01\n\x14\x41\x63lForwardActionEnum\x12!\n\x1d\x41\x43LFORWARDINGACTION_UNDEFINED\x10\x00\x12\x1c\n\x18\x41\x43LFORWARDINGACTION_DROP\x10\x01\x12\x1e\n\x1a\x41\x43LFORWARDINGACTION_ACCEPT\x10\x02\x12\x1e\n\x1a\x41\x43LFORWARDINGACTION_REJECT\x10\x03*_\n\x10\x41\x63lLogActionEnum\x12\x1a\n\x16\x41\x43LLOGACTION_UNDEFINED\x10\x00\x12\x16\n\x12\x41\x43LLOGACTION_NOLOG\x10\x01\x12\x17\n\x13\x41\x43LLOGACTION_SYSLOG\x10\x02\x62\x06proto3'
)
_ACLRULETYPEENUM = _descriptor.EnumDescriptor(
name='AclRuleTypeEnum',
full_name='acl.AclRuleTypeEnum',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_UNDEFINED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_IPV4', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_IPV6', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_L2', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_MPLS', index=4, number=4,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLRULETYPE_MIXED', index=5, number=5,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=550,
serialized_end=703,
)
_sym_db.RegisterEnumDescriptor(_ACLRULETYPEENUM)
AclRuleTypeEnum = enum_type_wrapper.EnumTypeWrapper(_ACLRULETYPEENUM)
_ACLFORWARDACTIONENUM = _descriptor.EnumDescriptor(
name='AclForwardActionEnum',
full_name='acl.AclForwardActionEnum',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='ACLFORWARDINGACTION_UNDEFINED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLFORWARDINGACTION_DROP', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLFORWARDINGACTION_ACCEPT', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLFORWARDINGACTION_REJECT', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=706,
serialized_end=857,
)
_sym_db.RegisterEnumDescriptor(_ACLFORWARDACTIONENUM)
AclForwardActionEnum = enum_type_wrapper.EnumTypeWrapper(_ACLFORWARDACTIONENUM)
_ACLLOGACTIONENUM = _descriptor.EnumDescriptor(
name='AclLogActionEnum',
full_name='acl.AclLogActionEnum',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='ACLLOGACTION_UNDEFINED', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLLOGACTION_NOLOG', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='ACLLOGACTION_SYSLOG', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=859,
serialized_end=954,
)
_sym_db.RegisterEnumDescriptor(_ACLLOGACTIONENUM)
AclLogActionEnum = enum_type_wrapper.EnumTypeWrapper(_ACLLOGACTIONENUM)
ACLRULETYPE_UNDEFINED = 0
ACLRULETYPE_IPV4 = 1
ACLRULETYPE_IPV6 = 2
ACLRULETYPE_L2 = 3
ACLRULETYPE_MPLS = 4
ACLRULETYPE_MIXED = 5
ACLFORWARDINGACTION_UNDEFINED = 0
ACLFORWARDINGACTION_DROP = 1
ACLFORWARDINGACTION_ACCEPT = 2
ACLFORWARDINGACTION_REJECT = 3
ACLLOGACTION_UNDEFINED = 0
ACLLOGACTION_NOLOG = 1
ACLLOGACTION_SYSLOG = 2
_ACLMATCH = _descriptor.Descriptor(
name='AclMatch',
full_name='acl.AclMatch',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='dscp', full_name='acl.AclMatch.dscp', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='protocol', full_name='acl.AclMatch.protocol', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='src_address', full_name='acl.AclMatch.src_address', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='dst_address', full_name='acl.AclMatch.dst_address', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='src_port', full_name='acl.AclMatch.src_port', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='dst_port', full_name='acl.AclMatch.dst_port', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='start_mpls_label', full_name='acl.AclMatch.start_mpls_label', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='end_mpls_label', full_name='acl.AclMatch.end_mpls_label', index=7,
number=8, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=19,
serialized_end=189,
)
_ACLACTION = _descriptor.Descriptor(
name='AclAction',
full_name='acl.AclAction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='forward_action', full_name='acl.AclAction.forward_action', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='log_action', full_name='acl.AclAction.log_action', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=191,
serialized_end=296,
)
_ACLENTRY = _descriptor.Descriptor(
name='AclEntry',
full_name='acl.AclEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='sequence_id', full_name='acl.AclEntry.sequence_id', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='acl.AclEntry.description', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='match', full_name='acl.AclEntry.match', 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,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='action', full_name='acl.AclEntry.action', 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,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=298,
serialized_end=412,
)
_ACLRULESET = _descriptor.Descriptor(
name='AclRuleSet',
full_name='acl.AclRuleSet',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='acl.AclRuleSet.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='type', full_name='acl.AclRuleSet.type', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='acl.AclRuleSet.description', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='user_id', full_name='acl.AclRuleSet.user_id', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='entries', full_name='acl.AclRuleSet.entries', 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,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=415,
serialized_end=547,
)
_ACLACTION.fields_by_name['forward_action'].enum_type = _ACLFORWARDACTIONENUM
_ACLACTION.fields_by_name['log_action'].enum_type = _ACLLOGACTIONENUM
_ACLENTRY.fields_by_name['match'].message_type = _ACLMATCH
_ACLENTRY.fields_by_name['action'].message_type = _ACLACTION
_ACLRULESET.fields_by_name['type'].enum_type = _ACLRULETYPEENUM
_ACLRULESET.fields_by_name['entries'].message_type = _ACLENTRY
DESCRIPTOR.message_types_by_name['AclMatch'] = _ACLMATCH
DESCRIPTOR.message_types_by_name['AclAction'] = _ACLACTION
DESCRIPTOR.message_types_by_name['AclEntry'] = _ACLENTRY
DESCRIPTOR.message_types_by_name['AclRuleSet'] = _ACLRULESET
DESCRIPTOR.enum_types_by_name['AclRuleTypeEnum'] = _ACLRULETYPEENUM
DESCRIPTOR.enum_types_by_name['AclForwardActionEnum'] = _ACLFORWARDACTIONENUM
DESCRIPTOR.enum_types_by_name['AclLogActionEnum'] = _ACLLOGACTIONENUM
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
AclMatch = _reflection.GeneratedProtocolMessageType('AclMatch', (_message.Message,), {
'DESCRIPTOR' : _ACLMATCH,
'__module__' : 'acl_pb2'
# @@protoc_insertion_point(class_scope:acl.AclMatch)
})
_sym_db.RegisterMessage(AclMatch)
AclAction = _reflection.GeneratedProtocolMessageType('AclAction', (_message.Message,), {
'DESCRIPTOR' : _ACLACTION,
'__module__' : 'acl_pb2'
# @@protoc_insertion_point(class_scope:acl.AclAction)
})
_sym_db.RegisterMessage(AclAction)
AclEntry = _reflection.GeneratedProtocolMessageType('AclEntry', (_message.Message,), {
'DESCRIPTOR' : _ACLENTRY,
'__module__' : 'acl_pb2'
# @@protoc_insertion_point(class_scope:acl.AclEntry)
})
_sym_db.RegisterMessage(AclEntry)
AclRuleSet = _reflection.GeneratedProtocolMessageType('AclRuleSet', (_message.Message,), {
'DESCRIPTOR' : _ACLRULESET,
'__module__' : 'acl_pb2'
# @@protoc_insertion_point(class_scope:acl.AclRuleSet)
})
_sym_db.RegisterMessage(AclRuleSet)
# @@protoc_insertion_point(module_scope)
This diff is collapsed.
This diff is collapsed.
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: context-policy.proto
"""Generated protocol buffer code."""
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 symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from . import context_pb2 as context__pb2
from . import policy_pb2 as policy__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='context-policy.proto',
package='context_policy',
syntax='proto3',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x14\x63ontext-policy.proto\x12\x0e\x63ontext_policy\x1a\rcontext.proto\x1a\x0cpolicy.proto2\xca\x02\n\x14\x43ontextPolicyService\x12?\n\x11ListPolicyRuleIds\x12\x0e.context.Empty\x1a\x18.policy.PolicyRuleIdList\"\x00\x12;\n\x0fListPolicyRules\x12\x0e.context.Empty\x1a\x16.policy.PolicyRuleList\"\x00\x12;\n\rGetPolicyRule\x12\x14.policy.PolicyRuleId\x1a\x12.policy.PolicyRule\"\x00\x12;\n\rSetPolicyRule\x12\x12.policy.PolicyRule\x1a\x14.policy.PolicyRuleId\"\x00\x12:\n\x10RemovePolicyRule\x12\x14.policy.PolicyRuleId\x1a\x0e.context.Empty\"\x00\x62\x06proto3'
,
dependencies=[context__pb2.DESCRIPTOR,policy__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_CONTEXTPOLICYSERVICE = _descriptor.ServiceDescriptor(
name='ContextPolicyService',
full_name='context_policy.ContextPolicyService',
file=DESCRIPTOR,
index=0,
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_start=70,
serialized_end=400,
methods=[
_descriptor.MethodDescriptor(
name='ListPolicyRuleIds',
full_name='context_policy.ContextPolicyService.ListPolicyRuleIds',
index=0,
containing_service=None,
input_type=context__pb2._EMPTY,
output_type=policy__pb2._POLICYRULEIDLIST,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='ListPolicyRules',
full_name='context_policy.ContextPolicyService.ListPolicyRules',
index=1,
containing_service=None,
input_type=context__pb2._EMPTY,
output_type=policy__pb2._POLICYRULELIST,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='GetPolicyRule',
full_name='context_policy.ContextPolicyService.GetPolicyRule',
index=2,
containing_service=None,
input_type=policy__pb2._POLICYRULEID,
output_type=policy__pb2._POLICYRULE,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='SetPolicyRule',
full_name='context_policy.ContextPolicyService.SetPolicyRule',
index=3,
containing_service=None,
input_type=policy__pb2._POLICYRULE,
output_type=policy__pb2._POLICYRULEID,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.MethodDescriptor(
name='RemovePolicyRule',
full_name='context_policy.ContextPolicyService.RemovePolicyRule',
index=4,
containing_service=None,
input_type=policy__pb2._POLICYRULEID,
output_type=context__pb2._EMPTY,
serialized_options=None,
create_key=_descriptor._internal_create_key,
),
])
_sym_db.RegisterServiceDescriptor(_CONTEXTPOLICYSERVICE)
DESCRIPTOR.services_by_name['ContextPolicyService'] = _CONTEXTPOLICYSERVICE
# @@protoc_insertion_point(module_scope)
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import context_pb2 as context__pb2
from . import policy_pb2 as policy__pb2
class ContextPolicyServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.ListPolicyRuleIds = channel.unary_unary(
'/context_policy.ContextPolicyService/ListPolicyRuleIds',
request_serializer=context__pb2.Empty.SerializeToString,
response_deserializer=policy__pb2.PolicyRuleIdList.FromString,
)
self.ListPolicyRules = channel.unary_unary(
'/context_policy.ContextPolicyService/ListPolicyRules',
request_serializer=context__pb2.Empty.SerializeToString,
response_deserializer=policy__pb2.PolicyRuleList.FromString,
)
self.GetPolicyRule = channel.unary_unary(
'/context_policy.ContextPolicyService/GetPolicyRule',
request_serializer=policy__pb2.PolicyRuleId.SerializeToString,
response_deserializer=policy__pb2.PolicyRule.FromString,
)
self.SetPolicyRule = channel.unary_unary(
'/context_policy.ContextPolicyService/SetPolicyRule',
request_serializer=policy__pb2.PolicyRule.SerializeToString,
response_deserializer=policy__pb2.PolicyRuleId.FromString,
)
self.RemovePolicyRule = channel.unary_unary(
'/context_policy.ContextPolicyService/RemovePolicyRule',
request_serializer=policy__pb2.PolicyRuleId.SerializeToString,
response_deserializer=context__pb2.Empty.FromString,
)
class ContextPolicyServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def ListPolicyRuleIds(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListPolicyRules(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def GetPolicyRule(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SetPolicyRule(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def RemovePolicyRule(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_ContextPolicyServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'ListPolicyRuleIds': grpc.unary_unary_rpc_method_handler(
servicer.ListPolicyRuleIds,
request_deserializer=context__pb2.Empty.FromString,
response_serializer=policy__pb2.PolicyRuleIdList.SerializeToString,
),
'ListPolicyRules': grpc.unary_unary_rpc_method_handler(
servicer.ListPolicyRules,
request_deserializer=context__pb2.Empty.FromString,
response_serializer=policy__pb2.PolicyRuleList.SerializeToString,
),
'GetPolicyRule': grpc.unary_unary_rpc_method_handler(
servicer.GetPolicyRule,
request_deserializer=policy__pb2.PolicyRuleId.FromString,
response_serializer=policy__pb2.PolicyRule.SerializeToString,
),
'SetPolicyRule': grpc.unary_unary_rpc_method_handler(
servicer.SetPolicyRule,
request_deserializer=policy__pb2.PolicyRule.FromString,
response_serializer=policy__pb2.PolicyRuleId.SerializeToString,
),
'RemovePolicyRule': grpc.unary_unary_rpc_method_handler(
servicer.RemovePolicyRule,
request_deserializer=policy__pb2.PolicyRuleId.FromString,
response_serializer=context__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'context_policy.ContextPolicyService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ContextPolicyService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def ListPolicyRuleIds(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/context_policy.ContextPolicyService/ListPolicyRuleIds',
context__pb2.Empty.SerializeToString,
policy__pb2.PolicyRuleIdList.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListPolicyRules(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/context_policy.ContextPolicyService/ListPolicyRules',
context__pb2.Empty.SerializeToString,
policy__pb2.PolicyRuleList.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetPolicyRule(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/context_policy.ContextPolicyService/GetPolicyRule',
policy__pb2.PolicyRuleId.SerializeToString,
policy__pb2.PolicyRule.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SetPolicyRule(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/context_policy.ContextPolicyService/SetPolicyRule',
policy__pb2.PolicyRule.SerializeToString,
policy__pb2.PolicyRuleId.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def RemovePolicyRule(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/context_policy.ContextPolicyService/RemovePolicyRule',
policy__pb2.PolicyRuleId.SerializeToString,
context__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
This diff is collapsed.
This diff is collapsed.
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
import copy import copy
from common.proto.context_pb2 import Connection, Context, Device, Link, Service, Topology
from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient
from context.proto.context_pb2 import Connection, Context, Device, Link, Service, Topology
from context.tests.Objects import ( from context.tests.Objects import (
CONNECTION_R1_R3, CONTEXT, TOPOLOGY, DEVICE_R1, DEVICE_R1_ID, DEVICE_R2, DEVICE_R2_ID, DEVICE_R3, DEVICE_R3_ID, CONNECTION_R1_R3, CONTEXT, TOPOLOGY, DEVICE_R1, DEVICE_R1_ID, DEVICE_R2, DEVICE_R2_ID, DEVICE_R3, DEVICE_R3_ID,
LINK_R1_R2, LINK_R1_R2_ID, LINK_R1_R3, LINK_R1_R3_ID, LINK_R2_R3, LINK_R2_R3_ID, SERVICE_R1_R2, SERVICE_R1_R3, LINK_R1_R2, LINK_R1_R2_ID, LINK_R1_R3, LINK_R1_R3_ID, LINK_R2_R3, LINK_R2_R3_ID, SERVICE_R1_R2, SERVICE_R1_R3,
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ from common.orm.fields.PrimaryKeyField import PrimaryKeyField ...@@ -22,7 +22,7 @@ from common.orm.fields.PrimaryKeyField import PrimaryKeyField
from common.orm.fields.StringField import StringField from common.orm.fields.StringField import StringField
from common.orm.model.Model import Model from common.orm.model.Model import Model
from common.orm.HighLevel import get_object, get_or_create_object, get_related_objects, update_or_create_object from common.orm.HighLevel import get_object, get_or_create_object, get_related_objects, update_or_create_object
from context.proto.context_pb2 import EndPointId from common.proto.context_pb2 import EndPointId
from .EndPointModel import EndPointModel from .EndPointModel import EndPointModel
from .ServiceModel import ServiceModel from .ServiceModel import ServiceModel
from .Tools import remove_dict_key from .Tools import remove_dict_key
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ from common.orm.fields.ForeignKeyField import ForeignKeyField ...@@ -22,7 +22,7 @@ from common.orm.fields.ForeignKeyField import ForeignKeyField
from common.orm.fields.PrimaryKeyField import PrimaryKeyField from common.orm.fields.PrimaryKeyField import PrimaryKeyField
from common.orm.fields.StringField import StringField from common.orm.fields.StringField import StringField
from common.orm.model.Model import Model from common.orm.model.Model import Model
from context.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum from common.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum
from .ConfigModel import ConfigModel from .ConfigModel import ConfigModel
from .Tools import grpc_to_enum from .Tools import grpc_to_enum
......
...@@ -16,12 +16,12 @@ import json, time ...@@ -16,12 +16,12 @@ import json, time
from typing import Dict from typing import Dict
from common.message_broker.Message import Message from common.message_broker.Message import Message
from common.message_broker.MessageBroker import MessageBroker from common.message_broker.MessageBroker import MessageBroker
from context.proto.context_pb2 import EventTypeEnum from common.proto.context_pb2 import EventTypeEnum
def notify_event( def notify_event(
messagebroker : MessageBroker, topic_name : str, event_type : EventTypeEnum, fields : Dict[str, str]) -> None: messagebroker : MessageBroker, topic_name : str, event_type : EventTypeEnum, fields : Dict[str, str]) -> None:
event = {'event': {'timestamp': time.time(), 'event_type': event_type}} event = {'event': {'timestamp': {'timestamp': time.time()}, 'event_type': event_type}}
for field_name, field_value in fields.items(): for field_name, field_value in fields.items():
event[field_name] = field_value event[field_name] = field_value
messagebroker.publish(Message(topic_name, json.dumps(event))) messagebroker.publish(Message(topic_name, json.dumps(event)))
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment