Search in sources :

Example 46 with ApplicationId

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

the class DistributedKubevirtNodeStore method activate.

@Activate
protected void activate() {
    ApplicationId appId = coreService.registerApplication(APP_ID);
    nodeStore = storageService.<String, KubevirtNode>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_KUBEVIRT_NODE)).withName("kubevirt-nodestore").withApplicationId(appId).build();
    nodeStore.addListener(nodeMapEventListener);
    log.info("Started");
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate)

Example 47 with ApplicationId

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

the class OpenstackManagementWebResource method purgeRulesBase.

private boolean purgeRulesBase() {
    ApplicationId appId = coreService.getAppId(Constants.OPENSTACK_NETWORKING_APP_ID);
    if (appId == null) {
        throw new ItemNotFoundException("application not found");
    }
    flowRuleService.removeFlowRulesById(appId);
    boolean result = true;
    long timeoutExpiredMs = System.currentTimeMillis() + TIMEOUT_MS;
    // we make sure all flow rules are removed from the store
    while (stream(flowRuleService.getFlowEntriesById(appId).spliterator(), false).count() > 0) {
        long waitMs = timeoutExpiredMs - System.currentTimeMillis();
        try {
            sleep(SLEEP_MS);
        } catch (InterruptedException e) {
            log.error("Exception caused during rule purging...");
        }
        if (stream(flowRuleService.getFlowEntriesById(appId).spliterator(), false).count() == 0) {
            break;
        } else {
            flowRuleService.removeFlowRulesById(appId);
            log.info("Failed to purging flow rules, retrying rule purging...");
        }
        if (waitMs <= 0) {
            result = false;
            break;
        }
    }
    if (result) {
        log.info("Successfully purged flow rules!");
    } else {
        log.warn("Failed to purge flow rules.");
    }
    return result;
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) ItemNotFoundException(org.onlab.util.ItemNotFoundException)

Example 48 with ApplicationId

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

the class DistributedInstancePortStore method activate.

@Activate
protected void activate() {
    ApplicationId appId = coreService.registerApplication(OPENSTACK_NETWORKING_APP_ID);
    instancePortStore = storageService.<String, InstancePort>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_INSTANCE_PORT)).withName("openstack-instanceport-store").withApplicationId(appId).build();
    instancePortStore.addListener(instancePortMapListener);
    log.info("Started");
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate)

Example 49 with ApplicationId

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

the class DistributedOpenstackRouterStore method activate.

@Activate
protected void activate() {
    ApplicationId appId = coreService.registerApplication(OPENSTACK_NETWORKING_APP_ID);
    osRouterStore = storageService.<String, Router>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_NEUTRON_L3)).withName("openstack-routerstore").withApplicationId(appId).build();
    osRouterStore.addListener(routerMapListener);
    osRouterInterfaceStore = storageService.<String, RouterInterface>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_NEUTRON_L3)).withName("openstack-routerifacestore").withApplicationId(appId).build();
    osRouterInterfaceStore.addListener(routerInterfaceMapListener);
    osFloatingIpStore = storageService.<String, NetFloatingIP>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_NEUTRON_L3)).withName("openstack-floatingipstore").withApplicationId(appId).build();
    osFloatingIpStore.addListener(floatingIpMapListener);
    log.info("Started");
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate)

Example 50 with ApplicationId

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

the class SimpleApplicationStore method loadFromDisk.

private void loadFromDisk() {
    for (String name : getApplicationNames()) {
        ApplicationId appId = idStore.registerApplication(name);
        ApplicationDescription appDesc = getApplicationDescription(name);
        DefaultApplication app = DefaultApplication.builder(appDesc).withAppId(appId).build();
        apps.put(appId, app);
        states.put(appId, isActive(name) ? INSTALLED : ACTIVE);
    // load app permissions
    }
}
Also used : DefaultApplication(org.onosproject.core.DefaultApplication) ApplicationId(org.onosproject.core.ApplicationId) ApplicationDescription(org.onosproject.app.ApplicationDescription)

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