updates to support 2/3 along with not using vcmd c extension

This commit is contained in:
bharnden 2019-06-02 19:06:25 -07:00
parent 864c7b69a1
commit ecc63f4abb
22 changed files with 680 additions and 636 deletions

View file

@ -146,7 +146,7 @@ if test "x$enable_daemon" = "xyes"; then
CFLAGS_save=$CFLAGS
CPPFLAGS_save=$CPPFLAGS
if test "x$PYTHON_INCLUDE_DIR" = "x"; then
PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"`
PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())"`
fi
CFLAGS="-I$PYTHON_INCLUDE_DIR"
CPPFLAGS="-I$PYTHON_INCLUDE_DIR"

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import core_pb2 as core__pb2
from core.api.grpc import core_pb2 as core_dot_api_dot_grpc_dot_core__pb2
class CoreApiStub(object):
@ -16,238 +16,238 @@ class CoreApiStub(object):
"""
self.CreateSession = channel.unary_unary(
'/core.CoreApi/CreateSession',
request_serializer=core__pb2.CreateSessionRequest.SerializeToString,
response_deserializer=core__pb2.CreateSessionResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.CreateSessionRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.CreateSessionResponse.FromString,
)
self.DeleteSession = channel.unary_unary(
'/core.CoreApi/DeleteSession',
request_serializer=core__pb2.DeleteSessionRequest.SerializeToString,
response_deserializer=core__pb2.DeleteSessionResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteSessionRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteSessionResponse.FromString,
)
self.GetSessions = channel.unary_unary(
'/core.CoreApi/GetSessions',
request_serializer=core__pb2.GetSessionsRequest.SerializeToString,
response_deserializer=core__pb2.GetSessionsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionsResponse.FromString,
)
self.GetSession = channel.unary_unary(
'/core.CoreApi/GetSession',
request_serializer=core__pb2.GetSessionRequest.SerializeToString,
response_deserializer=core__pb2.GetSessionResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionResponse.FromString,
)
self.GetSessionOptions = channel.unary_unary(
'/core.CoreApi/GetSessionOptions',
request_serializer=core__pb2.GetSessionOptionsRequest.SerializeToString,
response_deserializer=core__pb2.GetSessionOptionsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionOptionsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionOptionsResponse.FromString,
)
self.SetSessionOptions = channel.unary_unary(
'/core.CoreApi/SetSessionOptions',
request_serializer=core__pb2.SetSessionOptionsRequest.SerializeToString,
response_deserializer=core__pb2.SetSessionOptionsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionOptionsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionOptionsResponse.FromString,
)
self.GetSessionLocation = channel.unary_unary(
'/core.CoreApi/GetSessionLocation',
request_serializer=core__pb2.GetSessionLocationRequest.SerializeToString,
response_deserializer=core__pb2.GetSessionLocationResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionLocationRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionLocationResponse.FromString,
)
self.SetSessionLocation = channel.unary_unary(
'/core.CoreApi/SetSessionLocation',
request_serializer=core__pb2.SetSessionLocationRequest.SerializeToString,
response_deserializer=core__pb2.SetSessionLocationResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionLocationRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionLocationResponse.FromString,
)
self.SetSessionState = channel.unary_unary(
'/core.CoreApi/SetSessionState',
request_serializer=core__pb2.SetSessionStateRequest.SerializeToString,
response_deserializer=core__pb2.SetSessionStateResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionStateRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionStateResponse.FromString,
)
self.NodeEvents = channel.unary_stream(
'/core.CoreApi/NodeEvents',
request_serializer=core__pb2.NodeEventsRequest.SerializeToString,
response_deserializer=core__pb2.NodeEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.NodeEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.NodeEvent.FromString,
)
self.LinkEvents = channel.unary_stream(
'/core.CoreApi/LinkEvents',
request_serializer=core__pb2.LinkEventsRequest.SerializeToString,
response_deserializer=core__pb2.LinkEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.LinkEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.LinkEvent.FromString,
)
self.SessionEvents = channel.unary_stream(
'/core.CoreApi/SessionEvents',
request_serializer=core__pb2.SessionEventsRequest.SerializeToString,
response_deserializer=core__pb2.SessionEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SessionEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SessionEvent.FromString,
)
self.ConfigEvents = channel.unary_stream(
'/core.CoreApi/ConfigEvents',
request_serializer=core__pb2.ConfigEventsRequest.SerializeToString,
response_deserializer=core__pb2.ConfigEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.ConfigEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ConfigEvent.FromString,
)
self.ExceptionEvents = channel.unary_stream(
'/core.CoreApi/ExceptionEvents',
request_serializer=core__pb2.ExceptionEventsRequest.SerializeToString,
response_deserializer=core__pb2.ExceptionEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.ExceptionEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ExceptionEvent.FromString,
)
self.FileEvents = channel.unary_stream(
'/core.CoreApi/FileEvents',
request_serializer=core__pb2.FileEventsRequest.SerializeToString,
response_deserializer=core__pb2.FileEvent.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.FileEventsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.FileEvent.FromString,
)
self.AddNode = channel.unary_unary(
'/core.CoreApi/AddNode',
request_serializer=core__pb2.AddNodeRequest.SerializeToString,
response_deserializer=core__pb2.AddNodeResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddNodeRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddNodeResponse.FromString,
)
self.GetNode = channel.unary_unary(
'/core.CoreApi/GetNode',
request_serializer=core__pb2.GetNodeRequest.SerializeToString,
response_deserializer=core__pb2.GetNodeResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeResponse.FromString,
)
self.EditNode = channel.unary_unary(
'/core.CoreApi/EditNode',
request_serializer=core__pb2.EditNodeRequest.SerializeToString,
response_deserializer=core__pb2.EditNodeResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.EditNodeRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.EditNodeResponse.FromString,
)
self.DeleteNode = channel.unary_unary(
'/core.CoreApi/DeleteNode',
request_serializer=core__pb2.DeleteNodeRequest.SerializeToString,
response_deserializer=core__pb2.DeleteNodeResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteNodeRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteNodeResponse.FromString,
)
self.GetNodeLinks = channel.unary_unary(
'/core.CoreApi/GetNodeLinks',
request_serializer=core__pb2.GetNodeLinksRequest.SerializeToString,
response_deserializer=core__pb2.GetNodeLinksResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeLinksRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeLinksResponse.FromString,
)
self.AddLink = channel.unary_unary(
'/core.CoreApi/AddLink',
request_serializer=core__pb2.AddLinkRequest.SerializeToString,
response_deserializer=core__pb2.AddLinkResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddLinkRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddLinkResponse.FromString,
)
self.EditLink = channel.unary_unary(
'/core.CoreApi/EditLink',
request_serializer=core__pb2.EditLinkRequest.SerializeToString,
response_deserializer=core__pb2.EditLinkResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.EditLinkRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.EditLinkResponse.FromString,
)
self.DeleteLink = channel.unary_unary(
'/core.CoreApi/DeleteLink',
request_serializer=core__pb2.DeleteLinkRequest.SerializeToString,
response_deserializer=core__pb2.DeleteLinkResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteLinkRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteLinkResponse.FromString,
)
self.GetHooks = channel.unary_unary(
'/core.CoreApi/GetHooks',
request_serializer=core__pb2.GetHooksRequest.SerializeToString,
response_deserializer=core__pb2.GetHooksResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetHooksRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetHooksResponse.FromString,
)
self.AddHook = channel.unary_unary(
'/core.CoreApi/AddHook',
request_serializer=core__pb2.AddHookRequest.SerializeToString,
response_deserializer=core__pb2.AddHookResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddHookRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddHookResponse.FromString,
)
self.GetMobilityConfigs = channel.unary_unary(
'/core.CoreApi/GetMobilityConfigs',
request_serializer=core__pb2.GetMobilityConfigsRequest.SerializeToString,
response_deserializer=core__pb2.GetMobilityConfigsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigsResponse.FromString,
)
self.GetMobilityConfig = channel.unary_unary(
'/core.CoreApi/GetMobilityConfig',
request_serializer=core__pb2.GetMobilityConfigRequest.SerializeToString,
response_deserializer=core__pb2.GetMobilityConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigResponse.FromString,
)
self.SetMobilityConfig = channel.unary_unary(
'/core.CoreApi/SetMobilityConfig',
request_serializer=core__pb2.SetMobilityConfigRequest.SerializeToString,
response_deserializer=core__pb2.SetMobilityConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetMobilityConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetMobilityConfigResponse.FromString,
)
self.MobilityAction = channel.unary_unary(
'/core.CoreApi/MobilityAction',
request_serializer=core__pb2.MobilityActionRequest.SerializeToString,
response_deserializer=core__pb2.MobilityActionResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.MobilityActionRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.MobilityActionResponse.FromString,
)
self.GetServices = channel.unary_unary(
'/core.CoreApi/GetServices',
request_serializer=core__pb2.GetServicesRequest.SerializeToString,
response_deserializer=core__pb2.GetServicesResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetServicesRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetServicesResponse.FromString,
)
self.GetServiceDefaults = channel.unary_unary(
'/core.CoreApi/GetServiceDefaults',
request_serializer=core__pb2.GetServiceDefaultsRequest.SerializeToString,
response_deserializer=core__pb2.GetServiceDefaultsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetServiceDefaultsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetServiceDefaultsResponse.FromString,
)
self.SetServiceDefaults = channel.unary_unary(
'/core.CoreApi/SetServiceDefaults',
request_serializer=core__pb2.SetServiceDefaultsRequest.SerializeToString,
response_deserializer=core__pb2.SetServiceDefaultsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetServiceDefaultsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetServiceDefaultsResponse.FromString,
)
self.GetNodeService = channel.unary_unary(
'/core.CoreApi/GetNodeService',
request_serializer=core__pb2.GetNodeServiceRequest.SerializeToString,
response_deserializer=core__pb2.GetNodeServiceResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceResponse.FromString,
)
self.GetNodeServiceFile = channel.unary_unary(
'/core.CoreApi/GetNodeServiceFile',
request_serializer=core__pb2.GetNodeServiceFileRequest.SerializeToString,
response_deserializer=core__pb2.GetNodeServiceFileResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceFileRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceFileResponse.FromString,
)
self.SetNodeService = channel.unary_unary(
'/core.CoreApi/SetNodeService',
request_serializer=core__pb2.SetNodeServiceRequest.SerializeToString,
response_deserializer=core__pb2.SetNodeServiceResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceResponse.FromString,
)
self.SetNodeServiceFile = channel.unary_unary(
'/core.CoreApi/SetNodeServiceFile',
request_serializer=core__pb2.SetNodeServiceFileRequest.SerializeToString,
response_deserializer=core__pb2.SetNodeServiceFileResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceFileRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceFileResponse.FromString,
)
self.ServiceAction = channel.unary_unary(
'/core.CoreApi/ServiceAction',
request_serializer=core__pb2.ServiceActionRequest.SerializeToString,
response_deserializer=core__pb2.ServiceActionResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.ServiceActionRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ServiceActionResponse.FromString,
)
self.GetWlanConfig = channel.unary_unary(
'/core.CoreApi/GetWlanConfig',
request_serializer=core__pb2.GetWlanConfigRequest.SerializeToString,
response_deserializer=core__pb2.GetWlanConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetWlanConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetWlanConfigResponse.FromString,
)
self.SetWlanConfig = channel.unary_unary(
'/core.CoreApi/SetWlanConfig',
request_serializer=core__pb2.SetWlanConfigRequest.SerializeToString,
response_deserializer=core__pb2.SetWlanConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetWlanConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetWlanConfigResponse.FromString,
)
self.GetEmaneConfig = channel.unary_unary(
'/core.CoreApi/GetEmaneConfig',
request_serializer=core__pb2.GetEmaneConfigRequest.SerializeToString,
response_deserializer=core__pb2.GetEmaneConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneConfigResponse.FromString,
)
self.SetEmaneConfig = channel.unary_unary(
'/core.CoreApi/SetEmaneConfig',
request_serializer=core__pb2.SetEmaneConfigRequest.SerializeToString,
response_deserializer=core__pb2.SetEmaneConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneConfigResponse.FromString,
)
self.GetEmaneModels = channel.unary_unary(
'/core.CoreApi/GetEmaneModels',
request_serializer=core__pb2.GetEmaneModelsRequest.SerializeToString,
response_deserializer=core__pb2.GetEmaneModelsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelsResponse.FromString,
)
self.GetEmaneModelConfig = channel.unary_unary(
'/core.CoreApi/GetEmaneModelConfig',
request_serializer=core__pb2.GetEmaneModelConfigRequest.SerializeToString,
response_deserializer=core__pb2.GetEmaneModelConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigResponse.FromString,
)
self.SetEmaneModelConfig = channel.unary_unary(
'/core.CoreApi/SetEmaneModelConfig',
request_serializer=core__pb2.SetEmaneModelConfigRequest.SerializeToString,
response_deserializer=core__pb2.SetEmaneModelConfigResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneModelConfigRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneModelConfigResponse.FromString,
)
self.GetEmaneModelConfigs = channel.unary_unary(
'/core.CoreApi/GetEmaneModelConfigs',
request_serializer=core__pb2.GetEmaneModelConfigsRequest.SerializeToString,
response_deserializer=core__pb2.GetEmaneModelConfigsResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigsRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigsResponse.FromString,
)
self.SaveXml = channel.unary_unary(
'/core.CoreApi/SaveXml',
request_serializer=core__pb2.SaveXmlRequest.SerializeToString,
response_deserializer=core__pb2.SaveXmlResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.SaveXmlRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SaveXmlResponse.FromString,
)
self.OpenXml = channel.unary_unary(
'/core.CoreApi/OpenXml',
request_serializer=core__pb2.OpenXmlRequest.SerializeToString,
response_deserializer=core__pb2.OpenXmlResponse.FromString,
request_serializer=core_dot_api_dot_grpc_dot_core__pb2.OpenXmlRequest.SerializeToString,
response_deserializer=core_dot_api_dot_grpc_dot_core__pb2.OpenXmlResponse.FromString,
)
@ -589,238 +589,238 @@ def add_CoreApiServicer_to_server(servicer, server):
rpc_method_handlers = {
'CreateSession': grpc.unary_unary_rpc_method_handler(
servicer.CreateSession,
request_deserializer=core__pb2.CreateSessionRequest.FromString,
response_serializer=core__pb2.CreateSessionResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.CreateSessionRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.CreateSessionResponse.SerializeToString,
),
'DeleteSession': grpc.unary_unary_rpc_method_handler(
servicer.DeleteSession,
request_deserializer=core__pb2.DeleteSessionRequest.FromString,
response_serializer=core__pb2.DeleteSessionResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteSessionRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteSessionResponse.SerializeToString,
),
'GetSessions': grpc.unary_unary_rpc_method_handler(
servicer.GetSessions,
request_deserializer=core__pb2.GetSessionsRequest.FromString,
response_serializer=core__pb2.GetSessionsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionsResponse.SerializeToString,
),
'GetSession': grpc.unary_unary_rpc_method_handler(
servicer.GetSession,
request_deserializer=core__pb2.GetSessionRequest.FromString,
response_serializer=core__pb2.GetSessionResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionResponse.SerializeToString,
),
'GetSessionOptions': grpc.unary_unary_rpc_method_handler(
servicer.GetSessionOptions,
request_deserializer=core__pb2.GetSessionOptionsRequest.FromString,
response_serializer=core__pb2.GetSessionOptionsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionOptionsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionOptionsResponse.SerializeToString,
),
'SetSessionOptions': grpc.unary_unary_rpc_method_handler(
servicer.SetSessionOptions,
request_deserializer=core__pb2.SetSessionOptionsRequest.FromString,
response_serializer=core__pb2.SetSessionOptionsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionOptionsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionOptionsResponse.SerializeToString,
),
'GetSessionLocation': grpc.unary_unary_rpc_method_handler(
servicer.GetSessionLocation,
request_deserializer=core__pb2.GetSessionLocationRequest.FromString,
response_serializer=core__pb2.GetSessionLocationResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionLocationRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetSessionLocationResponse.SerializeToString,
),
'SetSessionLocation': grpc.unary_unary_rpc_method_handler(
servicer.SetSessionLocation,
request_deserializer=core__pb2.SetSessionLocationRequest.FromString,
response_serializer=core__pb2.SetSessionLocationResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionLocationRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionLocationResponse.SerializeToString,
),
'SetSessionState': grpc.unary_unary_rpc_method_handler(
servicer.SetSessionState,
request_deserializer=core__pb2.SetSessionStateRequest.FromString,
response_serializer=core__pb2.SetSessionStateResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionStateRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetSessionStateResponse.SerializeToString,
),
'NodeEvents': grpc.unary_stream_rpc_method_handler(
servicer.NodeEvents,
request_deserializer=core__pb2.NodeEventsRequest.FromString,
response_serializer=core__pb2.NodeEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.NodeEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.NodeEvent.SerializeToString,
),
'LinkEvents': grpc.unary_stream_rpc_method_handler(
servicer.LinkEvents,
request_deserializer=core__pb2.LinkEventsRequest.FromString,
response_serializer=core__pb2.LinkEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.LinkEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.LinkEvent.SerializeToString,
),
'SessionEvents': grpc.unary_stream_rpc_method_handler(
servicer.SessionEvents,
request_deserializer=core__pb2.SessionEventsRequest.FromString,
response_serializer=core__pb2.SessionEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SessionEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SessionEvent.SerializeToString,
),
'ConfigEvents': grpc.unary_stream_rpc_method_handler(
servicer.ConfigEvents,
request_deserializer=core__pb2.ConfigEventsRequest.FromString,
response_serializer=core__pb2.ConfigEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ConfigEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.ConfigEvent.SerializeToString,
),
'ExceptionEvents': grpc.unary_stream_rpc_method_handler(
servicer.ExceptionEvents,
request_deserializer=core__pb2.ExceptionEventsRequest.FromString,
response_serializer=core__pb2.ExceptionEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ExceptionEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.ExceptionEvent.SerializeToString,
),
'FileEvents': grpc.unary_stream_rpc_method_handler(
servicer.FileEvents,
request_deserializer=core__pb2.FileEventsRequest.FromString,
response_serializer=core__pb2.FileEvent.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.FileEventsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.FileEvent.SerializeToString,
),
'AddNode': grpc.unary_unary_rpc_method_handler(
servicer.AddNode,
request_deserializer=core__pb2.AddNodeRequest.FromString,
response_serializer=core__pb2.AddNodeResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddNodeRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddNodeResponse.SerializeToString,
),
'GetNode': grpc.unary_unary_rpc_method_handler(
servicer.GetNode,
request_deserializer=core__pb2.GetNodeRequest.FromString,
response_serializer=core__pb2.GetNodeResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeResponse.SerializeToString,
),
'EditNode': grpc.unary_unary_rpc_method_handler(
servicer.EditNode,
request_deserializer=core__pb2.EditNodeRequest.FromString,
response_serializer=core__pb2.EditNodeResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.EditNodeRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.EditNodeResponse.SerializeToString,
),
'DeleteNode': grpc.unary_unary_rpc_method_handler(
servicer.DeleteNode,
request_deserializer=core__pb2.DeleteNodeRequest.FromString,
response_serializer=core__pb2.DeleteNodeResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteNodeRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteNodeResponse.SerializeToString,
),
'GetNodeLinks': grpc.unary_unary_rpc_method_handler(
servicer.GetNodeLinks,
request_deserializer=core__pb2.GetNodeLinksRequest.FromString,
response_serializer=core__pb2.GetNodeLinksResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeLinksRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeLinksResponse.SerializeToString,
),
'AddLink': grpc.unary_unary_rpc_method_handler(
servicer.AddLink,
request_deserializer=core__pb2.AddLinkRequest.FromString,
response_serializer=core__pb2.AddLinkResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddLinkRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddLinkResponse.SerializeToString,
),
'EditLink': grpc.unary_unary_rpc_method_handler(
servicer.EditLink,
request_deserializer=core__pb2.EditLinkRequest.FromString,
response_serializer=core__pb2.EditLinkResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.EditLinkRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.EditLinkResponse.SerializeToString,
),
'DeleteLink': grpc.unary_unary_rpc_method_handler(
servicer.DeleteLink,
request_deserializer=core__pb2.DeleteLinkRequest.FromString,
response_serializer=core__pb2.DeleteLinkResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteLinkRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.DeleteLinkResponse.SerializeToString,
),
'GetHooks': grpc.unary_unary_rpc_method_handler(
servicer.GetHooks,
request_deserializer=core__pb2.GetHooksRequest.FromString,
response_serializer=core__pb2.GetHooksResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetHooksRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetHooksResponse.SerializeToString,
),
'AddHook': grpc.unary_unary_rpc_method_handler(
servicer.AddHook,
request_deserializer=core__pb2.AddHookRequest.FromString,
response_serializer=core__pb2.AddHookResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.AddHookRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.AddHookResponse.SerializeToString,
),
'GetMobilityConfigs': grpc.unary_unary_rpc_method_handler(
servicer.GetMobilityConfigs,
request_deserializer=core__pb2.GetMobilityConfigsRequest.FromString,
response_serializer=core__pb2.GetMobilityConfigsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigsResponse.SerializeToString,
),
'GetMobilityConfig': grpc.unary_unary_rpc_method_handler(
servicer.GetMobilityConfig,
request_deserializer=core__pb2.GetMobilityConfigRequest.FromString,
response_serializer=core__pb2.GetMobilityConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetMobilityConfigResponse.SerializeToString,
),
'SetMobilityConfig': grpc.unary_unary_rpc_method_handler(
servicer.SetMobilityConfig,
request_deserializer=core__pb2.SetMobilityConfigRequest.FromString,
response_serializer=core__pb2.SetMobilityConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetMobilityConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetMobilityConfigResponse.SerializeToString,
),
'MobilityAction': grpc.unary_unary_rpc_method_handler(
servicer.MobilityAction,
request_deserializer=core__pb2.MobilityActionRequest.FromString,
response_serializer=core__pb2.MobilityActionResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.MobilityActionRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.MobilityActionResponse.SerializeToString,
),
'GetServices': grpc.unary_unary_rpc_method_handler(
servicer.GetServices,
request_deserializer=core__pb2.GetServicesRequest.FromString,
response_serializer=core__pb2.GetServicesResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetServicesRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetServicesResponse.SerializeToString,
),
'GetServiceDefaults': grpc.unary_unary_rpc_method_handler(
servicer.GetServiceDefaults,
request_deserializer=core__pb2.GetServiceDefaultsRequest.FromString,
response_serializer=core__pb2.GetServiceDefaultsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetServiceDefaultsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetServiceDefaultsResponse.SerializeToString,
),
'SetServiceDefaults': grpc.unary_unary_rpc_method_handler(
servicer.SetServiceDefaults,
request_deserializer=core__pb2.SetServiceDefaultsRequest.FromString,
response_serializer=core__pb2.SetServiceDefaultsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetServiceDefaultsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetServiceDefaultsResponse.SerializeToString,
),
'GetNodeService': grpc.unary_unary_rpc_method_handler(
servicer.GetNodeService,
request_deserializer=core__pb2.GetNodeServiceRequest.FromString,
response_serializer=core__pb2.GetNodeServiceResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceResponse.SerializeToString,
),
'GetNodeServiceFile': grpc.unary_unary_rpc_method_handler(
servicer.GetNodeServiceFile,
request_deserializer=core__pb2.GetNodeServiceFileRequest.FromString,
response_serializer=core__pb2.GetNodeServiceFileResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceFileRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetNodeServiceFileResponse.SerializeToString,
),
'SetNodeService': grpc.unary_unary_rpc_method_handler(
servicer.SetNodeService,
request_deserializer=core__pb2.SetNodeServiceRequest.FromString,
response_serializer=core__pb2.SetNodeServiceResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceResponse.SerializeToString,
),
'SetNodeServiceFile': grpc.unary_unary_rpc_method_handler(
servicer.SetNodeServiceFile,
request_deserializer=core__pb2.SetNodeServiceFileRequest.FromString,
response_serializer=core__pb2.SetNodeServiceFileResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceFileRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetNodeServiceFileResponse.SerializeToString,
),
'ServiceAction': grpc.unary_unary_rpc_method_handler(
servicer.ServiceAction,
request_deserializer=core__pb2.ServiceActionRequest.FromString,
response_serializer=core__pb2.ServiceActionResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.ServiceActionRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.ServiceActionResponse.SerializeToString,
),
'GetWlanConfig': grpc.unary_unary_rpc_method_handler(
servicer.GetWlanConfig,
request_deserializer=core__pb2.GetWlanConfigRequest.FromString,
response_serializer=core__pb2.GetWlanConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetWlanConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetWlanConfigResponse.SerializeToString,
),
'SetWlanConfig': grpc.unary_unary_rpc_method_handler(
servicer.SetWlanConfig,
request_deserializer=core__pb2.SetWlanConfigRequest.FromString,
response_serializer=core__pb2.SetWlanConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetWlanConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetWlanConfigResponse.SerializeToString,
),
'GetEmaneConfig': grpc.unary_unary_rpc_method_handler(
servicer.GetEmaneConfig,
request_deserializer=core__pb2.GetEmaneConfigRequest.FromString,
response_serializer=core__pb2.GetEmaneConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneConfigResponse.SerializeToString,
),
'SetEmaneConfig': grpc.unary_unary_rpc_method_handler(
servicer.SetEmaneConfig,
request_deserializer=core__pb2.SetEmaneConfigRequest.FromString,
response_serializer=core__pb2.SetEmaneConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneConfigResponse.SerializeToString,
),
'GetEmaneModels': grpc.unary_unary_rpc_method_handler(
servicer.GetEmaneModels,
request_deserializer=core__pb2.GetEmaneModelsRequest.FromString,
response_serializer=core__pb2.GetEmaneModelsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelsResponse.SerializeToString,
),
'GetEmaneModelConfig': grpc.unary_unary_rpc_method_handler(
servicer.GetEmaneModelConfig,
request_deserializer=core__pb2.GetEmaneModelConfigRequest.FromString,
response_serializer=core__pb2.GetEmaneModelConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigResponse.SerializeToString,
),
'SetEmaneModelConfig': grpc.unary_unary_rpc_method_handler(
servicer.SetEmaneModelConfig,
request_deserializer=core__pb2.SetEmaneModelConfigRequest.FromString,
response_serializer=core__pb2.SetEmaneModelConfigResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneModelConfigRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SetEmaneModelConfigResponse.SerializeToString,
),
'GetEmaneModelConfigs': grpc.unary_unary_rpc_method_handler(
servicer.GetEmaneModelConfigs,
request_deserializer=core__pb2.GetEmaneModelConfigsRequest.FromString,
response_serializer=core__pb2.GetEmaneModelConfigsResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigsRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.GetEmaneModelConfigsResponse.SerializeToString,
),
'SaveXml': grpc.unary_unary_rpc_method_handler(
servicer.SaveXml,
request_deserializer=core__pb2.SaveXmlRequest.FromString,
response_serializer=core__pb2.SaveXmlResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.SaveXmlRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.SaveXmlResponse.SerializeToString,
),
'OpenXml': grpc.unary_unary_rpc_method_handler(
servicer.OpenXml,
request_deserializer=core__pb2.OpenXmlRequest.FromString,
response_serializer=core__pb2.OpenXmlResponse.SerializeToString,
request_deserializer=core_dot_api_dot_grpc_dot_core__pb2.OpenXmlRequest.FromString,
response_serializer=core_dot_api_dot_grpc_dot_core__pb2.OpenXmlResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(

View file

@ -692,7 +692,7 @@ class CoreBroker(object):
# send a Configuration message for the broker object and inform the
# server of its local name
tlvdata = ""
tlvdata = b""
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.OBJECT.value, "broker")
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.TYPE.value, ConfigFlags.UPDATE.value)
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.DATA_TYPES.value, (ConfigDataTypes.STRING.value,))
@ -722,7 +722,7 @@ class CoreBroker(object):
cmd = msg.get_tlv(ExecuteTlvs.COMMAND.value)
res = msg.get_tlv(ExecuteTlvs.RESULT.value)
tlvdata = ""
tlvdata = b""
tlvdata += coreapi.CoreExecuteTlv.pack(ExecuteTlvs.NODE.value, nodenum)
tlvdata += coreapi.CoreExecuteTlv.pack(ExecuteTlvs.NUMBER.value, execnum)
tlvdata += coreapi.CoreExecuteTlv.pack(ExecuteTlvs.COMMAND.value, cmd)
@ -1029,7 +1029,7 @@ class CoreBroker(object):
server.instantiation_complete = True
# broadcast out instantiate complete
tlvdata = ""
tlvdata = b""
tlvdata += coreapi.CoreEventTlv.pack(EventTlvs.TYPE.value, EventTypes.INSTANTIATION_COMPLETE.value)
message = coreapi.CoreEventMessage.pack(0, tlvdata)
for session_client in self.session_clients:

View file

@ -157,7 +157,7 @@ class CoreTlvDataUint64(CoreTlvData):
Helper class for packing uint64 data.
"""
data_format = "!2xQ"
data_type = long
data_type = int
pad_len = 2
@ -178,6 +178,7 @@ class CoreTlvDataString(CoreTlvData):
"""
if not isinstance(value, str):
raise ValueError("value not a string: %s" % value)
value = value.encode("utf-8")
if len(value) < 256:
header_len = CoreTlv.header_len
@ -185,7 +186,7 @@ class CoreTlvDataString(CoreTlvData):
header_len = CoreTlv.long_header_len
pad_len = -(header_len + len(value)) % 4
return len(value), value + "\0" * pad_len
return len(value), value + b"\0" * pad_len
@classmethod
def unpack(cls, data):
@ -195,7 +196,7 @@ class CoreTlvDataString(CoreTlvData):
:param str data: unpack string data
:return: unpacked string data
"""
return data.rstrip("\0")
return data.rstrip(b"\0").decode("utf-8")
class CoreTlvDataUint16List(CoreTlvData):
@ -266,7 +267,7 @@ class CoreTlvDataIpv4Addr(CoreTlvDataObj):
return obj.addr
@staticmethod
def new_obj(obj):
def new_obj(value):
"""
Retrieve Ipv4 address from a string representation.
@ -274,7 +275,9 @@ class CoreTlvDataIpv4Addr(CoreTlvDataObj):
:return: Ipv4 address
:rtype: core.misc.ipaddress.IpAddress
"""
return IpAddress(af=socket.AF_INET, address=obj)
# value = value.decode("ISO-8859-1")
# value = socket.inet_ntoa(value)
return IpAddress(af=socket.AF_INET, address=value)
class CoreTlvDataIPv6Addr(CoreTlvDataObj):
@ -304,6 +307,8 @@ class CoreTlvDataIPv6Addr(CoreTlvDataObj):
:return: Ipv4 address
:rtype: core.misc.ipaddress.IpAddress
"""
# value = value.decode("ISO-8859-1")
# value = socket.inet_ntoa(value)
return IpAddress(af=socket.AF_INET6, address=value)
@ -336,6 +341,8 @@ class CoreTlvDataMacAddr(CoreTlvDataObj):
:rtype: core.misc.ipaddress.MacAddress
"""
# only use 48 bits
# value = value.decode("ISO-8859-1")
# value = socket.inet_ntoa(value)
return MacAddress(address=value[2:])
@ -397,12 +404,10 @@ class CoreTlv(object):
:return: header and packed data
"""
tlv_len, tlv_data = cls.tlv_data_class_map[tlv_type].pack(value)
if tlv_len < 256:
hdr = struct.pack(cls.header_format, tlv_type, tlv_len)
else:
hdr = struct.pack(cls.long_header_format, tlv_type, 0, tlv_len)
return hdr + tlv_data
@classmethod

View file

@ -190,7 +190,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
thumbs = "|".join(thumb_list)
if num_sessions > 0:
tlv_data = ""
tlv_data = b""
if len(session_ids) > 0:
tlv_data += coreapi.CoreSessionTlv.pack(SessionTlvs.NUMBER.value, session_ids)
if len(names) > 0:
@ -224,7 +224,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
(EventTlvs.NAME, event_data.name),
(EventTlvs.DATA, event_data.data),
(EventTlvs.TIME, event_data.time),
(EventTlvs.TIME, event_data.session)
(EventTlvs.SESSION, event_data.session)
])
message = coreapi.CoreEventMessage.pack(0, tlv_data)
@ -373,7 +373,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
"""
logging.info("GUI has connected to session %d at %s", self.session.id, time.ctime())
tlv_data = ""
tlv_data = b""
tlv_data += coreapi.CoreRegisterTlv.pack(RegisterTlvs.EXECUTE_SERVER.value, "core-daemon")
tlv_data += coreapi.CoreRegisterTlv.pack(RegisterTlvs.EMULATION_SERVER.value, "core-daemon")
tlv_data += coreapi.CoreRegisterTlv.pack(self.session.broker.config_type, self.session.broker.name)
@ -424,7 +424,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
if message_len == 0:
logging.warn("received message with no data")
data = ""
data = b""
while len(data) < message_len:
data += self.request.recv(message_len - len(data))
if len(data) > message_len:
@ -504,7 +504,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
:param message: message for replies
:return: nothing
"""
logging.debug("dispatching replies")
logging.debug("dispatching replies: %s", replies)
for reply in replies:
message_type, message_flags, message_length = coreapi.CoreMessage.unpack_header(reply)
try:
@ -682,7 +682,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
# if we deleted a node broadcast out its removal
if result and message.flags & MessageFlags.STRING.value:
tlvdata = ""
tlvdata = b""
tlvdata += coreapi.CoreNodeTlv.pack(NodeTlvs.NUMBER.value, node_id)
flags = MessageFlags.DELETE.value | MessageFlags.LOCAL.value
replies.append(coreapi.CoreNodeMessage.pack(flags, tlvdata))
@ -779,7 +779,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
node = self.session.get_node(node_num)
# build common TLV items for reply
tlv_data = ""
tlv_data = b""
if node_num is not None:
tlv_data += coreapi.CoreExecuteTlv.pack(ExecuteTlvs.NODE.value, node_num)
tlv_data += coreapi.CoreExecuteTlv.pack(ExecuteTlvs.NUMBER.value, execute_num)
@ -1667,7 +1667,7 @@ class CoreHandler(socketserver.BaseRequestHandler):
:return: nothing
"""
if node_id in self.node_status_request:
tlv_data = ""
tlv_data = b""
tlv_data += coreapi.CoreNodeTlv.pack(NodeTlvs.NUMBER.value, node_id)
tlv_data += coreapi.CoreNodeTlv.pack(NodeTlvs.EMULATION_ID.value, node_id)
reply = coreapi.CoreNodeMessage.pack(MessageFlags.ADD.value | MessageFlags.LOCAL.value, tlv_data)

