Skip to content

Commit a050bca

Browse files
committed
Fix CPU ports not being detected by port manager
1 parent 3367bc1 commit a050bca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/util/port_manager.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,18 @@ impl PortManager {
283283
}
284284
async fn do_init(&mut self, switch: &SwitchConnection) -> Result<(), RBFRTError> {
285285
let req = table::Request::new("$PORT_STR_INFO");
286-
let all_ports = switch.get_table_entries(req).await?;
286+
287+
// For some reason, the CPU ports are not included if querying without a match key, despite them being present in the $PORT_STR_INFO table.
288+
// So we manually query for them.
289+
let mut all_port_reqs: Vec<table::Request> = (0..4)
290+
.map(|i| {
291+
table::Request::new("$PORT_STR_INFO")
292+
.match_key("$PORT_NAME", MatchValue::exact(format!("33/{}", i)))
293+
})
294+
.collect();
295+
all_port_reqs.push(req);
296+
297+
let all_ports = switch.get_tables_entries(all_port_reqs).await?;
287298

288299
for entry in &all_ports {
289300
let e = entry.get_action_data("$DEV_PORT")?;

0 commit comments

Comments
 (0)