Additional test cases for port forwardings API
This patch adds 2 additional test cases to API tests for port forwardings: 1. Attempt to delete Floating IP used already by port forwarding - this should returns Conflict error, 2. Try to associate port forwarding to Neutron's port which is already associated with another Floating IP - this should raise Conflict error. Depends-On: https://review.opendev.org/666235 Change-Id: I8b036068645f9d0277cde66b027a22273d9b1c41
This commit is contained in:
parent
4e44e244f7
commit
411261f4ff
@ -76,12 +76,22 @@ class PortForwardingTestJSON(base.BaseNetworkTest):
|
||||
self.assertEqual(port['fixed_ips'][0]['ip_address'],
|
||||
pf['internal_ip_address'])
|
||||
|
||||
# Now lets try to remove Floating IP with existing port forwarding,
|
||||
# this should fails
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.delete_floatingip, fip)
|
||||
|
||||
# Delete port forwarding
|
||||
self.client.delete_port_forwarding(fip['id'], pf['id'])
|
||||
self.assertRaises(exceptions.NotFound,
|
||||
self.client.get_port_forwarding,
|
||||
fip['id'], pf['id'])
|
||||
|
||||
# Now Floating IP should be deleted properly
|
||||
self.delete_floatingip(fip)
|
||||
self.assertRaises(exceptions.NotFound,
|
||||
self.client.get_floatingip, fip['id'])
|
||||
|
||||
@decorators.idempotent_id('aa842070-39ef-4b09-9df9-e723934f96f8')
|
||||
@utils.requires_ext(extension="expose-port-forwarding-in-fip",
|
||||
service="network")
|
||||
@ -170,3 +180,17 @@ class PortForwardingTestJSON(base.BaseNetworkTest):
|
||||
internal_ip_address=port['fixed_ips'][0]['ip_address'],
|
||||
internal_port=1111, external_port=2222,
|
||||
protocol="tcp")
|
||||
|
||||
@decorators.idempotent_id('4ca72d40-93e4-485f-a876-76caf33c1fe6')
|
||||
def test_associate_port_forwarding_to_port_with_fip(self):
|
||||
port = self.create_port(self.network)
|
||||
self.create_floatingip(port=port)
|
||||
fip_for_pf = self.create_floatingip()
|
||||
self.assertRaises(
|
||||
exceptions.Conflict,
|
||||
self.create_port_forwarding,
|
||||
fip_for_pf['id'],
|
||||
internal_port_id=port['id'],
|
||||
internal_ip_address=port['fixed_ips'][0]['ip_address'],
|
||||
internal_port=1111, external_port=2222,
|
||||
protocol="tcp")
|
||||
|
Loading…
Reference in New Issue
Block a user