Skip to content

Commit

Permalink
configure bgp during early networking
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Nov 9, 2023
1 parent 3445996 commit a1c413c
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 8 deletions.
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>,
/// 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": {
"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

0 comments on commit a1c413c

Please sign in to comment.