def nrr_topology(cls): """Return topology for testing NRR caching strategies """ # Topology sketch # # 0 ---- 2----- 4 # | \ # | s # | / # 1 ---- 3 ---- 5 # topology = IcnTopology(fnss.Topology()) topology.add_path([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 build_topology(cls): # Topology sketch # # 0 ---- 1 ---- 2 ---- 3 ---- 4 # | | # | | # 5 -- 6 - 7 -- 8 # topology = IcnTopology() topology.add_path([0, 1, 2, 3, 4], a=1, b=1) topology.add_path([1, 5, 6, 7, 8, 3], b=2, c=2) source = 4 receiver = 0 caches = (1, 2, 3, 5, 6, 7, 8) contents = [1, 2, 3] fnss.add_stack(topology, source, 'source', {'contents': contents}) fnss.add_stack(topology, receiver, 'receiver', {}) for v in caches: fnss.add_stack(topology, v, 'router', {'cache_size': 1}) return topology