def setUp(self): super(TestNoopNetworkDriver, self).setUp() self.driver = driver.NoopNetworkDriver() self.port_id = 88 self.network_id = self.FAKE_UUID_3 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.amphora_id = self.FAKE_UUID_1 self.compute_id = self.FAKE_UUID_2 self.subnet_id = self.FAKE_UUID_3
def create_load_balancer_and_vip(self, session, lb_dict, vip_dict): """Inserts load balancer and vip entities into the database. Inserts load balancer and vip entities into the database in one transaction and returns the data model of the load balancer. :param session: A Sql Alchemy database session. :param lb_dict: Dictionary representation of a load balancer :param vip_dict: Dictionary representation of a vip :returns: octava.common.data_models.LoadBalancer """ with session.begin(): if not lb_dict.get('id'): lb_dict['id'] = uuidutils.generate_uuid() lb = models.LoadBalancer(**lb_dict) session.add(lb) vip_dict['load_balancer_id'] = lb_dict['id'] vip = models.Vip(**vip_dict) session.add(vip) return self.load_balancer.get(session, id=lb.id)
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()
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.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