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