示例#1
0
    def setUp(self):
        super(TestHaproxyAmphoraLoadBalancerDriverTest, self).setUp()

        DEST1 = '198.51.100.0/24'
        DEST2 = '203.0.113.0/24'
        NEXTHOP = '192.0.2.1'

        self.driver = driver.HaproxyAmphoraLoadBalancerDriver()

        self.driver.cert_manager = mock.MagicMock()
        self.driver.cert_parser = mock.MagicMock()
        self.driver.client = mock.MagicMock()
        self.driver.jinja = mock.MagicMock()
        self.driver.udp_jinja = mock.MagicMock()

        # Build sample Listener and VIP configs
        self.sl = sample_configs.sample_listener_tuple(tls=True, sni=True)
        self.sl_udp = sample_configs.sample_listener_tuple(
            proto=constants.PROTOCOL_UDP,
            persistence_type=constants.SESSION_PERSISTENCE_SOURCE_IP,
            persistence_timeout=33,
            persistence_granularity='255.255.0.0',
            monitor_proto=constants.HEALTH_MONITOR_UDP_CONNECT)
        self.amp = self.sl.load_balancer.amphorae[0]
        self.sv = sample_configs.sample_vip_tuple()
        self.lb = self.sl.load_balancer
        self.fixed_ip = mock.MagicMock()
        self.fixed_ip.ip_address = '198.51.100.5'
        self.fixed_ip.subnet.cidr = '198.51.100.0/24'
        self.network = network_models.Network(mtu=FAKE_MTU)
        self.port = network_models.Port(mac_address=FAKE_MAC_ADDRESS,
                                        fixed_ips=[self.fixed_ip],
                                        network=self.network)

        self.host_routes = [
            network_models.HostRoute(destination=DEST1, nexthop=NEXTHOP),
            network_models.HostRoute(destination=DEST2, nexthop=NEXTHOP)
        ]
        host_routes_data = [{
            'destination': DEST1,
            'nexthop': NEXTHOP
        }, {
            'destination': DEST2,
            'nexthop': NEXTHOP
        }]
        self.subnet_info = {
            'subnet_cidr': FAKE_CIDR,
            'gateway': FAKE_GATEWAY,
            'mac_address': FAKE_MAC_ADDRESS,
            'vrrp_ip': self.amp.vrrp_ip,
            'mtu': FAKE_MTU,
            'host_routes': host_routes_data
        }

        self.timeout_dict = {
            constants.REQ_CONN_TIMEOUT: 1,
            constants.REQ_READ_TIMEOUT: 2,
            constants.CONN_MAX_RETRIES: 3,
            constants.CONN_RETRY_INTERVAL: 4
        }
示例#2
0
    def setUp(self):
        super(TestHaproxyAmphoraLoadBalancerDriverTest, self).setUp()

        conf = oslo_fixture.Config(cfg.CONF)
        conf.config(group="haproxy_amphora", user_group="everyone")

        DEST1 = '198.51.100.0/24'
        DEST2 = '203.0.113.0/24'
        NEXTHOP = '192.0.2.1'

        self.driver = driver.HaproxyAmphoraLoadBalancerDriver()

        self.driver.cert_manager = mock.MagicMock()
        self.driver.cert_parser = mock.MagicMock()
        self.driver.client = mock.MagicMock()
        self.driver.jinja = mock.MagicMock()

        # Build sample Listener and VIP configs
        self.sl = sample_configs.sample_listener_tuple(tls=True, sni=True)
        self.amp = self.sl.load_balancer.amphorae[0]
        self.sv = sample_configs.sample_vip_tuple()
        self.lb = self.sl.load_balancer
        self.fixed_ip = mock.MagicMock()
        self.fixed_ip.ip_address = '198.51.100.5'
        self.fixed_ip.subnet.cidr = '198.51.100.0/24'
        self.network = network_models.Network(mtu=FAKE_MTU)
        self.port = network_models.Port(mac_address=FAKE_MAC_ADDRESS,
                                        fixed_ips=[self.fixed_ip],
                                        network=self.network)

        self.host_routes = [
            network_models.HostRoute(destination=DEST1, nexthop=NEXTHOP),
            network_models.HostRoute(destination=DEST2, nexthop=NEXTHOP)
        ]
        host_routes_data = [{
            'destination': DEST1,
            'nexthop': NEXTHOP
        }, {
            'destination': DEST2,
            'nexthop': NEXTHOP
        }]
        self.subnet_info = {
            'subnet_cidr': FAKE_CIDR,
            'gateway': FAKE_GATEWAY,
            'mac_address': FAKE_MAC_ADDRESS,
            'vrrp_ip': self.amp.vrrp_ip,
            'mtu': FAKE_MTU,
            'host_routes': host_routes_data
        }

        self.timeout_dict = {
            constants.REQ_CONN_TIMEOUT: 1,
            constants.REQ_READ_TIMEOUT: 2,
            constants.CONN_MAX_RETRIES: 3,
            constants.CONN_RETRY_INTERVAL: 4
        }
