Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6e1950a
feat(mgmt): cleanup & don't build unused config
Fredi-raspall Dec 8, 2025
19e1617
feat(routing): fix renderer communities route-map
Fredi-raspall Dec 8, 2025
5119202
feat(mgmt): keep distinct prefix lists for vpc
Fredi-raspall Dec 8, 2025
21312f3
feat(config,routing): add new Community variant
Fredi-raspall Dec 9, 2025
e058736
feat(config,nat): adapt to grpc/k8s model for HA
Fredi-raspall Dec 9, 2025
0ac3d16
feat(mgmt): extend adv route-map for a vpc
Fredi-raspall Dec 12, 2025
666cc2d
feat(mgmt,nat): fix tests
Fredi-raspall Dec 15, 2025
5d816d1
feat(mgmt): log error on conversion failure
Fredi-raspall Dec 15, 2025
df6dc92
feat(config): unify address conversions
Fredi-raspall Dec 15, 2025
6dd342f
feat(config): don't fail if no community present
Fredi-raspall Dec 16, 2025
6be6ccd
chore: extend bolero with gw groups & communities
Fredi-raspall Dec 16, 2025
f300985
feat(mgmt): remove unnecessary clone() call
Fredi-raspall Dec 17, 2025
eb1af94
feat(k8s-intf,config): make priorities unsigned
Fredi-raspall Dec 17, 2025
eaf574f
feat(config): remove hostname validation
Fredi-raspall Dec 18, 2025
3c642b8
feat(config): remove device ports from model
Fredi-raspall Dec 17, 2025
2951923
feat(config,mgmt,nat): deprecate device settings
Fredi-raspall Dec 17, 2025
c8234b0
feat(config): map no priority to priority zero
Fredi-raspall Dec 19, 2025
38da8f8
feat(k8s-intf): bump to gateway v0.32.1
Fredi-raspall Dec 19, 2025
a651001
feat(config): impl Ord/PartialOrd for GwGroupMember
Fredi-raspall Dec 19, 2025
3ee0cb5
chore: bump gatway dep to v0.33.0
Fredi-raspall Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dpdk-sysroot-helper = { path = "./dpdk-sysroot-helper", package = "dataplane-dpd
dplane-rpc = { git = "https://github.com/githedgehog/dplane-rpc.git", rev = "e8fc33db10e1d00785f2a2b90cbadcad7900f200", features = [] }
errno = { path = "./errno", package = "dataplane-errno", features = [] }
flow-info = { path = "./flow-info", package = "dataplane-flow-info", features = [] }
gateway_config = { git = "https://github.com/githedgehog/gateway-proto", tag = "v0.17.0", features = [] }
gateway_config = { git = "https://github.com/githedgehog/gateway-proto", tag = "v0.20.0", features = [] }
gwname = { path = "./gwname", package = "dataplane-gwname", features = [] }
hardware = { path = "./hardware", package = "dataplane-hardware", features = [] }
id = { path = "./id", package = "dataplane-id", features = [] }
Expand Down
1 change: 1 addition & 0 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version.workspace = true
[dependencies]
# internal
gateway_config = { workspace = true }
gwname = { workspace = true }
hardware = { workspace = true }
net = { workspace = true }
lpm = { workspace = true }
Expand Down
40 changes: 4 additions & 36 deletions config/src/converters/grpc/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,14 @@
use ::gateway_config::config as gateway_config;
use gateway_config::TracingConfig as ApiTracingConfig;

use crate::internal::device::{
DeviceConfig,
settings::{DeviceSettings, DpdkPortConfig, KernelPacketConfig, PacketDriver},
tracecfg::TracingConfig,
};
use crate::internal::device::{DeviceConfig, tracecfg::TracingConfig};

impl TryFrom<&gateway_config::Device> for DeviceConfig {
type Error = String;

fn try_from(device: &gateway_config::Device) -> Result<Self, Self::Error> {
// Convert driver enum
let driver = match ::gateway_config::PacketDriver::try_from(device.driver) {
Ok(::gateway_config::PacketDriver::Kernel) => {
PacketDriver::Kernel(KernelPacketConfig {})
}
Ok(::gateway_config::PacketDriver::Dpdk) => PacketDriver::DPDK(DpdkPortConfig {}),
Err(_) => return Err(format!("Invalid driver value: {}", device.driver)),
};

// Create device settings
let mut device_settings = DeviceSettings::new(&device.hostname);
device_settings = device_settings.set_packet_driver(driver);

// Create DeviceConfig with these settings
// Note: PortConfig is not yet implemented, so we don't add any ports
let mut device_config = DeviceConfig::new(device_settings);

// Create DeviceConfig
let mut device_config = DeviceConfig::new();
if let Some(tracing) = &device.tracing {
device_config.set_tracing(TracingConfig::try_from(tracing)?);
}
Expand All @@ -42,21 +23,8 @@ impl TryFrom<&DeviceConfig> for gateway_config::Device {
type Error = String;

fn try_from(device: &DeviceConfig) -> Result<Self, Self::Error> {
let driver = match device.settings.driver {
PacketDriver::Kernel(_) => ::gateway_config::PacketDriver::Kernel,
PacketDriver::DPDK(_) => ::gateway_config::PacketDriver::Dpdk,
};

// Convert ports if available
let ports = Vec::new(); // TODO: Implement port conversion when needed
let tracing = device.tracing.as_ref().map(ApiTracingConfig::from);

Ok(gateway_config::Device {
driver: driver.into(),
hostname: device.settings.hostname.clone(),
eal: None, // TODO: Handle EAL configuration when needed
ports,
tracing,
})
Ok(gateway_config::Device { tracing })
}
}
50 changes: 48 additions & 2 deletions config/src/converters/grpc/gateway_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
use tracing::warn;

use crate::external::ExternalConfigBuilder;
use crate::external::communities::PriorityCommunityTable;
use crate::external::gwgroup::{GwGroup, GwGroupTable};
use crate::external::overlay::Overlay;
use crate::external::underlay::Underlay;
use crate::internal::device::{DeviceConfig, settings::DeviceSettings};
use crate::internal::device::DeviceConfig;
use crate::{ExternalConfig, GwConfig};
use gateway_config::config::GatewayGroup;

// Helper Functions
//--------------------------------------------------------------------------------
Expand All @@ -26,7 +29,7 @@ pub fn convert_gateway_config_from_grpc_with_defaults(
DeviceConfig::try_from(device)?
} else {
warn!("Missing device configuration!");
DeviceConfig::new(DeviceSettings::new("Unset"))
DeviceConfig::new()
};

// convert underlay or provide a default (empty)
Expand All @@ -45,12 +48,29 @@ pub fn convert_gateway_config_from_grpc_with_defaults(
Overlay::default()
};

// convert gateway groups
let mut gw_groups = GwGroupTable::new();
for g in &grpc_config.gw_groups {
let group = GwGroup::try_from(g)?;
gw_groups.add_group(group).map_err(|e| e.to_string())?;
}

// convert community table
let mut comtable = PriorityCommunityTable::new();
for (prio, community) in &grpc_config.communities {
comtable
.insert(*prio, community)
.map_err(|e| e.to_string())?;
}

// Create the ExternalConfig using the builder pattern
let external_config = ExternalConfigBuilder::default()
.genid(grpc_config.generation)
.device(device_config)
.underlay(underlay_config)
.overlay(overlay_config)
.gwgroups(gw_groups)
.communities(comtable)
.build()
.map_err(|e| format!("Failed to build ExternalConfig: {e}"))?;

Expand Down Expand Up @@ -82,12 +102,29 @@ impl TryFrom<&gateway_config::GatewayConfig> for ExternalConfig {
Err("Missing overlay configuration!".to_string())
}?;

// convert gateway groups
let mut gw_groups = GwGroupTable::new();
for g in &grpc_config.gw_groups {
let group = GwGroup::try_from(g)?;
gw_groups.add_group(group).map_err(|e| e.to_string())?;
}

// convert community table
let mut comtable = PriorityCommunityTable::new();
for (prio, community) in &grpc_config.communities {
comtable
.insert(*prio, community)
.map_err(|e| e.to_string())?;
}

// Create the ExternalConfig using the builder pattern
let external_config = ExternalConfigBuilder::default()
.genid(grpc_config.generation)
.device(device_config)
.underlay(underlay_config)
.overlay(overlay_config)
.gwgroups(gw_groups)
.communities(comtable)
.build()
.map_err(|e| format!("Failed to build ExternalConfig: {e}"))?;

Expand All @@ -108,12 +145,21 @@ impl TryFrom<&ExternalConfig> for gateway_config::GatewayConfig {
// Convert overlay config
let overlay = gateway_config::Overlay::try_from(&external_config.overlay)?;

// Convert gateway groups
let gw_groups: Vec<_> = external_config
.gwgroups
.iter()
.map(|g| GatewayGroup::try_from(g).unwrap_or_else(|_| unreachable!()))
.collect();

// Create the complete gRPC config
Ok(gateway_config::GatewayConfig {
generation: external_config.genid,
device: Some(device),
underlay: Some(underlay),
overlay: Some(overlay),
gw_groups,
communities: external_config.communities.inner().clone(),
})
}
}
57 changes: 57 additions & 0 deletions config/src/converters/grpc/gwgroups.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Open Network Fabric Authors

use crate::converters::strings::parse_address;
use crate::external::gwgroup::{GwGroup, GwGroupMember};
use gateway_config::config as gateway_config;

impl TryFrom<&gateway_config::GatewayGroupMember> for GwGroupMember {
type Error = String;

fn try_from(value: &gateway_config::GatewayGroupMember) -> Result<Self, Self::Error> {
let address = parse_address(&value.ipaddress)
.map_err(|e| format!("Bad ip address '{}': {e}", value.ipaddress))?;
Ok(GwGroupMember::new(&value.name, value.priority, address))
}
}
impl TryFrom<&GwGroupMember> for gateway_config::GatewayGroupMember {
type Error = String;

fn try_from(value: &GwGroupMember) -> Result<Self, Self::Error> {
Ok(gateway_config::GatewayGroupMember {
name: value.name.clone(),
priority: value.priority,
ipaddress: value.ipaddress.to_string(),
})
}
}

impl TryFrom<&gateway_config::GatewayGroup> for GwGroup {
type Error = String;

fn try_from(value: &gateway_config::GatewayGroup) -> Result<Self, Self::Error> {
let mut rgroup = GwGroup::new(&value.name);
for m in &value.members {
let member = GwGroupMember::try_from(m)?;
rgroup.add_member(member).map_err(|e| e.to_string())?;
}
Ok(rgroup)
}
}

impl TryFrom<&GwGroup> for gateway_config::GatewayGroup {
type Error = String;

fn try_from(value: &GwGroup) -> Result<Self, Self::Error> {
let members: Vec<_> = value
.iter()
.map(|m| {
gateway_config::GatewayGroupMember::try_from(m).unwrap_or_else(|_| unreachable!())
})
.collect();
Ok(Self {
name: value.name().to_owned(),
members,
})
}
}
Loading
Loading