blob: 0db4489c9b4ed01636192b54319465e8299dc259 [file] [log] [blame]
Hyunsun Moon90163ba2016-10-12 13:35:14 -07001/*
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 */
16package org.onosproject.ofagent.api;
17
Hyunsun Moon90163ba2016-10-12 13:35:14 -070018import org.onosproject.incubator.net.virtual.NetworkId;
19
Hyunsun Moon90163ba2016-10-12 13:35:14 -070020import java.util.Set;
Hyunsun Moon90163ba2016-10-12 13:35:14 -070021
22/**
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090023 * Representation of an OpenFlow agent, which holds the mapping between the virtual
24 * network and the external OpenFlow controllers.
Hyunsun Moon90163ba2016-10-12 13:35:14 -070025 */
26public interface OFAgent {
27
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090028 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 Moon90163ba2016-10-12 13:35:14 -070041 /**
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 Moonf4ba44f2017-03-14 03:25:52 +090056 * Returns the admin state of the agent.
57 *
58 * @return state
Hyunsun Moon90163ba2016-10-12 13:35:14 -070059 */
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090060 State state();
Hyunsun Moon90163ba2016-10-12 13:35:14 -070061
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 Moon90163ba2016-10-12 13:35:14 -070083 * 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 Moonf4ba44f2017-03-14 03:25:52 +090091 * Returns OF agent builder with the supplied state.
Hyunsun Moon90163ba2016-10-12 13:35:14 -070092 *
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090093 * @param state state of the agent
Hyunsun Moon90163ba2016-10-12 13:35:14 -070094 * @return of agent builder
95 */
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090096 Builder state(State state);
Hyunsun Moon90163ba2016-10-12 13:35:14 -070097 }
98}