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.nio.NioEventLoopGroup; |
| 19 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 20 | |
| 21 | import java.util.Map; |
| 22 | import java.util.Set; |
| 23 | import java.util.concurrent.ExecutorService; |
| 24 | |
| 25 | /** |
| 26 | * Representation of an OF agent, which brokers virtual devices and external |
| 27 | * controllers by handling OpenFlow connections and messages between them. |
| 28 | */ |
| 29 | public interface OFAgent { |
| 30 | |
| 31 | /** |
| 32 | * Returns the identifier of the virtual network that this agent cares for. |
| 33 | * |
| 34 | * @return id of the virtual network |
| 35 | */ |
| 36 | NetworkId networkId(); |
| 37 | |
| 38 | /** |
| 39 | * Returns the external OpenFlow controllers of the virtual network. |
| 40 | * |
| 41 | * @return set of openflow controllers |
| 42 | */ |
| 43 | Set<OFController> controllers(); |
| 44 | |
| 45 | /** |
| 46 | * Starts the OpenFlow agent. |
| 47 | */ |
| 48 | void start(); |
| 49 | |
| 50 | /** |
| 51 | * Stops the OpenFlow agent. |
| 52 | */ |
| 53 | void stop(); |
| 54 | |
| 55 | /** |
| 56 | * Builder of OF agent entities. |
| 57 | */ |
| 58 | interface Builder { |
| 59 | |
| 60 | /** |
| 61 | * Returns new OF agent. |
| 62 | * |
| 63 | * @return of agent |
| 64 | */ |
| 65 | OFAgent build(); |
| 66 | |
| 67 | /** |
| 68 | * Returns OF agent builder with the supplied network ID. |
| 69 | * |
| 70 | * @param networkId id of the virtual network |
| 71 | * @return of agent builder |
| 72 | */ |
| 73 | Builder networkId(NetworkId networkId); |
| 74 | |
| 75 | /** |
| 76 | * Returns OF agent builder with the supplied network services for the |
| 77 | * virtual network. |
| 78 | * |
| 79 | * @param services network services for the virtual network |
| 80 | * @return of agent builder |
| 81 | */ |
| 82 | Builder services(Map<Class<?>, Object> services); |
| 83 | |
| 84 | /** |
| 85 | * Returns OF agent builder with the supplied controllers. |
| 86 | * |
| 87 | * @param controllers set of openflow controllers |
| 88 | * @return of agent builder |
| 89 | */ |
| 90 | Builder controllers(Set<OFController> controllers); |
| 91 | |
| 92 | /** |
| 93 | * Returns OF agent builder with the supplied event executor. |
| 94 | * |
| 95 | * @param eventExecutor event executor |
| 96 | * @return of agent builder |
| 97 | */ |
| 98 | Builder eventExecutor(ExecutorService eventExecutor); |
| 99 | |
| 100 | /** |
| 101 | * Returns OF agent builder with the supplied IO work group. |
| 102 | * |
| 103 | * @param ioWorker io worker group |
| 104 | * @return of agent builder |
| 105 | */ |
| 106 | Builder ioWorker(NioEventLoopGroup ioWorker); |
| 107 | } |
| 108 | } |