blob: cbd8ac8dfce35a2621bc73c672ab8c75fa309f7a [file] [log] [blame]
Ashlesh Gawande27b5e1b2018-08-06 17:47:15 -05001# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2#
3# Copyright (C) 2015-2018, 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 ndn.experiments.experiment import Experiment
25from ndn.apps.nlsr import Nlsr, NlsrConfigGenerator
26
27from mininet.log import info
28
29import time, sys
30
31class AdvertiseDelayedStartExperiment(Experiment):
32 '''Tests Name LSA data segmentation'''
33
34 def __init__(self, args):
35 Experiment.__init__(self, args)
36
37 def setup(self):
38 pass
39
40 def run(self):
41 pass
42
43 def startNlsr(self, checkConvergence = True):
44 # NLSR Security
45 if self.options.nlsrSecurity is True:
46 Nlsr.createKeysAndCertificates(self.net, self.options.workDir)
47
48 host1 = self.net.hosts[0]
49 host1.nlsr = Nlsr(host1, self.options)
50 host1.nlsr.start()
51
52 expectedTotalCount = 500
53 for i in range(0, expectedTotalCount):
54 host1.cmd("nlsrc advertise /long/name/to/exceed/max/packet/size/host1/{}".format(i))
55
56 time.sleep(60)
57
58 host2 = self.net.hosts[1]
59 host2.nlsr = Nlsr(host2, self.options)
60 host2.nlsr.start()
61
62 time.sleep(60)
63
64 advertiseCount = int(host2.cmd("nfdc fib | grep host1 | wc -l"))
65 info(advertiseCount)
66 if advertiseCount == expectedTotalCount:
67 info('\nSuccessfully advertised {} prefixes\n'.format(expectedTotalCount))
68 else:
69 info('\nAdvertising {} prefixes failed. Exiting...\n'.format(expectedTotalCount))
70 self.net.stop()
71 sys.exit(1)
72
73Experiment.register("advertise-delayed-start", AdvertiseDelayedStartExperiment)