Java Code Examples for org.onosproject.core.ApplicationId#id()

The following examples show how to use org.onosproject.core.ApplicationId#id() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockCoreService.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public ApplicationId getAppId(Short id) {
    for (ApplicationId appId : appIds) {
        if (appId.id() == id.shortValue()) {
            return appId;
        }
    }
    return null;
}
 
Example 2
Source File: MappingManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<MappingEntry> getMappingEntriesByAppId(Type type, ApplicationId appId) {

    Set<MappingEntry> mappingEntries = Sets.newHashSet();
    for (Device d : deviceService.getDevices()) {
        for (MappingEntry mappingEntry : store.getMappingEntries(type, d.id())) {
            if (mappingEntry.appId() == appId.id()) {
                mappingEntries.add(mappingEntry);
            }
        }
    }
    return mappingEntries;
}
 
Example 3
Source File: VirtualNetworkFlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void removeFlowRulesById(ApplicationId id) {
    Set<FlowRule> flowEntries = Sets.newHashSet();
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(networkId(), d.id())) {
            if (flowEntry.appId() == id.id()) {
                flowEntries.add(flowEntry);
            }
        }
    }
    removeFlowRules(Iterables.toArray(flowEntries, FlowRule.class));
}
 
Example 4
Source File: VirtualNetworkFlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<FlowEntry> getFlowEntriesById(ApplicationId id) {
    DeviceService deviceService = manager.get(networkId(), DeviceService.class);

    Set<FlowEntry> flowEntries = Sets.newHashSet();
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(networkId(), d.id())) {
            if (flowEntry.appId() == id.id()) {
                flowEntries.add(flowEntry);
            }
        }
    }
    return flowEntries;
}
 
Example 5
Source File: VirtualNetworkFlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<FlowRule> getFlowRulesByGroupId(ApplicationId appId, short groupId) {
    DeviceService deviceService = manager.get(networkId(), DeviceService.class);

    Set<FlowRule> matches = Sets.newHashSet();
    long toLookUp = ((long) appId.id() << 16) | groupId;
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(networkId(), d.id())) {
            if ((flowEntry.id().value() >>> 32) == toLookUp) {
                matches.add(flowEntry);
            }
        }
    }
    return matches;
}
 
Example 6
Source File: FlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void removeFlowRulesById(ApplicationId id) {
    checkPermission(FLOWRULE_WRITE);

    Set<FlowRule> flowEntries = Sets.newHashSet();
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(d.id())) {
            if (flowEntry.appId() == id.id()) {
                flowEntries.add(flowEntry);
            }
        }
    }
    removeFlowRules(Iterables.toArray(flowEntries, FlowRule.class));
}
 
Example 7
Source File: FlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<FlowEntry> getFlowEntriesById(ApplicationId id) {
    checkPermission(FLOWRULE_READ);

    Set<FlowEntry> flowEntries = Sets.newHashSet();
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(d.id())) {
            if (flowEntry.appId() == id.id()) {
                flowEntries.add(flowEntry);
            }
        }
    }
    return flowEntries;
}
 
Example 8
Source File: FlowRuleManager.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<FlowRule> getFlowRulesByGroupId(ApplicationId appId, short groupId) {
    checkPermission(FLOWRULE_READ);

    Set<FlowRule> matches = Sets.newHashSet();
    long toLookUp = ((long) appId.id() << 16) | groupId;
    for (Device d : deviceService.getDevices()) {
        for (FlowEntry flowEntry : store.getFlowEntries(d.id())) {
            if ((flowEntry.id().value() >>> 32) == toLookUp) {
                matches.add(flowEntry);
            }
        }
    }
    return matches;
}
 
Example 9
Source File: AppIdFormatter.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
protected String nonNullFormat(Object value) {
    ApplicationId appId = (ApplicationId) value;
    return appId.id() + COLON + appId.name();
}
 
Example 10
Source File: StatisticManager.java    From onos with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a predicate that checks the application ID of a flow entry is the same as
 * the specified application ID.
 *
 * @param appId application ID to be checked
 * @return predicate
 */
private static Predicate<FlowEntry> hasApplicationId(ApplicationId appId) {
    return flowEntry -> flowEntry.appId() == appId.id();
}