blob: 6b2c9def6add6b8d9bdc6a297aac0a51ec0a388e [file] [log] [blame]
awlane1cec2332025-04-24 17:24:47 -05001# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2#
3# Copyright (C) 2015-2020, The University of Memphis,
4# Arizona Board of Regents,
5# Regents of the University of California.
6#
7# This file is part of Mini-NDN.
8# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
9#
10# Mini-NDN is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# Mini-NDN is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with Mini-NDN, e.g., in COPYING.md file.
22# If not, see <http://www.gnu.org/licenses/>.
23
24from mininet.log import setLogLevel, info
25
26from minindn.minindn import Minindn
27from minindn.apps.nfd import Nfd
28from minindn.apps.tshark import Tshark
29from minindn.apps.app_manager import AppManager
30from minindn.minindn_play.server import PlayServer
31from minindn.minindn_play.monitor import LogMonitor
32
33if __name__ == '__main__':
34 setLogLevel('info')
35
36 Minindn.cleanUp()
37 Minindn.verifyDependencies()
38
39 ndn = Minindn()
40
41 ndn.start()
42
43 info('Starting NFD on nodes\n')
44 nfds = AppManager(ndn, ndn.net.hosts, Nfd, logLevel="DEBUG")
45
46 info('Starting TShark on nodes\n')
47 sharks = AppManager(ndn, ndn.net.hosts, Tshark, singleLogFile=True)
48
49 ndn.initParams(ndn.net.hosts)
50
51 # Set the color of a node
52 ndn.net.hosts[0].params['params']['color'] = "orange"
53
54 # Starts the MiniNDN NDN-Play server
55 # This should print a URL you can open to connect to NDN-Play
56 # Port 8765 must be forwarded from the host running MiniNDN
57 # to the machine running the browser
58 server = PlayServer(ndn.net)
59
60 # This method will track updates to the nfd.log file on each node,
61 # changing the color briefly to indicate updates. This can be used
62 # for a variety of purposes to visualize activity, and is not restricted
63 # to just the NFD log file.
64 server.add_monitor(LogMonitor(ndn.net.hosts, "log/nfd.log", interval=0.2, regex_filter=""))
65
66 server.start()
67
68 ndn.stop()