Created
September 9, 2021 16:05
-
-
Save pulsejet/77f97979a8fc80393e2d1f064013700c to your computer and use it in GitHub Desktop.
DCT test scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[nodes] | |
Texas: _ network=/world router=/Texas.Router/ | |
California: _ network=/world router=/California.Router/ | |
s1: _ network=/world router=/s1.Router/ | |
s2: _ network=/world router=/s2.Router/ | |
bob: _ network=/world router=/bob.Router/ | |
alice: _ network=/world router=/alice.Router/ | |
[links] | |
alice:bob delay=10ms | |
alice:s1 delay=10ms | |
s1:California delay=10ms | |
California:Texas delay=10ms | |
Texas:s2 delay=10ms | |
bob:s2 delay=10ms | |
alice:s2 delay=10ms | |
bob:s1 delay=10ms | |
s1:Texas delay=10ms | |
s2:California delay=10ms | |
s2:s1 delay=10ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ | |
# | |
# Copyright (C) 2015-2020, The University of Memphis, | |
# Arizona Board of Regents, | |
# Regents of the University of California. | |
# | |
# This file is part of Mini-NDN. | |
# See AUTHORS.md for a complete list of Mini-NDN authors and contributors. | |
# | |
# Mini-NDN is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# Mini-NDN is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with Mini-NDN, e.g., in COPYING.md file. | |
# If not, see <http://www.gnu.org/licenses/>. | |
import sys | |
from mininet.log import setLogLevel, info | |
from minindn.minindn import Minindn | |
from minindn.util import MiniNDNCLI | |
from minindn.apps.app_manager import AppManager | |
from minindn.apps.nfd import Nfd | |
from minindn.helpers.ndn_routing_helper import NdnRoutingHelper | |
from minindn.helpers.nfdc import Nfdc | |
from minindn.apps.tshark import Tshark | |
from tqdm import tqdm | |
if __name__ == '__main__': | |
setLogLevel('info') | |
Minindn.cleanUp() | |
Minindn.verifyDependencies() | |
ndn = Minindn() | |
ndn.start() | |
info('Starting NFD on nodes\n') | |
nfds = AppManager(ndn, ndn.net.hosts, Nfd) | |
info('Setting NFD strategy to multicast on all nodes with prefix') | |
for node in tqdm(ndn.net.hosts): | |
Nfdc.setStrategy(node, "/localnet", Nfdc.STRATEGY_MULTICAST) | |
info('Adding static routes to NFD\n') | |
grh = NdnRoutingHelper(ndn.net, 'udp', 'link-state') | |
# For all host, pass ndn.net.hosts or a list, [ndn.net['a'], ..] or [ndn.net.hosts[0],.] | |
grh.addOrigin(ndn.net.hosts, ["/localnet"]) | |
for host in ndn.net.hosts: | |
if host.name == 'alice' or host.name == 'bob': | |
grh.addOrigin([host], ["/myNet/mbpsDemo/controller/" + host.name]) | |
print(host.name) | |
if host.name == 'california' or host.name == 'texas': | |
grh.addOrigin([host], ["/myNet/mbpsDemo/gateway/" + host.name.title()]) | |
print(host.name) | |
grh.calculateNPossibleRoutes() | |
info('Route addition to NFD completed\n') | |
info('Starting TShark on nodes\n') | |
sharks = AppManager(ndn, ndn.net.hosts, Tshark) | |
MiniNDNCLI(ndn.net) | |
ndn.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment