Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 2 | * Copyright 2011, Big Switch Networks, Inc. |
| 3 | * Originally created by David Erickson, Stanford University |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | * not use this file except in compliance with the License. You may obtain |
| 7 | * a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | * License for the specific language governing permissions and limitations |
| 15 | * under the License. |
| 16 | **/ |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 17 | |
| 18 | package net.floodlightcontroller.core; |
| 19 | |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 20 | import net.floodlightcontroller.core.IOFSwitch.PortChangeType; |
| 21 | |
| 22 | import org.projectfloodlight.openflow.protocol.OFPortDesc; |
| 23 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 24 | /** |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 25 | * |
| 26 | * Switch lifecycle notifications. |
| 27 | * |
| 28 | * These updates /happen-after/ the corresponding changes have been |
| 29 | * committed. I.e., the changes are visible when |
| 30 | * {@link IFloodlightProviderService#getSwitch(long)} |
| 31 | * {@link IFloodlightProviderService#getAllSwitchDpids()} |
| 32 | * {@link IFloodlightProviderService#getAllSwitchMap()} |
| 33 | * or any method on the IOFSwitch returned by these methods are |
| 34 | * called from the notification method or after it. |
| 35 | * |
| 36 | * Note however, that additional changes could have been committed before |
| 37 | * the notification for which the notification is still pending. E.g., |
| 38 | * {@link IFloodlightProviderService#getSwitch(long)} might return null after |
| 39 | * a switchAdded() (which happens if the switch has been added and then |
| 40 | * removed and the remove hasn't been dispatched yet). |
| 41 | * |
| 42 | * These lifecycle notification methods are called by a single thread and they |
| 43 | * will always be called by the same thread. |
| 44 | * The calls are always in order. |
| 45 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 46 | */ |
| 47 | public interface IOFSwitchListener { |
| 48 | |
| 49 | /** |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 50 | * The name assigned to this listener |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 51 | */ |
| 52 | public String getName(); |
Brian O'Connor | c67f9fa | 2014-08-07 18:17:46 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Fired when switch becomes active on the controller cluster and this |
| 56 | * controller instance has acquired MASTER role for this switch |
| 57 | * @param switchId the datapath Id of the new switch |
| 58 | */ |
| 59 | public void switchActivatedMaster(long swId); |
| 60 | |
| 61 | /** |
| 62 | * Fired when switch becomes active on the controller cluster and this |
| 63 | * controller instance has acquired EQUAL role for this switch |
| 64 | * @param switchId the datapath Id of the new switch |
| 65 | */ |
| 66 | public void switchActivatedEqual(long swId); |
| 67 | |
| 68 | /** |
| 69 | * Fired when the role of this controller for this switch, transitions |
| 70 | * from MASTER role to EQUAL role |
| 71 | * @param switchId the datapath Id of the new switch |
| 72 | */ |
| 73 | public void switchMasterToEqual(long swId); |
| 74 | |
| 75 | /** |
| 76 | * Fired when the role of this controller for this switch, transitions |
| 77 | * from EQUAL role to MASTER role |
| 78 | * @param switchId the datapath Id of the new switch |
| 79 | */ |
| 80 | public void switchEqualToMaster(long swId); |
| 81 | |
| 82 | /** |
| 83 | * Fired when this switch has disconnected at this controller. It does NOT |
| 84 | * imply that the switch has died, or it has disconnected from any or every |
| 85 | * other controller it was connected to. |
| 86 | * @param swId |
| 87 | */ |
| 88 | public void switchDisconnected(long swId); |
| 89 | |
| 90 | /** |
| 91 | * Fired when a port on a known switch changes. |
| 92 | * |
| 93 | * A user of this notification needs to take care if the port and type |
| 94 | * information is used directly and if the collection of ports has been |
| 95 | * queried as well. This notification will only be dispatched after the |
| 96 | * the port changes have been committed to the IOFSwitch instance. However, |
| 97 | * if a user has previously called {@link IOFSwitch#getPorts()} or related |
| 98 | * method a subsequent update might already be present in the information |
| 99 | * returned by getPorts. |
| 100 | * @param switchId |
| 101 | * @param port |
| 102 | * @param type |
| 103 | */ |
| 104 | public void switchPortChanged(long swId, OFPortDesc port, |
| 105 | PortChangeType changeType); |
| 106 | |
| 107 | /** |
| 108 | * Fired when any non-port related information (e.g., attributes, |
| 109 | * features) change after a switchAdded XXX S needs more specific methods |
| 110 | * TODO: currently unused |
| 111 | * @param switchId |
| 112 | */ |
| 113 | //public void switchChanged(long swId); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 114 | } |