grpc: removed get node service configs, achieved with get session
This commit is contained in:
parent
9205fe1764
commit
c574ace9a0
5 changed files with 0 additions and 65 deletions
|
@ -46,7 +46,6 @@ from core.api.grpc.mobility_pb2 import (
|
|||
SetMobilityConfigRequest,
|
||||
)
|
||||
from core.api.grpc.services_pb2 import (
|
||||
GetNodeServiceConfigsRequest,
|
||||
GetNodeServiceFileRequest,
|
||||
GetNodeServiceRequest,
|
||||
GetServiceDefaultsRequest,
|
||||
|
@ -870,24 +869,6 @@ class CoreGrpcClient:
|
|||
response = self.stub.SetServiceDefaults(request)
|
||||
return response.result
|
||||
|
||||
def get_node_service_configs(
|
||||
self, session_id: int
|
||||
) -> List[wrappers.NodeServiceConfig]:
|
||||
"""
|
||||
Get service data for a node.
|
||||
|
||||
:param session_id: session id
|
||||
:return: list of node service data
|
||||
:raises grpc.RpcError: when session doesn't exist
|
||||
"""
|
||||
request = GetNodeServiceConfigsRequest(session_id=session_id)
|
||||
response = self.stub.GetNodeServiceConfigs(request)
|
||||
node_services = []
|
||||
for config in response.configs:
|
||||
node_service = wrappers.NodeServiceConfig.from_proto(config)
|
||||
node_services.append(node_service)
|
||||
return node_services
|
||||
|
||||
def get_node_service(
|
||||
self, session_id: int, node_id: int, service: str
|
||||
) -> wrappers.NodeServiceData:
|
||||
|
|
|
@ -66,8 +66,6 @@ from core.api.grpc.mobility_pb2 import (
|
|||
SetMobilityConfigResponse,
|
||||
)
|
||||
from core.api.grpc.services_pb2 import (
|
||||
GetNodeServiceConfigsRequest,
|
||||
GetNodeServiceConfigsResponse,
|
||||
GetNodeServiceFileRequest,
|
||||
GetNodeServiceFileResponse,
|
||||
GetNodeServiceRequest,
|
||||
|
@ -1018,22 +1016,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
] = service_defaults.services
|
||||
return SetServiceDefaultsResponse(result=True)
|
||||
|
||||
def GetNodeServiceConfigs(
|
||||
self, request: GetNodeServiceConfigsRequest, context: ServicerContext
|
||||
) -> GetNodeServiceConfigsResponse:
|
||||
"""
|
||||
Retrieve all node service configurations.
|
||||
|
||||
:param request:
|
||||
get-node-service request
|
||||
:param context: context object
|
||||
:return: all node service configs response
|
||||
"""
|
||||
logger.debug("get node service configs: %s", request)
|
||||
session = self.get_session(request.session_id, context)
|
||||
configs = grpcutils.get_node_service_configs(session)
|
||||
return GetNodeServiceConfigsResponse(configs=configs)
|
||||
|
||||
def GetNodeService(
|
||||
self, request: GetNodeServiceRequest, context: ServicerContext
|
||||
) -> GetNodeServiceResponse:
|
||||
|
|
|
@ -75,8 +75,6 @@ service CoreApi {
|
|||
// service rpc
|
||||
rpc SetServiceDefaults (services.SetServiceDefaultsRequest) returns (services.SetServiceDefaultsResponse) {
|
||||
}
|
||||
rpc GetNodeServiceConfigs (services.GetNodeServiceConfigsRequest) returns (services.GetNodeServiceConfigsResponse) {
|
||||
}
|
||||
rpc GetNodeService (services.GetNodeServiceRequest) returns (services.GetNodeServiceResponse) {
|
||||
}
|
||||
rpc GetNodeServiceFile (services.GetNodeServiceFileRequest) returns (services.GetNodeServiceFileResponse) {
|
||||
|
|
|
@ -91,14 +91,6 @@ message SetServiceDefaultsResponse {
|
|||
bool result = 1;
|
||||
}
|
||||
|
||||
message GetNodeServiceConfigsRequest {
|
||||
int32 session_id = 1;
|
||||
}
|
||||
|
||||
message GetNodeServiceConfigsResponse {
|
||||
repeated NodeServiceConfig configs = 1;
|
||||
}
|
||||
|
||||
message GetNodeServiceRequest {
|
||||
int32 session_id = 1;
|
||||
int32 node_id = 2;
|
||||
|
|
|
@ -710,24 +710,6 @@ class TestGrpcw:
|
|||
assert result is True
|
||||
assert session.services.default_services[node_type] == services
|
||||
|
||||
def test_get_node_service_configs(self, grpc_server: CoreGrpcServer):
|
||||
# given
|
||||
client = CoreGrpcClient()
|
||||
session = grpc_server.coreemu.create_session()
|
||||
node = session.add_node(CoreNode)
|
||||
service_name = "DefaultRoute"
|
||||
session.services.set_service(node.id, service_name)
|
||||
|
||||
# then
|
||||
with client.context_connect():
|
||||
services = client.get_node_service_configs(session.id)
|
||||
|
||||
# then
|
||||
assert len(services) == 1
|
||||
service_config = services[0]
|
||||
assert service_config.node_id == node.id
|
||||
assert service_config.service == service_name
|
||||
|
||||
def test_get_node_service(self, grpc_server: CoreGrpcServer):
|
||||
# given
|
||||
client = CoreGrpcClient()
|
||||
|
|
Loading…
Reference in a new issue