Search in sources :

Example 91 with ApplicationId

use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.

the class ApplicationsWebResource method activateApp.

/**
 * Activate application.
 * Activates the specified application.
 *
 * @param name application name
 * @return 200 OK; 404; 401
 */
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{name}/active")
public Response activateApp(@PathParam("name") String name) {
    ApplicationAdminService service = get(ApplicationAdminService.class);
    ApplicationId appId = nullIsNotFound(service.getId(name), APP_NOT_FOUND + ": " + name);
    service.activate(appId);
    return response(service, appId);
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 92 with ApplicationId

use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.

the class ApplicationsWebResource method uninstallApp.

/**
 * Uninstall application.
 * Uninstalls the specified application deactivating it first if necessary.
 *
 * @param name application name
 * @return 204 NO CONTENT
 */
@DELETE
@Path("{name}")
public Response uninstallApp(@PathParam("name") String name) {
    ApplicationAdminService service = get(ApplicationAdminService.class);
    ApplicationId appId = service.getId(name);
    if (appId != null) {
        service.uninstall(appId);
    }
    return Response.noContent().build();
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 93 with ApplicationId

use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.

the class ApplicationsWebResource method getAppBits.

/**
 * Get application OAR/JAR file.
 * Returns the OAR/JAR file used to install the specified application.
 *
 * @param name application name
 * @return 200 OK; 404; 401
 */
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("{name}/bits")
public Response getAppBits(@PathParam("name") String name) {
    ApplicationAdminService service = get(ApplicationAdminService.class);
    ApplicationId appId = nullIsNotFound(service.getId(name), APP_ID_NOT_FOUND + ": " + name);
    InputStream bits = service.getApplicationArchive(appId);
    return ok(bits).build();
}
Also used : InputStream(java.io.InputStream) ApplicationId(org.onosproject.core.ApplicationId) ApplicationAdminService(org.onosproject.app.ApplicationAdminService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 94 with ApplicationId

use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.

the class ApplicationsWebResource method registerAppId.

/**
 * Registers an on or off platform application.
 *
 * @param name application name
 * @return 200 OK; 404; 401
 * @onos.rsModel ApplicationId
 */
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{name}/register")
public Response registerAppId(@PathParam("name") String name) {
    CoreService service = get(CoreService.class);
    ApplicationId appId = service.registerApplication(name);
    return response(appId);
}
Also used : CoreService(org.onosproject.core.CoreService) ApplicationId(org.onosproject.core.ApplicationId) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 95 with ApplicationId

use of org.onosproject.core.ApplicationId in project onos by opennetworkinglab.

the class ConnectivityIntentCommand method appId.

@Override
protected ApplicationId appId() {
    ApplicationId appIdForIntent;
    if (appId == null) {
        appIdForIntent = super.appId();
    } else {
        CoreService service = get(CoreService.class);
        appIdForIntent = service.getAppId(appId);
    }
    return appIdForIntent;
}
Also used : CoreService(org.onosproject.core.CoreService) ApplicationId(org.onosproject.core.ApplicationId)

Aggregations

ApplicationId (org.onosproject.core.ApplicationId)138 CoreService (org.onosproject.core.CoreService)36 Activate (org.osgi.service.component.annotations.Activate)36 DefaultApplicationId (org.onosproject.core.DefaultApplicationId)25 Path (javax.ws.rs.Path)21 Produces (javax.ws.rs.Produces)16 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)15 GET (javax.ws.rs.GET)14 Test (org.junit.Test)13 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)11 FlowRuleService (org.onosproject.net.flow.FlowRuleService)11 TrafficSelector (org.onosproject.net.flow.TrafficSelector)11 Intent (org.onosproject.net.intent.Intent)11 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)9 InputStream (java.io.InputStream)9 DeviceId (org.onosproject.net.DeviceId)9 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)9 IntentService (org.onosproject.net.intent.IntentService)9 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)8