grpc: removed set node service, achieved with start session

This commit is contained in:
Blake Harnden 2021-05-04 14:55:12 -07:00
parent c574ace9a0
commit 3e2cb86b6b
5 changed files with 0 additions and 67 deletions

View file

@ -53,7 +53,6 @@ from core.api.grpc.services_pb2 import (
ServiceActionRequest,
ServiceDefaults,
SetNodeServiceFileRequest,
SetNodeServiceRequest,
SetServiceDefaultsRequest,
)
from core.api.grpc.wlan_pb2 import (
@ -906,23 +905,6 @@ class CoreGrpcClient:
response = self.stub.GetNodeServiceFile(request)
return response.data
def set_node_service(
self, session_id: int, service_config: wrappers.ServiceConfig
) -> bool:
"""
Set service data for a node.
:param session_id: session id
:param service_config: service configuration for a node
:return: True for success, False otherwise
:raises grpc.RpcError: when session or node doesn't exist
"""
request = SetNodeServiceRequest(
session_id=session_id, config=service_config.to_proto()
)
response = self.stub.SetNodeService(request)
return response.result
def set_node_service_file(
self, session_id: int, service_file_config: wrappers.ServiceFileConfig
) -> bool:

View file

@ -80,8 +80,6 @@ from core.api.grpc.services_pb2 import (
ServiceActionResponse,
SetNodeServiceFileRequest,
SetNodeServiceFileResponse,
SetNodeServiceRequest,
SetNodeServiceResponse,
SetServiceDefaultsRequest,
SetServiceDefaultsResponse,
)
@ -1054,23 +1052,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
)
return GetNodeServiceFileResponse(data=file_data.data)
def SetNodeService(
self, request: SetNodeServiceRequest, context: ServicerContext
) -> SetNodeServiceResponse:
"""
Set a node service for a node
:param request: set-node-service
request that has info to set a node service
:param context: context object
:return: set-node-service response
"""
logger.debug("set node service: %s", request)
session = self.get_session(request.session_id, context)
config = request.config
grpcutils.service_configuration(session, config)
return SetNodeServiceResponse(result=True)
def SetNodeServiceFile(
self, request: SetNodeServiceFileRequest, context: ServicerContext
) -> SetNodeServiceFileResponse:

View file

@ -79,8 +79,6 @@ service CoreApi {
}
rpc GetNodeServiceFile (services.GetNodeServiceFileRequest) returns (services.GetNodeServiceFileResponse) {
}
rpc SetNodeService (services.SetNodeServiceRequest) returns (services.SetNodeServiceResponse) {
}
rpc SetNodeServiceFile (services.SetNodeServiceFileRequest) returns (services.SetNodeServiceFileResponse) {
}
rpc ServiceAction (services.ServiceActionRequest) returns (services.ServiceActionResponse) {

View file

@ -112,15 +112,6 @@ message GetNodeServiceFileResponse {
string data = 1;
}
message SetNodeServiceRequest {
int32 session_id = 1;
ServiceConfig config = 2;
}
message SetNodeServiceResponse {
bool result = 1;
}
message SetNodeServiceFileRequest {
int32 session_id = 1;
ServiceFileConfig config = 2;

View file

@ -27,7 +27,6 @@ from core.api.grpc.wrappers import (
NodeType,
Position,
ServiceAction,
ServiceConfig,
ServiceFileConfig,
ServiceValidationMode,
SessionLocation,
@ -738,24 +737,6 @@ class TestGrpcw:
# then
assert data is not None
def test_set_node_service(self, grpc_server: CoreGrpcServer):
# given
client = CoreGrpcClient()
session = grpc_server.coreemu.create_session()
node = session.add_node(CoreNode)
config = ServiceConfig(node.id, "DefaultRoute", validate=["echo hello"])
# then
with client.context_connect():
result = client.set_node_service(session.id, config)
# then
assert result is True
service = session.services.get_service(
node.id, config.service, default_service=True
)
assert service.validate == tuple(config.validate)
def test_set_node_service_file(self, grpc_server: CoreGrpcServer):
# given
client = CoreGrpcClient()