agent-ctl: Add stub for AddSwap API
Add a basic implementation for the `AddSwap` agent API call.
@@ -88,6 +88,11 @@ static AGENT_CMDS: &'static [AgentCmd] = &[
st: ServiceType::Agent,
fp: agent_cmd_sandbox_add_arp_neighbors,
},
+ AgentCmd {
+ name: "AddSwap",
+ st: ServiceType::Agent,
+ fp: agent_cmd_sandbox_add_swap,
+ },
AgentCmd {
name: "Check",
st: ServiceType::Health,
@@ -1992,3 +1997,29 @@ fn get_repeat_count(cmdline: &str) -> i64 {
Err(_) => return default_repeat_count,
}
}
+
+fn agent_cmd_sandbox_add_swap(
+ ctx: &Context,
+ client: &AgentServiceClient,
+ _health: &HealthClient,
+ _options: &mut Options,
+ _args: &str,
+) -> Result<()> {
+ let req = AddSwapRequest::default();
+
+ let ctx = clone_context(ctx);
+
+ debug!(sl!(), "sending request"; "request" => format!("{:?}", req));
+
+ let reply = client
+ .add_swap(ctx, &req)
+ .map_err(|e| anyhow!("{:?}", e).context(ERR_API_FAILED))?;
+
+ // FIXME: Implement 'AddSwap' fully.
+ eprintln!("FIXME: 'AddSwap' not fully implemented");
+
+ info!(sl!(), "response received";
+ "response" => format!("{:?}", reply));
+
+ Ok(())
+}
