blob: ed1b2befcb7284a973bc6f10153444b79aaf3538 [file] [log] [blame]
Hyunsun Moon90163ba2016-10-12 13:35:14 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Hyunsun Moon90163ba2016-10-12 13:35:14 -07003 *
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
Hyunsun Moon53381e82017-03-28 19:58:28 +090074
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 Moon90163ba2016-10-12 13:35:14 -070083 /**
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 Moon90163ba2016-10-12 13:35:14 -070092 * 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 Moon53381e82017-03-28 19:58:28 +0900100 * 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 Moonf4ba44f2017-03-14 03:25:52 +0900116 * Returns OF agent builder with the supplied state.
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700117 *
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +0900118 * @param state state of the agent
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700119 * @return of agent builder
120 */
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +0900121 Builder state(State state);
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700122 }
123}