-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Renato Westphal <[email protected]>
- Loading branch information
Showing
30 changed files
with
2,960 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,10 @@ Holo supports the following IETF RFCs and Internet drafts: | |
* RFC 2453 - RIP Version 2 | ||
* RFC 4822 - RIPv2 Cryptographic Authentication | ||
|
||
##### VRRP | ||
|
||
* RFC 3768 - Virtual Router Redundancy Protocol (VRRP) | ||
|
||
##### IETF YANG implementation coverage | ||
|
||
| Module | Configuration | State | RPCs | Notifications | Total | | ||
|
@@ -234,6 +238,7 @@ Holo supports the following IETF RFCs and Internet drafts: | |
| ietf-routing@2018-03-13 | 100.00% | 85.71% | - | - | [92.31%](http://westphal.com.br/holo/ietf-routing.html) | | ||
| ietf-segment-routing-mpls@2021-05-26 | 62.50% | 0.00% | - | 23.53% | [32.76%](http://westphal.com.br/holo/ietf-segment-routing-mpls.html) | | ||
| ietf-segment-routing@2021-05-26 | 100.00% | - | - | - | [100.00%](http://westphal.com.br/holo/ietf-segment-routing.html) | | ||
| ietf-vrrp@2018-03-13 | 51.06% | 60.47% | - | 41.67% | [53.92%](http://westphal.com.br/holo/[email protected]) | | ||
|
||
## Funding | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[package] | ||
name = "holo-vrrp" | ||
version.workspace = true | ||
authors.workspace = true # TODO | ||
license.workspace = true | ||
edition.workspace = true | ||
|
||
[dependencies] | ||
async-trait.workspace = true | ||
bitflags.workspace = true | ||
bytes.workspace = true | ||
chrono.workspace = true | ||
derive-new.workspace = true | ||
enum-as-inner.workspace = true | ||
ipnetwork.workspace = true | ||
itertools.workspace = true | ||
libc.workspace = true | ||
num-derive.workspace = true | ||
num-traits.workspace = true | ||
rand.workspace = true | ||
serde.workspace = true | ||
serde_json.workspace = true | ||
serde_with.workspace = true | ||
tokio.workspace = true | ||
tracing.workspace = true | ||
yang2.workspace = true | ||
|
||
holo-northbound = { path = "../holo-northbound" } | ||
holo-protocol = { path = "../holo-protocol" } | ||
holo-utils = { path = "../holo-utils" } | ||
holo-yang = { path = "../holo-yang" } | ||
|
||
[dev-dependencies] | ||
holo-vrrp = { path = ".", features = ["testing"] } | ||
holo-protocol = { path = "../holo-protocol", features = ["testing"] } | ||
holo-utils = { path = "../holo-utils", features = ["testing"] } | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
default = [] | ||
testing = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2023 The Holo Core Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// Copyright (c) The Holo Core Contributors | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
use std::net::IpAddr; | ||
|
||
use tracing::{debug, debug_span}; | ||
|
||
use crate::packet::Packet; | ||
|
||
// VRRP debug messages. | ||
#[derive(Debug)] | ||
pub enum Debug<'a> { | ||
InstanceCreate, | ||
InstanceDelete, | ||
InstanceStart, | ||
InstanceStop(InstanceInactiveReason), | ||
// Network | ||
PacketRx(&'a IpAddr, &'a Packet), | ||
PacketTx(&'a IpAddr, &'a Packet), | ||
} | ||
|
||
// Reason why an VRRP instance is inactive. | ||
#[derive(Debug)] | ||
pub enum InstanceInactiveReason { | ||
AdminDown, | ||
MissingRouterId, | ||
} | ||
|
||
// ===== impl Debug ===== | ||
|
||
impl<'a> Debug<'a> { | ||
// Log debug message using the tracing API. | ||
pub(crate) fn log(&self) { | ||
match self { | ||
Debug::InstanceCreate | ||
| Debug::InstanceDelete | ||
| Debug::InstanceStart => { | ||
// Parent span(s): vrrp-instance | ||
debug!("{}", self); | ||
} | ||
Debug::InstanceStop(reason) => { | ||
// Parent span(s): vrrp-instance | ||
debug!(%reason, "{}", self); | ||
} | ||
Debug::PacketRx(src, packet) => { | ||
// Parent span(s): vrrp-instance | ||
debug_span!("network").in_scope(|| { | ||
debug_span!("input").in_scope(|| { | ||
let data = serde_json::to_string(&packet).unwrap(); | ||
debug!(%src, %data, "{}", self); | ||
}) | ||
}) | ||
} | ||
Debug::PacketTx(addr, packet) => { | ||
// Parent span(s): vrrp-instance:network:output | ||
let data = serde_json::to_string(&packet).unwrap(); | ||
debug!(%addr, %data, "{}", self); | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl<'a> std::fmt::Display for Debug<'a> { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
Debug::InstanceCreate => { | ||
write!(f, "instance created") | ||
} | ||
Debug::InstanceDelete => { | ||
write!(f, "instance deleted") | ||
} | ||
Debug::InstanceStart => { | ||
write!(f, "starting instance") | ||
} | ||
Debug::InstanceStop(..) => { | ||
write!(f, "stopping instance") | ||
} | ||
Debug::PacketRx(..) | Debug::PacketTx(..) => { | ||
write!(f, "packet") | ||
} | ||
} | ||
} | ||
} | ||
|
||
// ===== impl InstanceInactiveReason ===== | ||
|
||
impl std::fmt::Display for InstanceInactiveReason { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
InstanceInactiveReason::AdminDown => { | ||
write!(f, "administrative status down") | ||
} | ||
InstanceInactiveReason::MissingRouterId => { | ||
write!(f, "missing router-id") | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.