Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +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 | */ |
| 16 | package org.onosproject.ofagent.api; |
| 17 | |
| 18 | import io.netty.channel.Channel; |
| 19 | import org.onosproject.net.Port; |
Claudine Chiu | 5c184e1 | 2017-08-08 21:21:38 -0400 | [diff] [blame^] | 20 | import org.onosproject.net.PortNumber; |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 21 | import org.onosproject.net.flow.FlowRule; |
| 22 | import org.onosproject.net.packet.InboundPacket; |
| 23 | import org.projectfloodlight.openflow.protocol.OFMessage; |
Claudine Chiu | 5c184e1 | 2017-08-08 21:21:38 -0400 | [diff] [blame^] | 24 | import org.projectfloodlight.openflow.protocol.OFPacketOut; |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Service for providing OpenFlow operations. |
| 28 | */ |
| 29 | public interface OFSwitchOperationService { |
| 30 | |
| 31 | /** |
| 32 | * Processes a new port of the switch. |
Claudine Chiu | 785ef2d | 2017-07-04 13:13:28 -0400 | [diff] [blame] | 33 | * It sends out PORT_STATUS asynchronous message to the controllers. |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 34 | * |
| 35 | * @param port virtual port |
| 36 | */ |
| 37 | void processPortAdded(Port port); |
| 38 | |
| 39 | /** |
Claudine Chiu | 785ef2d | 2017-07-04 13:13:28 -0400 | [diff] [blame] | 40 | * Processes the removal of a port from the switch. |
| 41 | * It sends out PORT_STATUS asynchronous message to the controllers. |
| 42 | * |
| 43 | * @param port virtual port |
| 44 | */ |
| 45 | void processPortRemoved(Port port); |
| 46 | |
| 47 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 48 | * Processes port link down. |
| 49 | * It sends out PORT_STATUS asynchronous message to the controllers. |
| 50 | * |
| 51 | * @param port virtual port |
| 52 | */ |
| 53 | void processPortDown(Port port); |
| 54 | |
| 55 | /** |
| 56 | * Processes port link down. |
| 57 | * It sends out PORT_STATUS asynchronous message to the controllers. |
| 58 | * |
| 59 | * @param port virtual port |
| 60 | */ |
| 61 | void processPortUp(Port port); |
| 62 | |
| 63 | /** |
| 64 | * Processes flow removed. |
| 65 | * It sends out FLOW_REMOVED asynchronous message to the controllers. |
| 66 | * |
| 67 | * @param flowRule removed flow rule |
| 68 | */ |
| 69 | void processFlowRemoved(FlowRule flowRule); |
| 70 | |
| 71 | /** |
| 72 | * Processes packet in. |
| 73 | * It sends out PACKET_IN asynchronous message to the controllers. |
| 74 | * |
| 75 | * @param packet inbound packet |
| 76 | */ |
| 77 | void processPacketIn(InboundPacket packet); |
| 78 | |
| 79 | /** |
| 80 | * Processes commands from the controllers that modify the state of the switch. |
| 81 | * Possible message types include PACKET_OUT, FLOW_MOD, GROUP_MOD, |
| 82 | * PORT_MOD, TABLE_MOD. These types of messages can be denied based on a |
| 83 | * role of the request controller. |
| 84 | * |
| 85 | * @param channel received channel |
| 86 | * @param msg command message received |
| 87 | */ |
| 88 | void processControllerCommand(Channel channel, OFMessage msg); |
| 89 | |
| 90 | /** |
| 91 | * Processes a stats request from the controllers. |
| 92 | * Targeted message type is MULTIPART_REQUEST with FLOW, PORT, GROUP, |
| 93 | * GROUP_DESC subtypes. |
| 94 | * |
| 95 | * @param channel received channel |
| 96 | * @param msg stats request message received |
| 97 | */ |
| 98 | void processStatsRequest(Channel channel, OFMessage msg); |
| 99 | |
| 100 | /** |
| 101 | * Processes a role request from the controllers. |
| 102 | * Targeted message type is ROLE_REQUEST. |
| 103 | * |
| 104 | * @param channel received channel |
| 105 | * @param msg role request message received |
| 106 | */ |
| 107 | void processRoleRequest(Channel channel, OFMessage msg); |
| 108 | |
| 109 | /** |
| 110 | * Processes a features request from the controllers. |
| 111 | * |
| 112 | * @param channel received channel |
| 113 | * @param msg received features request |
| 114 | */ |
| 115 | void processFeaturesRequest(Channel channel, OFMessage msg); |
| 116 | |
| 117 | /** |
| 118 | * Processes LLDP packets from the controller. |
| 119 | * |
| 120 | * @param channel received channel |
| 121 | * @param msg packet out message with lldp |
| 122 | */ |
| 123 | void processLldp(Channel channel, OFMessage msg); |
| 124 | |
| 125 | /** |
Claudine Chiu | 5c184e1 | 2017-08-08 21:21:38 -0400 | [diff] [blame^] | 126 | * Sends lldp response to the controller. |
| 127 | * |
| 128 | * @param ofPacketOut packet out message with lldp |
| 129 | * @param inPort in port to be used for packet in message |
| 130 | */ |
| 131 | void sendLldpResponse(OFPacketOut ofPacketOut, PortNumber inPort); |
| 132 | |
| 133 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 134 | * Sends hello to the controller. |
| 135 | * |
| 136 | * @param channel received channel |
| 137 | */ |
| 138 | void sendOfHello(Channel channel); |
| 139 | |
| 140 | /** |
| 141 | * Processes echo request from the controllers. |
| 142 | * |
| 143 | * @param channel received channel |
| 144 | * @param msg echo request message |
| 145 | */ |
| 146 | void processEchoRequest(Channel channel, OFMessage msg); |
Claudine Chiu | e2d5acc | 2017-06-08 22:49:21 -0400 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Processes GetConfig request from the controllers. |
| 150 | * |
| 151 | * @param channel received channel |
| 152 | * @param msg GetConfig request message |
| 153 | */ |
| 154 | void processGetConfigRequest(Channel channel, OFMessage msg); |
| 155 | |
| 156 | /** |
| 157 | * Processes SetConfig message from the controllers. |
| 158 | * |
| 159 | * @param channel received channel |
| 160 | * @param msg SetConfig message |
| 161 | */ |
| 162 | void processSetConfigMessage(Channel channel, OFMessage msg); |
| 163 | |
| 164 | /** |
| 165 | * Processes barrier request from the controllers. |
| 166 | * |
| 167 | * @param channel received channel |
| 168 | * @param msg barrier request message |
| 169 | */ |
| 170 | void processBarrierRequest(Channel channel, OFMessage msg); |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 171 | } |