finished all current grpc commands, potentially should add remaining
This commit is contained in:
parent
e9d7ed5049
commit
2b419ac67c
1 changed files with 82 additions and 12 deletions
|
@ -166,13 +166,13 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startThroughput() throws IOException {
|
public boolean startThroughput() throws IOException {
|
||||||
// TODO: convert
|
// TODO: convert throughput
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stopThroughput() throws IOException {
|
public boolean stopThroughput() throws IOException {
|
||||||
// TODO: convert
|
// TODO: convert throughput
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String nodeCommand(CoreNode node, String command) throws IOException {
|
public String nodeCommand(CoreNode node, String command) throws IOException {
|
||||||
// TODO: convert
|
// TODO: convert node command
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,14 +713,41 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WlanConfig getWlanConfig(CoreNode node) throws IOException {
|
public WlanConfig getWlanConfig(CoreNode node) throws IOException {
|
||||||
// TODO: convert
|
CoreProto.GetWlanConfigRequest request = CoreProto.GetWlanConfigRequest.newBuilder()
|
||||||
return null;
|
.setSession(sessionId)
|
||||||
|
.setId(node.getId())
|
||||||
|
.build();
|
||||||
|
CoreProto.GetWlanConfigResponse response = blockingStub.getWlanConfig(request);
|
||||||
|
Map<String, String> protoConfig = new HashMap<>();
|
||||||
|
for (CoreProto.ConfigGroup group : response.getGroupsList()) {
|
||||||
|
for (CoreProto.ConfigOption option : group.getOptionsList()) {
|
||||||
|
protoConfig.put(option.getName(), option.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WlanConfig config = new WlanConfig();
|
||||||
|
config.setBandwidth(protoConfig.get("bandwidth"));
|
||||||
|
config.setDelay(protoConfig.get("delay"));
|
||||||
|
config.setError(protoConfig.get("error"));
|
||||||
|
config.setJitter(protoConfig.get("jitter"));
|
||||||
|
config.setRange(protoConfig.get("range"));
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setWlanConfig(CoreNode node, WlanConfig config) throws IOException {
|
public boolean setWlanConfig(CoreNode node, WlanConfig config) throws IOException {
|
||||||
// TODO: convert
|
Map<String, String> protoConfig = new HashMap<>();
|
||||||
return false;
|
protoConfig.put("bandwidth", config.getBandwidth());
|
||||||
|
protoConfig.put("delay", config.getDelay());
|
||||||
|
protoConfig.put("error", config.getError());
|
||||||
|
protoConfig.put("jitter", config.getJitter());
|
||||||
|
protoConfig.put("range", config.getRange());
|
||||||
|
CoreProto.SetWlanConfigRequest request = CoreProto.SetWlanConfigRequest.newBuilder()
|
||||||
|
.setSession(sessionId)
|
||||||
|
.setId(node.getId())
|
||||||
|
.putAllConfig(protoConfig)
|
||||||
|
.build();
|
||||||
|
CoreProto.SetWlanConfigResponse response = blockingStub.setWlanConfig(request);
|
||||||
|
return response.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -740,7 +767,20 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
CoreProto.GetMobilityConfigsResponse.MobilityConfig protoMobilityConfig = response.getConfigsMap()
|
CoreProto.GetMobilityConfigsResponse.MobilityConfig protoMobilityConfig = response.getConfigsMap()
|
||||||
.get(nodeId);
|
.get(nodeId);
|
||||||
MobilityConfig mobilityConfig = new MobilityConfig();
|
MobilityConfig mobilityConfig = new MobilityConfig();
|
||||||
CoreProto.ConfigGroup configGroup = protoMobilityConfig.getGroups(0);
|
Map<String, String> protoConfig = new HashMap<>();
|
||||||
|
for (CoreProto.ConfigGroup group : protoMobilityConfig.getGroupsList()) {
|
||||||
|
for (CoreProto.ConfigOption option : group.getOptionsList()) {
|
||||||
|
protoConfig.put(option.getName(), option.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mobilityConfig.setFile(protoConfig.get("file"));
|
||||||
|
mobilityConfig.setRefresh(Integer.parseInt(protoConfig.get("refresh_ms")));
|
||||||
|
mobilityConfig.setAutostart(protoConfig.get("autostart"));
|
||||||
|
mobilityConfig.setLoop(protoConfig.get("loop"));
|
||||||
|
mobilityConfig.setPauseScript(protoConfig.get("script_pause"));
|
||||||
|
mobilityConfig.setStartScript(protoConfig.get("script_start"));
|
||||||
|
mobilityConfig.setStopScript(protoConfig.get("script_stop"));
|
||||||
|
mobilityConfig.setMap(protoConfig.get("map"));
|
||||||
mobilityConfigs.put(nodeId, mobilityConfig);
|
mobilityConfigs.put(nodeId, mobilityConfig);
|
||||||
}
|
}
|
||||||
return mobilityConfigs;
|
return mobilityConfigs;
|
||||||
|
@ -748,8 +788,24 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setMobilityConfig(CoreNode node, MobilityConfig config) throws IOException {
|
public boolean setMobilityConfig(CoreNode node, MobilityConfig config) throws IOException {
|
||||||
// TODO: convert
|
Map<String, String> protoConfig = new HashMap<>();
|
||||||
return false;
|
protoConfig.put("file", config.getFile());
|
||||||
|
if (config.getRefresh() != null) {
|
||||||
|
protoConfig.put("refresh_ms", config.getRefresh().toString());
|
||||||
|
}
|
||||||
|
protoConfig.put("autostart", config.getAutostart());
|
||||||
|
protoConfig.put("loop", config.getLoop());
|
||||||
|
protoConfig.put("map", config.getMap());
|
||||||
|
protoConfig.put("script_pause", config.getPauseScript());
|
||||||
|
protoConfig.put("script_start", config.getStartScript());
|
||||||
|
protoConfig.put("script_stop", config.getStopScript());
|
||||||
|
CoreProto.SetMobilityConfigRequest request = CoreProto.SetMobilityConfigRequest.newBuilder()
|
||||||
|
.setSession(sessionId)
|
||||||
|
.setId(node.getId())
|
||||||
|
.putAllConfig(protoConfig)
|
||||||
|
.build();
|
||||||
|
CoreProto.SetMobilityConfigResponse response = blockingStub.setMobilityConfig(request);
|
||||||
|
return response.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -759,8 +815,22 @@ public class CoreGrpcClient implements ICoreClient {
|
||||||
.setId(node.getId())
|
.setId(node.getId())
|
||||||
.build();
|
.build();
|
||||||
CoreProto.GetMobilityConfigResponse response = blockingStub.getMobilityConfig(request);
|
CoreProto.GetMobilityConfigResponse response = blockingStub.getMobilityConfig(request);
|
||||||
// TODO: convert
|
Map<String, String> protoConfig = new HashMap<>();
|
||||||
return null;
|
for (CoreProto.ConfigGroup group : response.getGroupsList()) {
|
||||||
|
for (CoreProto.ConfigOption option : group.getOptionsList()) {
|
||||||
|
protoConfig.put(option.getName(), option.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MobilityConfig config = new MobilityConfig();
|
||||||
|
config.setFile(protoConfig.get("file"));
|
||||||
|
config.setRefresh(Integer.parseInt(protoConfig.get("refresh_ms")));
|
||||||
|
config.setAutostart(protoConfig.get("autostart"));
|
||||||
|
config.setLoop(protoConfig.get("loop"));
|
||||||
|
config.setPauseScript(protoConfig.get("script_pause"));
|
||||||
|
config.setStartScript(protoConfig.get("script_start"));
|
||||||
|
config.setStopScript(protoConfig.get("script_stop"));
|
||||||
|
config.setMap(protoConfig.get("map"));
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue