@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response createFloatingIp(InputStream input) throws IOException {
        log.trace(String.format(MESSAGE, "CREATE"));

        String inputStr = IOUtils.toString(input, REST_UTF8);

        if (!haService.isActive()
                && !DEFAULT_ACTIVE_IP_ADDRESS.equals(haService.getActiveIp())) {
            return syncPost(haService, FLOATING_IPS, inputStr);
        }

        final NeutronFloatingIP floatingIp = (NeutronFloatingIP)
                jsonToModelEntity(inputStr, NeutronFloatingIP.class);

        adminService.createFloatingIp(floatingIp);

        UriBuilder locationBuilder = uriInfo.getBaseUriBuilder()
                .path(FLOATING_IPS)
                .path(floatingIp.getId());

        return created(locationBuilder.build()).build();
    }
@Test
    public void testCreateFloatingIpWithDuplicatedIp() {
        expect(mockOpenstackHaService.isActive()).andReturn(true).anyTimes();
        replay(mockOpenstackHaService);
        mockOpenstackRouterAdminService.createFloatingIp(anyObject());
        expectLastCall().andThrow(new IllegalArgumentException());
        replay(mockOpenstackRouterAdminService);

        final WebTarget wt = target();
        InputStream jsonStream = OpenstackFloatingIpWebResourceTest.class
                .getResourceAsStream("openstack-floatingip1.json");

        Response response = wt.path(PATH).request(MediaType.APPLICATION_JSON_TYPE)
                .post(Entity.json(jsonStream));
        final int status = response.getStatus();

        assertThat(status, is(400));

        verify(mockOpenstackRouterAdminService);
    }