Test floatingip pools service plugin

Add a test case to list floating IP pools and create a floating
IP from a pool. Assert the floating IP is created successfully.

Neutron patch: Iaa995630645042520df67d95271e14f11ffcff8c

Change-Id: I4f269c2cf5e3f67b766d9ccb45fd145640de68f3
Related-Bug: #1653932
This commit is contained in:
Hongbin Lu 2018-04-17 20:15:35 +00:00
parent 5734c579a8
commit db2e6c90f9
2 changed files with 40 additions and 3 deletions

View File

@ -16,7 +16,7 @@
tox_envlist: all
devstack_localrc:
TEMPEST_PLUGINS: /opt/stack/neutron-tempest-plugin
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,floatingip-pools,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation
devstack_plugins:
neutron: git://git.openstack.org/openstack/neutron.git
neutron-tempest-plugin: git://git.openstack.org/openstack/neutron-tempest-plugin.git
@ -146,7 +146,7 @@
vars:
devstack_localrc:
Q_AGENT: linuxbridge
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,standard-attr-tag,subnet_allocation,tag,tag-ext,trunk,trunk-details
NETWORK_API_EXTENSIONS: address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,floatingip-pools,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-timestamp,standard-attr-tag,subnet_allocation,tag,tag-ext,trunk,trunk-details
devstack_local_conf:
post-config:
$NEUTRON_CONF:
@ -203,7 +203,7 @@
tempest_test_regex: ^neutron_tempest_plugin\.scenario
devstack_localrc:
TEMPEST_PLUGINS: /opt/stack/neutron-tempest-plugin
NETWORK_API_EXTENSIONS: "address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details"
NETWORK_API_EXTENSIONS: "address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,fip-port-details,flavors,floatingip-pools,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details"
PHYSICAL_NETWORK: default
DOWNLOAD_DEFAULT_IMAGES: false
IMAGE_URLS: "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img,http://cloud-images.ubuntu.com/releases/16.04/release-20180622/ubuntu-16.04-server-cloudimg-amd64-disk1.img"

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import netaddr
from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -121,3 +122,39 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
self.assertEqual(port['status'], port_details['status'])
self.assertEqual(port['device_id'], port_details['device_id'])
self.assertEqual(port['device_owner'], port_details['device_owner'])
class FloatingIPPoolTestJSON(base.BaseAdminNetworkTest):
required_extensions = ['router']
@decorators.idempotent_id('6c438332-4554-461c-9668-512ae09bf952')
@utils.requires_ext(extension="floatingip-pools", service="network")
def test_create_floatingip_from_specific_pool(self):
network = self.create_network(client=self.admin_client, external=True)
subnet1 = self.create_subnet(network, client=self.admin_client)
subnet2 = self.create_subnet(network, client=self.admin_client)
pools = self.client.list_floatingip_pools()["floatingip_pools"]
def test_create_floatingip_from_subnet(pools, subnet):
pool = None
for p in pools:
if p['network_id'] == subnet['network_id'] \
and p['subnet_id'] == subnet['id']:
pool = p
break
self.assertTrue(pool)
new_floatingip = self.create_floatingip(
pool['network_id'], subnet_id=pool['subnet_id'])
cidr = netaddr.IPNetwork(pool['cidr'])
ip_address = netaddr.IPAddress(
new_floatingip['floating_ip_address'])
self.assertIn(ip_address, cidr)
fip_id = new_floatingip['id']
floatingip = self.client.get_floatingip(fip_id)['floatingip']
self.assertEqual(new_floatingip['floating_ip_address'],
floatingip['floating_ip_address'])
test_create_floatingip_from_subnet(pools, subnet1)
test_create_floatingip_from_subnet(pools, subnet2)