Skip to content

Commit

Permalink
ospf: add conformance tests for hostname and node-tag updates
Browse files Browse the repository at this point in the history
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
  • Loading branch information
rwestphal committed Feb 12, 2025
1 parent 36d5a34 commit b6cf4a8
Show file tree
Hide file tree
Showing 18 changed files with 6,303 additions and 4 deletions.
6 changes: 4 additions & 2 deletions holo-ospf/src/ospfv2/packet/lsa_opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ pub struct LsaRouterInfo {
pub srlb: Vec<SrLocalBlockTlv>,
pub msds: Option<MsdTlv>,
pub srms_pref: Option<SrmsPrefTlv>,
#[serde(skip)]
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub info_hostname: Option<DynamicHostnameTlv>,
#[serde(skip)]
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub node_tags: Vec<NodeAdminTagTlv>,
pub unknown_tlvs: Vec<UnknownTlv>,
}
Expand Down
6 changes: 4 additions & 2 deletions holo-ospf/src/ospfv3/packet/lsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,10 +954,12 @@ pub struct LsaRouterInfo {
#[new(default)]
pub srms_pref: Option<SrmsPrefTlv>,
#[new(default)]
#[serde(skip)]
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub info_hostname: Option<DynamicHostnameTlv>,
#[new(default)]
#[serde(skip)]
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub node_tags: Vec<NodeAdminTagTlv>,
#[new(default)]
pub unknown_tlvs: Vec<UnknownTlv>,
Expand Down
60 changes: 60 additions & 0 deletions holo-ospf/tests/conformance/ospfv2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,31 @@ async fn nb_config_iface1() {
run_test::<Instance<Ospfv2>>("nb-config-iface1", "topo1-1", "rt2").await;
}

// Test description:
//
// Input:
// * Northbound: configure two admin node tags (10 and 20)
// Output:
// * Northbound:
// - the self-originated RI-LSA now contains two admin node tags
// - the retransmission queue length of all adjacencies increases to 1
// - the SPF Delay FSM state transitions from "quiet" to "short-wait"
// * Protocol: send an LS Update to all adjacencies containing the updated
// RI-LSA
//
// Input:
// * Northbound: remove the two previously configured admin node tags
// Output:
// * Northbound:
// - the self-originated RI-LSA no longer contains admin node tags
// * Protocol: send an LS Update to all adjacencies containing the updated
// RI-LSA
#[tokio::test]
async fn nb_config_node_tags1() {
run_test::<Instance<Ospfv2>>("nb-config-node-tags1", "topo2-1", "rt6")
.await;
}

// Test description:
//
// Input:
Expand Down Expand Up @@ -1285,6 +1310,41 @@ async fn sb_addr_del3() {
run_test::<Instance<Ospfv2>>("sb-addr-del3", "topo2-1", "rt2").await;
}

// Test description:
//
// Input:
// * Southbound: hostname update ("earth")
// Output:
// * Northbound:
// - the self-originated RI-LSA now contains the "earth" hostname
// - the "hostnames" list now maps Router ID 6.6.6.6 to the hostname "earth"
// - the retransmission queue length of all adjacencies increases to 1
// - the SPF Delay FSM state transitions from "quiet" to "short-wait"
// * Protocol: send an LS Update to all adjacencies containing the updated
// RI-LSA
//
// Input:
// * Southbound: hostname update ("mars")
// Output:
// * Northbound:
// - the self-originated RI-LSA now contains the "mars" hostname
// - the "hostnames" list now maps Router ID 6.6.6.6 to the hostname "mars"
// * Protocol: send an LS Update to all adjacencies containing the updated
// RI-LSA
//
// Input:
// * Southbound: hostname update (none)
// Output:
// * Northbound:
// - the self-originated RI-LSA now has no hostname
// - the "hostnames" list is removed
// * Protocol: send an LS Update to all adjacencies containing the updated
// RI-LSA
#[tokio::test]
async fn sb_hostname_update1() {
run_test::<Instance<Ospfv2>>("sb-hostname-update1", "topo2-1", "rt6").await;
}

// Test description:
//
// Input:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"ietf-routing:routing": {
"@": {
"yang:operation": "none"
},
"control-plane-protocols": {
"control-plane-protocol": [
{
"type": "ietf-ospf:ospfv2",
"name": "test",
"ietf-ospf:ospf": {
"node-tags": {
"node-tag": [
{
"@": {
"yang:operation": "create"
},
"tag": 10
},
{
"@": {
"yang:operation": "create"
},
"tag": 20
}
]
}
}
}
]
}
}
}
Loading

0 comments on commit b6cf4a8

Please sign in to comment.