<s> from tempest . lib . common . utils import data_utils <EOL> from tempest . lib import exceptions as lib_exc <EOL> from tempest import test <EOL> from neutron . tests . tempest . api import base <EOL> from neutron . tests . tempest import config <EOL> CONF = config . CONF <EOL> class FloatingIPNegativeTestJSON ( base . BaseNetworkTest ) : <EOL> @ classmethod <EOL> @ test . requires_ext ( extension = "<STR_LIT>" , service = "<STR_LIT>" ) <EOL> def resource_setup ( cls ) : <EOL> super ( FloatingIPNegativeTestJSON , cls ) . resource_setup ( ) <EOL> cls . ext_net_id = CONF . network . public_network_id <EOL> cls . network = cls . create_network ( ) <EOL> cls . subnet = cls . create_subnet ( cls . network ) <EOL> cls . router = cls . create_router ( data_utils . rand_name ( '<STR_LIT>' ) ) <EOL> cls . create_router_interface ( cls . router [ '<STR_LIT:id>' ] , cls . subnet [ '<STR_LIT:id>' ] ) <EOL> cls . port = cls . create_port ( cls . network ) <EOL> @ test . attr ( type = '<STR_LIT>' ) <EOL> @ test . idempotent_id ( '<STR_LIT>' ) <EOL> def test_associate_floatingip_with_port_with_floatingip ( self ) : <EOL> net = self . create_network ( ) <EOL> subnet = self . create_subnet ( net ) <EOL> r = self . create_router ( '<STR_LIT:test>' ) <EOL> self . create_router_interface ( r [ '<STR_LIT:id>' ] , subnet [ '<STR_LIT:id>' ] ) <EOL> self . client . update_router ( <EOL> r [ '<STR_LIT:id>' ] , <EOL> external_gateway_info = { <EOL> '<STR_LIT>' : self . ext_net_id } ) <EOL> self . addCleanup ( self . client . update_router , self . router [ '<STR_LIT:id>' ] , <EOL> external_gateway_info = { } ) <EOL> port = self . create_port ( net ) <EOL> body1 = self . client . create_floatingip ( <EOL> floating_network_id = self . ext_net_id ) <EOL> floating_ip1 = body1 [ '<STR_LIT>' ] <EOL> self . addCleanup ( self . client . delete_floatingip , floating_ip1 [ '<STR_LIT:id>' ] ) <EOL> body2 = self . client . create_floatingip ( <EOL> floating_network_id = self . ext_net_id ) <EOL> floating_ip2 = body2 [ '<STR_LIT>' ] <EOL> self . addCleanup ( self . client . delete_floatingip , floating_ip2 [ '<STR_LIT:id>' ] ) <EOL> self . client . update_floatingip ( floating_ip1 [ '<STR_LIT:id>' ] , <EOL> port_id = port [ '<STR_LIT:id>' ] ) <EOL> self . assertRaises ( lib_exc . Conflict , self . client . update_floatingip , <EOL> floating_ip2 [ '<STR_LIT:id>' ] , port_id = port [ '<STR_LIT:id>' ] ) </s>
