-
Notifications
You must be signed in to change notification settings - Fork 58
Various networking API & DB fixes #5701
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2497,7 +2497,7 @@ pub struct SwitchPortSettingsView { | |
pub routes: Vec<SwitchPortRouteConfig>, | ||
|
||
/// BGP peer settings. | ||
pub bgp_peers: Vec<SwitchPortBgpPeerConfig>, | ||
pub bgp_peers: Vec<BgpPeer>, | ||
|
||
/// Layer 3 IP address settings. | ||
pub addresses: Vec<SwitchPortAddressConfig>, | ||
|
@@ -2551,6 +2551,74 @@ pub struct SwitchPortConfig { | |
pub geometry: SwitchPortGeometry, | ||
} | ||
|
||
/// The speed of a link. | ||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum LinkSpeed { | ||
/// Zero gigabits per second. | ||
Speed0G, | ||
/// 1 gigabit per second. | ||
Speed1G, | ||
/// 10 gigabits per second. | ||
Speed10G, | ||
/// 25 gigabits per second. | ||
Speed25G, | ||
/// 40 gigabits per second. | ||
Speed40G, | ||
/// 50 gigabits per second. | ||
Speed50G, | ||
/// 100 gigabits per second. | ||
Speed100G, | ||
/// 200 gigabits per second. | ||
Speed200G, | ||
/// 400 gigabits per second. | ||
Speed400G, | ||
} | ||
|
||
/// The forward error correction mode of a link. | ||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum LinkFec { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not net-new, it's moved from nexus/external_api/params.rs to be used as a common data structure for PUT/POST and GET requests. |
||
/// Firecode foward error correction. | ||
Firecode, | ||
/// No forward error correction. | ||
None, | ||
/// Reed-Solomon forward error correction. | ||
Rs, | ||
} | ||
|
||
impl From<crate::api::internal::shared::PortFec> for LinkFec { | ||
fn from(x: crate::api::internal::shared::PortFec) -> LinkFec { | ||
match x { | ||
crate::api::internal::shared::PortFec::Firecode => Self::Firecode, | ||
crate::api::internal::shared::PortFec::None => Self::None, | ||
crate::api::internal::shared::PortFec::Rs => Self::Rs, | ||
} | ||
} | ||
} | ||
|
||
impl From<crate::api::internal::shared::PortSpeed> for LinkSpeed { | ||
fn from(x: crate::api::internal::shared::PortSpeed) -> Self { | ||
match x { | ||
crate::api::internal::shared::PortSpeed::Speed0G => Self::Speed0G, | ||
crate::api::internal::shared::PortSpeed::Speed1G => Self::Speed1G, | ||
crate::api::internal::shared::PortSpeed::Speed10G => Self::Speed10G, | ||
crate::api::internal::shared::PortSpeed::Speed25G => Self::Speed25G, | ||
crate::api::internal::shared::PortSpeed::Speed40G => Self::Speed40G, | ||
crate::api::internal::shared::PortSpeed::Speed50G => Self::Speed50G, | ||
crate::api::internal::shared::PortSpeed::Speed100G => { | ||
Self::Speed100G | ||
} | ||
crate::api::internal::shared::PortSpeed::Speed200G => { | ||
Self::Speed200G | ||
} | ||
crate::api::internal::shared::PortSpeed::Speed400G => { | ||
Self::Speed400G | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// A link configuration for a port settings object. | ||
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq)] | ||
pub struct SwitchPortLinkConfig { | ||
|
@@ -2566,6 +2634,15 @@ pub struct SwitchPortLinkConfig { | |
|
||
/// The maximum transmission unit for this link. | ||
pub mtu: u16, | ||
|
||
/// The forward error correction mode of the link. | ||
pub fec: LinkFec, | ||
|
||
/// The configured speed of the link. | ||
pub speed: LinkSpeed, | ||
|
||
/// Whether or not the link has autonegotiation enabled. | ||
pub autoneg: bool, | ||
} | ||
|
||
/// A link layer discovery protocol (LLDP) service configuration. | ||
|
@@ -2674,6 +2751,7 @@ pub struct SwitchPortRouteConfig { | |
pub vlan_id: Option<u16>, | ||
} | ||
|
||
/* | ||
/// A BGP peer configuration for a port settings object. | ||
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq)] | ||
pub struct SwitchPortBgpPeerConfig { | ||
|
@@ -2692,6 +2770,74 @@ pub struct SwitchPortBgpPeerConfig { | |
/// The address of the peer. | ||
pub addr: IpAddr, | ||
} | ||
*/ | ||
|
||
/// A BGP peer configuration for an interface. Includes the set of announcements | ||
/// that will be advertised to the peer identified by `addr`. The `bgp_config` | ||
/// parameter is a reference to global BGP parameters. The `interface_name` | ||
/// indicates what interface the peer should be contacted on. | ||
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] | ||
pub struct BgpPeer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not net-new, it's moved from |
||
/// The global BGP configuration used for establishing a session with this | ||
/// peer. | ||
pub bgp_config: NameOrId, | ||
|
||
/// The name of interface to peer on. This is relative to the port | ||
/// configuration this BGP peer configuration is a part of. For example this | ||
/// value could be phy0 to refer to a primary physical interface. Or it | ||
/// could be vlan47 to refer to a VLAN interface. | ||
pub interface_name: String, | ||
|
||
/// The address of the host to peer with. | ||
pub addr: IpAddr, | ||
|
||
/// How long to hold peer connections between keepalives (seconds). | ||
pub hold_time: u32, | ||
|
||
/// How long to hold a peer in idle before attempting a new session | ||
/// (seconds). | ||
pub idle_hold_time: u32, | ||
|
||
/// How long to delay sending an open request after establishing a TCP | ||
/// session (seconds). | ||
pub delay_open: u32, | ||
|
||
/// How long to to wait between TCP connection retries (seconds). | ||
pub connect_retry: u32, | ||
|
||
/// How often to send keepalive requests (seconds). | ||
pub keepalive: u32, | ||
|
||
/// Require that a peer has a specified ASN. | ||
pub remote_asn: Option<u32>, | ||
|
||
/// Require messages from a peer have a minimum IP time to live field. | ||
pub min_ttl: Option<u8>, | ||
|
||
/// Use the given key for TCP-MD5 authentication with the peer. | ||
pub md5_auth_key: Option<String>, | ||
|
||
/// Apply the provided multi-exit discriminator (MED) updates sent to the peer. | ||
pub multi_exit_discriminator: Option<u32>, | ||
|
||
/// Include the provided communities in updates sent to the peer. | ||
pub communities: Vec<u32>, | ||
|
||
/// Apply a local preference to routes received from this peer. | ||
pub local_pref: Option<u32>, | ||
|
||
/// Enforce that the first AS in paths received from this peer is the peer's AS. | ||
pub enforce_first_as: bool, | ||
|
||
/// Define import policy for a peer. | ||
pub allowed_import: ImportExportPolicy, | ||
|
||
/// Define export policy for a peer. | ||
pub allowed_export: ImportExportPolicy, | ||
|
||
/// Associate a VLAN ID with a peer. | ||
pub vlan_id: Option<u16>, | ||
} | ||
|
||
/// A base BGP configuration. | ||
#[derive( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not net-new, it's moved from
nexus/external_api/params.rs
to be used as a common data structure for PUT/POST and GET requests.