Skip to content

Commit 409e7b4

Browse files
committed
pull in bgp work
1 parent 1bd54d4 commit 409e7b4

File tree

9 files changed

+210
-100
lines changed

9 files changed

+210
-100
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ ntp-admin-api = { path = "ntp-admin/api" }
566566
ntp-admin-client = { path = "clients/ntp-admin-client" }
567567
ntp-admin-types = { path = "ntp-admin/types" }
568568
ntp-admin-types-versions = { path = "ntp-admin/types/versions" }
569-
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
570-
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
569+
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06" }
570+
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06" }
571571
multimap = "0.10.1"
572572
nexus-auth = { path = "nexus/auth" }
573573
nexus-background-task-interface = { path = "nexus/background-task-interface" }
@@ -628,7 +628,7 @@ oxide-client = { path = "clients/oxide-client" }
628628
oxide-tokio-rt = "0.1.2"
629629
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "a1ed0960673b6ca2e6b68835537f53cc86110a77", features = [ "api", "std" ] }
630630
oxlog = { path = "dev-tools/oxlog" }
631-
oxnet = "0.1.3"
631+
oxnet = "0.1.4"
632632
once_cell = "1.21.3"
633633
openapi-lint = { git = "https://github.com/oxidecomputer/openapi-lint", branch = "main" }
634634
openapiv3 = "2.2.0"
@@ -697,7 +697,7 @@ rats-corim = { git = "https://github.com/oxidecomputer/rats-corim.git", rev = "f
697697
raw-cpuid = { git = "https://github.com/oxidecomputer/rust-cpuid.git", rev = "a4cf01df76f35430ff5d39dc2fe470bcb953503b" }
698698
rayon = "1.10"
699699
rcgen = "0.12.1"
700-
rdb-types = { git = "https://github.com/oxidecomputer/maghemite", rev = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d" }
700+
rdb-types = { git = "https://github.com/oxidecomputer/maghemite", rev = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06" }
701701
reconfigurator-cli = { path = "dev-tools/reconfigurator-cli" }
702702
reedline = "0.40.0"
703703
ref-cast = "1.0"

nexus/src/app/background/tasks/sync_switch_configuration.rs

Lines changed: 73 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ use futures::future::BoxFuture;
3030
use mg_admin_client::types::{
3131
AddStaticRoute4Request, AddStaticRoute6Request, ApplyRequest,
3232
BgpPeerConfig, CheckerSource, DeleteStaticRoute4Request,
33-
DeleteStaticRoute6Request, ImportExportPolicy as MgImportExportPolicy,
34-
ShaperSource, StaticRoute4, StaticRoute4List, StaticRoute6,
35-
StaticRoute6List,
33+
DeleteStaticRoute6Request, ImportExportPolicy4 as MgImportExportPolicy4,
34+
ImportExportPolicy6 as MgImportExportPolicy6, Ipv4UnicastConfig,
35+
Ipv6UnicastConfig, JitterRange, ShaperSource, StaticRoute4,
36+
StaticRoute4List, StaticRoute6, StaticRoute6List,
3637
};
3738
use nexus_db_queries::{
3839
context::OpContext,
@@ -48,7 +49,7 @@ use omicron_common::{
4849
internal::shared::ParseSwitchLocationError,
4950
},
5051
};
51-
use rdb_types::{Prefix as MgPrefix, Prefix4, Prefix6};
52+
use rdb_types::{Prefix4, Prefix6};
5253
use serde_json::json;
5354
use sled_agent_client::types::{
5455
BgpConfig as SledBgpConfig, BgpPeerConfig as SledBgpPeerConfig,
@@ -703,30 +704,48 @@ impl BackgroundTask for SwitchPortSettingsManager {
703704
}
704705
};
705706

706-
let import_policy = match allow_import {
707+
let import_policy4 = match &allow_import {
707708
Some(list) => {
708-
MgImportExportPolicy::Allow(list
709+
MgImportExportPolicy4::Allow(list
710+
.clone()
709711
.into_iter()
710-
.map(|x|
712+
.filter_map(|x|
711713
match x.prefix {
712-
IpNetwork::V4(p) => MgPrefix::V4(
714+
IpNetwork::V4(p) => Some(
713715
Prefix4{
714716
length: p.prefix(),
715717
value: p.ip(),
716718
}
717719
),
718-
IpNetwork::V6(p) => MgPrefix::V6(
720+
IpNetwork::V6(_) => None,
721+
}
722+
)
723+
.collect()
724+
)
725+
}
726+
None => MgImportExportPolicy4::NoFiltering,
727+
};
728+
729+
let import_policy6 = match &allow_import {
730+
Some(list) => {
731+
MgImportExportPolicy6::Allow(list
732+
.clone()
733+
.into_iter()
734+
.filter_map(|x|
735+
match x.prefix {
736+
IpNetwork::V6(p) => Some(
719737
Prefix6{
720738
length: p.prefix(),
721739
value: p.ip(),
722740
}
723-
)
741+
),
742+
IpNetwork::V4(_) => None,
724743
}
725744
)
726745
.collect()
727746
)
728747
}
729-
None => MgImportExportPolicy::NoFiltering,
748+
None => MgImportExportPolicy6::NoFiltering,
730749
};
731750

732751
let allow_export = match self.datastore.allow_export_for_peer(
@@ -753,30 +772,48 @@ impl BackgroundTask for SwitchPortSettingsManager {
753772
}
754773
};
755774

756-
let export_policy = match allow_export {
775+
let export_policy4 = match &allow_export {
757776
Some(list) => {
758-
MgImportExportPolicy::Allow(list
777+
MgImportExportPolicy4::Allow(list
778+
.clone()
759779
.into_iter()
760-
.map(|x|
780+
.filter_map(|x|
761781
match x.prefix {
762-
IpNetwork::V4(p) => MgPrefix::V4(
782+
IpNetwork::V4(p) => Some(
763783
Prefix4{
764784
length: p.prefix(),
765785
value: p.ip(),
766786
}
767787
),
768-
IpNetwork::V6(p) => MgPrefix::V6(
788+
IpNetwork::V6(_) => None,
789+
}
790+
)
791+
.collect()
792+
)
793+
}
794+
None => MgImportExportPolicy4::NoFiltering,
795+
};
796+
797+
let export_policy6 = match &allow_export {
798+
Some(list) => {
799+
MgImportExportPolicy6::Allow(list
800+
.clone()
801+
.into_iter()
802+
.filter_map(|x|
803+
match x.prefix {
804+
IpNetwork::V6(p) => Some(
769805
Prefix6{
770806
length: p.prefix(),
771807
value: p.ip(),
772808
}
773-
)
809+
),
810+
IpNetwork::V4(_) => None,
774811
}
775812
)
776813
.collect()
777814
)
778815
}
779-
None => MgImportExportPolicy::NoFiltering,
816+
None => MgImportExportPolicy6::NoFiltering,
780817
};
781818

782819
// now that the peer passes the above validations, add it to the list for configuration
@@ -797,9 +834,24 @@ impl BackgroundTask for SwitchPortSettingsManager {
797834
local_pref: peer.local_pref.as_ref().map(|x| x.0),
798835
enforce_first_as: peer.enforce_first_as,
799836
communities: communities.into_iter().map(|c| c.community.0).collect(),
800-
allow_export: export_policy,
801-
allow_import: import_policy,
837+
ipv4_unicast: Some(Ipv4UnicastConfig{
838+
nexthop: None,
839+
import_policy: import_policy4,
840+
export_policy: export_policy4,
841+
}),
842+
ipv6_unicast: Some(Ipv6UnicastConfig{
843+
nexthop: None,
844+
import_policy: import_policy6,
845+
export_policy: export_policy6,
846+
}),
802847
vlan_id: peer.vlan_id.map(|x| x.0),
848+
//TODO plumb these out to the external API
849+
connect_retry_jitter: Some(JitterRange {
850+
max: 1.0,
851+
min: 0.75,
852+
}),
853+
deterministic_collision_resolution: false,
854+
idle_hold_jitter: None,
803855
};
804856

805857
// update the stored vec if it exists, create a new on if it doesn't exist
@@ -874,7 +926,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
874926
"switch_location" => ?location,
875927
"config" => ?config,
876928
);
877-
if let Err(e) = client.bgp_apply(config).await {
929+
if let Err(e) = client.bgp_apply_v2(config).await {
878930
error!(log, "error while applying bgp configuration"; "error" => ?e);
879931
}
880932
}

nexus/src/app/bgp.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl super::Nexus {
123123
for r in &router_info {
124124
let asn = r.asn;
125125

126-
let peers = match client.get_neighbors_v2(asn).await {
126+
let peers = match client.get_neighbors_v3(asn).await {
127127
Ok(result) => result.into_inner(),
128128
Err(e) => {
129129
error!(
@@ -146,8 +146,11 @@ impl super::Nexus {
146146
addr: host,
147147
local_asn: r.asn,
148148
remote_asn: info.asn.unwrap_or(0),
149-
state: info.state.into(),
150-
state_duration_millis: info.duration_millis,
149+
state: info.fsm_state.into(),
150+
state_duration_millis: u64::try_from(
151+
info.fsm_state_duration.as_millis(),
152+
)
153+
.unwrap_or(u64::MAX),
151154
});
152155
}
153156
}

package-manifest.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,10 @@ source.repo = "maghemite"
654654
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
655655
# building `ddm-admin-client` (which will instruct you to update
656656
# `tools/maghemite_openapi_version`).
657-
source.commit = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d"
657+
source.commit = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06"
658658
# The SHA256 digest is automatically posted to:
659659
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm-gz.sha256.txt
660-
source.sha256 = "c317e4bd2958324a6de2b5eba3380cd3b4071617676684213eb6ddbd33087118"
660+
source.sha256 = "c962841f5d3a4c9e2d2dcdc9ec002d1978e70463009d31dfd46d7def80b3ecbb"
661661
output.type = "tarball"
662662

663663
[package.mg-ddm]
@@ -670,10 +670,10 @@ source.repo = "maghemite"
670670
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
671671
# building `ddm-admin-client` (which will instruct you to update
672672
# `tools/maghemite_openapi_version`).
673-
source.commit = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d"
673+
source.commit = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06"
674674
# The SHA256 digest is automatically posted to:
675675
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm.sha256.txt
676-
source.sha256 = "e74b8bd7bc8384dec558a5afafc624c67e9704a2a976f5cb75664f62d969bd97"
676+
source.sha256 = "c97b4e329b59d467a5c5af39e5d45298b6ce8dafb93831f37d7aa827a897472d"
677677
output.type = "zone"
678678
output.intermediate_only = true
679679

@@ -685,10 +685,10 @@ source.repo = "maghemite"
685685
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
686686
# building `ddm-admin-client` (which will instruct you to update
687687
# `tools/maghemite_openapi_version`).
688-
source.commit = "3877aa0467fe275806f07ff4f7e92efa43e6fa6d"
688+
source.commit = "7f78e2b9ab37981e9edcf2e076a3257a032bbb06"
689689
# The SHA256 digest is automatically posted to:
690690
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mgd.sha256.txt
691-
source.sha256 = "c32c66f81c2a6b9149d97c83153327e7d6897c53e047ae425291bd622d8559ec"
691+
source.sha256 = "2b0813a1e857ec2e995bc07c6d1de13c8321a20ea768cbab3f01f8e494240d61"
692692
output.type = "zone"
693693
output.intermediate_only = true
694694

0 commit comments

Comments
 (0)