def test_delete_without_health_monitor(self): pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS') pool.members = [fake_objs.FakeMember()] pool.health_monitors_status = [] self._test_delete(pool) (self.a.last_client.slb.service_group.delete.assert_called_with( pool.id))
def test_delete(self): m = fake_objs.FakeMember() ip = self.a.member.neutron.member_get_ip(None, m, True) self.set_count_1() self.a.member.delete(None, m) self.a.last_client.slb.server.delete(ip)
def test_delete_count_gt_one(self): m = fake_objs.FakeMember() ip = self.a.member.neutron.member_get_ip(None, m, True) name = self.a.member._get_name(m, ip) self.set_count_2() self.a.member.delete(None, m) pool_name = self.a.member._pool_name(None, m['pool_id']) self.a.last_client.slb.service_group.member.delete.assert_called_with( pool_name, name, m['protocol_port'])
def test_delete(self): pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS') pool.members = [fake_objs.FakeMember()] pool.health_monitors_status = [{'monitor_id': 'hm1', "pools": [pool]}] self.a.pool.neutron.openstack_driver._pool_get_hm.return_value = fake_objs.FakeHM( ) self._test_delete(pool) (self.a.last_client.slb.service_group.delete.assert_called_with( pool['id']))
def test_delete_with_hm_dissociates_hm(self): pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS') hm = fake_objs.FakeHM("TCP") hm.pools.append(fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')) pool.members = [fake_objs.FakeMember()] pool.health_monitors_status = [{'monitor_id': 'hm1', "pools": [pool]}] self.a.pool.neutron.openstack_driver._pool_get_hm.return_value = hm self._test_delete(pool) self.a.last_client.slb.service_group.update.assert_called_with( "id1", health_monitor="", health_check_disable=True)
def test_update_down(self): m = fake_objs.FakeMember(admin_state_up=False) ip = self.a.member.neutron.member_get_ip(None, m, True) name = self.a.member._get_name(m, ip) self.a.member.update(None, m, m) pool_name = self.a.member._pool_name(None, m['pool_id']) self.a.last_client.slb.service_group.member.update.assert_called_with( pool_name, name, m['protocol_port'], self.a.last_client.slb.DOWN, axapi_args={'member': {}})
def _test_create(self, admin_state_up=True, uuid_name=False, conn_limit=800000): if uuid_name: old = self.a.config.get('member_name_use_uuid') self.a.config._config.member_name_use_uuid = True m = fake_objs.FakeMember(admin_state_up=admin_state_up) ip = self.a.member.neutron.member_get_ip(None, m, True) if uuid_name: name = m['id'] else: name = self.a.member._get_name(m, ip) self.a.member.create(None, m) if admin_state_up: status = self.a.last_client.slb.UP else: status = self.a.last_client.slb.DOWN if conn_limit < 1 or conn_limit > 8000000: self.a.last_client.slb.server.create.assert_called_with( name, ip, '80', status=status, axapi_args={'server': {}}) else: self.a.last_client.slb.server.create.assert_called_with( name, ip, '80', status=status, axapi_args={'server': { 'conn-limit': conn_limit }}) pool_name = self.a.member._pool_name(None, m['pool_id']) self.a.last_client.slb.service_group.member.create.assert_called_with( pool_name, name, m['protocol_port'], status=status, axapi_args={'member': {}}) if uuid_name: self.a.config._config.member_name_use_uuid = old
def test_count(self): self.a.member.neutron.member_count(None, fake_objs.FakeMember())
def test_get_name(self): m = fake_objs.FakeMember() z = self.a.member._get_name(m, '1.1.1.1') self.assertEqual(z, '_ten1_1_1_1_1_neutron')
def test_get_ip(self): m = fake_objs.FakeMember() self.a.member.neutron.member_get_ip(None, m, False) self.a.openstack_driver._member_get_ip.assert_called_with( None, m, False)
def test_delete_removes_monitor(self): pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS') pool.members = [fake_objs.FakeMember()] pool.health_monitors_status = [{'monitor_id': "hm1"}] self._test_delete(pool) self.a.last_client.slb.hm.delete.assert_called()