Ejemplo n.º 1
0
    def setUp(self):
        super(TestNoopNetworkDriver, self).setUp()
        self.driver = driver.NoopNetworkDriver()
        self.port = mock.MagicMock()
        self.port_id = 88
        self.port_name = 'port1'
        self.port.id = self.port_id
        self.network_id = self.FAKE_UUID_3
        self.network_name = 'net1'
        self.device_id = self.FAKE_UUID_4
        self.ip_address = "10.0.0.2"
        self.load_balancer = models.LoadBalancer()
        self.load_balancer.id = self.FAKE_UUID_2

        self.vip = models.Vip()
        self.vip.ip_address = "10.0.0.1"
        self.vip.subnet_id = uuidutils.generate_uuid()
        self.vip.port_id = uuidutils.generate_uuid()
        self.amphora_id = self.FAKE_UUID_1
        self.compute_id = self.FAKE_UUID_2
        self.subnet_id = self.FAKE_UUID_3
        self.subnet_name = 'subnet1'
        self.qos_policy_id = self.FAKE_UUID_5
        self.vrrp_port_id = self.FAKE_UUID_6

        self.amphora1 = models.Amphora()
        self.amphora1.id = uuidutils.generate_uuid()
        self.amphora1.vrrp_port_id = uuidutils.generate_uuid()
        self.amphora1.ha_port_id = uuidutils.generate_uuid()
        self.amphora1.vrrp_ip = '10.0.1.10'
        self.amphora1.ha_ip = '10.0.1.11'
        self.amphora2 = models.Amphora()
        self.amphora2.id = uuidutils.generate_uuid()
        self.amphora2.vrrp_port_id = uuidutils.generate_uuid()
        self.amphora2.ha_port_id = uuidutils.generate_uuid()
        self.amphora2.vrrp_ip = '10.0.2.10'
        self.amphora2.ha_ip = '10.0.2.11'
        self.load_balancer.amphorae = [self.amphora1, self.amphora2]
        self.load_balancer.vip = self.vip
        self.subnet = mock.MagicMock()
Ejemplo n.º 2
0
 def setUp(self, mock_session):
     super(TestSshDriver, self).setUp()
     mock.MagicMock(keystone.get_session())
     self.driver = ssh_driver.HaproxyManager()
     self.listener = sample_configs.sample_listener_tuple()
     self.vip = sample_configs.sample_vip_tuple()
     self.amphora = models.Amphora()
     self.amphora.id = self.FAKE_UUID_1
     self.driver.cert_manager = mock.Mock(
         spec=cert_mgr.CertManager)
     self.driver.client = mock.Mock(spec=paramiko.SSHClient)
     self.driver.client.exec_command.return_value = (
         mock.Mock(), mock.Mock(), mock.Mock())
     self.driver.amp_config = mock.MagicMock()
     self.port = network_models.Port(mac_address='123')
Ejemplo n.º 3
0
    def setUp(self):
        super(TestAmphoraAPIClientTest, self).setUp()
        self.driver = driver.AmphoraAPIClient()
        self.base_url = "https://127.0.0.1:9443/0.5"
        self.amp = models.Amphora(lb_network_ip='127.0.0.1', compute_id='123')
        self.port_info = dict(mac_address=FAKE_MAC_ADDRESS)
        # Override with much lower values for testing purposes..
        conf = oslo_fixture.Config(cfg.CONF)
        conf.config(group="haproxy_amphora", connection_max_retries=2)

        self.subnet_info = {'subnet_cidr': FAKE_CIDR,
                            'gateway': FAKE_GATEWAY,
                            'mac_address': FAKE_MAC_ADDRESS,
                            'vrrp_ip': self.amp.vrrp_ip}
        patcher = mock.patch('time.sleep').start()
        self.addCleanup(patcher.stop)
Ejemplo n.º 4
0
 def setUp(self):
     super(AmphoraAPIClientTest, self).setUp()
     self.driver = driver.AmphoraAPIClient()
     self.base_url = "https://127.0.0.1:9443/0.5"
     self.amp = models.Amphora(lb_network_ip='127.0.0.1', compute_id='123')
     self.port_info = dict(mac_address='123')