Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Laboratory |
| 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; |
| 20 | import org.onosproject.net.flow.FlowRule; |
| 21 | import org.onosproject.net.packet.InboundPacket; |
| 22 | import org.projectfloodlight.openflow.protocol.OFMessage; |
| 23 | |
| 24 | /** |
| 25 | * Service providing OpenFlow switch operations. |
| 26 | */ |
| 27 | public interface OFSwitchService { |
| 28 | |
| 29 | /** |
| 30 | * Handles the switch starts. |
| 31 | */ |
| 32 | void started(); |
| 33 | |
| 34 | /** |
| 35 | * Handles the switch stops. |
| 36 | */ |
| 37 | void stopped(); |
| 38 | |
| 39 | /** |
| 40 | * Processes a new port of the switch. |
| 41 | * It sends out FEATURE_REPLY message to the controllers. |
| 42 | * |
| 43 | * @param port virtual port |
| 44 | */ |
| 45 | void processPortAdded(Port port); |
| 46 | |
| 47 | /** |
| 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 | } |