blob: 125712157caccaa28f7006eb92023426af7b182c [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;
Thomas Vachuska52f2cd12018-11-08 21:20:04 -080019import org.onosproject.net.TenantId;
Hyunsun Moon90163ba2016-10-12 13:35:14 -070020
Hyunsun Moon90163ba2016-10-12 13:35:14 -070021import java.util.Set;
Hyunsun Moon90163ba2016-10-12 13:35:14 -070022
23/**
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090024 * Representation of an OpenFlow agent, which holds the mapping between the virtual
25 * network and the external OpenFlow controllers.
Hyunsun Moon90163ba2016-10-12 13:35:14 -070026 */
27public interface OFAgent {
28
Jovana Vuletac884b692017-11-28 16:52:35 +010029 String TRACER_LOG_TENANT_ID_PREFIX = "OFAGENT_tenantId:";
30
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090031 enum State {
32
33 /**
34 * Specifies that the ofagent state is started.
35 */
36 STARTED,
37
38 /**
39 * Specifies that the ofagent state is stopped.
40 */
41 STOPPED
42 }
43
Hyunsun Moon90163ba2016-10-12 13:35:14 -070044 /**
45 * Returns the identifier of the virtual network that this agent cares for.
46 *
47 * @return id of the virtual network
48 */
49 NetworkId networkId();
50
51 /**
Jovana Vuletac884b692017-11-28 16:52:35 +010052 * Returns the identifier of the tenant which owns virtual network this agent cares for.
53 *
54 * @return id of the tenant
55 */
56 TenantId tenantId();
57
58 /**
Hyunsun Moon90163ba2016-10-12 13:35:14 -070059 * Returns the external OpenFlow controllers of the virtual network.
60 *
61 * @return set of openflow controllers
62 */
63 Set<OFController> controllers();
64
65 /**
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090066 * Returns the admin state of the agent.
67 *
68 * @return state
Hyunsun Moon90163ba2016-10-12 13:35:14 -070069 */
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +090070 State state();
Hyunsun Moon90163ba2016-10-12 13:35:14 -070071
72 /**
73 * Builder of OF agent entities.
74 */
75 interface Builder {
76
77 /**
78 * Returns new OF agent.
79 *
80 * @return of agent
81 */
82 OFAgent build();
83
Hyunsun Moon53381e82017-03-28 19:58:28 +090084
85 /**
86 * Returns OF agent builder with the supplied OF agent.
87 *
88 * @param ofAgent ofagent
89 * @return of agent builder
90 */
91 Builder from(OFAgent ofAgent);
92
Hyunsun Moon90163ba2016-10-12 13:35:14 -070093 /**
94 * Returns OF agent builder with the supplied network ID.
95 *
96 * @param networkId id of the virtual network
97 * @return of agent builder
98 */
99 Builder networkId(NetworkId networkId);
100
101 /**
Jovana Vuletac884b692017-11-28 16:52:35 +0100102 * Returns OF agent builder with the supplied tenant ID.
103 *
104 * @param tenantId id of the virtual network
105 * @return of agent builder
106 */
107 Builder tenantId(TenantId tenantId);
108
109 /**
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700110 * Returns OF agent builder with the supplied controllers.
111 *
112 * @param controllers set of openflow controllers
113 * @return of agent builder
114 */
115 Builder controllers(Set<OFController> controllers);
116
117 /**
Hyunsun Moon53381e82017-03-28 19:58:28 +0900118 * Returns OF agent builder with the supplied additional controller.
119 *
120 * @param controller additional controller
121 * @return of agent builder
122 */
123 Builder addController(OFController controller);
124
125 /**
126 * Returns OF agent builder with the supplied controller removed.
127 *
128 * @param controller controller to delete
129 * @return of agent builder
130 */
131 Builder deleteController(OFController controller);
132
133 /**
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +0900134 * Returns OF agent builder with the supplied state.
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700135 *
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +0900136 * @param state state of the agent
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700137 * @return of agent builder
138 */
Hyunsun Moonf4ba44f2017-03-14 03:25:52 +0900139 Builder state(State state);
Hyunsun Moon90163ba2016-10-12 13:35:14 -0700140 }
141}