Add NDN Play integration to Mini-NDN code base
Integrate the minindn_play project by Varun Patil into
the base Mini-NDN codebase; this will allow for the
use of the NDN-Play browser UI with minimal additional
dependencies or setup.
Refs #5359
Change-Id: I4fedfa885b07d7fe946a18c6d9b5016d291b3582
diff --git a/minindn/minindn_play/net/state.py b/minindn/minindn_play/net/state.py
new file mode 100644
index 0000000..e325edb
--- /dev/null
+++ b/minindn/minindn_play/net/state.py
@@ -0,0 +1,23 @@
+from mininet.net import Mininet
+from minindn.util import is_valid_hostid, run_popen
+
+class StateExecutor:
+ def __init__(self, net: Mininet):
+ self.net = net
+
+ async def get_fib(self, node_id):
+ """UI Function: Get the NFDC status report and ifconfig as the fib"""
+ if not is_valid_hostid(self.net, node_id):
+ if node_id in self.net:
+ node = self.net[node_id]
+ return { "id": node_id, "fib": f"Node is not a host ({node.__class__.__name__})" }
+ return
+
+ node = self.net[node_id]
+ nfd_status = run_popen(node, "nfdc status report".split()).decode("utf-8")
+ ifconfig = run_popen(node, "ifconfig".split()).decode("utf-8")
+ output = nfd_status + "\n" + ifconfig
+ return {
+ "id": node_id,
+ "fib": output,
+ }