Search in sources :

Example 21 with Application

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

the class ReviewCommand method doExecute.

@Override
protected void doExecute() {
    ApplicationAdminService applicationAdminService = get(ApplicationAdminService.class);
    ApplicationId appId = applicationAdminService.getId(name);
    if (appId == null) {
        print("No such application: %s", name);
        return;
    }
    Application app = applicationAdminService.getApplication(appId);
    SecurityAdminService smService = SecurityUtil.getSecurityService();
    if (smService == null) {
        print("Security Mode is disabled");
        return;
    }
    if (accept == null) {
        smService.review(appId);
        printPolicy(smService, app);
    } else if ("accept".equals(accept.trim())) {
        smService.acceptPolicy(appId);
        printPolicy(smService, app);
    } else {
        print("Unknown command");
    }
}
Also used : SecurityAdminService(org.onosproject.security.SecurityAdminService) ApplicationId(org.onosproject.core.ApplicationId) Application(org.onosproject.core.Application) ApplicationAdminService(org.onosproject.app.ApplicationAdminService)

Example 22 with Application

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

the class ApplicationEventTest method withTime.

@Test
public void withTime() {
    Application app = createApp();
    long before = System.currentTimeMillis();
    ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app);
    long after = System.currentTimeMillis();
    validateEvent(event, APP_ACTIVATED, app, before, after);
}
Also used : Application(org.onosproject.core.Application) DefaultApplication(org.onosproject.core.DefaultApplication) DefaultApplicationDescriptionTest(org.onosproject.app.DefaultApplicationDescriptionTest) AbstractEventTest(org.onosproject.event.AbstractEventTest) Test(org.junit.Test)

Example 23 with Application

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

the class SimpleApplicationStore method remove.

@Override
public void remove(ApplicationId appId) {
    Application app = apps.remove(appId);
    if (app != null) {
        states.remove(appId);
        delegate.notify(new ApplicationEvent(APP_UNINSTALLED, app));
        purgeApplication(app.id().name());
    }
}
Also used : ApplicationEvent(org.onosproject.app.ApplicationEvent) Application(org.onosproject.core.Application) DefaultApplication(org.onosproject.core.DefaultApplication)

Example 24 with Application

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

the class SimpleApplicationStoreTest method deactivate.

@Test
public void deactivate() {
    Application app = createTestApp();
    store.deactivate(app.id());
    assertEquals("incorrect app count", 1, store.getApplications().size());
    assertEquals("incorrect app state", INSTALLED, store.getState(app.id()));
    assertEquals("incorrect event type", APP_DEACTIVATED, delegate.event.type());
    assertEquals("incorrect event app", app, delegate.event.subject());
}
Also used : Application(org.onosproject.core.Application) Test(org.junit.Test)

Example 25 with Application

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

the class ApplicationManager method install.

@Override
public Application install(InputStream appDescStream) {
    checkNotNull(appDescStream, "Application archive stream cannot be null");
    Application app = store.create(appDescStream);
    SecurityUtil.register(app.id());
    return app;
}
Also used : Application(org.onosproject.core.Application)

Aggregations

Application (org.onosproject.core.Application)32 DefaultApplication (org.onosproject.core.DefaultApplication)12 Test (org.junit.Test)8 List (java.util.List)6 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)6 ApplicationEvent (org.onosproject.app.ApplicationEvent)6 ApplicationId (org.onosproject.core.ApplicationId)6 IOException (java.io.IOException)4 Lists (com.google.common.collect.Lists)3 InputStream (java.io.InputStream)3 Collectors (java.util.stream.Collectors)3 Service (org.apache.karaf.shell.api.action.lifecycle.Service)3 ApplicationService (org.onosproject.app.ApplicationService)3 ApplicationState (org.onosproject.app.ApplicationState)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 Charsets (com.google.common.base.Charsets)2 MoreObjects (com.google.common.base.MoreObjects)2 Preconditions (com.google.common.base.Preconditions)2 Throwables (com.google.common.base.Throwables)2