Committed by
Gerrit Code Review
Added management service and renamed dummy to default
Change-Id: I9df13c359f04c413a8c5a01cafccd882a5e9583c (cherry picked from commit 91ba41a2)
Showing
3 changed files
with
29 additions
and
21 deletions
... | @@ -19,6 +19,8 @@ import com.google.common.base.MoreObjects; | ... | @@ -19,6 +19,8 @@ import com.google.common.base.MoreObjects; |
19 | import com.google.common.collect.Sets; | 19 | import com.google.common.collect.Sets; |
20 | import org.onlab.packet.IpAddress; | 20 | import org.onlab.packet.IpAddress; |
21 | import org.onlab.packet.IpPrefix; | 21 | import org.onlab.packet.IpPrefix; |
22 | +import org.onosproject.xosclient.api.VtnServiceApi.NetworkType; | ||
23 | +import org.onosproject.xosclient.api.VtnServiceApi.ServiceType; | ||
22 | 24 | ||
23 | import java.util.Objects; | 25 | import java.util.Objects; |
24 | import java.util.Set; | 26 | import java.util.Set; |
... | @@ -30,18 +32,6 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -30,18 +32,6 @@ import static com.google.common.base.Preconditions.checkNotNull; |
30 | */ | 32 | */ |
31 | public final class VtnService { | 33 | public final class VtnService { |
32 | 34 | ||
33 | - public enum NetworkType { | ||
34 | - PRIVATE, | ||
35 | - PUBLIC, | ||
36 | - MANAGEMENT | ||
37 | - } | ||
38 | - | ||
39 | - public enum ServiceType { | ||
40 | - VSG, | ||
41 | - OLT_AGENT, | ||
42 | - DUMMY | ||
43 | - } | ||
44 | - | ||
45 | private final VtnServiceId id; | 35 | private final VtnServiceId id; |
46 | private final String name; | 36 | private final String name; |
47 | private final ServiceType serviceType; | 37 | private final ServiceType serviceType; | ... | ... |
... | @@ -22,6 +22,20 @@ import java.util.Set; | ... | @@ -22,6 +22,20 @@ import java.util.Set; |
22 | */ | 22 | */ |
23 | public interface VtnServiceApi { | 23 | public interface VtnServiceApi { |
24 | 24 | ||
25 | + // TODO move network type to VtnNetwork later | ||
26 | + enum NetworkType { | ||
27 | + PRIVATE, | ||
28 | + PUBLIC, | ||
29 | + MANAGEMENT | ||
30 | + } | ||
31 | + | ||
32 | + enum ServiceType { | ||
33 | + VSG, | ||
34 | + OLT_AGENT, | ||
35 | + MANAGEMENT, | ||
36 | + DEFAULT | ||
37 | + } | ||
38 | + | ||
25 | /** | 39 | /** |
26 | * Returns all services list. | 40 | * Returns all services list. |
27 | * | 41 | * | ... | ... |
... | @@ -22,8 +22,6 @@ import com.google.common.collect.Sets; | ... | @@ -22,8 +22,6 @@ import com.google.common.collect.Sets; |
22 | import org.onlab.packet.IpAddress; | 22 | import org.onlab.packet.IpAddress; |
23 | import org.onlab.packet.IpPrefix; | 23 | import org.onlab.packet.IpPrefix; |
24 | import org.onosproject.xosclient.api.OpenStackAccess; | 24 | import org.onosproject.xosclient.api.OpenStackAccess; |
25 | -import org.onosproject.xosclient.api.VtnService.NetworkType; | ||
26 | -import org.onosproject.xosclient.api.VtnService.ServiceType; | ||
27 | import org.onosproject.xosclient.api.VtnServiceApi; | 25 | import org.onosproject.xosclient.api.VtnServiceApi; |
28 | import org.onosproject.xosclient.api.XosAccess; | 26 | import org.onosproject.xosclient.api.XosAccess; |
29 | import org.onosproject.xosclient.api.VtnService; | 27 | import org.onosproject.xosclient.api.VtnService; |
... | @@ -41,8 +39,12 @@ import java.util.Set; | ... | @@ -41,8 +39,12 @@ import java.util.Set; |
41 | 39 | ||
42 | import static com.google.common.base.Preconditions.checkNotNull; | 40 | import static com.google.common.base.Preconditions.checkNotNull; |
43 | import static com.google.common.base.Preconditions.checkArgument; | 41 | import static com.google.common.base.Preconditions.checkArgument; |
44 | -import static org.onosproject.xosclient.api.VtnService.NetworkType.*; | 42 | +import static org.onosproject.xosclient.api.VtnServiceApi.NetworkType.PRIVATE; |
45 | -import static org.onosproject.xosclient.api.VtnService.ServiceType.*; | 43 | +import static org.onosproject.xosclient.api.VtnServiceApi.NetworkType.PUBLIC; |
44 | +import static org.onosproject.xosclient.api.VtnServiceApi.NetworkType.MANAGEMENT; | ||
45 | +import static org.onosproject.xosclient.api.VtnServiceApi.ServiceType.DEFAULT; | ||
46 | +import static org.onosproject.xosclient.api.VtnServiceApi.ServiceType.OLT_AGENT; | ||
47 | +import static org.onosproject.xosclient.api.VtnServiceApi.ServiceType.VSG; | ||
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Provides CORD VTN service and service dependency APIs. | 50 | * Provides CORD VTN service and service dependency APIs. |
... | @@ -176,9 +178,9 @@ public final class DefaultVtnServiceApi extends XosApi implements VtnServiceApi | ... | @@ -176,9 +178,9 @@ public final class DefaultVtnServiceApi extends XosApi implements VtnServiceApi |
176 | checkArgument(!Strings.isNullOrEmpty(netName)); | 178 | checkArgument(!Strings.isNullOrEmpty(netName)); |
177 | 179 | ||
178 | String name = netName.toUpperCase(); | 180 | String name = netName.toUpperCase(); |
179 | - if (name.contains(PUBLIC.toString())) { | 181 | + if (name.contains(PUBLIC.name())) { |
180 | return PUBLIC; | 182 | return PUBLIC; |
181 | - } else if (name.contains(MANAGEMENT.toString())) { | 183 | + } else if (name.contains(MANAGEMENT.name())) { |
182 | return MANAGEMENT; | 184 | return MANAGEMENT; |
183 | } else { | 185 | } else { |
184 | return PRIVATE; | 186 | return PRIVATE; |
... | @@ -190,12 +192,14 @@ public final class DefaultVtnServiceApi extends XosApi implements VtnServiceApi | ... | @@ -190,12 +192,14 @@ public final class DefaultVtnServiceApi extends XosApi implements VtnServiceApi |
190 | checkArgument(!Strings.isNullOrEmpty(netName)); | 192 | checkArgument(!Strings.isNullOrEmpty(netName)); |
191 | 193 | ||
192 | String name = netName.toUpperCase(); | 194 | String name = netName.toUpperCase(); |
193 | - if (name.contains(VSG.toString())) { | 195 | + if (name.contains(VSG.name())) { |
194 | return VSG; | 196 | return VSG; |
195 | - } else if (name.contains(OLT_AGENT.toString())) { | 197 | + } else if (name.contains(OLT_AGENT.name())) { |
196 | return OLT_AGENT; | 198 | return OLT_AGENT; |
199 | + } else if (name.contains(ServiceType.MANAGEMENT.name())) { | ||
200 | + return ServiceType.MANAGEMENT; | ||
197 | } else { | 201 | } else { |
198 | - return DUMMY; | 202 | + return DEFAULT; |
199 | } | 203 | } |
200 | } | 204 | } |
201 | } | 205 | } | ... | ... |
-
Please register or login to post a comment