Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [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 | 90163ba | 2016-10-12 13:35:14 -0700 | [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 | |
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 | |
Hyunsun Moon | 53381e8 | 2017-03-28 19:58:28 +0900 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Returns OF agent builder with the supplied OF agent. |
| 77 | * |
| 78 | * @param ofAgent ofagent |
| 79 | * @return of agent builder |
| 80 | */ |
| 81 | Builder from(OFAgent ofAgent); |
| 82 | |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 83 | /** |
| 84 | * Returns OF agent builder with the supplied network ID. |
| 85 | * |
| 86 | * @param networkId id of the virtual network |
| 87 | * @return of agent builder |
| 88 | */ |
| 89 | Builder networkId(NetworkId networkId); |
| 90 | |
| 91 | /** |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 92 | * Returns OF agent builder with the supplied controllers. |
| 93 | * |
| 94 | * @param controllers set of openflow controllers |
| 95 | * @return of agent builder |
| 96 | */ |
| 97 | Builder controllers(Set<OFController> controllers); |
| 98 | |
| 99 | /** |
Hyunsun Moon | 53381e8 | 2017-03-28 19:58:28 +0900 | [diff] [blame] | 100 | * Returns OF agent builder with the supplied additional controller. |
| 101 | * |
| 102 | * @param controller additional controller |
| 103 | * @return of agent builder |
| 104 | */ |
| 105 | Builder addController(OFController controller); |
| 106 | |
| 107 | /** |
| 108 | * Returns OF agent builder with the supplied controller removed. |
| 109 | * |
| 110 | * @param controller controller to delete |
| 111 | * @return of agent builder |
| 112 | */ |
| 113 | Builder deleteController(OFController controller); |
| 114 | |
| 115 | /** |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 116 | * Returns OF agent builder with the supplied state. |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 117 | * |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 118 | * @param state state of the agent |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 119 | * @return of agent builder |
| 120 | */ |
Hyunsun Moon | f4ba44f | 2017-03-14 03:25:52 +0900 | [diff] [blame] | 121 | Builder state(State state); |
Hyunsun Moon | 90163ba | 2016-10-12 13:35:14 -0700 | [diff] [blame] | 122 | } |
| 123 | } |