def test_create_cccl_member_min_config(pool, members): """Test creation of ApiPoolMember from bare config.""" cfg_name = "member_min_config" partition = "Common" # pdb.set_trace() member = ApiPoolMember(partition=partition, default_route_domain=0, pool=pool, **members[cfg_name]) assert member # Test data assert member.data pool_data = copy.copy(member.data) for k, _ in POOL_PROPERTIES.items(): if k == 'name': assert pool_data['name'] == "172.16.200.100%0:80" elif k == 'partition': assert pool_data['partition'] == "Common" elif k == 'ratio': assert pool_data['ratio'] == 1 elif k == 'connectionLimit': assert pool_data['connectionLimit'] == 0 elif k == 'priorityGroup': assert pool_data['priorityGroup'] == 0 elif k == 'session': assert pool_data['session'] == "user-enabled" elif k == 'description': assert not pool_data['description'] pool_data.pop(k) assert not pool_data, "unexpected keys found in data"
def test_create_cccl_member_min_ipv6_rd_config(pool, members): """Test of ApiPoolMember create with IPv6 address and route domain.""" cfg_name = "member_min_ipv6_rd_config" partition = "Common" # pdb.set_trace() member = ApiPoolMember(partition=partition, default_route_domain=0, pool=pool, **members[cfg_name]) assert member # Test data assert member.data pool_data = copy.copy(member.data) for k, _ in POOL_PROPERTIES.items(): if k == 'name': assert (pool_data['name'] == "2001:0db8:3c4d:0015:0000:0000:abcd:ef12%2.80") elif k == 'partition': assert pool_data['partition'] == "Common" elif k == 'ratio': assert pool_data['ratio'] == 1 elif k == 'connectionLimit': assert pool_data['connectionLimit'] == 0 elif k == 'priorityGroup': assert pool_data['priorityGroup'] == 0 elif k == 'session': assert pool_data['session'] == "user-enabled" elif k == 'description': assert not pool_data['description'] pool_data.pop(k) assert not pool_data, "unexpected keys found in data"
def test_create_cccl_member_w_nonzero_route_domain(pool, members): """Test of ApiPoolMember create with non-zero route-domain.""" cfg_name = "member_w_nonzero_route_domain" partition = "Common" member = ApiPoolMember(partition=partition, default_route_domain=0, pool=pool, **members[cfg_name]) assert member # Test data assert member.data pool_data = copy.copy(member.data) for k, _ in POOL_PROPERTIES.items(): if k == 'name': assert pool_data['name'] == "172.16.200.103%2:80" elif k == 'partition': assert pool_data['partition'] == "Common" elif k == 'ratio': assert pool_data['ratio'] == 1 elif k == 'connectionLimit': assert pool_data['connectionLimit'] == 0 elif k == 'priorityGroup': assert pool_data['priorityGroup'] == 0 elif k == 'session': assert pool_data['session'] == "user-enabled" elif k == 'description': assert not pool_data['description'] pool_data.pop(k) assert not pool_data, "unexpected keys found in data"
def test_create_cccl_member_no_address(pool, members): """Test of ApiPoolMember create without name or address.""" cfg_name = "member_no_address" partition = "Common" with pytest.raises(TypeError): member = ApiPoolMember(partition=partition, default_route_domain=0, pool=pool, **members[cfg_name]) assert not member
def _get_members(self, partition, default_route_domain, members): """Get a list of members from the pool definition""" members_list = list() if members: for member in members: m = ApiPoolMember(partition=partition, default_route_domain=default_route_domain, pool=self, **member) members_list.append(m) return members_list
def _get_members(self, partition, members): """Get a list of members from the pool definition""" members_list = list() if members: for member in members: m = ApiPoolMember(name=None, partition=partition, pool=self, **member) members_list.append(m) return members_list
def test_create_cccl_member_no_port(pool, members): """Test of ApiPoolMember create without name or port.""" cfg_name = "member_no_port" partition = "Common" with pytest.raises(TypeError): member = ApiPoolMember( name=None, partition=partition, pool=pool, **members[cfg_name] ) assert not member