blob: 24413c1c763262ccf10ec63592507d7dc2173637 [file] [log] [blame]
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
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 */
16package org.onosproject.pce.pceservice;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import java.util.Collection;
21import java.util.Iterator;
22import java.util.HashSet;
23import java.util.List;
24import java.util.LinkedList;
25import java.util.Map;
26import java.util.Set;
27
Avantika-Huaweidbdf7722016-05-21 14:20:31 +053028import org.onlab.packet.IpAddress;
29import org.onlab.packet.IpPrefix;
30import org.onlab.packet.MplsLabel;
31import org.onlab.packet.TpPort;
32import org.onosproject.core.ApplicationId;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +053033import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
34import org.onosproject.incubator.net.resource.label.LabelResource;
35import org.onosproject.incubator.net.resource.label.LabelResourceId;
36import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
37import org.onosproject.incubator.net.resource.label.LabelResourceService;
38import org.onosproject.incubator.net.tunnel.DefaultLabelStack;
39import org.onosproject.incubator.net.tunnel.LabelStack;
40import org.onosproject.net.DeviceId;
41import org.onosproject.pce.pcestore.api.PceStore;
42import org.onosproject.net.Link;
43import org.onosproject.net.Path;
Avantika-Huaweidbdf7722016-05-21 14:20:31 +053044import org.onosproject.net.PortNumber;
45import org.onosproject.net.flow.DefaultTrafficSelector;
46import org.onosproject.net.flow.DefaultTrafficTreatment;
47import org.onosproject.net.flow.TrafficSelector;
48import org.onosproject.net.flow.TrafficTreatment;
49import org.onosproject.net.flowobjective.DefaultForwardingObjective;
50import org.onosproject.net.flowobjective.FlowObjectiveService;
51import org.onosproject.net.flowobjective.ForwardingObjective;
52import org.onosproject.net.flowobjective.Objective;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +053053import org.slf4j.Logger;
54import org.slf4j.LoggerFactory;
55
56import com.google.common.collect.ArrayListMultimap;
57import com.google.common.collect.Multimap;
58
59/**
60 * PCE SR-BE and SR-TE functionality.
61 * SR-BE: Each node (PCC) is allocated a node-SID (label) by the PCECC. The PCECC sends PCLabelUpd to
62 * update the label map of each node to all the nodes in the domain.
63 * SR-TE: apart from node-SID, Adj-SID is used where each adjacency is allocated an Adj-SID (label) by the PCECC.
64 * The PCECC sends PCLabelUpd to update the label map of each Adj to the corresponding nodes in the domain.
65 */
66public final class PceccSrTeBeHandler {
67 private static final Logger log = LoggerFactory.getLogger(PceccSrTeBeHandler.class);
68
69 private static final String LABEL_RESOURCE_ADMIN_SERVICE_NULL = "Label Resource Admin Service cannot be null";
70 private static final String LABEL_RESOURCE_SERVICE_NULL = "Label Resource Service cannot be null";
71 private static final String PCE_STORE_NULL = "PCE Store cannot be null";
72 private static final String DEVICE_SERVICE_NULL = "Device Service cannot be null";
73 private static final String DEVICE_ID_NULL = "Device-Id cannot be null";
74 private static final String LSR_ID_NULL = "LSR-Id cannot be null";
75 private static final String DEVICE_ID_LSR_ID_MAP_NULL = "Device-Id and LSR-Id map cannot be null";
76 private static final String LINK_NULL = "Link cannot be null";
77 private static final String PATH_NULL = "Path cannot be null";
78 private static final String LSR_ID = "lsrId";
79 private static final int PREFIX_LENGTH = 32;
80 private static PceccSrTeBeHandler srTeHandlerInstance = null;
81 private LabelResourceAdminService labelRsrcAdminService;
82 private LabelResourceService labelRsrcService;
Avantika-Huaweidbdf7722016-05-21 14:20:31 +053083 private FlowObjectiveService flowObjectiveService;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +053084 private PceStore pceStore;
Avantika-Huaweidbdf7722016-05-21 14:20:31 +053085 private ApplicationId appId;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +053086
87 /**
88 * Initializes default values.
89 */
90 private PceccSrTeBeHandler() {
91 }
92
93 /**
94 * Returns single instance of this class.
95 *
96 * @return this class single instance
97 */
98 public static PceccSrTeBeHandler getInstance() {
99 if (srTeHandlerInstance == null) {
100 srTeHandlerInstance = new PceccSrTeBeHandler();
101 }
102 return srTeHandlerInstance;
103 }
104
105 /**
106 * Initialization of label manager interfaces and pce store.
107 *
108 * @param labelRsrcAdminService label resource admin service
109 * @param labelRsrcService label resource service
Mahesh Poojary Huaweie2d87ff2016-05-27 12:37:46 +0530110 * @param flowObjectiveService flow objective service to push device label information
111 * @param appId application id
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530112 * @param pceStore PCE label store
113 */
114 public void initialize(LabelResourceAdminService labelRsrcAdminService,
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530115 LabelResourceService labelRsrcService,
116 FlowObjectiveService flowObjectiveService,
117 ApplicationId appId, PceStore pceStore) {
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530118 this.labelRsrcAdminService = labelRsrcAdminService;
119 this.labelRsrcService = labelRsrcService;
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530120 this.flowObjectiveService = flowObjectiveService;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530121 this.pceStore = pceStore;
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530122 this.appId = appId;
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530123 }
124
125 /**
126 * Reserves the global label pool.
127 *
128 * @param beginLabel minimum value of global label space
129 * @param endLabel maximum value of global label space
130 * @return success or failure
131 */
132 public boolean reserveGlobalPool(long beginLabel, long endLabel) {
133 checkNotNull(labelRsrcAdminService, LABEL_RESOURCE_ADMIN_SERVICE_NULL);
134 return labelRsrcAdminService.createGlobalPool(LabelResourceId.labelResourceId(beginLabel),
135 LabelResourceId.labelResourceId(endLabel));
136 }
137
138 /**
139 * Allocates node label from global node label pool to specific device.
140 * Configure this device with labels and lsrid mapping of all other devices and vice versa.
141 *
142 * @param specificDeviceId node label needs to be allocated to specific device
143 * @param specificLsrId lsrid of specific device
144 * @param deviceIdLsrIdMap deviceid and lsrid mapping
145 * @return success or failure
146 */
147 public boolean allocateNodeLabel(DeviceId specificDeviceId, String specificLsrId,
148 Map<DeviceId, String> deviceIdLsrIdMap) {
149 long applyNum = 1; // For each node only one node label
150 LabelResourceId specificLabelId = null;
151
152 checkNotNull(specificDeviceId, DEVICE_ID_NULL);
153 checkNotNull(specificLsrId, LSR_ID_NULL);
154 checkNotNull(deviceIdLsrIdMap, DEVICE_ID_LSR_ID_MAP_NULL);
155 checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
156 checkNotNull(pceStore, PCE_STORE_NULL);
157
158 // The specificDeviceId is the new device and is not there in the deviceIdLsrIdMap.
159 // So, first generate its label and configure label and its lsr-id to it.
160 Collection<LabelResource> result = labelRsrcService.applyFromGlobalPool(applyNum);
161 if (result.size() > 0) {
162 // Only one element (label-id) to retrieve
163 Iterator<LabelResource> iterator = result.iterator();
164 DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
165 specificLabelId = defaultLabelResource.labelResourceId();
166 if (specificLabelId == null) {
167 log.error("Unable to retrieve global node label for a device id {}.", specificDeviceId.toString());
168 return false;
169 }
170 } else {
171 log.error("Unable to allocate global node label for a device id {}.", specificDeviceId.toString());
172 return false;
173 }
174
175 pceStore.addGlobalNodeLabel(specificDeviceId, specificLabelId);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530176 // Push its label information into specificDeviceId
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530177 advertiseNodeLabelRule(specificDeviceId, specificLabelId,
178 IpPrefix.valueOf(IpAddress.valueOf(specificLsrId), PREFIX_LENGTH),
179 Objective.Operation.ADD, false);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530180
181 // Configure (node-label, lsr-id) mapping of each devices in list to specific device and vice versa.
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530182 for (Map.Entry<DeviceId, String> element:deviceIdLsrIdMap.entrySet()) {
183 DeviceId otherDevId = element.getKey();
184 String otherLsrId = element.getValue();
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530185 if (otherLsrId == null) {
186 log.error("The lsr-id of device id {} is null.", otherDevId.toString());
187 releaseNodeLabel(specificDeviceId, specificLsrId, deviceIdLsrIdMap);
188 return false;
189 }
190
191 // Label for other device in list should be already allocated.
192 LabelResourceId otherLabelId = pceStore.getGlobalNodeLabel(otherDevId);
193 if (otherLabelId == null) {
194 log.error("Unable to find global node label in store for a device id {}.", otherDevId.toString());
195 releaseNodeLabel(specificDeviceId, specificLsrId, deviceIdLsrIdMap);
196 return false;
197 }
198
199 // Push to device
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530200 // Push label information of specificDeviceId to otherDevId in list and vice versa.
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530201 advertiseNodeLabelRule(otherDevId, specificLabelId, IpPrefix.valueOf(IpAddress.valueOf(specificLsrId),
202 PREFIX_LENGTH), Objective.Operation.ADD, false);
203 advertiseNodeLabelRule(specificDeviceId, otherLabelId, IpPrefix.valueOf(IpAddress.valueOf(otherLsrId),
204 PREFIX_LENGTH), Objective.Operation.ADD, false);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530205 }
206
207 return true;
208 }
209
210 /**
211 * Releases assigned node label of specific device from global node label pool and pce store.
212 * and remove configured this node label from all other devices.
213 *
214 * @param specificDeviceId node label needs to be released for specific device
215 * @param specificLsrId lsrid of specific device
216 * @param deviceIdLsrIdMap deviceid and lsrid mapping
217 * @return success or failure
218 */
219 public boolean releaseNodeLabel(DeviceId specificDeviceId, String specificLsrId,
220 Map<DeviceId, String> deviceIdLsrIdMap) {
221 checkNotNull(specificDeviceId, DEVICE_ID_NULL);
222 checkNotNull(specificLsrId, LSR_ID_NULL);
223 checkNotNull(deviceIdLsrIdMap, DEVICE_ID_LSR_ID_MAP_NULL);
224 checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
225 checkNotNull(pceStore, PCE_STORE_NULL);
226 boolean retValue = true;
227
228 // Release node label entry of this specific device from all other devices
229 // Retrieve node label of this specific device from store
230 LabelResourceId labelId = pceStore.getGlobalNodeLabel(specificDeviceId);
231 if (labelId == null) {
232 log.error("Unable to retrieve label of a device id {} from store.", specificDeviceId.toString());
233 return false;
234 }
235
236 // Go through all devices in the map and remove label entry
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530237 for (Map.Entry<DeviceId, String> element:deviceIdLsrIdMap.entrySet()) {
238 DeviceId otherDevId = element.getKey();
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530239
240 // Remove this specific device label information from all other nodes except
241 // this specific node where connection already lost.
242 if (!specificDeviceId.equals(otherDevId)) {
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530243 advertiseNodeLabelRule(otherDevId, labelId, IpPrefix.valueOf(IpAddress.valueOf(specificLsrId),
244 PREFIX_LENGTH), Objective.Operation.REMOVE, false);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530245 }
246 }
247
248 // Release from label manager
249 Set<LabelResourceId> release = new HashSet<>();
250 release.add(labelId);
251 if (!labelRsrcService.releaseToGlobalPool(release)) {
252 log.error("Unable to release label id {} from label manager.", labelId.toString());
253 retValue = false;
254 }
255
256 // Remove from store
257 if (!pceStore.removeGlobalNodeLabel(specificDeviceId)) {
258 log.error("Unable to remove global node label id {} from store.", labelId.toString());
259 retValue = false;
260 }
261
262 return retValue;
263 }
264
265 /**
266 * Allocates adjacency label to a link from local resource pool by a specific device id.
267 *
268 * @param link between devices
269 * @return success or failure
270 */
271 public boolean allocateAdjacencyLabel(Link link) {
272 long applyNum = 1; // Single label to each link.
273 DeviceId srcDeviceId = link.src().deviceId();
274 Collection<LabelResource> labelList;
275
276 checkNotNull(link, LINK_NULL);
277 checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
278 checkNotNull(pceStore, PCE_STORE_NULL);
279
280 // Allocate adjacency label to a link from label manager.
281 // Take label from source device pool to allocate.
282 labelList = labelRsrcService.applyFromDevicePool(srcDeviceId, applyNum);
283 if (labelList.size() <= 0) {
284 log.error("Unable to allocate label to a device id {}.", srcDeviceId.toString());
285 return false;
286 }
287
288 // Currently only one label to a device. So, no need to iterate through list
289 Iterator<LabelResource> iterator = labelList.iterator();
290 DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
291 LabelResourceId labelId = defaultLabelResource.labelResourceId();
292 if (labelId == null) {
293 log.error("Unable to allocate label to a device id {}.", srcDeviceId.toString());
294 return false;
295 }
296 log.debug("Allocated adjacency label {} to a link {}.", labelId.toString(),
297 link.toString());
298
299 // Push adjacency label to device
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530300 installAdjLabelRule(srcDeviceId, labelId, link.src().port(), link.dst().port(), Objective.Operation.ADD);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530301
302 // Save in store
303 pceStore.addAdjLabel(link, labelId);
304 return true;
305 }
306
307 /**
308 * Releases unused adjacency labels from device pools.
309 *
310 * @param link between devices
311 * @return success or failure
312 */
313 public boolean releaseAdjacencyLabel(Link link) {
314 checkNotNull(link, LINK_NULL);
315 checkNotNull(labelRsrcService, LABEL_RESOURCE_SERVICE_NULL);
316 checkNotNull(pceStore, PCE_STORE_NULL);
317 boolean retValue = true;
318
319 // Retrieve link label from store
320 LabelResourceId labelId = pceStore.getAdjLabel(link);
321 if (labelId == null) {
322 log.error("Unabel to retrieve label for a link {} from store.", link.toString());
323 return false;
324 }
325
326 // Device
327 DeviceId srcDeviceId = link.src().deviceId();
328
329 // Release adjacency label from device
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530330 installAdjLabelRule(srcDeviceId, labelId, link.src().port(), link.dst().port(), Objective.Operation.REMOVE);
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530331
332 // Release link label from label manager
333 Multimap<DeviceId, LabelResource> release = ArrayListMultimap.create();
334 DefaultLabelResource defaultLabelResource = new DefaultLabelResource(srcDeviceId, labelId);
335 release.put(srcDeviceId, defaultLabelResource);
336 if (!labelRsrcService.releaseToDevicePool(release)) {
337 log.error("Unable to release label id {} from label manager.", labelId.toString());
338 retValue = false;
339 }
340
341 // Remove adjacency label from store
342 if (!pceStore.removeAdjLabel(link)) {
343 log.error("Unable to remove adjacency label id {} from store.", labelId.toString());
344 retValue = false;
345 }
346 return retValue;
347 }
348
349 /**
350 * Computes label stack for a path.
351 *
352 * @param path lsp path
353 * @return label stack
354 */
355 public LabelStack computeLabelStack(Path path) {
356 checkNotNull(path, PATH_NULL);
357 // Label stack is linked list to make labels in order.
358 List<LabelResourceId> labelStack = new LinkedList<>();
359 List<Link> linkList = path.links();
360 if ((linkList != null) && (linkList.size() > 0)) {
361 // Path: [x] ---- [y] ---- [z]
362 // For other than last link, add only source[x] device label.
363 // For the last link, add both source[y] and destination[z] device labels.
364 // For all links add adjacency label
365 Link link = null;
366 LabelResourceId nodeLabelId = null;
367 LabelResourceId adjLabelId = null;
368 DeviceId deviceId = null;
369 for (Iterator<Link> iterator = linkList.iterator(); iterator.hasNext();) {
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530370 link = iterator.next();
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530371 // Add source device label now
372 deviceId = link.src().deviceId();
373 nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
374 if (nodeLabelId == null) {
375 log.error("Unable to find node label for a device id {} in store.", deviceId.toString());
376 return null;
377 }
378 labelStack.add(nodeLabelId);
379
380 // Add adjacency label for this link
381 adjLabelId = pceStore.getAdjLabel(link);
382 if (adjLabelId == null) {
383 log.error("Adjacency label id is null for a link {}.", link.toString());
384 return null;
385 }
386 labelStack.add(adjLabelId);
387 }
388
389 // This is the last link in path
390 // Add destination device label now.
391 if (link != null) {
392 deviceId = link.dst().deviceId();
393 nodeLabelId = pceStore.getGlobalNodeLabel(deviceId);
394 if (nodeLabelId == null) {
395 log.error("Unable to find node label for a device id {} in store.", deviceId.toString());
396 return null;
397 }
398 labelStack.add(nodeLabelId);
399 }
400 } else {
401 log.debug("Empty link in path.");
402 return null;
403 }
404 return new DefaultLabelStack(labelStack);
405 }
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530406
407 /**
408 * Install a rule for pushing unique global labels to the device.
Avantika-Huawei032a9872016-05-27 22:57:38 +0530409 *
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530410 * @param deviceId device to which flow should be pushed
411 * @param labelId label for the device
412 * @param type type of operation
413 */
414 private void installNodeLabelRule(DeviceId deviceId, LabelResourceId labelId, Objective.Operation type) {
415 checkNotNull(flowObjectiveService);
416 checkNotNull(appId);
417 TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
418
419 selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
420
421 TrafficTreatment treatment = DefaultTrafficTreatment.builder()
422 .build();
423
424 ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
425 .withSelector(selectorBuilder.build())
426 .withTreatment(treatment)
427 .withFlag(ForwardingObjective.Flag.VERSATILE)
428 .fromApp(appId)
429 .makePermanent();
430
431 if (type.equals(Objective.Operation.ADD)) {
432
433 flowObjectiveService.forward(deviceId, forwardingObjective.add());
434 } else {
435 flowObjectiveService.forward(deviceId, forwardingObjective.remove());
436 }
437 }
438
439 /**
440 * Install a rule for pushing node labels to the device of other nodes.
Avantika-Huawei032a9872016-05-27 22:57:38 +0530441 *
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530442 * @param deviceId device to which flow should be pushed
443 * @param labelId label for the device
444 * @param ipPrefix device for which label is pushed
445 * @param type type of operation
446 * @param bBos is this the end of sync push
447 */
448 public void advertiseNodeLabelRule(DeviceId deviceId, LabelResourceId labelId,
449 IpPrefix ipPrefix, Objective.Operation type, boolean bBos) {
450 checkNotNull(flowObjectiveService);
451 checkNotNull(appId);
452 TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
453
454 selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
455 selectorBuilder.matchIPSrc(ipPrefix);
456
457 if (bBos) {
458 selectorBuilder.matchMplsBos(bBos);
459 }
460
461 TrafficTreatment treatment = DefaultTrafficTreatment.builder()
462 .build();
463
464 ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
465 .withSelector(selectorBuilder.build())
466 .withTreatment(treatment)
467 .withFlag(ForwardingObjective.Flag.VERSATILE)
468 .fromApp(appId)
469 .makePermanent();
470
471 if (type.equals(Objective.Operation.ADD)) {
472 flowObjectiveService.forward(deviceId, forwardingObjective.add());
473 } else {
474 flowObjectiveService.forward(deviceId, forwardingObjective.remove());
475 }
476 }
477
478 /**
Avantika-Huawei032a9872016-05-27 22:57:38 +0530479 * Install a rule for pushing Adjacency labels to the device.
480 *
Avantika-Huaweidbdf7722016-05-21 14:20:31 +0530481 * @param deviceId device to which flow should be pushed
482 * @param labelId label for the adjacency
483 * @param srcPortNum local port of the adjacency
484 * @param dstPortNum remote port of the adjacency
485 * @param type type of operation
486 */
487 public void installAdjLabelRule(DeviceId deviceId, LabelResourceId labelId,
488 PortNumber srcPortNum, PortNumber dstPortNum,
489 Objective.Operation type) {
490 checkNotNull(flowObjectiveService);
491 checkNotNull(appId);
492 TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
493
494 selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
495 selectorBuilder.matchTcpSrc(TpPort.tpPort((int) srcPortNum.toLong()));
496 selectorBuilder.matchTcpDst(TpPort.tpPort((int) dstPortNum.toLong()));
497
498 TrafficTreatment treatment = DefaultTrafficTreatment.builder()
499 .build();
500
501 ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
502 .withSelector(selectorBuilder.build())
503 .withTreatment(treatment)
504 .withFlag(ForwardingObjective.Flag.VERSATILE)
505 .fromApp(appId)
506 .makePermanent();
507
508 if (type.equals(Objective.Operation.ADD)) {
509 flowObjectiveService.forward(deviceId, forwardingObjective.add());
510 } else {
511 flowObjectiveService.forward(deviceId, forwardingObjective.remove());
512 }
513 }
Mahesh Poojary Sa4df1aa2016-05-13 08:53:53 +0530514}