示例#3
0
    def setUp(self):
        super(HaproxyAmphoraLoadBalancerDriverTest, self).setUp()
        self.driver = driver.HaproxyAmphoraLoadBalancerDriver()

        self.driver.cert_manager = mock.MagicMock()
        self.driver.cert_parser = mock.MagicMock()
        self.driver.client = mock.MagicMock()
        self.driver.jinja = mock.MagicMock()

        # Build sample Listener and VIP configs
        self.sl = sample_configs.sample_listener_tuple(tls=True, sni=True)
        self.amp = self.sl.load_balancer.amphorae[0]
        self.sv = sample_configs.sample_vip_tuple()
        self.lb = self.sl.load_balancer
        self.port = network_models.Port(mac_address='123')
    def setUp(self):
        super(TestHaproxyAmphoraLoadBalancerDriverTest, self).setUp()

        DEST1 = '198.51.100.0/24'
        DEST2 = '203.0.113.0/24'
        NEXTHOP = '192.0.2.1'

        self.driver = driver.HaproxyAmphoraLoadBalancerDriver()

        self.driver.cert_manager = mock.MagicMock()
        self.driver.cert_parser = mock.MagicMock()
        self.driver.client = mock.MagicMock()
        self.driver.jinja = mock.MagicMock()

        # Build sample Listener and VIP configs
        self.sl = sample_configs.sample_listener_tuple(tls=True, sni=True)
        self.amp = self.sl.load_balancer.amphorae[0]
        self.sv = sample_configs.sample_vip_tuple()
        self.lb = self.sl.load_balancer
        self.fixed_ip = mock.MagicMock()
        self.fixed_ip.ip_address = '198.51.100.5'
        self.fixed_ip.subnet.cidr = '198.51.100.0/24'
        self.network = network_models.Network(mtu=FAKE_MTU)
        self.port = network_models.Port(mac_address=FAKE_MAC_ADDRESS,
                                        fixed_ips=[self.fixed_ip],
                                        network=self.network)

        self.host_routes = [
            network_models.HostRoute(destination=DEST1, nexthop=NEXTHOP),
            network_models.HostRoute(destination=DEST2, nexthop=NEXTHOP)
        ]
        host_routes_data = [{
            'destination': DEST1,
            'nexthop': NEXTHOP
        }, {
            'destination': DEST2,
            'nexthop': NEXTHOP
        }]
        self.subnet_info = {
            'subnet_cidr': FAKE_CIDR,
            'gateway': FAKE_GATEWAY,
            'mac_address': FAKE_MAC_ADDRESS,
            'vrrp_ip': self.amp.vrrp_ip,
            'mtu': FAKE_MTU,
            'host_routes': host_routes_data
        }
示例#5
0
 def setUp(self):
     super().setUp()
     self.driver = rest_api_driver.HaproxyAmphoraLoadBalancerDriver()