Skip to content

Commit

Permalink
bfd, bgp, ldp: exclude port numbers in testing mode
Browse files Browse the repository at this point in the history
L4 port numbers are non-deterministic, they change whenever a
test topology runs. As such, they shouldn't be included in the
operational data output when running in testing mode.

Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Apr 7, 2024
1 parent 078c9c8 commit 8b34b69
Show file tree
Hide file tree
Showing 80 changed files with 196 additions and 553 deletions.
4 changes: 4 additions & 0 deletions holo-bfd/src/northbound/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ fn load_callbacks() -> Callbacks<Master> {
sess.state.remote.as_ref().map(|remote| remote.multiplier)
})
.path(bfd::ip_sh::sessions::session::source_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_master, _args| {
Some(*network::PORT_SRC_RANGE.start())
})
.path(bfd::ip_sh::sessions::session::dest_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_master, _args| {
Some(network::PORT_DST_SINGLE_HOP)
})
Expand Down Expand Up @@ -332,10 +334,12 @@ fn load_callbacks() -> Callbacks<Master> {
sess.state.remote.as_ref().map(|remote| remote.multiplier)
})
.path(bfd::ip_mh::session_groups::session_group::sessions::source_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_master, _args| {
Some(*network::PORT_SRC_RANGE.start())
})
.path(bfd::ip_mh::session_groups::session_group::sessions::dest_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_master, _args| {
Some(network::PORT_DST_MULTIHOP)
})
Expand Down
2 changes: 2 additions & 0 deletions holo-bgp/src/northbound/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,13 @@ fn load_callbacks() -> Callbacks<Instance> {
nbr.conn_info.as_ref().map(|conn_info| conn_info.local_addr)
})
.path(bgp::neighbors::neighbor::local_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_instance, args| {
let nbr = args.list_entry.as_neighbor().unwrap();
nbr.conn_info.as_ref().map(|conn_info| conn_info.local_port)
})
.path(bgp::neighbors::neighbor::remote_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_instance, args| {
let nbr = args.list_entry.as_neighbor().unwrap();
nbr.conn_info.as_ref().map(|conn_info| conn_info.remote_port)
Expand Down
2 changes: 2 additions & 0 deletions holo-ldp/src/northbound/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ fn load_callbacks() -> Callbacks<Instance> {
nbr.conn_info.as_ref().map(|conn_info| conn_info.local_addr)
})
.path(mpls_ldp::peers::peer::tcp_connection::local_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_instance, args| {
let nbr = args.list_entry.as_neighbor().unwrap();
nbr.conn_info.as_ref().map(|conn_info| conn_info.local_port)
Expand All @@ -510,6 +511,7 @@ fn load_callbacks() -> Callbacks<Instance> {
nbr.conn_info.as_ref().map(|conn_info| conn_info.remote_addr)
})
.path(mpls_ldp::peers::peer::tcp_connection::remote_port::PATH)
.attributes(NodeAttributes::PORT_NO)
.get_element_u16(|_instance, args| {
let nbr = args.list_entry.as_neighbor().unwrap();
nbr.conn_info.as_ref().map(|conn_info| conn_info.remote_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -969,9 +967,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1028,9 +1024,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -950,9 +948,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1009,9 +1005,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -969,9 +967,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1028,9 +1024,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -950,9 +948,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1009,9 +1005,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -958,9 +956,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1017,9 +1013,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -722,9 +720,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -969,9 +967,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1028,9 +1024,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -969,9 +967,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1036,9 +1032,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -790,9 +788,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -790,9 +788,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 34139,
"remote-address": "1.1.1.1",
"remote-port": 646
"remote-address": "1.1.1.1"
},
"statistics": {
"total-addresses": 2,
Expand Down Expand Up @@ -1005,9 +1003,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "3.3.3.3",
"remote-port": 37703
"remote-address": "3.3.3.3"
},
"statistics": {
"total-addresses": 4,
Expand Down Expand Up @@ -1064,9 +1060,7 @@
"session-state": "operational",
"tcp-connection": {
"local-address": "2.2.2.2",
"local-port": 646,
"remote-address": "4.4.4.4",
"remote-port": 39091
"remote-address": "4.4.4.4"
},
"statistics": {
"total-addresses": 5,
Expand Down
Loading

0 comments on commit 8b34b69

Please sign in to comment.