Beispiel #1
0
    def _new_ip_allocator(self, recycling_interval):
        """
        Creates and sets up an IPAllocator with the given recycling interval.
        """
        config = {
            'recycling_interval': recycling_interval,
            'persist_to_redis': False,
            'redis_port': 6379,
        }
        mconfig = MobilityD(ip_allocator_type=MobilityD.IP_POOL,
                            static_ip_enabled=True)

        self._allocator = IPAddressManager(recycling_interval=recycling_interval,
                                           subscriberdb_rpc_stub=MockedSubscriberDBStub(),
                                           config=config,
                                           mconfig=mconfig)
        self._allocator.add_ip_block(self._block)
Beispiel #2
0
 def _new_ip_allocator(self, recycling_interval):
     """
     Creates and sets up an IPAllocator with the given recycling interval.
     """
     # NOTE: change below to True to run IP allocator tests locally. We
     # don't persist to Redis during normal unit tests since they are run
     # in Sandcastle.
     config = {
         'recycling_interval': recycling_interval,
         'persist_to_redis': False,
         'redis_port': 6379,
     }
     mconfig = MobilityD(ip_allocator_type=MobilityD.IP_POOL,
                         static_ip_enabled=False)
     self._allocator = IPAddressManager(
         recycling_interval=recycling_interval,
         config=config,
         mconfig=mconfig)
     self._allocator.add_ip_block(self._block)
Beispiel #3
0
    def setUp(self):
        self._br = "t_up_br0"

        setup_dhcp_server = SCRIPT_PATH + "scripts/setup-test-dhcp-srv.sh"
        subprocess.check_call([setup_dhcp_server, "t0"])

        setup_uplink_br = [
            SCRIPT_PATH + "scripts/setup-uplink-br.sh", self._br,
            "t0uplink_p0", "t0_dhcp1"
        ]
        subprocess.check_call(setup_uplink_br)

        config = {
            'dhcp_iface': 't0uplink_p0',
            'retry_limit': 50,
            'persist_to_redis': False,
        }
        mconfig = MobilityD(ip_allocator_type=MobilityD.DHCP,
                            static_ip_enabled=False)

        self._dhcp_allocator = IPAddressManager(recycling_interval=2,
                                                config=config,
                                                mconfig=mconfig)