@PUT
    @Path("{id}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response updatePort(@PathParam("id") String id, InputStream input) throws IOException {
        log.trace(String.format(MESSAGE, "UPDATE " + id));

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

        if (!haService.isActive()
                && !DEFAULT_ACTIVE_IP_ADDRESS.equals(haService.getActiveIp())) {
            return syncPut(haService, PORTS, id, inputStr);
        }

        final NeutronPort port = (NeutronPort)
                jsonToModelEntity(inputStr, NeutronPort.class);

        adminService.updatePort(port);
        ObjectMapper mapper = new ObjectMapper();
        ObjectNode jsonNode = mapper.createObjectNode();

        OpenstackNode node = nodeService.node(port.getHostId());
        if (node == null) {
            return status(Response.Status.OK).build();
        } else if (node.datapathType().equals(DpdkConfig.DatapathType.NETDEV)) {
            log.debug("UpdatePort for port {} called in netdev device {} " +
                            "so sends vif type as a payload of the response",
                    port.getId(), node.hostname());
            jsonNode.put(VIF_TYPE, VHOSTUSER);

            if (node.socketDir() != null) {
                jsonNode.put(SOCKET_DIR, node.socketDir());
            }
            return status(Response.Status.OK).entity(jsonNode.toString()).build();
        } else {
            return status(Response.Status.OK).build();
        }
    }
@Test
    public void testUpdatePortWithNonexistId() {
        expect(mockOpenstackHaService.isActive()).andReturn(true).anyTimes();
        replay(mockOpenstackHaService);

        mockOpenstackNetworkAdminService.updatePort(anyObject());
        expectLastCall().andThrow(new IllegalArgumentException());
        replay(mockOpenstackNetworkAdminService);

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

        Response response = wt.path(PATH + "/65c0ee9f-d634-4522-8954-51021b570b0d")
                .request(MediaType.APPLICATION_JSON_TYPE)
                .put(Entity.json(jsonStream));
        final int status = response.getStatus();

        assertThat(status, is(400));

        verify(mockOpenstackNetworkAdminService);
    }