Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 1 | /* |
Jian Li | c7efc1d | 2018-08-23 16:37:34 +0900 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 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 | */ |
Jian Li | c7efc1d | 2018-08-23 16:37:34 +0900 | [diff] [blame] | 16 | package org.onosproject.simplefabric.api; |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 17 | |
| 18 | import org.onlab.packet.IpAddress; |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onlab.packet.VlanId; |
| 21 | import org.onosproject.core.ApplicationId; |
| 22 | import org.onosproject.event.ListenerService; |
| 23 | import org.onosproject.net.intf.Interface; |
| 24 | import org.onosproject.net.ConnectPoint; |
| 25 | import org.onosproject.net.Host; |
| 26 | |
| 27 | import java.io.OutputStream; |
| 28 | import java.util.Set; |
| 29 | import java.util.Collection; |
| 30 | |
| 31 | /** |
| 32 | * Provides information about the routing configuration. |
| 33 | */ |
| 34 | public interface SimpleFabricService |
| 35 | extends ListenerService<SimpleFabricEvent, SimpleFabricListener> { |
| 36 | |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 37 | /** |
| 38 | * Gets appId. |
| 39 | * |
| 40 | * @return appId of simple fabric app |
| 41 | */ |
| 42 | ApplicationId getAppId(); |
| 43 | |
| 44 | /** |
| 45 | * Gets all the l2Networks. |
| 46 | * |
| 47 | * @return all the l2Networks |
| 48 | */ |
| 49 | Collection<L2Network> getL2Networks(); |
| 50 | |
| 51 | /** |
| 52 | * Retrieves the entire set of ipSubnets configuration. |
| 53 | * |
| 54 | * @return all the ipSubnets |
| 55 | */ |
| 56 | Set<IpSubnet> getIpSubnets(); |
| 57 | |
| 58 | /** |
| 59 | * Retrieves the entire set of static routes to outer networks. |
| 60 | * |
| 61 | * @return the set of static routes to outer networks. |
| 62 | */ |
| 63 | Set<Route> getBorderRoutes(); |
| 64 | |
| 65 | /** |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 66 | * Evaluates whether a mac is of Virtual Gateway Mac Addresses. |
| 67 | * |
| 68 | * @param mac the MacAddress to evaluate |
| 69 | * @return true if the mac is of any Vitrual Gateway Mac Address of ipSubnets |
| 70 | */ |
| 71 | boolean isVMac(MacAddress mac); |
| 72 | |
| 73 | /** |
| 74 | * Evaluates whether an Interface belongs to l2Networks. |
| 75 | * |
| 76 | * @param intf the interface to evaluate |
| 77 | * @return true if the inteface belongs to l2Networks configed, otherwise false |
| 78 | */ |
| 79 | boolean isL2NetworkInterface(Interface intf); |
| 80 | |
| 81 | /** |
Lee Yongjae | 6dc7e4f | 2017-12-06 16:17:51 +0900 | [diff] [blame] | 82 | * Find Virtual Gateway Mac Address for Local Subnet Virtual Gateway Ip. |
| 83 | * |
| 84 | * @param ip the ip to check for Virtual Gateway Ip |
| 85 | * @return mac address of virtual gateway |
| 86 | */ |
| 87 | MacAddress findVMacForIp(IpAddress ip); |
| 88 | |
| 89 | /** |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 90 | * Finds the L2 Network with given port and vlanId. |
| 91 | * |
| 92 | * @param port the port to be matched |
| 93 | * @param vlanId the vlanId to be matched |
| 94 | * @return the L2 Network for specific port and vlanId or null |
| 95 | */ |
| 96 | L2Network findL2Network(ConnectPoint port, VlanId vlanId); |
| 97 | |
| 98 | /** |
| 99 | * Finds the L2 Network of the name. |
| 100 | * |
| 101 | * @param name the name to be matched |
| 102 | * @return the L2 Network for specific name |
| 103 | */ |
| 104 | L2Network findL2Network(String name); |
| 105 | |
| 106 | /** |
| 107 | * Finds the IpSubnet containing the ipAddress. |
| 108 | * |
| 109 | * @param ipAddress the ipAddress to be matched |
| 110 | * @return the IpSubnet for specific ipAddress |
| 111 | */ |
| 112 | IpSubnet findIpSubnet(IpAddress ipAddress); |
| 113 | |
| 114 | /** |
| 115 | * Finds the Border Route containing the ipAddress. |
| 116 | * ASSUME: ipAddress is out of ipSubnets |
| 117 | * |
| 118 | * @param ipAddress the ipAddress to be matched |
| 119 | * @return the IpSubnet for specific ipAddress |
| 120 | */ |
| 121 | Route findBorderRoute(IpAddress ipAddress); |
| 122 | |
| 123 | /** |
| 124 | * Finds the network interface related to the host. |
| 125 | * |
| 126 | * @param host the host |
| 127 | * @return the interface related to the host |
| 128 | */ |
Lee Yongjae | 6dc7e4f | 2017-12-06 16:17:51 +0900 | [diff] [blame] | 129 | Interface findHostInterface(Host host); |
Lee Yongjae | 7c27bb4 | 2017-11-17 12:00:45 +0900 | [diff] [blame] | 130 | |
| 131 | /** |
| 132 | * Sends Neighbour Query (ARP or NDP) to Find Host Location. |
| 133 | * |
| 134 | * @param ip the ip address to resolve |
| 135 | * @return true if request mac packets are emitted. otherwise false |
| 136 | */ |
| 137 | boolean requestMac(IpAddress ip); |
| 138 | |
| 139 | /** |
| 140 | * Sends Dump Event to all SimpleFabricListeners to Dump Info on the Subject. |
| 141 | * |
| 142 | * @param subject the subject to dump |
| 143 | * @param out the output stream to dump |
| 144 | */ |
| 145 | void dumpToStream(String subject, OutputStream out); |
| 146 | |
| 147 | /** |
| 148 | * Triggers to send Refresh Notification to all sub modules. |
| 149 | */ |
| 150 | void triggerRefresh(); |
| 151 | |
| 152 | /** |
| 153 | * Triggers to send Flush Notification to all sub modules. |
| 154 | */ |
| 155 | void triggerFlush(); |
| 156 | |
| 157 | } |