Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure bgp during early networking #4480

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

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

11 changes: 11 additions & 0 deletions common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ pub struct BgpPeerConfig {
pub port: String,
/// Address of the peer.
pub addr: Ipv4Addr,
/// How long to keep a session alive without a keepalive in seconds.
/// Defaults to 6.
pub hold_time: Option<u64>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a Duration typically for these, but if you want/need to keep them as u64 then I'd suggest adding a suffix like s as in hold_time_s

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently part of the data stored in the bootstore, but I think because these are all optional fields deserialization should still work. I would suggest testing the upgrade path though, where you initialize a rack with the old version and then install the new to see what happens.

/// How long to keep a peer in idle after a state machine reset in seconds.
pub idle_hold_time: Option<u64>,
/// How long to delay sending open messages to a peer. In seconds.
pub delay_open: Option<u64>,
/// The interval in seconds between peer connection retry attempts.
pub connect_retry: Option<u64>,
/// The interval to send keepalive messages at.
pub keepalive: Option<u64>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
Expand Down
9 changes: 9 additions & 0 deletions nexus/inventory/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ mod test {
let message = regex::Regex::new(r"os error \d+")
.unwrap()
.replace_all(&e, "os error <<redacted>>");
// Communication errors differ based on the configuration of the
// machine running the test. For example whether or not the machine
// has IPv6 configured will determine if an error is network
// unreachable or a timeout due to sending a packet to a known
// discard prefix. So just key in on the communication error in a
// general sense.
let message = regex::Regex::new(r"Communication Error.*")
.unwrap()
.replace_all(&message, "Communication Error <<redacted>>");
write!(&mut s, "error: {}\n", message).unwrap();
}

Expand Down
2 changes: 1 addition & 1 deletion nexus/inventory/tests/output/collector_errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ cabooses found:
RotSlotB baseboard part "FAKE_SIM_SIDECAR" serial "SimSidecar1": board "SimSidecarRot"

errors:
error: MGS "http://[100::1]:12345": listing ignition targets: Communication Error: error sending request for url (http://[100::1]:12345/ignition): error trying to connect: tcp connect error: Network is unreachable (os error <<redacted>>): error sending request for url (http://[100::1]:12345/ignition): error trying to connect: tcp connect error: Network is unreachable (os error <<redacted>>): error trying to connect: tcp connect error: Network is unreachable (os error <<redacted>>): tcp connect error: Network is unreachable (os error <<redacted>>): Network is unreachable (os error <<redacted>>)
error: MGS "http://[100::1]:12345": listing ignition targets: Communication Error <<redacted>>
7 changes: 6 additions & 1 deletion nexus/src/app/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,15 @@ impl super::Nexus {
addresses: info.addresses.iter().map(|a| a.address).collect(),
bgp_peers: peer_info
.iter()
.map(|(_p, asn, addr)| BgpPeerConfig {
.map(|(p, asn, addr)| BgpPeerConfig {
addr: *addr,
asn: *asn,
port: port.port_name.clone(),
hold_time: Some(p.hold_time.0.into()),
connect_retry: Some(p.connect_retry.0.into()),
delay_open: Some(p.delay_open.0.into()),
idle_hold_time: Some(p.idle_hold_time.0.into()),
keepalive: Some(p.keepalive.0.into()),
})
.collect(),
switch: port.switch_location.parse().unwrap(),
Expand Down
5 changes: 5 additions & 0 deletions nexus/src/app/sagas/switch_port_settings_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,11 @@ pub(crate) async fn bootstore_update(
asn: *asn,
port: switch_port_name.into(),
addr,
hold_time: Some(p.hold_time.0.into()),
connect_retry: Some(p.connect_retry.0.into()),
delay_open: Some(p.delay_open.0.into()),
idle_hold_time: Some(p.idle_hold_time.0.into()),
keepalive: Some(p.keepalive.0.into()),
}),
IpAddr::V6(_) => {
warn!(opctx.log, "IPv6 peers not yet supported");
Expand Down
35 changes: 35 additions & 0 deletions openapi/bootstrap-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,41 @@
"format": "uint32",
"minimum": 0
},
"connect_retry": {
"nullable": true,
"description": "The interval in seconds between peer connection retry attempts.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"delay_open": {
"nullable": true,
"description": "How long to delay sending open messages to a peer. In seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"hold_time": {
"nullable": true,
"description": "How long to keep a session alive without a keepalive in seconds. Defaults to 6.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"idle_hold_time": {
"nullable": true,
"description": "How long to keep a peer in idle after a state machine reset in seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"keepalive": {
"nullable": true,
"description": "The interval to send keepalive messages at.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"port": {
"description": "Switch port the peer is reachable on.",
"type": "string"
Expand Down
35 changes: 35 additions & 0 deletions openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,41 @@
"format": "uint32",
"minimum": 0
},
"connect_retry": {
"nullable": true,
"description": "The interval in seconds between peer connection retry attempts.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"delay_open": {
"nullable": true,
"description": "How long to delay sending open messages to a peer. In seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"hold_time": {
"nullable": true,
"description": "How long to keep a session alive without a keepalive in seconds. Defaults to 6.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"idle_hold_time": {
"nullable": true,
"description": "How long to keep a peer in idle after a state machine reset in seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"keepalive": {
"nullable": true,
"description": "The interval to send keepalive messages at.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"port": {
"description": "Switch port the peer is reachable on.",
"type": "string"
Expand Down
35 changes: 35 additions & 0 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,41 @@
"format": "uint32",
"minimum": 0
},
"connect_retry": {
"nullable": true,
"description": "The interval in seconds between peer connection retry attempts.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"delay_open": {
"nullable": true,
"description": "How long to delay sending open messages to a peer. In seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"hold_time": {
"nullable": true,
"description": "How long to keep a session alive without a keepalive in seconds. Defaults to 6.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"idle_hold_time": {
"nullable": true,
"description": "How long to keep a peer in idle after a state machine reset in seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"keepalive": {
"nullable": true,
"description": "The interval to send keepalive messages at.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"port": {
"description": "Switch port the peer is reachable on.",
"type": "string"
Expand Down
35 changes: 35 additions & 0 deletions openapi/wicketd.json
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,41 @@
"format": "uint32",
"minimum": 0
},
"connect_retry": {
"nullable": true,
"description": "The interval in seconds between peer connection retry attempts.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"delay_open": {
"nullable": true,
"description": "How long to delay sending open messages to a peer. In seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"hold_time": {
"nullable": true,
"description": "How long to keep a session alive without a keepalive in seconds. Defaults to 6.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"idle_hold_time": {
"nullable": true,
"description": "How long to keep a peer in idle after a state machine reset in seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"keepalive": {
"nullable": true,
"description": "The interval to send keepalive messages at.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"port": {
"description": "Switch port the peer is reachable on.",
"type": "string"
Expand Down
45 changes: 45 additions & 0 deletions schema/rss-sled-plan.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,51 @@
"format": "uint32",
"minimum": 0.0
},
"connect_retry": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we rewrite the sled-plan after RSS time, so this should be fine. I also just confirmed that adding a sled doesn't create a plan, and so we don't have to worry about reading an old plan with a new schema.

"description": "The interval in seconds between peer connection retry attempts.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"delay_open": {
"description": "How long to delay sending open messages to a peer. In seconds.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"hold_time": {
"description": "How long to keep a session alive without a keepalive in seconds. Defaults to 6.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"idle_hold_time": {
"description": "How long to keep a peer in idle after a state machine reset in seconds.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"keepalive": {
"description": "The interval to send keepalive messages at.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"port": {
"description": "Switch port the peer is reachable on.",
"type": "string"
Expand Down
1 change: 1 addition & 0 deletions sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ itertools.workspace = true
key-manager.workspace = true
libc.workspace = true
macaddr.workspace = true
mg-admin-client.workspace = true
nexus-client.workspace = true
omicron-common.workspace = true
once_cell.workspace = true
Expand Down
Loading
Loading