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 | |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 18 | import org.onosproject.incubator.net.virtual.NetworkId; |
| 19 | |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 20 | import java.util.Set; |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 23 | * Representation of an OpenFlow agent, which holds the mapping between the virtual |
| 24 | * network and the external OpenFlow controllers. |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 25 | */ |
| 26 | public interface OFAgent { |
| 27 | |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 28 | enum State { |
| 29 | |
| 30 | /** |
| 31 | * Specifies that the ofagent state is started. |
| 32 | */ |
| 33 | STARTED, |
| 34 | |
| 35 | /** |
| 36 | * Specifies that the ofagent state is stopped. |
| 37 | */ |
| 38 | STOPPED |
| 39 | } |
| 40 | |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Returns the identifier of the virtual network that this agent cares for. |
| 43 | * |
| 44 | * @return id of the virtual network |
| 45 | */ |
| 46 | NetworkId networkId(); |
| 47 | |
| 48 | /** |
| 49 | * Returns the external OpenFlow controllers of the virtual network. |
| 50 | * |
| 51 | * @return set of openflow controllers |
| 52 | */ |
| 53 | Set<OFController> controllers(); |
| 54 | |
| 55 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 56 | * Returns the admin state of the agent. |
| 57 | * |
| 58 | * @return state |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 59 | */ |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 60 | State state(); |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Builder of OF agent entities. |
| 64 | */ |
| 65 | interface Builder { |
| 66 | |
| 67 | /** |
| 68 | * Returns new OF agent. |
| 69 | * |
| 70 | * @return of agent |
| 71 | */ |
| 72 | OFAgent build(); |
| 73 | |
| 74 | /** |
| 75 | * Returns OF agent builder with the supplied network ID. |
| 76 | * |
| 77 | * @param networkId id of the virtual network |
| 78 | * @return of agent builder |
| 79 | */ |
| 80 | Builder networkId(NetworkId networkId); |
| 81 | |
| 82 | /** |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 83 | * Returns OF agent builder with the supplied controllers. |
| 84 | * |
| 85 | * @param controllers set of openflow controllers |
| 86 | * @return of agent builder |
| 87 | */ |
| 88 | Builder controllers(Set<OFController> controllers); |
| 89 | |
| 90 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 91 | * Returns OF agent builder with the supplied state. |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 92 | * |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 93 | * @param state state of the agent |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 94 | * @return of agent builder |
| 95 | */ |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 96 | Builder state(State state); |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 97 | } |
| 98 | } |