Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.pipelines.fabric.pipeliner; |
| 18 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 19 | import org.onlab.packet.VlanId; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 20 | import org.onosproject.net.DeviceId; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 21 | import org.onosproject.net.PortNumber; |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 22 | import org.onosproject.net.driver.Driver; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 23 | import org.onosproject.net.flow.DefaultFlowRule; |
| 24 | import org.onosproject.net.flow.DefaultTrafficSelector; |
| 25 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 26 | import org.onosproject.net.flow.TrafficSelector; |
| 27 | import org.onosproject.net.flow.TrafficTreatment; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 28 | import org.onosproject.net.flow.criteria.Criterion; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 29 | import org.onosproject.net.flow.criteria.PiCriterion; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 30 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 31 | import org.onosproject.net.flow.instructions.Instruction; |
| 32 | import org.onosproject.net.flow.instructions.Instructions.OutputInstruction; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 33 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 34 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 35 | import org.onosproject.net.flowobjective.NextObjective; |
Yi Tseng | 6e9b6f5 | 2018-02-27 10:40:51 +0100 | [diff] [blame] | 36 | import org.onosproject.net.flowobjective.Objective; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 37 | import org.onosproject.net.flowobjective.ObjectiveError; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 38 | import org.onosproject.net.group.DefaultGroupBucket; |
| 39 | import org.onosproject.net.group.DefaultGroupDescription; |
| 40 | import org.onosproject.net.group.GroupBucket; |
| 41 | import org.onosproject.net.group.GroupBuckets; |
| 42 | import org.onosproject.net.group.GroupDescription; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 43 | import org.onosproject.net.pi.runtime.PiActionGroupId; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 44 | import org.onosproject.net.pi.runtime.PiGroupKey; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 45 | import org.slf4j.Logger; |
| 46 | |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 47 | import java.util.List; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 48 | import java.util.stream.Collectors; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 49 | |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame] | 50 | import static org.onosproject.pipelines.fabric.FabricConstants.ACT_PRF_FABRICINGRESS_NEXT_ECMP_SELECTOR_ID; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 51 | import static org.onosproject.pipelines.fabric.FabricConstants.HF_FABRIC_METADATA_NEXT_ID_ID; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 52 | import static org.onosproject.pipelines.fabric.FabricConstants.HF_STANDARD_METADATA_EGRESS_PORT_ID; |
| 53 | import static org.onosproject.pipelines.fabric.FabricConstants.TBL_EGRESS_VLAN_ID; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 54 | import static org.onosproject.pipelines.fabric.FabricConstants.TBL_HASHED_ID; |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 55 | import static org.onosproject.pipelines.fabric.FabricConstants.TBL_SIMPLE_ID; |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 56 | import static org.onosproject.pipelines.fabric.FabricConstants.TBL_VLAN_META_ID; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 57 | import static org.slf4j.LoggerFactory.getLogger; |
| 58 | |
| 59 | /** |
| 60 | * Handling next objective for fabric pipeliner. |
| 61 | */ |
| 62 | public class FabricNextPipeliner { |
| 63 | private static final Logger log = getLogger(FabricNextPipeliner.class); |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 64 | private static final String NO_HASHED_TABLE = "noHashedTable"; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 65 | |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 66 | protected DeviceId deviceId; |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 67 | protected Driver driver; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 68 | |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 69 | public FabricNextPipeliner(DeviceId deviceId, Driver driver) { |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 70 | this.deviceId = deviceId; |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 71 | this.driver = driver; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | public PipelinerTranslationResult next(NextObjective nextObjective) { |
| 75 | PipelinerTranslationResult.Builder resultBuilder = PipelinerTranslationResult.builder(); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 76 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 77 | processNextVlanMeta(nextObjective, resultBuilder); |
| 78 | |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 79 | switch (nextObjective.type()) { |
| 80 | case SIMPLE: |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 81 | processSimpleNext(nextObjective, resultBuilder); |
| 82 | break; |
| 83 | case HASHED: |
| 84 | processHashedNext(nextObjective, resultBuilder); |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 85 | break; |
| 86 | default: |
| 87 | log.warn("Unsupported next type {}", nextObjective); |
| 88 | resultBuilder.setError(ObjectiveError.UNSUPPORTED); |
| 89 | break; |
| 90 | } |
| 91 | |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 92 | return resultBuilder.build(); |
| 93 | } |
| 94 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 95 | private void processNextVlanMeta(NextObjective next, |
| 96 | PipelinerTranslationResult.Builder resultBuilder) { |
| 97 | TrafficSelector meta = next.meta(); |
| 98 | if (meta == null) { |
| 99 | // do nothing if there is no metadata in the next objective. |
| 100 | return; |
| 101 | } |
| 102 | VlanIdCriterion vlanIdCriterion = |
| 103 | (VlanIdCriterion) meta.getCriterion(Criterion.Type.VLAN_VID); |
| 104 | |
| 105 | if (vlanIdCriterion == null) { |
| 106 | // do nothing if we can't find vlan from next objective metadata. |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | VlanId vlanId = vlanIdCriterion.vlanId(); |
| 111 | TrafficSelector selector = buildNextIdSelector(next.id()); |
| 112 | TrafficTreatment treatment = DefaultTrafficTreatment.builder() |
| 113 | .setVlanId(vlanId) |
| 114 | .build(); |
| 115 | |
| 116 | resultBuilder.addFlowRule(DefaultFlowRule.builder() |
| 117 | .withSelector(selector) |
| 118 | .withTreatment(treatment) |
| 119 | .forTable(TBL_VLAN_META_ID) |
| 120 | .makePermanent() |
| 121 | .withPriority(next.priority()) |
| 122 | .forDevice(deviceId) |
| 123 | .fromApp(next.appId()) |
| 124 | .build()); |
| 125 | } |
| 126 | |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 127 | private void processSimpleNext(NextObjective next, |
| 128 | PipelinerTranslationResult.Builder resultBuilder) { |
| 129 | |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 130 | if (next.next().size() > 1) { |
| 131 | log.warn("Only one treatment in simple next objective"); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 132 | resultBuilder.setError(ObjectiveError.BADPARAMS); |
| 133 | return; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | TrafficSelector selector = buildNextIdSelector(next.id()); |
| 137 | TrafficTreatment treatment = next.next().iterator().next(); |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 138 | PortNumber outputPort = getOutputPort(treatment); |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 139 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 140 | if (outputPort == null) { |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 141 | log.warn("At least one output instruction in simple next objective"); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 142 | resultBuilder.setError(ObjectiveError.BADPARAMS); |
| 143 | return; |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 144 | } |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 145 | |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 146 | resultBuilder.addFlowRule(DefaultFlowRule.builder() |
| 147 | .withSelector(selector) |
| 148 | .withTreatment(treatment) |
| 149 | .forTable(TBL_SIMPLE_ID) |
| 150 | .makePermanent() |
| 151 | .withPriority(next.priority()) |
| 152 | .forDevice(deviceId) |
| 153 | .fromApp(next.appId()) |
| 154 | .build()); |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 155 | |
| 156 | if (includesPopVlanInst(treatment)) { |
| 157 | processVlanPopRule(outputPort, next, resultBuilder); |
| 158 | } |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 159 | } |
| 160 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 161 | private PortNumber getOutputPort(TrafficTreatment treatment) { |
| 162 | return treatment.allInstructions() |
| 163 | .stream() |
| 164 | .filter(inst -> inst.type() == Instruction.Type.OUTPUT) |
| 165 | .map(inst -> (OutputInstruction) inst) |
| 166 | .findFirst() |
| 167 | .map(OutputInstruction::port) |
| 168 | .orElse(null); |
| 169 | } |
| 170 | |
| 171 | private boolean includesPopVlanInst(TrafficTreatment treatment) { |
| 172 | return treatment.allInstructions() |
| 173 | .stream() |
| 174 | .filter(inst -> inst.type() == Instruction.Type.L2MODIFICATION) |
| 175 | .map(inst -> (L2ModificationInstruction) inst) |
| 176 | .anyMatch(inst -> inst.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP); |
| 177 | } |
| 178 | |
| 179 | private void processVlanPopRule(PortNumber port, NextObjective next, |
| 180 | PipelinerTranslationResult.Builder resultBuilder) { |
| 181 | TrafficSelector meta = next.meta(); |
| 182 | VlanIdCriterion vlanIdCriterion = |
| 183 | (VlanIdCriterion) meta.getCriterion(Criterion.Type.VLAN_VID); |
| 184 | VlanId vlanId = vlanIdCriterion.vlanId(); |
| 185 | |
| 186 | PiCriterion egressVlanTableMatch = PiCriterion.builder() |
| 187 | .matchExact(HF_STANDARD_METADATA_EGRESS_PORT_ID, |
| 188 | (short) port.toLong()) |
| 189 | .build(); |
| 190 | // Add VLAN pop rule to egress pipeline table |
| 191 | TrafficSelector selector = DefaultTrafficSelector.builder() |
| 192 | .matchPi(egressVlanTableMatch) |
| 193 | .matchVlanId(vlanId) |
| 194 | .build(); |
| 195 | TrafficTreatment treatment = DefaultTrafficTreatment.builder() |
| 196 | .popVlan() |
| 197 | .build(); |
| 198 | resultBuilder.addFlowRule(DefaultFlowRule.builder() |
| 199 | .withSelector(selector) |
| 200 | .withTreatment(treatment) |
| 201 | .forTable(TBL_EGRESS_VLAN_ID) |
| 202 | .makePermanent() |
| 203 | .withPriority(next.priority()) |
| 204 | .forDevice(deviceId) |
| 205 | .fromApp(next.appId()) |
| 206 | .build()); |
| 207 | } |
| 208 | |
| 209 | private void processHashedNext(NextObjective next, PipelinerTranslationResult.Builder resultBuilder) { |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 210 | boolean noHashedTable = Boolean.parseBoolean(driver.getProperty(NO_HASHED_TABLE)); |
| 211 | |
| 212 | if (noHashedTable) { |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 213 | if (next.next().isEmpty()) { |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 214 | return; |
| 215 | } |
| 216 | // use first action if not support hashed group |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 217 | TrafficTreatment treatment = next.next().iterator().next(); |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 218 | |
| 219 | NextObjective.Builder simpleNext = DefaultNextObjective.builder() |
| 220 | .addTreatment(treatment) |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 221 | .withId(next.id()) |
| 222 | .fromApp(next.appId()) |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 223 | .makePermanent() |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 224 | .withMeta(next.meta()) |
| 225 | .withPriority(next.priority()) |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 226 | .withType(NextObjective.Type.SIMPLE); |
| 227 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 228 | if (next.context().isPresent()) { |
| 229 | processSimpleNext(simpleNext.add(next.context().get()), resultBuilder); |
Yi Tseng | 4fd2843 | 2018-02-01 14:48:03 -0800 | [diff] [blame] | 230 | } else { |
| 231 | processSimpleNext(simpleNext.add(), resultBuilder); |
| 232 | } |
| 233 | return; |
| 234 | } |
| 235 | |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 236 | // create hash groups |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 237 | int groupId = next.id(); |
| 238 | List<GroupBucket> bucketList = next.next().stream() |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 239 | .map(DefaultGroupBucket::createSelectGroupBucket) |
| 240 | .collect(Collectors.toList()); |
| 241 | |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 242 | // Egress VLAN handling |
| 243 | next.next().forEach(treatment -> { |
| 244 | PortNumber outputPort = getOutputPort(treatment); |
| 245 | if (includesPopVlanInst(treatment) && outputPort != null) { |
| 246 | processVlanPopRule(outputPort, next, resultBuilder); |
| 247 | } |
| 248 | }); |
| 249 | |
| 250 | if (bucketList.size() != next.next().size()) { |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 251 | // some action not converted |
| 252 | // set error |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 253 | log.warn("Expected bucket size {}, got {}", next.next().size(), bucketList.size()); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 254 | resultBuilder.setError(ObjectiveError.BADPARAMS); |
| 255 | return; |
| 256 | } |
| 257 | |
| 258 | GroupBuckets buckets = new GroupBuckets(bucketList); |
| 259 | PiGroupKey groupKey = new PiGroupKey(TBL_HASHED_ID, |
Yi Tseng | 27b9bc0 | 2018-04-12 14:52:40 +0800 | [diff] [blame] | 260 | ACT_PRF_FABRICINGRESS_NEXT_ECMP_SELECTOR_ID, |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 261 | groupId); |
| 262 | |
| 263 | resultBuilder.addGroup(new DefaultGroupDescription(deviceId, |
| 264 | GroupDescription.Type.SELECT, |
| 265 | buckets, |
| 266 | groupKey, |
| 267 | groupId, |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 268 | next.appId())); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 269 | |
| 270 | // flow |
Yi Tseng | 6e9b6f5 | 2018-02-27 10:40:51 +0100 | [diff] [blame] | 271 | // If operation is ADD_TO_EXIST or REMOVE_FROM_EXIST, means we modify |
| 272 | // group buckets only, no changes for flow rule |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 273 | if (next.op() == Objective.Operation.ADD_TO_EXISTING || |
| 274 | next.op() == Objective.Operation.REMOVE_FROM_EXISTING) { |
Yi Tseng | 6e9b6f5 | 2018-02-27 10:40:51 +0100 | [diff] [blame] | 275 | return; |
| 276 | } |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 277 | TrafficSelector selector = buildNextIdSelector(next.id()); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 278 | TrafficTreatment treatment = DefaultTrafficTreatment.builder() |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 279 | .piTableAction(PiActionGroupId.of(next.id())) |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 280 | .build(); |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 281 | |
| 282 | resultBuilder.addFlowRule(DefaultFlowRule.builder() |
| 283 | .withSelector(selector) |
| 284 | .withTreatment(treatment) |
| 285 | .forTable(TBL_HASHED_ID) |
| 286 | .makePermanent() |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 287 | .withPriority(next.priority()) |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 288 | .forDevice(deviceId) |
Yi Tseng | 20f9e7b | 2018-05-24 23:27:39 +0800 | [diff] [blame] | 289 | .fromApp(next.appId()) |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 290 | .build()); |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | private TrafficSelector buildNextIdSelector(int nextId) { |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 294 | PiCriterion nextIdCriterion = PiCriterion.builder() |
| 295 | .matchExact(HF_FABRIC_METADATA_NEXT_ID_ID, nextId) |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 296 | .build(); |
| 297 | return DefaultTrafficSelector.builder() |
Yi Tseng | 1b154bd | 2017-11-20 17:48:19 -0800 | [diff] [blame] | 298 | .matchPi(nextIdCriterion) |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 299 | .build(); |
| 300 | } |
Yi Tseng | 0b80972 | 2017-11-03 10:23:26 -0700 | [diff] [blame] | 301 | } |