View file

@ -15,7 +15,8 @@ def pack_values(clazz, packers):
"""
# iterate through tuples of values to pack
data = ""
logging.debug("packing: %s", packers)
data = b""
for packer in packers:
# check if a transformer was provided for valid values
transformer = None
@ -26,10 +27,6 @@ def pack_values(clazz, packers):
else:
raise RuntimeError("packer had more than 3 arguments")
# convert unicode to normal str for packing
if isinstance(value, unicode):
value = str(value)
# only pack actual values and avoid packing empty strings
# protobuf defaults to empty strings and does no imply a value to set
if value is None or (isinstance(value, str) and not value):

View file

@ -497,7 +497,7 @@ class EmaneManager(ModelManager):
logging.info("Setting up default controlnet prefixes for distributed (%d configured)" % len(prefixes))
prefixes = ctrlnet.DEFAULT_PREFIX_LIST[0]
vals = 'controlnet="%s"' % prefixes
tlvdata = ""
tlvdata = b""
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.OBJECT.value, "session")
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.TYPE.value, 0)
tlvdata += coreapi.CoreConfigTlv.pack(ConfigTlvs.VALUES.value, vals)

View file

@ -1509,6 +1509,7 @@ class Session(object):
assign_address = self.master
prefix = prefixes[0]
logging.info("controlnet prefix: %s - %s", type(prefix), prefix)
control_net_class = nodeutils.get_node_class(NodeTypes.CONTROL_NET)
control_net = self.create_node(cls=control_net_class, _id=_id, prefix=prefix,
assign_address=assign_address,

View file

@ -5,6 +5,7 @@ event.py: event loop implementation using a heap queue and threads.
import heapq
import threading
import time
from past.builtins import cmp
class Timer(threading.Thread):

View file

@ -9,6 +9,7 @@ import os
import threading
import time
from builtins import int
from past.builtins import cmp
from core import utils
from core.config import ConfigGroup

View file

@ -687,7 +687,8 @@ class CoreNode(CoreNodeBase):
output = output.split("\n")
veth.flow_id = int(output[0].strip().split(":")[0]) + 1
logging.debug("interface flow index: %s - %s", veth.name, veth.flow_id)
veth.hwaddr = MacAddress.from_string(output[1].strip().split()[1])
# TODO: mimic packed hwaddr
# veth.hwaddr = MacAddress.from_string(output[1].strip().split()[1])
logging.debug("interface mac: %s - %s", veth.name, veth.hwaddr)
try:
@ -1062,11 +1063,13 @@ class CoreNetworkBase(NodeBase):
if ipaddress.is_ipv4_address(ip):
family = AF_INET
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface2_ip4 = ipaddress.IpAddress(af=family, address=ipl)
interface2_ip4_mask = mask
else:
family = AF_INET6
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface2_ip6 = ipaddress.IpAddress(af=family, address=ipl)
interface2_ip6_mask = mask

View file

@ -8,7 +8,7 @@ by invoking the vcmd shell command.
import logging
import os
import vcmd
from subprocess import Popen, PIPE
from core import CoreCommandError, utils
from core import constants
@ -28,7 +28,6 @@ class VnodeClient(object):
"""
self.name = name
self.ctrlchnlname = ctrlchnlname
self.cmdchnl = vcmd.VCmd(self.ctrlchnlname)
self._addr = {}
def _verify_connection(self):
@ -48,7 +47,7 @@ class VnodeClient(object):
:return: True if connected, False otherwise
:rtype: bool
"""
return self.cmdchnl.connected()
return True
def close(self):
"""
@ -56,7 +55,10 @@ class VnodeClient(object):
:return: nothing
"""
self.cmdchnl.close()
pass
def _cmd_args(self):
return [constants.VCMD_BIN, "-c", self.ctrlchnlname, "--"]
def cmd(self, args, wait=True):
"""
@ -71,7 +73,9 @@ class VnodeClient(object):
args = utils.split_args(args)
# run command, return process when not waiting
p = self.cmdchnl.qcmd(args)
cmd = self._cmd_args() + args
logging.info("cmd wait(%s): %s", wait, cmd)
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
if not wait:
return 0
@ -94,7 +98,7 @@ class VnodeClient(object):
stdout.close()
stderr.close()
status = p.wait()
return status, output.strip()
return status, output.decode("utf-8").strip()
def check_cmd(self, args):
"""
@ -120,7 +124,12 @@ class VnodeClient(object):
"""
self._verify_connection()
args = utils.split_args(args)
return self.cmdchnl.popen(args)
# if isinstance(args, list):
# args = " ".join(args)
cmd = self._cmd_args() + args
logging.info("popen: %s", cmd)
p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE)
return p, p.stdin, p.stdout, p.stderr
def icmd(self, args):
"""
@ -150,7 +159,10 @@ class VnodeClient(object):
# run command, return process when not waiting
args = utils.split_args(args)
p = self.cmdchnl.redircmd(infd, outfd, errfd, args)
cmd = self._cmd_args() + args
logging.info("redircmd: %s", cmd)
p = Popen(cmd, stdin=infd, stdout=outfd, stderr=errfd)
if not wait:
return p

View file

@ -31,7 +31,7 @@ class CoreInterface(object):
self.node = node
self.name = name
if not isinstance(mtu, (int, long)):
if not isinstance(mtu, int):
raise ValueError
self.mtu = mtu
self.net = None
@ -142,7 +142,7 @@ class CoreInterface(object):
"""
# treat None and 0 as unchanged values
current_value = self._params.get(key)
if current_value == value or current_value <= 0 and value <= 0:
if current_value is None or current_value == value or current_value <= 0 and value <= 0:
return False
self._params[key] = value
@ -174,6 +174,16 @@ class CoreInterface(object):
"""
self.poshook(self, x, y, z)
def __lt__(self, other):
"""
Used for comparisons of this object.
:param other: other interface
:return: true if less than, false otherwise
:rtype: bool
"""
return id(self) < id(other)
class Veth(CoreInterface):
"""

