@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response createSubnet(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, SUBNETS, inputStr);
        }

        final NeutronSubnet subnet = (NeutronSubnet)
                jsonToModelEntity(inputStr, NeutronSubnet.class);

        adminService.createSubnet(subnet);
        UriBuilder locationBuilder = uriInfo.getBaseUriBuilder()
                .path(SUBNETS)
                .path(subnet.getId());

        // TODO fix networking-onos to send Network UPDATE when subnet created
        return created(locationBuilder.build()).build();
    }
@Test
    public void testCreateSubnetWithCreationOperation() {
        expect(mockOpenstackHaService.isActive()).andReturn(true).anyTimes();
        replay(mockOpenstackHaService);
        mockOpenstackNetworkAdminService.createSubnet(anyObject());
        replay(mockOpenstackNetworkAdminService);

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

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

        assertThat(status, is(201));

        verify(mockOpenstackNetworkAdminService);
    }