Skip to content

Commit

Permalink
a bit of cleanup, unhook bgp programmable policy
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed May 3, 2024
1 parent 2890274 commit 271606d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 49 deletions.
4 changes: 3 additions & 1 deletion nexus/types/src/external_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,10 +1840,12 @@ pub struct BgpConfigCreate {
/// configuration.
pub vrf: Option<Name>,

// Dynamic BGP policy is not yet available so we skip adding it to the API
/// A shaper program to apply to outgoing open and update messages.
#[serde(skip)]
pub shaper: Option<String>,

/// A checker program to apply to incoming open and update messages.
#[serde(skip)]
pub checker: Option<String>,
}

Expand Down
10 changes: 0 additions & 10 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -9491,22 +9491,12 @@
"bgp_announce_set_id": {
"$ref": "#/components/schemas/NameOrId"
},
"checker": {
"nullable": true,
"description": "A checker program to apply to incoming open and update messages.",
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"$ref": "#/components/schemas/Name"
},
"shaper": {
"nullable": true,
"description": "A shaper program to apply to outgoing open and update messages.",
"type": "string"
},
"vrf": {
"nullable": true,
"description": "Optional virtual routing and forwarding identifier for this BGP configuration.",
Expand Down
75 changes: 37 additions & 38 deletions sled-agent/src/bootstrap/early_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ use internal_dns::ServiceName;
use ipnetwork::Ipv6Network;
use mg_admin_client::types::{
AddStaticRoute4Request, ApplyRequest, BfdPeerConfig, BgpPeerConfig,
CheckerSource, Prefix4, ShaperSource, StaticRoute4, StaticRoute4List,
CheckerSource, ImportExportPolicy as MgImportExportPolicy, Prefix, Prefix4,
Prefix6, ShaperSource, StaticRoute4, StaticRoute4List,
};
use mg_admin_client::Client as MgdClient;
use omicron_common::address::DENDRITE_PORT;
use omicron_common::address::{MGD_PORT, MGS_PORT};
use omicron_common::api::external::BfdMode;
use omicron_common::api::external::{BfdMode, IpNet};
use omicron_common::api::internal::shared::{
BgpConfig, PortConfigV1, PortFec, PortSpeed, RackNetworkConfig,
RackNetworkConfigV1, SwitchLocation, UplinkConfig,
BgpConfig, ImportExportPolicy, PortConfigV1, PortFec, PortSpeed,
RackNetworkConfig, RackNetworkConfigV1, SwitchLocation, UplinkConfig,
};
use omicron_common::backoff::{
retry_notify, retry_policy_local, BackoffError, ExponentialBackoff,
Expand Down Expand Up @@ -505,50 +506,48 @@ impl<'a> EarlyNetworkSetup<'a> {
local_pref: peer.local_pref,
enforce_first_as: peer.enforce_first_as,
allow_export: match &peer.allowed_export {
omicron_common::api::internal::shared::ImportExportPolicy::NoFiltering =>
mg_admin_client::types::ImportExportPolicy::NoFiltering,
omicron_common::api::internal::shared::ImportExportPolicy::Allow(list) =>
mg_admin_client::types::ImportExportPolicy::Allow(
list.clone().iter().map(|x| {
match x {
omicron_common::api::external::IpNet::V4(p) => mg_admin_client::types::Prefix::V4(
mg_admin_client::types::Prefix4{
ImportExportPolicy::NoFiltering => {
MgImportExportPolicy::NoFiltering
}
ImportExportPolicy::Allow(list) => {
MgImportExportPolicy::Allow(
list.clone()
.iter()
.map(|x| match x {
IpNet::V4(p) => Prefix::V4(Prefix4 {
length: p.prefix(),
value: p.ip(),
}
),
omicron_common::api::external::IpNet::V6(p) => mg_admin_client::types::Prefix::V6(
mg_admin_client::types::Prefix6{
}),
IpNet::V6(p) => Prefix::V6(Prefix6 {
length: p.prefix(),
value: p.ip(),
}
),
}
}).collect()
),
}),
})
.collect(),
)
}
},
allow_import: match &peer.allowed_import {
omicron_common::api::internal::shared::ImportExportPolicy::NoFiltering =>
mg_admin_client::types::ImportExportPolicy::NoFiltering,
omicron_common::api::internal::shared::ImportExportPolicy::Allow(list) =>
mg_admin_client::types::ImportExportPolicy::Allow(
list.clone().iter().map(|x| {
match x {
omicron_common::api::external::IpNet::V4(p) => mg_admin_client::types::Prefix::V4(
mg_admin_client::types::Prefix4{
ImportExportPolicy::NoFiltering => {
MgImportExportPolicy::NoFiltering
}
ImportExportPolicy::Allow(list) => {
MgImportExportPolicy::Allow(
list.clone()
.iter()
.map(|x| match x {
IpNet::V4(p) => Prefix::V4(Prefix4 {
length: p.prefix(),
value: p.ip(),
}
),
omicron_common::api::external::IpNet::V6(p) => mg_admin_client::types::Prefix::V6(
mg_admin_client::types::Prefix6{
}),
IpNet::V6(p) => Prefix::V6(Prefix6 {
length: p.prefix(),
value: p.ip(),
}
),
}
}).collect()
),
}),
})
.collect(),
)
}
},
vlan_id: peer.vlan_id,
};
Expand Down

0 comments on commit 271606d

Please sign in to comment.