View file

@ -31,7 +31,9 @@ class MacAddress(object):
:return: string representation
:rtype: str
"""
return ":".join("%02x" % ord(x) for x in self.addr)
logging.info("mac addr: %s", type(self.addr))
addr = self.addr.decode("ISO-8859-1")
return ":".join("%02x" % ord(x) for x in addr)
def to_link_local(self):
"""
@ -93,7 +95,9 @@ class IpAddress(object):
:return:
"""
# check if (af, addr) is valid
logging.info("ip address: %s", type(address))
if not socket.inet_ntop(af, address):
# if not socket.inet_ntop(af, address.encode("ISO-8859-1")):
raise ValueError("invalid af/addr")
self.af = af
self.addr = address
@ -124,6 +128,7 @@ class IpAddress(object):
:rtype: str
"""
return socket.inet_ntop(self.af, self.addr)
# return socket.inet_ntop(self.af, self.addr.encode("ISO-8859-1"))
def __eq__(self, other):
"""
@ -231,7 +236,7 @@ class IpPrefix(object):
self.prefixlen = int(tmp[1])
else:
self.prefixlen = self.addrlen
self.prefix = socket.inet_pton(self.af, tmp[0])
self.prefix = socket.inet_pton(self.af, tmp[0]).decode("ISO-8859-1")
if self.addrlen > self.prefixlen:
addrbits = self.addrlen - self.prefixlen
netmask = ((1 << self.prefixlen) - 1) << addrbits

View file

@ -855,11 +855,13 @@ class PtpNet(CoreNetwork):
if ipaddress.is_ipv4_address(ip):
family = AF_INET
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface1_ip4 = ipaddress.IpAddress(af=family, address=ipl)
interface1_ip4_mask = mask
else:
family = AF_INET6
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface1_ip6 = ipaddress.IpAddress(af=family, address=ipl)
interface1_ip6_mask = mask
@ -873,11 +875,13 @@ class PtpNet(CoreNetwork):
if ipaddress.is_ipv4_address(ip):
family = AF_INET
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface2_ip4 = ipaddress.IpAddress(af=family, address=ipl)
interface2_ip4_mask = mask
else:
family = AF_INET6
ipl = socket.inet_pton(family, ip)
# ipl = ipl.decode("ISO-8859-1")
interface2_ip6 = ipaddress.IpAddress(af=family, address=ipl)
interface2_ip6_mask = mask

View file

@ -4,7 +4,11 @@ sdt.py: Scripted Display Tool (SDT3D) helper
import logging
import socket
from urlparse import urlparse
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse
from core import constants
from core.nodes.base import NodeBase, CoreNetworkBase

View file

@ -2,6 +2,7 @@
Miscellaneous utility functions, wrappers around some subprocess procedures.
"""
import fcntl
import importlib
import inspect
import logging
@ -10,8 +11,6 @@ import shlex
import subprocess
import sys
import fcntl
from core import CoreCommandError
DEVNULL = open(os.devnull, "wb")
@ -126,7 +125,7 @@ def make_tuple_fromstr(s, value_type):
"""
Create a tuple from a string.
:param str|unicode s: string to convert to a tuple
:param str s: string to convert to a tuple
:param value_type: type of values to be contained within tuple
:return: tuple from string
:rtype: tuple
@ -148,7 +147,9 @@ def split_args(args):
:return: shell-like syntax list
:rtype: list
"""
if isinstance(args, basestring):
logging.info("split args: %s - %s", args, type(args))
if isinstance(args, str):
logging.info("splitting args")
args = shlex.split(args)
return args
@ -231,7 +232,7 @@ def check_cmd(args, **kwargs):
status = p.wait()
if status != 0:
raise CoreCommandError(status, args, stdout)
return stdout.strip()
return stdout.decode("utf-8").strip()
except OSError:
raise CoreCommandError(-1, args)

