Search in sources :

Example 96 with ApplicationId

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

the class FlowsListCommand method removeFlowsInteractive.

/**
 * Removes the flows passed as argument after confirmation is provided
 * for each of them.
 * If no explicit confirmation is provided, the flow is not removed.
 *
 * @param flows       list of flows to remove
 * @param flowService FlowRuleService object
 * @param coreService CoreService object
 */
public void removeFlowsInteractive(Iterable<FlowEntry> flows, FlowRuleService flowService, CoreService coreService) {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    flows.forEach(flow -> {
        ApplicationId appId = coreService.getAppId(flow.appId());
        System.out.print(String.format("Id=%s, AppId=%s. Remove? [y/N]: ", flow.id(), appId != null ? appId.name() : "<none>"));
        String response;
        try {
            response = br.readLine();
            response = response.trim().replace("\n", "");
            if ("y".equals(response)) {
                flowService.removeFlowRules(flow);
            }
        } catch (IOException e) {
            response = "";
        }
        print(response);
    });
}
Also used : InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) ApplicationId(org.onosproject.core.ApplicationId)

Example 97 with ApplicationId

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

the class DistributedKubevirtRouterStore method activate.

@Activate
protected void activate() {
    ApplicationId appId = coreService.registerApplication(APP_ID);
    routerStore = storageService.<String, KubevirtRouter>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_KUBEVIRT_ROUTER)).withName("kubevirt-routerstore").withApplicationId(appId).build();
    fipStore = storageService.<String, KubevirtFloatingIp>consistentMapBuilder().withSerializer(Serializer.using(SERIALIZER_KUBEVIRT_ROUTER)).withName("kubevirt-fipstore").withApplicationId(appId).build();
    routerStore.addListener(routerMapListener);
    fipStore.addListener(fipMapListener);
    log.info("Started");
}
Also used : ApplicationId(org.onosproject.core.ApplicationId) Activate(org.osgi.service.component.annotations.Activate)

Example 98 with ApplicationId

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

the class DistributedKubevirtSecurityGroupStore method activate.

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

Example 99 with ApplicationId

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

the class DistributedKubevirtLoadBalancerStore method activate.

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

Example 100 with ApplicationId

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

the class DistributedKubevirtNetworkStore method activate.

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

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