blob: afc6d2e12f9407c254e8a12733c6dd4460bffbf1 [file] [log] [blame]
Brian O'Connor7cbbbb72016-04-09 02:13:23 -07001/*
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 */
Charles Chan5270ed02016-01-30 23:22:37 -080016package org.onosproject.segmentrouting;
17
18import org.onosproject.net.DeviceId;
19import org.onosproject.net.flowobjective.Objective;
20import org.onosproject.net.flowobjective.ObjectiveContext;
21import org.onosproject.net.flowobjective.ObjectiveError;
22import org.slf4j.Logger;
23import org.slf4j.LoggerFactory;
24
25/**
26 * Segment Routing Flow Objective Context.
27 */
28public class SRObjectiveContext implements ObjectiveContext {
29 enum ObjectiveType {
30 FILTER,
31 FORWARDING
32 }
33 private final DeviceId deviceId;
34 private final ObjectiveType type;
35
36 private static final Logger log = LoggerFactory
37 .getLogger(SegmentRoutingManager.class);
38
39 SRObjectiveContext(DeviceId deviceId, ObjectiveType type) {
40 this.deviceId = deviceId;
41 this.type = type;
42 }
43 @Override
44 public void onSuccess(Objective objective) {
45 log.debug("{} objective operation successful in device {}",
46 type.name(), deviceId);
47 }
48
49 @Override
50 public void onError(Objective objective, ObjectiveError error) {
51 log.warn("{} objective {} operation failed with error: {} in device {}",
52 type.name(), objective, error, deviceId);
53 }
54}
55