View file

@ -14,7 +14,7 @@
}
},
"root": {
"level": "INFO",
"level": "DEBUG",
"handlers": ["console"]
}
}

View file

@ -1,5 +1,5 @@
all:
$(PYTHON) -m grpc_tools.protoc -I . --python_out=../core/api/grpc --grpc_python_out=../core/api/grpc core.proto
$(PYTHON) -m grpc_tools.protoc -I . --python_out=.. --grpc_python_out=.. core/api/grpc/core.proto
clean:
-rm -f ../core/api/grpc/core_pb2*

View file

@ -30,38 +30,38 @@ netns_SOURCES = $(SRC_NETNS)
# this triggers automake to run setup.py for building the Python libraries
# actual library names are netns.so and vcmd.so
# SOURCES line prevents 'make dist' from looking for a 'libnetns.c' file
if WANT_PYTHON
noinst_LIBRARIES = libnetns.a
libnetns_a_SOURCES = netnsmodule.c vcmdmodule.c
libnetns.a:
LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build_ext
# Python libraries install
install-exec-local:
$(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
--root=/$(DESTDIR) \
--prefix=$(prefix) \
--install-lib=$(pythondir) \
--single-version-externally-managed \
--no-compile
# Python libraries uninstall
uninstall-hook:
rm -rf core_netns.egg-info
rm -rf $(DESTDIR)/$(pythondir)/core_netns-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
rm -f $(DESTDIR)/$(bindir)/{vnoded,vcmd,netns}
rm -f $(DESTDIR)/$(pythondir)/{netns.so,vcmd.so}
# Python libraries cleanup
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf build
distclean-local:
-rm -rf core_netns.egg-info
endif
#if WANT_PYTHON
#noinst_LIBRARIES = libnetns.a
#libnetns_a_SOURCES = netnsmodule.c vcmdmodule.c
#libnetns.a:
# LDFLAGS="$(LDFLAGS) @libev_LIBS@" CFLAGS="$(CFLAGS) @libev_CFLAGS@" $(PYTHON) setup.py build_ext
#
## Python libraries install
#install-exec-local:
# $(PYTHON) $(SETUPPY) $(SETUPPYFLAGS) install \
# --root=/$(DESTDIR) \
# --prefix=$(prefix) \
# --install-lib=$(pythondir) \
# --single-version-externally-managed \
# --no-compile
#
## Python libraries uninstall
#uninstall-hook:
# rm -rf core_netns.egg-info
# rm -rf $(DESTDIR)/$(pythondir)/core_netns-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg-info
# rm -f $(DESTDIR)/$(bindir)/{vnoded,vcmd,netns}
# rm -f $(DESTDIR)/$(pythondir)/{netns.so,vcmd.so}
#
## Python libraries cleanup
#clean-local: clean-local-check
#.PHONY: clean-local-check
#clean-local-check:
# -rm -rf build
#
#distclean-local:
# -rm -rf core_netns.egg-info
#
#endif
# endif WANT_PYTHON
# extra cruft to remove