Tunahan Sezen | 03e5527 | 2020-04-18 09:18:53 +0000 | [diff] [blame] | 1 | /* |
Joey Armstrong | 53fcac2 | 2023-01-11 13:25:01 -0500 | [diff] [blame^] | 2 | * Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Tunahan Sezen | 03e5527 | 2020-04-18 09:18:53 +0000 | [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 | */ |
| 16 | package org.opencord.maclearner.api; |
| 17 | |
| 18 | import org.onlab.packet.MacAddress; |
| 19 | import org.onlab.packet.VlanId; |
| 20 | import org.onosproject.event.ListenerService; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.PortNumber; |
| 23 | |
| 24 | import java.util.Map; |
| 25 | import java.util.Optional; |
| 26 | import java.util.Set; |
| 27 | |
| 28 | /** |
| 29 | * Mac Learner Service. |
| 30 | */ |
| 31 | public interface MacLearnerService extends ListenerService<MacLearnerEvent, MacLearnerListener> { |
| 32 | |
| 33 | /** |
| 34 | * Adding a port to ignore map to prevent mac mapping. |
| 35 | * @param deviceId openflow device id |
| 36 | * @param portNumber port number |
| 37 | */ |
| 38 | void addPortToIgnore(DeviceId deviceId, PortNumber portNumber); |
| 39 | |
| 40 | /** |
| 41 | * Removing a port from ignore port map. |
| 42 | * @param deviceId openflow device id |
| 43 | * @param portNumber port number |
| 44 | */ |
| 45 | void removeFromIgnoredPorts(DeviceId deviceId, PortNumber portNumber); |
| 46 | |
| 47 | /** |
| 48 | * Getting All MAC Mappings. |
| 49 | * @return Map of MAC Addresses by device id, port number and vlan id |
| 50 | */ |
| 51 | Map<MacLearnerKey, MacAddress> getAllMappings(); |
| 52 | |
| 53 | /** |
| 54 | * Getting Requested MAC Address. |
| 55 | * @param deviceId openflow device id |
| 56 | * @param portNumber port number |
| 57 | * @param vlanId vlan id |
| 58 | * @return MAC Address of requested device id, port number and vlan id |
| 59 | */ |
| 60 | Optional<MacAddress> getMacMapping(DeviceId deviceId, PortNumber portNumber, VlanId vlanId); |
| 61 | |
| 62 | /** |
| 63 | * Deleting a MAC Mapping. |
| 64 | * @param deviceId openflow device id |
| 65 | * @param portNumber port number |
| 66 | * @param vlanId vlan id |
| 67 | * @return MacDeleteResult situation after method call |
| 68 | */ |
| 69 | MacDeleteResult deleteMacMapping(DeviceId deviceId, PortNumber portNumber, VlanId vlanId); |
| 70 | |
| 71 | /** |
| 72 | * Deleting MAC Mappings of port. |
| 73 | * @param deviceId openflow device id |
| 74 | * @param portNumber port number |
| 75 | * @return true if the mappings deleted successfully; false otherwise |
| 76 | */ |
| 77 | boolean deleteMacMappings(DeviceId deviceId, PortNumber portNumber); |
| 78 | |
| 79 | /** |
| 80 | * Deleting MAC Mappings of device. |
| 81 | * @param deviceId openflow device id |
| 82 | * @return true if the mappings deleted successfully; false otherwise |
| 83 | */ |
| 84 | boolean deleteMacMappings(DeviceId deviceId); |
| 85 | |
| 86 | /** |
| 87 | * Getting Device List in MAC Mapping List. |
| 88 | * @return mapped ONOS devices |
| 89 | */ |
| 90 | Set<DeviceId> getMappedDevices(); |
| 91 | |
| 92 | /** |
| 93 | * Getting Port Number List in MAC Mapping List. |
| 94 | * @return mapped port numbers |
| 95 | */ |
| 96 | Set<PortNumber> getMappedPorts(); |
| 97 | |
| 98 | /** |
| 99 | * Getting Ignored Ports for MAC Mapping. |
| 100 | * @return device and its ignored ports map |
| 101 | */ |
| 102 | Map<DeviceId, Set<PortNumber>> getIgnoredPorts(); |
| 103 | |
| 104 | } |