Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 1 | package org.onosproject.segmentrouting; |
| 2 | |
| 3 | import org.onosproject.net.DeviceId; |
| 4 | import org.onosproject.net.flowobjective.Objective; |
| 5 | import org.onosproject.net.flowobjective.ObjectiveContext; |
| 6 | import org.onosproject.net.flowobjective.ObjectiveError; |
| 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; |
| 9 | |
| 10 | /** |
| 11 | * Segment Routing Flow Objective Context. |
| 12 | */ |
| 13 | public 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 | |