def nrr_topology(cls): """Return topology for testing NRR caching strategies """ # Topology sketch # # 0 ---- 2----- 4 # | \ # | s # | / # 1 ---- 3 ---- 5 # topology = IcnTopology(fnss.Topology()) nx.add_path(topology, [0, 2, 4, "s", 5, 3, 1]) topology.add_edge(2, 3) receivers = (0, 1) source = "s" caches = (2, 3, 4, 5) contents = (1, 2, 3, 4) fnss.add_stack(topology, source, 'source', {'contents': contents}) for v in caches: fnss.add_stack(topology, v, 'router', {'cache_size': 1}) for v in receivers: fnss.add_stack(topology, v, 'receiver', {}) fnss.set_delays_constant(topology, 1, 'ms') return topology
def on_path_topology(cls): """Return topology for testing on-path caching strategies """ # Topology sketch # # 0 ---- 1 ---- 2 ---- 3 ---- 4 # | # | # 5 # topology = IcnTopology(fnss.line_topology(5)) topology.add_edge(2, 5) source = 4 receivers = (0, 5) caches = (1, 2, 3) contents = caches fnss.add_stack(topology, source, 'source', {'contents': contents}) for v in caches: fnss.add_stack(topology, v, 'router', {'cache_size': 1}) for v in receivers: fnss.add_stack(topology, v, 'receiver', {}) return topology