Skip to content

Commit

Permalink
Port from eui48 to macaddr
Browse files Browse the repository at this point in the history
eui48 has a dependency on the deprecated
rustc-serialize package.
  • Loading branch information
milliams committed Sep 19, 2023
1 parent a31ae44 commit df7f77d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rustls = ["reqwest/rustls-tls", "osauth/rustls"]
async-stream = "^0.3"
async-trait = "^0.1"
chrono = { version = "^0.4", features = ["serde"] }
eui48 = { version = "^1.0", features = ["disp_hexstring", "serde"] }
macaddr = { version = "^1.0", features = ["serde_std"]}
futures = "^0.3"
ipnet = { version = "^2.0", features = ["serde"] }
log = "^0.4"
Expand Down
8 changes: 4 additions & 4 deletions src/network/ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use std::time::Duration;

use async_trait::async_trait;
use chrono::{DateTime, FixedOffset};
use eui48::MacAddress;
use futures::stream::{Stream, TryStreamExt};
use macaddr::MacAddr6;

use super::super::common::{
NetworkRef, PortRef, Refresh, ResourceIterator, ResourceQuery, SecurityGroupRef, SubnetRef,
Expand Down Expand Up @@ -211,12 +211,12 @@ impl Port {

transparent_property! {
#[doc = "MAC address of the port."]
mac_address: MacAddress
mac_address: MacAddr6
}

update_field! {
#[doc = "Update the MAC address (admin-only)."]
set_mac_address, with_mac_address -> mac_address: MacAddress
set_mac_address, with_mac_address -> mac_address: MacAddr6
}

transparent_property! {
Expand Down Expand Up @@ -573,7 +573,7 @@ impl NewPort {

creation_inner_field! {
#[doc = "Set MAC address for the port (generated otherwise)."]
set_mac_address, with_mac_address -> mac_address: MacAddress
set_mac_address, with_mac_address -> mac_address: MacAddr6
}

creation_inner_field! {
Expand Down
10 changes: 5 additions & 5 deletions src/network/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::net;
use std::ops::Not;

use chrono::{DateTime, FixedOffset};
use eui48::MacAddress;
use macaddr::MacAddr6;
use osauth::common::empty_as_default;
use serde::{Deserialize, Serialize};
use serde_json::Value;
Expand Down Expand Up @@ -335,7 +335,7 @@ pub struct FixedIp {
pub struct AllowedAddressPair {
pub ip_address: net::IpAddr,
#[serde(skip_serializing_if = "Option::is_none")]
pub mac_address: Option<MacAddress>,
pub mac_address: Option<MacAddr6>,
}

/// A port.
Expand Down Expand Up @@ -382,8 +382,8 @@ pub struct Port {
pub fixed_ips: Vec<FixedIp>,
#[serde(skip_serializing)]
pub id: String,
#[serde(skip_serializing_if = "MacAddress::is_nil")]
pub mac_address: MacAddress,
#[serde(skip_serializing_if = "MacAddr6::is_nil")]
pub mac_address: MacAddr6,
#[serde(
deserialize_with = "empty_as_default",
skip_serializing_if = "Option::is_none"
Expand Down Expand Up @@ -420,7 +420,7 @@ pub struct PortUpdate {
#[serde(skip_serializing_if = "Option::is_none")]
pub fixed_ips: Option<Vec<FixedIp>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mac_address: Option<MacAddress>,
pub mac_address: Option<MacAddr6>,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down

0 comments on commit df7f77d

Please sign in to comment.