blob: 8dd75de3c55eb2a2195908b3ab881f82388d3c3a [file] [log] [blame]
Charles Chan5270ed02016-01-30 23:22:37 -08001package org.onosproject.segmentrouting;
2
3import org.onosproject.net.DeviceId;
4import org.onosproject.net.flowobjective.Objective;
5import org.onosproject.net.flowobjective.ObjectiveContext;
6import org.onosproject.net.flowobjective.ObjectiveError;
7import org.slf4j.Logger;
8import org.slf4j.LoggerFactory;
9
10/**
11 * Segment Routing Flow Objective Context.
12 */
13public class SRObjectiveContext implements ObjectiveContext {
14 enum ObjectiveType {
15 FILTER,
16 FORWARDING
17 }
18 private final DeviceId deviceId;
19 private final ObjectiveType type;
20
21 private static final Logger log = LoggerFactory
22 .getLogger(SegmentRoutingManager.class);
23
24 SRObjectiveContext(DeviceId deviceId, ObjectiveType type) {
25 this.deviceId = deviceId;
26 this.type = type;
27 }
28 @Override
29 public void onSuccess(Objective objective) {
30 log.debug("{} objective operation successful in device {}",
31 type.name(), deviceId);
32 }
33
34 @Override
35 public void onError(Objective objective, ObjectiveError error) {
36 log.warn("{} objective {} operation failed with error: {} in device {}",
37 type.name(), objective, error, deviceId);
38 }
39}
40