@ApiOperation(value = "Is edge upgrade enabled (isEdgeUpgradeAvailable)",
            notes = "Returns 'true' if upgrade available for connected edge, 'false' - otherwise.")
    @PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
    @GetMapping(value = "/edge/{edgeId}/upgrade/available")
    public boolean isEdgeUpgradeAvailable(
            @Parameter(description = EDGE_ID_PARAM_DESCRIPTION, required = true)
            @PathVariable("edgeId") String strEdgeId) throws Exception {
        if (isEdgesEnabled() && edgeUpgradeServiceOpt.isPresent()) {
            EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
            edgeId = checkNotNull(edgeId);
            Edge edge = checkEdgeId(edgeId, Operation.READ);
            return edgeUpgradeServiceOpt.get().isUpgradeAvailable(edge.getTenantId(), edge.getId());
        } else {
            throw new ThingsboardException("Edges support disabled", ThingsboardErrorCode.GENERAL);
        }
    }
@Test
    public void testIsEdgeUpgradeAvailable() throws Exception {
        Edge edge = constructEdge("Edge Upgrade Available", "default");
        Edge savedEdge = doPost("/api/edge", edge, Edge.class);

        // Test 3.5.0 Edge - upgrade not available
        String body = "{\"edgeVersion\": \"V_3_5_0\"}";
        doPostAsync("/api/plugins/telemetry/EDGE/" + savedEdge.getId().getId() + "/attributes/SERVER_SCOPE", body, String.class, status().isOk());
        edgeUpgradeInstructionsService.setAppVersion("3.6.0");
        Assert.assertFalse(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.2");
        Assert.assertFalse(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.2.7");
        Assert.assertFalse(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));

        // Test 3.6.0 Edge - upgrade available
        body = "{\"edgeVersion\": \"V_3_6_0\"}";
        doPostAsync("/api/plugins/telemetry/EDGE/" + savedEdge.getId().getId() + "/attributes/SERVER_SCOPE", body, String.class, status().isOk());
        edgeUpgradeInstructionsService.setAppVersion("3.6.0");
        Assert.assertFalse(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.1.5");
        Assert.assertTrue(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.2");
        Assert.assertTrue(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));

        // Test 3.6.1 Edge - upgrade available
        body = "{\"edgeVersion\": \"V_3_6_1\"}";
        doPostAsync("/api/plugins/telemetry/EDGE/" + savedEdge.getId().getId() + "/attributes/SERVER_SCOPE", body, String.class, status().isOk());
        edgeUpgradeInstructionsService.setAppVersion("3.6.1");
        Assert.assertFalse(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.2");
        Assert.assertTrue(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
        edgeUpgradeInstructionsService.setAppVersion("3.6.2.6");
        Assert.assertTrue(edgeUpgradeInstructionsService.isUpgradeAvailable(savedEdge.getTenantId(), savedEdge.getId()));
    }