Skip to content
Merged
48 changes: 40 additions & 8 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[workspace]
members = [
"agama-cli",
"agama-server",
"agama-lib",
"agama-locale-data",
"xtask",
"agama-cli",
"agama-server",
"agama-lib",
"agama-locale-data",
"agama-network",
"agama-utils",
"xtask",
]
resolver = "2"

Expand Down
3 changes: 2 additions & 1 deletion rust/agama-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ edition = "2021"

[dependencies]
anyhow = "1.0"
agama-utils = { path = "../agama-utils" }
agama-network = { path = "../agama-network" }
async-trait = "0.1.83"
cidr = { version = "0.3.1", features = ["serde"] }
futures-util = "0.3.30"
jsonschema = { version = "0.30.0", default-features = false, features = [
"resolve-file",
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-lib/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ use std::collections::HashMap;
use serde::Serialize;
use zbus::zvariant::OwnedValue;

use crate::{dbus::get_property, error::ServiceError};
use crate::error::ServiceError;
use agama_utils::dbus::get_property;

pub mod client;

Expand Down
10 changes: 4 additions & 6 deletions rust/agama-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,18 @@ pub mod manager;
pub mod network;
pub mod product;
pub mod profile;
pub mod software;
pub mod storage;
pub mod users;
// TODO: maybe expose only clients when we have it?
pub mod dbus;
pub mod openapi;
pub mod progress;
pub mod proxies;
pub mod questions;
pub mod scripts;
pub mod security;
pub mod software;
pub mod storage;
mod store;
pub mod users;
pub use store::Store;
pub mod utils;
pub use agama_utils::{dbus, openapi};

use crate::error::ServiceError;
use zbus::conn::Builder;
Expand Down
8 changes: 5 additions & 3 deletions rust/agama-lib/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) [2024] SUSE LLC
// Copyright (c) [2024-2025] SUSE LLC
//
// All Rights Reserved.
//
Expand All @@ -21,10 +21,12 @@
//! Implements support for handling the network settings

mod client;
pub mod settings;
mod store;
pub mod types;

pub use agama_network::{
error, model, settings, types, Action, Adapter, NetworkAdapterError, NetworkManagerAdapter,
NetworkSystem, NetworkSystemClient, NetworkSystemError,
};
pub use client::{NetworkClient, NetworkClientError};
pub use settings::NetworkSettings;
pub use store::{NetworkStore, NetworkStoreError};
2 changes: 1 addition & 1 deletion rust/agama-lib/src/product/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

use crate::dbus::{get_optional_property, get_property};
use crate::error::ServiceError;
use crate::software::model::{AddonParams, AddonProperties};
use crate::software::proxies::SoftwareProductProxy;
use agama_utils::dbus::{get_optional_property, get_property};
use serde::Serialize;
use std::collections::HashMap;
use zbus::Connection;
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/storage/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use super::model::{
};
use super::proxies::{DevicesProxy, ProposalCalculatorProxy, ProposalProxy, Storage1Proxy};
use super::StorageSettings;
use crate::dbus::get_property;
use crate::error::ServiceError;
use agama_utils::dbus::get_property;
use serde_json::value::RawValue;
use std::collections::HashMap;
use zbus::fdo::ObjectManagerProxy;
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/storage/client/iscsi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use core::fmt;
use std::collections::HashMap;

use crate::{
dbus::{extract_id_from_path, get_property},
error::ServiceError,
storage::proxies::iscsi::{ISCSIProxy, InitiatorProxy, NodeProxy},
};
use agama_utils::dbus::{extract_id_from_path, get_property};
use serde::{Deserialize, Serialize};
use serde_json::value::RawValue;
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/storage/client/zfcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use zbus::{
};

use crate::{
dbus::{extract_id_from_path, get_property},
error::ServiceError,
storage::{
model::zfcp::{ZFCPController, ZFCPDisk},
proxies::zfcp::{ControllerProxy, ManagerProxy},
},
};
use agama_utils::dbus::{extract_id_from_path, get_property};

const ZFCP_CONTROLLER_PREFIX: &str = "/org/opensuse/Agama/Storage1/zfcp_controllers";

Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/storage/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use zbus::zvariant::{OwnedValue, Value};

use crate::dbus::{get_optional_property, get_property};
use agama_utils::dbus::{get_optional_property, get_property};

pub mod dasd;
pub mod zfcp;
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-lib/src/storage/model/dasd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use std::collections::HashMap;
use serde::Serialize;
use zbus::zvariant::OwnedValue;

use crate::{dbus::get_property, error::ServiceError};
use crate::error::ServiceError;
use agama_utils::dbus::get_property;

/// Represents a DASD device (specific to s390x systems).
#[derive(Clone, Debug, Serialize, Default, utoipa::ToSchema)]
Expand Down
3 changes: 2 additions & 1 deletion rust/agama-lib/src/storage/model/zfcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use std::collections::HashMap;
use serde::Serialize;
use zbus::zvariant::OwnedValue;

use crate::{dbus::get_property, error::ServiceError};
use crate::error::ServiceError;
use agama_utils::dbus::get_property;

/// Represents a zFCP disk (specific to s390x systems).
#[derive(Clone, Debug, Serialize, Default, utoipa::ToSchema)]
Expand Down
27 changes: 27 additions & 0 deletions rust/agama-network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "agama-network"
version = "0.1.0"
rust-version.workspace = true
edition.workspace = true

[dependencies]
agama-utils = { path = "../agama-utils" }
anyhow = "1.0.98"
async-trait = "0.1.88"
cidr = { version = "0.3.1", features = ["serde"] }
futures-util = { version = "0.3.30", default-features = false, features = [
"alloc",
] }
macaddr = { version = "1.0.1", features = ["serde_std"] }
pin-project = "1.1.10"
serde = { version = "1.0.219", features = ["derive"] }
serde_with = "3.12.0"
strum = { version = "0.27.1", features = ["derive"] }
thiserror = "2.0.12"
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.17"
tokio-test = "0.4.4"
tracing = "0.1.41"
utoipa = { version = "5.3.1", features = ["uuid"] }
uuid = { version = "1.16.0", features = ["v4"] }
zbus = { version = "5", default-features = false, features = ["tokio"] }
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

use crate::network::model::{AccessPoint, Connection, Device};
use agama_lib::network::types::{ConnectionState, DeviceType};
use crate::model::{AccessPoint, Connection, Device};
use crate::types::{ConnectionState, DeviceType};
use tokio::sync::oneshot;
use uuid::Uuid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

use crate::network::{model::StateConfig, Action, NetworkState};
use agama_lib::error::ServiceError;
use crate::{model::StateConfig, Action, NetworkState};
use async_trait::async_trait;
use thiserror::Error;
use tokio::sync::mpsc::UnboundedSender;

#[derive(Error, Debug)]
pub enum NetworkAdapterError {
#[error("Could not read the network configuration: {0}")]
Read(ServiceError),
Read(anyhow::Error),
#[error("Could not update the network configuration: {0}")]
Write(ServiceError),
Write(anyhow::Error),
#[error("Checkpoint handling error: {0}")]
Checkpoint(ServiceError), // only relevant for adapters that implement a checkpoint mechanism
Checkpoint(anyhow::Error), // only relevant for adapters that implement a checkpoint mechanism
#[error("The network watcher cannot run: {0}")]
Watcher(ServiceError),
Watcher(anyhow::Error),
}

/// A trait for the ability to read/write from/to a network service.
Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions rust/agama-network/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) [2025] SUSE LLC
//
// All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, contact SUSE LLC.
//
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

//! Network configuration service for Agama
//!
//! This library implements the network configuration service for Agama.

pub mod action;
pub mod adapter;
pub mod error;
pub mod model;
mod nm;
pub mod settings;
mod system;
pub mod types;

pub use action::Action;
pub use adapter::{Adapter, NetworkAdapterError};
pub use model::NetworkState;
pub use nm::NetworkManagerAdapter;
pub use system::{NetworkSystem, NetworkSystemClient, NetworkSystemError};
Loading
Loading