Search in sources :

Example 1 with Ofdpa3PushL2Header

use of org.onosproject.driver.extensions.Ofdpa3PushL2Header in project onos by opennetworkinglab.

the class Ofdpa3GroupHandler method createMplsL2VpnGroup.

/**
 * Helper method to create a mpls l2 vpn group.
 *
 * @param nextGroupId the next group in the chain
 * @param index the index of the group
 * @param instructions the instructions to push
 * @param applicationId the application id
 * @return the group description
 */
private GroupDescription createMplsL2VpnGroup(int nextGroupId, int index, List<Instruction> instructions, ApplicationId applicationId) {
    TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
    // We add the extensions and the instructions.
    treatment.extension(new Ofdpa3PushL2Header(), deviceId);
    treatment.pushVlan();
    instructions.forEach(treatment::add);
    treatment.extension(new Ofdpa3PushCw(), deviceId);
    // We point the group to the next group.
    treatment.group(new GroupId(nextGroupId));
    GroupBucket groupBucket = DefaultGroupBucket.createIndirectGroupBucket(treatment.build());
    // Finally we build the group description.
    int groupId = makeMplsLabelGroupId(OfdpaMplsGroupSubType.L2_VPN, index);
    GroupKey groupKey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(index));
    return new DefaultGroupDescription(deviceId, INDIRECT, new GroupBuckets(Collections.singletonList(groupBucket)), groupKey, groupId, applicationId);
}
Also used : GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupBucket(org.onosproject.net.group.GroupBucket) DefaultGroupBucket(org.onosproject.net.group.DefaultGroupBucket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) GroupBuckets(org.onosproject.net.group.GroupBuckets) Ofdpa3PushL2Header(org.onosproject.driver.extensions.Ofdpa3PushL2Header) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription) Ofdpa3PushCw(org.onosproject.driver.extensions.Ofdpa3PushCw) GroupId(org.onosproject.core.GroupId)

Aggregations

GroupId (org.onosproject.core.GroupId)1 Ofdpa3PushCw (org.onosproject.driver.extensions.Ofdpa3PushCw)1 Ofdpa3PushL2Header (org.onosproject.driver.extensions.Ofdpa3PushL2Header)1 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)1 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)1 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)1 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)1 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)1 GroupBucket (org.onosproject.net.group.GroupBucket)1 GroupBuckets (org.onosproject.net.group.GroupBuckets)1 GroupKey (org.onosproject.net.group.GroupKey)1