| from ndn.experiments.experiment import Experiment |
| from ndn.nlsr import Nlsr |
| class FailureExperiment(Experiment): |
| def __init__(self, args): |
| Experiment.__init__(self, args) |
| self.PING_COLLECTION_TIME_BEFORE_FAILURE = 60 |
| self.PING_COLLECTION_TIME_AFTER_RECOVERY = 90 |
| # After the pings are scheduled, collect pings for 1 minute |
| time.sleep(self.PING_COLLECTION_TIME_BEFORE_FAILURE) |
| for host in self.net.hosts: |
| print("Bringing CSU down") |
| # CSU is down for 2 minutes |
| for host in self.net.hosts: |
| host.nfd.setStrategy("/ndn/edu", self.strategy) |
| host.cmd("ndnpingserver /ndn/edu/" + str(host) + " > ping-server &") |
| # Collect pings for more seconds after CSU is up |
| time.sleep(self.PING_COLLECTION_TIME_AFTER_RECOVERY) |
| Experiment.register("failure", FailureExperiment) |