blob: f12260a6a22d848135fd6f30f39ca7dcf43c1224 [file] [log] [blame]
Jian Lie2d87512018-08-23 17:33:05 +09001/*
2 * Copyright 2018-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 */
16package org.onosproject.simplefabric.api;
17
18import org.onlab.packet.IpAddress;
19import org.onlab.packet.IpPrefix;
20import org.onosproject.cluster.NodeId;
21
22/**
23 * Interface of fabric route.
24 */
25public interface FabricRoute {
26
27 /**
28 * Source of the route.
29 */
30 enum Source {
31 /**
32 * Route came from the iBGP route source.
33 */
34 BGP,
35
36 /**
37 * Route came from the FPM route source.
38 */
39 FPM,
40
41 /**
42 * Route can from the static route source.
43 */
44 STATIC,
45
46 /**
47 * Route source was not defined.
48 */
49 UNDEFINED
50 }
51
52 /**
53 * Returns the route source.
54 *
55 * @return route source
56 */
57 Source source();
58
59 /**
60 * Returns the IP prefix of the route.
61 *
62 * @return IP prefix
63 */
64 IpPrefix prefix();
65
66 /**
67 * Returns the next hop IP address.
68 *
69 * @return next hop
70 */
71 IpAddress nextHop();
72
73 /**
74 * Returns the ONOS node the route was sourced from.
75 *
76 * @return ONOS node ID
77 */
78 NodeId sourceNode();
79
80 /**
81 * Builder of FabricRoute.
82 */
83 interface Builder {
84
85 /**
86 * Returns FabricRoute builder with supplied source.
87 *
88 * @param source source of route
89 * @return FabricRoute instance builder
90 */
91 Builder source(Source source);
92
93 /**
94 * Returns FabricRoute builder with supplied IP prefix.
95 *
96 * @param prefix IP prefix
97 * @return FabricRoute instance builder
98 */
99 Builder prefix(IpPrefix prefix);
100
101 /**
102 * Returns Fabric builder with supplied next hop.
103 *
104 * @param nextHop next hop
105 * @return FabricRoute instance builder
106 */
107 Builder nextHop(IpAddress nextHop);
108
109 /**
110 * Returns Fabric builder with supplied source node identifier.
111 *
112 * @param sourceNode source node identifier
113 * @return FabricRoute instance builder
114 */
115 Builder sourceNode(NodeId sourceNode);
116
117 /**
118 * Builds an immutable FabricRoute instance.
119 *
120 * @return FabricRoute instance
121 */
122 FabricRoute build();
123 }
124}