grpc: removed get wlan configs, achieved with get session

This commit is contained in:
Blake Harnden 2021-05-04 13:36:10 -07:00
parent 15acdaa40f
commit 639b29a134
4 changed files with 0 additions and 45 deletions

View file

@ -61,7 +61,6 @@ from core.api.grpc.services_pb2 import (
) )
from core.api.grpc.wlan_pb2 import ( from core.api.grpc.wlan_pb2 import (
GetWlanConfigRequest, GetWlanConfigRequest,
GetWlanConfigsRequest,
SetWlanConfigRequest, SetWlanConfigRequest,
WlanConfig, WlanConfig,
WlanLinkRequest, WlanLinkRequest,
@ -1002,23 +1001,6 @@ class CoreGrpcClient:
response = self.stub.ServiceAction(request) response = self.stub.ServiceAction(request)
return response.result return response.result
def get_wlan_configs(
self, session_id: int
) -> Dict[int, Dict[str, wrappers.ConfigOption]]:
"""
Get all wlan configurations.
:param session_id: session id
:return: dict of node ids to dict of names to options
:raises grpc.RpcError: when session doesn't exist
"""
request = GetWlanConfigsRequest(session_id=session_id)
response = self.stub.GetWlanConfigs(request)
configs = {}
for node_id, mapped_config in response.configs.items():
configs[node_id] = wrappers.ConfigOption.from_dict(mapped_config.config)
return configs
def get_wlan_config( def get_wlan_config(
self, session_id: int, node_id: int self, session_id: int, node_id: int
) -> Dict[str, wrappers.ConfigOption]: ) -> Dict[str, wrappers.ConfigOption]:

View file

@ -94,8 +94,6 @@ from core.api.grpc.services_pb2 import (
from core.api.grpc.wlan_pb2 import ( from core.api.grpc.wlan_pb2 import (
GetWlanConfigRequest, GetWlanConfigRequest,
GetWlanConfigResponse, GetWlanConfigResponse,
GetWlanConfigsRequest,
GetWlanConfigsResponse,
SetWlanConfigRequest, SetWlanConfigRequest,
SetWlanConfigResponse, SetWlanConfigResponse,
WlanLinkRequest, WlanLinkRequest,
@ -1171,21 +1169,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
return ServiceActionResponse(result=result) return ServiceActionResponse(result=result)
def GetWlanConfigs(
self, request: GetWlanConfigsRequest, context: ServicerContext
) -> GetWlanConfigsResponse:
"""
Retrieve all wireless-lan configurations.
:param request: request
:param context: core.api.grpc.core_pb2.GetWlanConfigResponse
:return: all wlan configurations
"""
logger.debug("get wlan configs: %s", request)
session = self.get_session(request.session_id, context)
configs = grpcutils.get_wlan_configs(session)
return GetWlanConfigsResponse(configs=configs)
def GetWlanConfig( def GetWlanConfig(
self, request: GetWlanConfigRequest, context: ServicerContext self, request: GetWlanConfigRequest, context: ServicerContext
) -> GetWlanConfigResponse: ) -> GetWlanConfigResponse:

View file

@ -109,8 +109,6 @@ service CoreApi {
} }
// wlan rpc // wlan rpc
rpc GetWlanConfigs (wlan.GetWlanConfigsRequest) returns (wlan.GetWlanConfigsResponse) {
}
rpc GetWlanConfig (wlan.GetWlanConfigRequest) returns (wlan.GetWlanConfigResponse) { rpc GetWlanConfig (wlan.GetWlanConfigRequest) returns (wlan.GetWlanConfigResponse) {
} }
rpc SetWlanConfig (wlan.SetWlanConfigRequest) returns (wlan.SetWlanConfigResponse) { rpc SetWlanConfig (wlan.SetWlanConfigRequest) returns (wlan.SetWlanConfigResponse) {

View file

@ -9,14 +9,6 @@ message WlanConfig {
map<string, string> config = 2; map<string, string> config = 2;
} }
message GetWlanConfigsRequest {
int32 session_id = 1;
}
message GetWlanConfigsResponse {
map<int32, common.MappedConfig> configs = 1;
}
message GetWlanConfigRequest { message GetWlanConfigRequest {
int32 session_id = 1; int32 session_id = 1;
int32 node_id = 2; int32 node_id = 2;