Skip to content
Open
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
387 changes: 340 additions & 47 deletions dpd-api/src/lib.rs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we deprecating some endpoints and versioning others?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm deprecating the endpoints that nobody uses (according to github org:oxidecomputer). That lets me delete corresponding code from dpd.

If we keep link_ipv*_reset, I feel like it should support tags. But why do that work if nobody uses it? So I deprecated the endpoint and deleted the dpd code instead.

The other endpoints are broadly useful, so I'm versioning and updating them.

Does that answer your question?

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dpd-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tofino_asic = ["asic/tofino_asic"]

[dependencies]
async-trait = "0.1.89"
anyhow.workspace = true
chrono.workspace = true
futures.workspace = true
http.workspace = true
Expand Down
27 changes: 26 additions & 1 deletion dpd-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ progenitor::generate_api!(
PortId = {derives = [PartialOrd, Ord, PartialEq, Eq, Hash, Clone] },
},
crates = {
"oxnet" = "0.1.0",
"oxnet" = "0.1.7",
},
);

Expand Down Expand Up @@ -418,6 +418,31 @@ impl fmt::Display for types::MediaInterfaceId {
}
}

impl types::CmdAck {
/// A test helper that returns err if `self` is not [`CmdAck::Updated`].
pub fn verify_updated(&self, msg: impl AsRef<str>) -> anyhow::Result<()> {
self.verify_state(msg, Self::Updated)
}

/// A test helper that returns err if `self` is not [`CmdAck::NoChange`].
pub fn verify_no_change(&self, msg: impl AsRef<str>) -> anyhow::Result<()> {
self.verify_state(msg, Self::NoChange)
}

fn verify_state(
&self,
msg: impl AsRef<str>,
want: types::CmdAck,
) -> anyhow::Result<()> {
anyhow::ensure!(
self == &want,
"Expectation failed, {self:?} != {want:?}: {}",
msg.as_ref()
);
Ok(())
}
}

#[cfg(test)]
mod tests {
use super::types::SwitchIdentifiers;
Expand Down
Loading
Loading