blob: e325edb8a56a22e05a86675e72b90f2619a8ddb1 [file] [log] [blame]
awlane1cec2332025-04-24 17:24:47 -05001from mininet.net import Mininet
2from minindn.util import is_valid_hostid, run_popen
3
4class StateExecutor:
5 def __init__(self, net: Mininet):
6 self.net = net
7
8 async def get_fib(self, node_id):
9 """UI Function: Get the NFDC status report and ifconfig as the fib"""
10 if not is_valid_hostid(self.net, node_id):
11 if node_id in self.net:
12 node = self.net[node_id]
13 return { "id": node_id, "fib": f"Node is not a host ({node.__class__.__name__})" }
14 return
15
16 node = self.net[node_id]
17 nfd_status = run_popen(node, "nfdc status report".split()).decode("utf-8")
18 ifconfig = run_popen(node, "ifconfig".split()).decode("utf-8")
19 output = nfd_status + "\n" + ifconfig
20 return {
21 "id": node_id,
22 "fib": output,
23 }