Ejemplo n.º 1
0
    def setUp(self):
        self.parser: DefaultNFNParser = DefaultNFNParser()

        synced_data_struct_factory = PiCNSyncDataStructFactory()
        synced_data_struct_factory.register("cs", ContentStoreMemoryExact)
        synced_data_struct_factory.register(
            "fib", ForwardingInformationBaseMemoryPrefix)
        synced_data_struct_factory.register("pit",
                                            PendingInterstTableMemoryExact)
        synced_data_struct_factory.register("computation_table",
                                            NFNComputationList)
        synced_data_struct_factory.register("faceidtable", FaceIDDict)
        synced_data_struct_factory.create_manager()

        cs = synced_data_struct_factory.manager.cs()
        fib = synced_data_struct_factory.manager.fib()
        pit = synced_data_struct_factory.manager.pit()
        faceidtable = synced_data_struct_factory.manager.faceidtable()

        self.r2cclient = TimeoutR2CHandler()
        parser = DefaultNFNParser()
        comp_table = synced_data_struct_factory.manager.computation_table(
            self.r2cclient, parser)

        self.optimizer: ToDataFirstOptimizer = ToDataFirstOptimizer(
            cs, fib, pit, faceidtable)
Ejemplo n.º 2
0
    def setUp(self):
        self.encoder_type = self.get_encoder()
        self.simulation_bus = SimulationBus(packetencoder=self.encoder_type())

        self.fetch_tool1 = Fetch(
            "nfn1",
            None,
            255,
            self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("fetchtool1")])

        self.nfn1 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn1")],
            log_level=255,
            ageing_interval=1)
        self.nfn2 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn2")],
            log_level=255,
            ageing_interval=1)

        self.simulation_bus.add_interface("deadend")

        self.nfn1.icnlayer.pit.set_pit_timeout(0)
        self.nfn1.icnlayer.cs.set_cs_timeout(30)
        self.nfn2.icnlayer.pit.set_pit_timeout(0)
        self.nfn2.icnlayer.cs.set_cs_timeout(30)

        self.nfn1.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn1.icnlayer.cs, self.nfn1.icnlayer.fib,
            self.nfn1.icnlayer.pit, self.nfn1.linklayer.faceidtable)
        self.nfn2.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn2.icnlayer.cs, self.nfn2.icnlayer.fib,
            self.nfn2.icnlayer.pit, self.nfn2.linklayer.faceidtable)

        self.mgmt_client1 = MgmtClient(
            self.nfn1.mgmt.mgmt_sock.getsockname()[1])
        self.mgmt_client2 = MgmtClient(
            self.nfn2.mgmt.mgmt_sock.getsockname()[1])
Ejemplo n.º 3
0
 def __init__(self, cs: BaseContentStore, fib: BaseForwardingInformationBase, pit: BasePendingInterestTable,
              faceidtable: BaseFaceIDTable,
              comp_table: BaseNFNComputationTable, executors: Dict[str, type(BaseNFNExecutor)],
              parser: DefaultNFNParser, r2c_client: BaseR2CHandler, log_level: int=255):
     super().__init__("NFN-Layer", log_level=log_level)
     self.cs = cs
     self.fib = fib
     self.pit = pit
     self.faceidtable = faceidtable
     self.computation_table = comp_table
     self.executors = executors
     self.r2cclient = r2c_client
     self.parser: DefaultNFNParser = parser
     self.optimizer: BaseNFNOptimizer = ToDataFirstOptimizer(self.cs, self.fib, self.pit, self.faceidtable)
Ejemplo n.º 4
0
    def setUp(self):
        self.encoder_type = self.get_encoder()
        self.simulation_bus = SimulationBus(packetencoder=self.encoder_type())

        self.fetch_tool1 = Fetch(
            "nfn0",
            None,
            255,
            self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("fetchtool1")])

        self.nfn0 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn0")],
            log_level=255,
            ageing_interval=1)
        self.nfn1 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn1")],
            log_level=255,
            ageing_interval=1)
        self.nfn2 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn2")],
            log_level=255,
            ageing_interval=1)
        self.nfn3 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn3")],
            log_level=255,
            ageing_interval=1)
        self.nfn4 = NFNForwarder(
            port=0,
            encoder=self.encoder_type(),
            interfaces=[self.simulation_bus.add_interface("nfn4")],
            log_level=255,
            ageing_interval=1)

        self.repo1 = ICNDataRepository(
            "/tmp/repo1", Name("/repo/r1"), 0, 255, self.encoder_type(), False,
            False, [self.simulation_bus.add_interface("repo1")])
        self.repo2 = ICNDataRepository(
            "/tmp/repo2", Name("/repo/r2"), 0, 255, self.encoder_type(), False,
            False, [self.simulation_bus.add_interface("repo2")])
        self.repo3 = ICNDataRepository(
            "/tmp/repo3", Name("/repo/r3"), 0, 255, self.encoder_type(), False,
            False, [self.simulation_bus.add_interface("repo3")])
        self.repo4 = ICNDataRepository(
            "/tmp/repo4", Name("/repo/r4"), 0, 255, self.encoder_type(), False,
            False, [self.simulation_bus.add_interface("repo4")])

        self.nfn1.icnlayer.pit.set_pit_timeout(0)
        self.nfn1.icnlayer.cs.set_cs_timeout(30)
        self.nfn2.icnlayer.pit.set_pit_timeout(0)
        self.nfn2.icnlayer.cs.set_cs_timeout(30)
        self.nfn3.icnlayer.pit.set_pit_timeout(0)
        self.nfn3.icnlayer.cs.set_cs_timeout(30)
        self.nfn4.icnlayer.pit.set_pit_timeout(0)
        self.nfn4.icnlayer.cs.set_cs_timeout(30)

        self.nfn0.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn0.icnlayer.cs, self.nfn0.icnlayer.fib,
            self.nfn0.icnlayer.pit, self.nfn0.linklayer.faceidtable)
        self.nfn1.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn1.icnlayer.cs, self.nfn1.icnlayer.fib,
            self.nfn1.icnlayer.pit, self.nfn1.linklayer.faceidtable)
        self.nfn2.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn2.icnlayer.cs, self.nfn2.icnlayer.fib,
            self.nfn2.icnlayer.pit, self.nfn2.linklayer.faceidtable)
        self.nfn3.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn3.icnlayer.cs, self.nfn3.icnlayer.fib,
            self.nfn3.icnlayer.pit, self.nfn3.linklayer.faceidtable)
        self.nfn4.nfnlayer.optimizer = ToDataFirstOptimizer(
            self.nfn4.icnlayer.cs, self.nfn4.icnlayer.fib,
            self.nfn4.icnlayer.pit, self.nfn4.linklayer.faceidtable)

        self.mgmt_client0 = MgmtClient(
            self.nfn0.mgmt.mgmt_sock.getsockname()[1])
        self.mgmt_client1 = MgmtClient(
            self.nfn1.mgmt.mgmt_sock.getsockname()[1])
        self.mgmt_client2 = MgmtClient(
            self.nfn2.mgmt.mgmt_sock.getsockname()[1])
        self.mgmt_client3 = MgmtClient(
            self.nfn3.mgmt.mgmt_sock.getsockname()[1])
        self.mgmt_client4 = MgmtClient(
            self.nfn4.mgmt.mgmt_sock.getsockname()[1])