blob: be2bed3bb5d0672cac02ea2b8e890716b7571a13 [file] [log] [blame]
Lee Yongjae7c27bb42017-11-17 12:00:45 +09001/*
2 * Copyright 2017-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;
17
18import org.onlab.packet.IpAddress;
Lee Yongjae7c27bb42017-11-17 12:00:45 +090019import org.onlab.packet.MacAddress;
20import org.onlab.packet.VlanId;
21import org.onosproject.core.ApplicationId;
22import org.onosproject.event.ListenerService;
23import org.onosproject.net.intf.Interface;
24import org.onosproject.net.ConnectPoint;
25import org.onosproject.net.Host;
26
27import java.io.OutputStream;
28import java.util.Set;
29import java.util.Collection;
30
31/**
32 * Provides information about the routing configuration.
33 */
34public interface SimpleFabricService
35 extends ListenerService<SimpleFabricEvent, SimpleFabricListener> {
36
37 // App symbols
38 static final String APP_ID = "org.onosproject.simplefabric";
39 static final String L2FORWARD_APP_ID = "org.onosproject.simplefabric.l2forward";
40 static final String REACTIVE_APP_ID = "org.onosproject.simplefabric.reactive";
41
42 // Priority for l2NetworkRouting: L2NETWORK_UNICAST or L2NETWORK_BROADCAST
43 static final int PRI_L2NETWORK_UNICAST = 601;
44 static final int PRI_L2NETWORK_BROADCAST = 600;
45
46 // Reactive Routing within Local Subnets
47 // ASSUME: local subnets NEVER overlaps each other
48 static final int PRI_REACTIVE_LOCAL_FORWARD = 501;
49 static final int PRI_REACTIVE_LOCAL_INTERCEPT = 500;
50 // Reactive Routing for Border Routes with local subnet
51 // Priority: REACTIVE_BROUTE_BASE + routeIpPrefix * REACTIVE_BROUTE_STEP
52 // + REACTIVE_BROUTE_FORWARD or REACTIVE_BROUTE_INTERCEPT
53 static final int PRI_REACTIVE_BORDER_BASE = 100;
54 static final int PRI_REACTIVE_BORDER_STEP = 2;
55 static final int PRI_REACTIVE_BORDER_FORWARD = 1;
56 static final int PRI_REACTIVE_BORDER_INTERCEPT = 0;
57
58 // Simple fabric event related timers
59 static final long IDLE_INTERVAL_MSEC = 5000;
60
61 // Feature control parameters
62 static final boolean ALLOW_IPV6 = false;
63 static final boolean ALLOW_ETH_ADDRESS_SELECTOR = true;
64 static final boolean REACTIVE_SINGLE_TO_SINGLE = false;
65 static final boolean REACTIVE_ALLOW_LINK_CP = false; // MUST BE false (yjlee, 2017-10-18)
66 static final boolean REACTIVE_HASHED_PATH_SELECTION = false;
67 static final boolean REACTIVE_MATCH_IP_PROTO = false;
68
69 /**
70 * Gets appId.
71 *
72 * @return appId of simple fabric app
73 */
74 ApplicationId getAppId();
75
76 /**
77 * Gets all the l2Networks.
78 *
79 * @return all the l2Networks
80 */
81 Collection<L2Network> getL2Networks();
82
83 /**
84 * Retrieves the entire set of ipSubnets configuration.
85 *
86 * @return all the ipSubnets
87 */
88 Set<IpSubnet> getIpSubnets();
89
90 /**
91 * Retrieves the entire set of static routes to outer networks.
92 *
93 * @return the set of static routes to outer networks.
94 */
95 Set<Route> getBorderRoutes();
96
97 /**
Lee Yongjae7c27bb42017-11-17 12:00:45 +090098 * Evaluates whether a mac is of Virtual Gateway Mac Addresses.
99 *
100 * @param mac the MacAddress to evaluate
101 * @return true if the mac is of any Vitrual Gateway Mac Address of ipSubnets
102 */
103 boolean isVMac(MacAddress mac);
104
105 /**
106 * Evaluates whether an Interface belongs to l2Networks.
107 *
108 * @param intf the interface to evaluate
109 * @return true if the inteface belongs to l2Networks configed, otherwise false
110 */
111 boolean isL2NetworkInterface(Interface intf);
112
113 /**
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +0900114 * Find Virtual Gateway Mac Address for Local Subnet Virtual Gateway Ip.
115 *
116 * @param ip the ip to check for Virtual Gateway Ip
117 * @return mac address of virtual gateway
118 */
119 MacAddress findVMacForIp(IpAddress ip);
120
121 /**
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900122 * Finds the L2 Network with given port and vlanId.
123 *
124 * @param port the port to be matched
125 * @param vlanId the vlanId to be matched
126 * @return the L2 Network for specific port and vlanId or null
127 */
128 L2Network findL2Network(ConnectPoint port, VlanId vlanId);
129
130 /**
131 * Finds the L2 Network of the name.
132 *
133 * @param name the name to be matched
134 * @return the L2 Network for specific name
135 */
136 L2Network findL2Network(String name);
137
138 /**
139 * Finds the IpSubnet containing the ipAddress.
140 *
141 * @param ipAddress the ipAddress to be matched
142 * @return the IpSubnet for specific ipAddress
143 */
144 IpSubnet findIpSubnet(IpAddress ipAddress);
145
146 /**
147 * Finds the Border Route containing the ipAddress.
148 * ASSUME: ipAddress is out of ipSubnets
149 *
150 * @param ipAddress the ipAddress to be matched
151 * @return the IpSubnet for specific ipAddress
152 */
153 Route findBorderRoute(IpAddress ipAddress);
154
155 /**
156 * Finds the network interface related to the host.
157 *
158 * @param host the host
159 * @return the interface related to the host
160 */
Lee Yongjae6dc7e4f2017-12-06 16:17:51 +0900161 Interface findHostInterface(Host host);
Lee Yongjae7c27bb42017-11-17 12:00:45 +0900162
163 /**
164 * Sends Neighbour Query (ARP or NDP) to Find Host Location.
165 *
166 * @param ip the ip address to resolve
167 * @return true if request mac packets are emitted. otherwise false
168 */
169 boolean requestMac(IpAddress ip);
170
171 /**
172 * Sends Dump Event to all SimpleFabricListeners to Dump Info on the Subject.
173 *
174 * @param subject the subject to dump
175 * @param out the output stream to dump
176 */
177 void dumpToStream(String subject, OutputStream out);
178
179 /**
180 * Triggers to send Refresh Notification to all sub modules.
181 */
182 void triggerRefresh();
183
184 /**
185 * Triggers to send Flush Notification to all sub modules.
186 */
187 void triggerFlush();
188
189}