Java Code Examples for org.onosproject.net.pi.model.PiActionProfileId#of()

The following examples show how to use org.onosproject.net.pi.model.PiActionProfileId#of() . 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: Utils.java    From ngsdn-tutorial with Apache License 2.0 6 votes vote down vote up
public static GroupDescription buildSelectGroup(DeviceId deviceId,
                                                String tableId,
                                                String actionProfileId,
                                                int groupId,
                                                Collection<PiAction> actions,
                                                ApplicationId appId) {

    final GroupKey groupKey = new PiGroupKey(
            PiTableId.of(tableId), PiActionProfileId.of(actionProfileId), groupId);
    final List<GroupBucket> buckets = actions.stream()
            .map(action -> DefaultTrafficTreatment.builder()
                    .piTableAction(action).build())
            .map(DefaultGroupBucket::createSelectGroupBucket)
            .collect(Collectors.toList());
    return new DefaultGroupDescription(
            deviceId,
            GroupDescription.Type.SELECT,
            new GroupBuckets(buckets),
            groupKey,
            groupId,
            appId);
}
 
Example 2
Source File: Utils.java    From onos-p4-tutorial with Apache License 2.0 6 votes vote down vote up
public static GroupDescription buildSelectGroup(DeviceId deviceId,
                                                String tableId,
                                                String actionProfileId,
                                                int groupId,
                                                Collection<PiAction> actions,
                                                ApplicationId appId) {

    final GroupKey groupKey = new PiGroupKey(
            PiTableId.of(tableId), PiActionProfileId.of(actionProfileId), groupId);
    final List<GroupBucket> buckets = actions.stream()
            .map(action -> DefaultTrafficTreatment.builder()
                    .piTableAction(action).build())
            .map(DefaultGroupBucket::createSelectGroupBucket)
            .collect(Collectors.toList());
    return new DefaultGroupDescription(
            deviceId,
            GroupDescription.Type.SELECT,
            new GroupBuckets(buckets),
            groupKey,
            groupId,
            appId);
}
 
Example 3
Source File: Utils.java    From onos-p4-tutorial with Apache License 2.0 6 votes vote down vote up
public static GroupDescription buildSelectGroup(DeviceId deviceId,
                                                String tableId,
                                                String actionProfileId,
                                                int groupId,
                                                Collection<PiAction> actions,
                                                ApplicationId appId) {

    final GroupKey groupKey = new PiGroupKey(
            PiTableId.of(tableId), PiActionProfileId.of(actionProfileId), groupId);
    final List<GroupBucket> buckets = actions.stream()
            .map(action -> DefaultTrafficTreatment.builder()
                    .piTableAction(action).build())
            .map(DefaultGroupBucket::createSelectGroupBucket)
            .collect(Collectors.toList());
    return new DefaultGroupDescription(
            deviceId,
            GroupDescription.Type.SELECT,
            new GroupBuckets(buckets),
            groupKey,
            groupId,
            appId);
}
 
Example 4
Source File: ActionProfileMemberCodec.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public PiActionProfileMember decode(
        ActionProfileMember message, Object ignored,
        PiPipeconf pipeconf, P4InfoBrowser browser)
        throws P4InfoBrowser.NotFoundException, CodecException {
    final PiActionProfileId actionProfileId = PiActionProfileId.of(
            browser.actionProfiles()
                    .getById(message.getActionProfileId())
                    .getPreamble()
                    .getName());
    return PiActionProfileMember.builder()
            .forActionProfile(actionProfileId)
            .withId(PiActionProfileMemberId.of(message.getMemberId()))
            .withAction(CODECS.action().decode(
                    message.getAction(), null, pipeconf))
            .build();
}