Skip to content

Commit 86aeba8

Browse files
authored
DHCPv6 Server / Router Adv Daemon / Vsock Support / GRPC Client (#49)
1 parent 5b67713 commit 86aeba8

File tree

16 files changed

+1618
-135
lines changed

16 files changed

+1618
-135
lines changed

Cargo.lock

Lines changed: 123 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,21 @@ chrono = "0.4"
4444
futures-util = "0.3"
4545
futures-core = "0.3"
4646
async-stream = "0.3"
47+
tokio-vsock = { git = "https://github.com/rust-vsock/tokio-vsock", rev = "3a41323", features = ["tonic-conn"]}
48+
tower = "0.4.13"
49+
hyper-util = "0.1"
50+
socket2 = "0.5.7"
4751
libc = "0.2"
4852

53+
pelite = "0.9"
54+
regex = "1.10.6"
55+
4956
[build-dependencies]
5057
tonic-build = "0.12.1"
5158

59+
[dev-dependencies]
60+
serial_test = "3.1.1"
61+
5262
[workspace]
5363
members = [
5464
"client",

client/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
fn main() {
22
tonic_build::configure()
33
.build_server(false)
4-
.compile(&["../proto/feos.proto"], &["../proto"])
4+
.compile(
5+
&["../proto/feos.proto", "../proto/container.proto"],
6+
&["../proto"],
7+
)
58
.unwrap();
69
}

client/src/client.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use tokio_stream::wrappers::ReceiverStream;
66
use tonic::transport::Endpoint;
77
use tonic::Request;
88

9+
use crate::client_container::ContainerCommand;
910
use feos_grpc::feos_grpc_client::FeosGrpcClient;
1011
use feos_grpc::*;
1112

@@ -45,6 +46,12 @@ pub enum Command {
4546
BootVM {
4647
uuid: String,
4748
},
49+
ShutdownVM {
50+
uuid: String,
51+
},
52+
PingVM {
53+
uuid: String,
54+
},
4855
AttachNicVM {
4956
uuid: String,
5057
mac_address: String,
@@ -55,6 +62,7 @@ pub enum Command {
5562
ConsoleVM {
5663
uuid: String,
5764
},
65+
Container(ContainerCommand),
5866
}
5967

6068
fn format_address(ip: &str, port: u16) -> String {
@@ -77,6 +85,10 @@ pub async fn run_client(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
7785
let mut client = FeosGrpcClient::new(channel);
7886

7987
match opt.cmd {
88+
Command::Container(container_cmd) => {
89+
crate::client_container::run_container_client(opt.server_ip, opt.port, container_cmd)
90+
.await?;
91+
}
8092
Command::Reboot => {
8193
let request = Request::new(RebootRequest {});
8294
let response = client.reboot(request).await?;
@@ -127,6 +139,16 @@ pub async fn run_client(opt: Opt) -> Result<(), Box<dyn std::error::Error>> {
127139
let response = client.boot_vm(request).await?;
128140
println!("BOOT VM RESPONSE={:?}", response);
129141
}
142+
Command::PingVM { uuid } => {
143+
let request = Request::new(PingVmRequest { uuid });
144+
let response = client.ping_vm(request).await?;
145+
println!("BOOT VM RESPONSE={:?}", response);
146+
}
147+
Command::ShutdownVM { uuid } => {
148+
let request = Request::new(ShutdownVmRequest { uuid });
149+
let response = client.shutdown_vm(request).await?;
150+
println!("SHUTDOWN VM RESPONSE={:?}", response);
151+
}
130152
Command::AttachNicVM {
131153
uuid,
132154
mac_address,

0 commit comments

Comments
 (0)