Add a script to generate up-to-date NDN testbed topologies for Mini-NDN
Change-Id: I9686c65fe2f38fbc980c5fb54d876ebb3d9e7ede
diff --git a/docs/howtos.rst b/docs/howtos.rst
index b95bde3..102f6ef 100644
--- a/docs/howtos.rst
+++ b/docs/howtos.rst
@@ -113,3 +113,16 @@
Also, if the local machine has a public IP, Mini-NDN nodes can be
reached via external machines.
+
+Generate NDN testbed topology
+___________________________________________
+
+Run the following install.sh command
+
+::
+
+ python3 util/testbed_topo_generator.py
+
+This will place a "testbed.conf" file in the topologies subdirectory,
+where it can be referenced as desired. To update the topology, simply
+rerun this command.
\ No newline at end of file
diff --git a/install.sh b/install.sh
index 35071b1..72d7271 100755
--- a/install.sh
+++ b/install.sh
@@ -103,7 +103,7 @@
fi
function patchDummy {
- git -C $NDN_SRC/ndn-cxx apply $(pwd)/patches/ndn-cxx-dummy-keychain-from-ndnsim.patch
+ git -C $NDN_SRC/ndn-cxx apply $(pwd)/util/patches/ndn-cxx-dummy-keychain-from-ndnsim.patch
if [[ "$?" -ne 0 ]]; then
echo "Patch might already be applied"
fi
@@ -320,6 +320,10 @@
popd
}
+function testbedTopo {
+ python3 ./testbed_topo_generator.py
+}
+
function commonClientLibraries {
ndn_cpp
pyNDN
@@ -369,6 +373,7 @@
mininet
minindn
commonClientLibraries
+ testbedTopo
break
;;
c) commonClientLibraries;;
diff --git a/topologies/current-testbed.conf b/topologies/current-testbed.conf
deleted file mode 100644
index 32669f9..0000000
--- a/topologies/current-testbed.conf
+++ /dev/null
@@ -1,161 +0,0 @@
-[nodes]
-afa: _ radius=10.3354428445 angle=1.12640207075
-anyang: _ radius=14.3378634978 angle=2.99956859362
-arizona: _ radius=16.2305391314 angle=2.97033285094
-basel: _ radius=13.2717666497 angle=2.41932
-bern: _ radius=13.2717666497 angle=2.42933
-bupt: _ radius=29.2553552716 angle=3.07635893011
-byu: _ radius=19.3538454318 angle=3.77334112453
-cagliari: _ radius=13.5903793307 angle=1.1403443
-caida: _ radius=17.6030443241 angle=2.94302721088
-caruna: _ radius=13.6888312672 angle=1.172
-cnic: _ radius=13.0513265591 angle=2.87446074202
-copelabs: _ radius=16.206035855 angle=2.62082
-csu: _ radius=14.1056931988 angle=2.99266609146
-goettingen: _ radius=12.2349274272 angle=2.4715271786
-indonesia: _ radius=29.2553552716 angle=2.75021570319
-kisti: _ radius=11.5531281288 angle=2.98403796376
-lip6: _ radius=29.2553552716 angle=2.62295081967
-memphis: _ radius=15.264773513 angle=2.98360655738
-michigan: _ radius=17.7738038607 angle=2.98018269082
-minho: _ radius=16.206035855 angle=2.631
-msu: _ radius=19.6533436173 angle=3.64135462555
-mumbai_aws: _ radius=12.8934676597 angle=2.95081967213
-neu: _ radius=19.9001283692 angle=2.13894230769
-nist: _ radius=13.4257788269 angle=2.97670405522
-ntnu: _ radius=12.0281644432 angle=3.11561691113
-osaka: _ radius=19.3573834399 angle=3.53687143598
-padua: _ radius=13.5903793307 angle=1.1393442623
-pkusz: _ radius=11.1495655496 angle=2.87016
-remap: _ radius=16.5866430024 angle=2.99811
-srru: _ radius=12.8769009681 angle=3.63761863676
-systemx: _ radius=19.1697680538 angle=2.62274588692
-tno: _ radius=12.0148443703 angle=2.4603106126
-tongji: _ radius=11.1495655496 angle=2.87015
-uaslp: _ radius=19.0473935894 angle=2.96488127257
-uci: _ radius=19.2697694366 angle=2.94186046512
-ucla: _ radius=16.5866430024 angle=2.999107674
-ufpa: _ radius=29.2553552716 angle=3.51898188093
-uiuc: _ radius=29.2553552716 angle=2.98231233822
-urjc: _ radius=13.6888312672 angle=1.17169974116
-uum: _ radius=14.8351249127 angle=3.44434857636
-waseda: _ radius=19.3583257472 angle=2.99935233161
-wu: _ radius=19.4268485719 angle=4.31067173954
-[links]
-afa:mumbai_aws delay=100ms
-afa:bern delay=15ms
-afa:cagliari delay=25ms
-afa:padua delay=11ms
-afa:copelabs delay=36ms
-anyang:tongji delay=54ms
-anyang:srru delay=57ms
-anyang:msu delay=70ms
-anyang:bupt delay=33ms
-anyang:kisti delay=40ms
-anyang:waseda delay=40ms
-anyang:osaka delay=36ms
-arizona:caida delay=25ms
-arizona:remap delay=25ms
-arizona:waseda delay=75ms
-arizona:byu delay=30ms
-arizona:uaslp delay=100ms
-arizona:wu delay=33ms
-arizona:csu delay=18ms
-arizona:memphis delay=17ms
-basel:urjc delay=14ms
-basel:minho delay=23ms
-basel:ntnu delay=30ms
-basel:padua delay=9ms
-basel:lip6 delay=7ms
-basel:goettingen delay=10ms
-basel:bern delay=2ms
-basel:tno delay=14ms
-basel:systemx delay=9ms
-bern:lip6 delay=18ms
-bupt:pkusz delay=54ms
-bupt:waseda delay=48ms
-bupt:tongji delay=18ms
-bupt:srru delay=72ms
-bupt:indonesia delay=54ms
-bupt:kisti delay=33ms
-bupt:cnic delay=10ms
-byu:csu delay=8ms
-byu:remap delay=9ms
-cagliari:urjc delay=28ms
-cagliari:caruna delay=40ms
-cagliari:padua delay=25ms
-cagliari:wu delay=100ms
-caida:ufpa delay=155ms
-caida:ucla delay=3ms
-caida:uci delay=3ms
-caida:tongji delay=93ms
-caruna:urjc delay=17ms
-caruna:minho delay=27ms
-cnic:pkusz delay=20ms
-cnic:osaka delay=45ms
-copelabs:urjc delay=13ms
-copelabs:minho delay=4ms
-copelabs:padua delay=24ms
-copelabs:lip6 delay=22ms
-copelabs:ufpa delay=145ms
-csu:remap delay=16ms
-csu:kisti delay=106ms
-csu:michigan delay=15ms
-csu:ucla delay=16ms
-csu:uiuc delay=14ms
-goettingen:osaka delay=136ms
-goettingen:ntnu delay=40ms
-goettingen:padua delay=14ms
-goettingen:tno delay=12ms
-goettingen:systemx delay=10ms
-indonesia:waseda delay=49ms
-indonesia:tongji delay=61ms
-indonesia:srru delay=32ms
-indonesia:uum delay=100ms
-indonesia:kisti delay=150ms
-indonesia:ufpa delay=200ms
-kisti:waseda delay=39ms
-lip6:urjc delay=15ms
-lip6:michigan delay=69ms
-lip6:ntnu delay=25ms
-lip6:tno delay=9ms
-lip6:systemx delay=1ms
-memphis:michigan delay=12ms
-memphis:uaslp delay=100ms
-memphis:wu delay=17ms
-memphis:ufpa delay=115ms
-memphis:neu delay=21ms
-michigan:uiuc delay=5ms
-michigan:neu delay=14ms
-michigan:nist delay=13ms
-minho:urjc delay=13ms
-minho:padua delay=26ms
-msu:pkusz delay=71ms
-msu:srru delay=3ms
-msu:ucla delay=150ms
-msu:uum delay=100ms
-msu:tno delay=120ms
-mumbai_aws:uum delay=100ms
-neu:ntnu delay=69ms
-neu:nist delay=12ms
-nist:uiuc delay=12ms
-ntnu:systemx delay=24ms
-osaka:pkusz delay=63ms
-osaka:waseda delay=5ms
-osaka:srru delay=67ms
-osaka:tongji delay=63ms
-osaka:uum delay=100ms
-padua:urjc delay=15ms
-padua:pkusz delay=170ms
-padua:uiuc delay=80ms
-pkusz:tongji delay=54ms
-pkusz:srru delay=71ms
-pkusz:waseda delay=98ms
-remap:ucla delay=1ms
-remap:uci delay=1ms
-srru:uum delay=100ms
-tongji:waseda delay=98ms
-uaslp:ufpa delay=100ms
-uci:ucla delay=1ms
-uiuc:wu delay=9ms
-urjc:wu delay=86ms
diff --git a/topologies/minindn.testbed.conf b/topologies/minindn.testbed.conf
deleted file mode 100644
index 0073f50..0000000
--- a/topologies/minindn.testbed.conf
+++ /dev/null
@@ -1,74 +0,0 @@
-[nodes]
-unibas: _ radius=13.2717666496574 angle=2.41932700603969
-bupt: _ radius=11.5095245566676 angle=2.87230371009491
-pku: _ radius=11.1495655496376 angle=2.87014667817084
-tongji: _ radius=11.1495655496376 angle=2.8701500000
-orange: _ radius=10.9327229663161 angle=2.7739430543572
-arizona: _ radius=16.2305391313912 angle=2.97033285094067
-byu: _ radius=19.353845431776 angle=3.77334112452928
-csu: _ radius=14.1056931988398 angle=2.99266609145815
-uiuc: _ radius=29.2553552716 angle=2.98231233822261
-memphis: _ radius=15.2647735129845 angle=2.98360655737705
-neu: _ radius=19.9001283692128 angle=2.13894230769231
-uci: _ radius=19.2697694366069 angle=2.94186046511628
-ucla: _ radius=16.5866430024476 angle=2.99910767400357
-remap: _ radius=16.5866430024476 angle=2.9991100000
-umich: _ radius=17.7738038607456 angle=2.98018269081901
-wustl: _ radius=19.426848571939 angle=4.31067173953721
-urjc: _ radius=13.6888312671789 angle=1.17169974115617
-systemx: _ radius=19.1697680538273 angle=2.62274588691716
-lip6: _ radius=29.2553552716 angle=2.62295081967213
-waseda: _ radius=19.3583257471934 angle=2.99935233160622
-anyang: _ radius=14.3378634978013 angle=2.99956859361519
-caida: _ radius=17.6030443241278 angle=2.94302721088435
-[links]
-bupt:pku delay=14ms
-pku:unibas delay=127ms
-pku:tongji delay=14ms
-bupt:anyang delay=33ms
-bupt:tongji delay=18ms
-anyang:tongji delay=54ms
-bupt:waseda delay=48ms
-tongji:waseda delay=98ms
-tongji:caida delay=93ms
-caida:ucla delay=3ms
-anyang:pku delay=38ms
-anyang:waseda delay=22ms
-ucla:pku delay=85ms
-ucla:remap delay=1ms
-caida:uci delay=3ms
-uci:ucla delay=1ms
-uci:remap delay=1ms
-ucla:csu delay=16ms
-remap:csu delay=16ms
-caida:arizona delay=25ms
-waseda:arizona delay=75ms
-remap:arizona delay=25ms
-arizona:wustl delay=33ms
-wustl:uiuc delay=9ms
-csu:uiuc delay=14ms
-uiuc:umich delay=5ms
-csu:byu delay=8ms
-byu:remap delay=9ms
-byu:arizona delay=30ms
-wustl:urjc delay=86ms
-wustl:memphis delay=17ms
-arizona:memphis delay=17ms
-waseda:orange delay=144ms
-orange:systemx delay=2ms
-unibas:systemx delay=10ms
-memphis:neu delay=21ms
-pku:neu delay=112ms
-csu:umich delay=15ms
-urjc:lip6 delay=15ms
-urjc:unibas delay=9ms
-lip6:systemx delay=2ms
-unibas:lip6 delay=18ms
-memphis:umich delay=12ms
-memphis:orange delay=56ms
-urjc:orange delay=15ms
-lip6:orange delay=3ms
-lip6:umich delay=69ms
-unibas:orange delay=18ms
-umich:neu delay=14ms
-csu:arizona delay=18ms
diff --git a/topologies/testbed.conf b/topologies/testbed.conf
new file mode 100644
index 0000000..54e7213
--- /dev/null
+++ b/topologies/testbed.conf
@@ -0,0 +1,134 @@
+[nodes]
+UNIVH2C: _ radius=15.7232 angle=3.03408
+MINHO: _ radius=16.2060 angle=2.62083
+MSU: _ radius=19.6533 angle=3.64135
+AVEIRO: _ radius=16.2060 angle=2.62081
+BASEL: _ radius=13.2717 angle=2.41932
+WU: _ radius=19.4268 angle=4.31067
+NEU: _ radius=19.9001 angle=2.13894
+UASLP: _ radius=19.0473 angle=2.96488
+UIUC: _ radius=29.2553 angle=2.98231
+COPELABS: _ radius=16.2060 angle=2.62082
+PADUA: _ radius=13.5903 angle=1.13934
+CNIC: _ radius=13.05132 angle=2.87446
+LIP6: _ radius=29.2553 angle=2.62295
+ANYANG: _ radius=14.3378 angle=2.99956
+UFBA: _ radius=29.2553 angle=3.51898
+MUMBAI_AWS: _ radius=12.8934 angle=2.95081
+GIST: _ radius=11.5531 angle=2.98403
+LACL: _ radius=12.5144 angle=2.62296
+MICHIGAN: _ radius=17.7738 angle=2.98018
+AFA: _ radius=10.3354 angle=1.12640
+WASEDA: _ radius=19.3583 angle=2.99935
+CORUNA: _ radius=13.6888 angle=1.17180
+CSU: _ radius=14.1056 angle=2.99266
+TNO: _ radius=12.0148 angle=2.46031
+BERN: _ radius=13.2717 angle=2.41933
+URJC: _ radius=13.6888 angle=1.17169
+ARIZONA: _ radius=16.2305 angle=2.97033
+SRRU: _ radius=12.8769 angle=3.63761
+MEMPHIS: _ radius=15.2647 angle=2.98360
+OSAKA: _ radius=19.3573 angle=3.53687
+TONGJI: _ radius=11.1495 angle=2.87015
+UCLA: _ radius=16.5866 angle=2.99911
+UUM: _ radius=14.8351 angle=3.44434
+QUB: _ radius=17.8582321576696 angle=2.42743127401714
+SAVI: _ radius=19.5605 angle=4.04925
+GOETTINGEN: _ radius=12.2349 angle=2.47152
+UCLACS: _ radius=16.5866 angle=2.99910
+[links]
+MICHIGAN:NEU delay=14ms
+MICHIGAN:MEMPHIS delay=12ms
+MICHIGAN:UIUC delay=5ms
+MICHIGAN:CSU delay=15ms
+WU:ARIZONA delay=33ms
+ARIZONA:CSU delay=18ms
+ARIZONA:MEMPHIS delay=17ms
+UIUC:CSU delay=14ms
+UIUC:WU delay=9ms
+MEMPHIS:WU delay=17ms
+MEMPHIS:NEU delay=21ms
+CSU:UCLACS delay=16ms
+LIP6:MICHIGAN delay=69ms
+URJC:LIP6 delay=15ms
+URJC:WU delay=86ms
+BASEL:LIP6 delay=18ms
+BASEL:URJC delay=9ms
+WASEDA:TONGJI delay=98ms
+ARIZONA:WASEDA delay=75ms
+ANYANG:WASEDA delay=22ms
+ANYANG:TONGJI delay=54ms
+UIUC:PADUA delay=80ms
+BASEL:PADUA delay=9ms
+URJC:PADUA delay=15ms
+COPELABS:URJC delay=13ms
+COPELABS:PADUA delay=23ms
+COPELABS:LIP6 delay=21ms
+BASEL:GOETTINGEN delay=21ms
+PADUA:GOETTINGEN delay=21ms
+WASEDA:OSAKA delay=5ms
+GOETTINGEN:OSAKA delay=136ms
+ANYANG:OSAKA delay=36ms
+TONGJI:OSAKA delay=63ms
+COPELABS:MINHO delay=4ms
+BASEL:MINHO delay=23ms
+PADUA:MINHO delay=26ms
+URJC:MINHO delay=13ms
+UFBA:COPELABS delay=145ms
+UFBA:MEMPHIS delay=115ms
+SRRU:OSAKA delay=13ms
+SRRU:ANYANG delay=13ms
+TNO:GOETTINGEN delay=38ms
+TNO:LIP6 delay=38ms
+TNO:BASEL delay=38ms
+SRRU:MSU delay=5ms
+UCLACS:MSU delay=150ms
+TNO:MSU delay=120ms
+ANYANG:MSU delay=70ms
+CNIC:OSAKA delay=45ms
+BERN:BASEL delay=2ms
+BERN:AFA delay=15ms
+COPELABS:AFA delay=36ms
+PADUA:AFA delay=11ms
+MSU:UUM delay=26ms
+SRRU:UUM delay=42ms
+AFA:MUMBAI_AWS delay=72ms
+OSAKA:UUM delay=100ms
+UUM:MUMBAI_AWS delay=88ms
+UASLP:MEMPHIS delay=100ms
+UASLP:ARIZONA delay=32ms
+UASLP:UFBA delay=100ms
+MINHO:CORUNA delay=27ms
+URJC:CORUNA delay=17ms
+ANYANG:GIST delay=4ms
+MINHO:AVEIRO delay=2ms
+COPELABS:AVEIRO delay=4ms
+AFA:AVEIRO delay=45ms
+PADUA:UNIVH2C delay=50ms
+COPELABS:UNIVH2C delay=50ms
+URJC:UNIVH2C delay=52ms
+WU:MUMBAI_AWS delay=122ms
+UCLACS:ARIZONA delay=25ms
+WU:AVEIRO delay=75ms
+WU:UNIVH2C delay=75ms
+WU:UFBA delay=65ms
+UNIVH2C:UFBA delay=125ms
+AVEIRO:URJC delay=15ms
+UCLACS:WU delay=30ms
+NEU:SAVI delay=15ms
+MICHIGAN:SAVI delay=15ms
+LIP6:LACL delay=4ms
+BERN:LACL delay=18ms
+UNIVH2C:LACL delay=50ms
+QUB:WU delay=60ms
+QUB:TNO delay=15ms
+QUB:LIP6 delay=12ms
+QUB:NEU delay=60ms
+UCLA:ARIZONA delay=25ms
+UCLA:WU delay=30ms
+UCLA:UCLACS delay=1ms
+TONGJI:CNIC delay=18ms
+ANYANG:CNIC delay=33ms
+CSU:UCLA delay=16ms
+ANYANG:UCLA delay=100ms
+OSAKA:ARIZONA delay=100ms
diff --git a/patches/ndn-cxx-dummy-keychain-from-ndnsim.patch b/util/patches/ndn-cxx-dummy-keychain-from-ndnsim.patch
similarity index 100%
rename from patches/ndn-cxx-dummy-keychain-from-ndnsim.patch
rename to util/patches/ndn-cxx-dummy-keychain-from-ndnsim.patch
diff --git a/util/testbed_topo_generator.py b/util/testbed_topo_generator.py
new file mode 100755
index 0000000..4730587
--- /dev/null
+++ b/util/testbed_topo_generator.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python3
+# -*- Mode:bash; 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/>.
+
+# This script generates a testbed topology based on current data. Note
+# that this topology is memory intensive and can have issues on lower specced
+# systems due to its size.
+# To use, run with python3
+
+import argparse
+import datetime
+import json
+import logging
+from os import path
+from urllib.request import urlopen
+
+def testbedGen():
+ """Returns a string with the Mini-NDN topology version of the testbed"""
+ topology = None
+ connections = None
+ hosts = []
+ links = []
+ try:
+ with urlopen("https://ndndemo.arl.wustl.edu/testbedNodes.json") as url:
+ topology = json.loads(url.read().decode())
+ with urlopen("https://ndndemo.arl.wustl.edu/links.json") as url:
+ connections = json.loads(url.read().decode())
+ except:
+ logging.error("Failed to retrieve testbed info from WUSTL servers")
+ if __name__ == '__main__':
+ from sys import exit
+ exit(1)
+ raise
+
+ logging.info("Generating testbed topology...")
+ for node_name in topology:
+ node = topology[node_name]
+ if node['neighbors']:
+ radius = node['hr_radius']
+ angle = node['hr_angle']
+ host_str = "{}: _ radius={} angle={}\n".format(node_name, radius, angle)
+ hosts.append(host_str)
+ logging.debug("Add node: {}".format(host_str)[:-1])
+ else:
+ # A node without neighbors shouldn't be considered part of the testbed
+ # for testing purposes
+ logging.debug("Node {} has no neighbors, passing...".format(node_name))
+ for link in connections:
+ node1 = link['start']
+ node2 = link['end']
+ # This value is equivalent to RTT in the testbed
+ delay = link['nlsr_weight']
+ link_str = "{}:{} delay={}ms\n".format(node1, node2, delay)
+ logging.debug("Add link: {}".format(link_str)[:-1])
+ links.append(link_str.strip())
+
+ topo_str = "[nodes]\n"
+ for host in hosts:
+ topo_str = topo_str + host
+ topo_str = topo_str + "[links]\n"
+ for link in links:
+ topo_str = topo_str + link
+ return topo_str.strip()
+
+if __name__ == '__main__':
+ default_path = path.dirname(__file__) + '/../topologies/testbed{}.conf'.format(str(datetime.date.today()))
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-l", "--log_level", help="Log level to output", default="info", choices=["debug", "info", "warning", "error"])
+ parser.add_argument("-o", "--output_dir", help="File output location", default=default_path)
+ args = parser.parse_args()
+ log_level = getattr(logging, args.log_level.upper())
+ topologies_path = path.abspath(args.output_dir)
+ logging.basicConfig(format="%(levelname)s: %(message)s", level=log_level)
+ topo = testbedGen()
+ logging.info("Testbed generated, writing to file...")
+ with open(topologies_path, "w") as file:
+ file.writelines(topo)
+ logging.info("Finished")
\ No newline at end of file