1# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15""" 16test_floating_ip_pool 17---------------------------------- 18 19Functional tests for floating IP pool resource (managed by nova) 20""" 21 22from openstack.tests.functional import base 23 24 25# When using nova-network, floating IP pools are created with nova-manage 26# command. 27# When using Neutron, floating IP pools in Nova are mapped from external 28# network names. This only if the floating-ip-pools nova extension is 29# available. 30# For instance, for current implementation of hpcloud that's not true: 31# nova floating-ip-pool-list returns 404. 32 33 34class TestFloatingIPPool(base.BaseFunctionalTest): 35 def setUp(self): 36 super(TestFloatingIPPool, self).setUp() 37 38 if not self.user_cloud._has_nova_extension('os-floating-ip-pools'): 39 # Skipping this test is floating-ip-pool extension is not 40 # available on the testing cloud 41 self.skip( 42 'Floating IP pools extension is not available') 43 44 def test_list_floating_ip_pools(self): 45 pools = self.user_cloud.list_floating_ip_pools() 46 if not pools: 47 self.assertFalse('no floating-ip pool available') 48 49 for pool in pools: 50 self.assertIn('name', pool) 51