Revert "[ONOS-5187] Compute path with Explicit path objects"
This reverts commit a32f6da9. Change-Id: Ic023d701d18f0ae7af2579bc43777714a0e701dc
Showing
22 changed files
with
83 additions
and
1133 deletions
... | @@ -105,10 +105,5 @@ | ... | @@ -105,10 +105,5 @@ |
105 | <groupId>org.onosproject</groupId> | 105 | <groupId>org.onosproject</groupId> |
106 | <artifactId>onos-app-pcep-api</artifactId> | 106 | <artifactId>onos-app-pcep-api</artifactId> |
107 | </dependency> | 107 | </dependency> |
108 | - <dependency> | ||
109 | - <groupId>org.easymock</groupId> | ||
110 | - <artifactId>easymock</artifactId> | ||
111 | - <scope>test</scope> | ||
112 | - </dependency> | ||
113 | </dependencies> | 108 | </dependencies> |
114 | </project> | 109 | </project> | ... | ... |
... | @@ -24,13 +24,10 @@ import org.onosproject.cli.AbstractShellCommand; | ... | @@ -24,13 +24,10 @@ import org.onosproject.cli.AbstractShellCommand; |
24 | import org.onosproject.incubator.net.tunnel.Tunnel; | 24 | import org.onosproject.incubator.net.tunnel.Tunnel; |
25 | import org.onosproject.incubator.net.tunnel.TunnelId; | 25 | import org.onosproject.incubator.net.tunnel.TunnelId; |
26 | import org.onosproject.net.AnnotationKeys; | 26 | import org.onosproject.net.AnnotationKeys; |
27 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
28 | import org.onosproject.pce.pceservice.api.PceService; | 27 | import org.onosproject.pce.pceservice.api.PceService; |
29 | 28 | ||
30 | import org.slf4j.Logger; | 29 | import org.slf4j.Logger; |
31 | 30 | ||
32 | -import java.util.List; | ||
33 | - | ||
34 | /** | 31 | /** |
35 | * Supports quering PCE path. | 32 | * Supports quering PCE path. |
36 | */ | 33 | */ |
... | @@ -75,9 +72,6 @@ public class PceQueryPathCommand extends AbstractShellCommand { | ... | @@ -75,9 +72,6 @@ public class PceQueryPathCommand extends AbstractShellCommand { |
75 | * @param tunnel pce tunnel | 72 | * @param tunnel pce tunnel |
76 | */ | 73 | */ |
77 | void display(Tunnel tunnel) { | 74 | void display(Tunnel tunnel) { |
78 | - List<ExplicitPathInfo> explicitPathInfoList = AbstractShellCommand.get(PceService.class) | ||
79 | - .explicitPathInfoList(tunnel.tunnelName().value()); | ||
80 | - | ||
81 | print("\npath-id : %s \n" + | 75 | print("\npath-id : %s \n" + |
82 | "source : %s \n" + | 76 | "source : %s \n" + |
83 | "destination : %s \n" + | 77 | "destination : %s \n" + |
... | @@ -90,13 +84,5 @@ public class PceQueryPathCommand extends AbstractShellCommand { | ... | @@ -90,13 +84,5 @@ public class PceQueryPathCommand extends AbstractShellCommand { |
90 | tunnel.path().dst().deviceId().toString(), | 84 | tunnel.path().dst().deviceId().toString(), |
91 | tunnel.type().name(), tunnel.tunnelName(), tunnel.annotations().value(COST_TYPE), | 85 | tunnel.type().name(), tunnel.tunnelName(), tunnel.annotations().value(COST_TYPE), |
92 | tunnel.annotations().value(AnnotationKeys.BANDWIDTH)); | 86 | tunnel.annotations().value(AnnotationKeys.BANDWIDTH)); |
93 | - if (explicitPathInfoList != null) { | ||
94 | - for (ExplicitPathInfo e : explicitPathInfoList) { | ||
95 | - print("explicitPathObjects : \n" + | ||
96 | - " type : %s \n" + | ||
97 | - " value : %s ", | ||
98 | - String.valueOf(e.type().type()), e.value().toString()); | ||
99 | - } | ||
100 | - } | ||
101 | } | 87 | } |
102 | } | 88 | } | ... | ... |
... | @@ -15,35 +15,27 @@ | ... | @@ -15,35 +15,27 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pce.cli; | 16 | package org.onosproject.pce.cli; |
17 | 17 | ||
18 | -import static org.onosproject.net.Link.State.ACTIVE; | ||
19 | -import static org.onosproject.net.Link.Type.DIRECT; | ||
20 | import static org.slf4j.LoggerFactory.getLogger; | 18 | import static org.slf4j.LoggerFactory.getLogger; |
21 | 19 | ||
22 | import java.util.Collection; | 20 | import java.util.Collection; |
23 | import java.util.List; | 21 | import java.util.List; |
24 | import java.util.LinkedList; | 22 | import java.util.LinkedList; |
25 | 23 | ||
26 | -import com.google.common.collect.Lists; | ||
27 | - | ||
28 | import org.apache.karaf.shell.commands.Argument; | 24 | import org.apache.karaf.shell.commands.Argument; |
29 | import org.apache.karaf.shell.commands.Command; | 25 | import org.apache.karaf.shell.commands.Command; |
30 | import org.apache.karaf.shell.commands.Option; | 26 | import org.apache.karaf.shell.commands.Option; |
27 | + | ||
31 | import org.onlab.util.DataRateUnit; | 28 | import org.onlab.util.DataRateUnit; |
32 | import org.onosproject.cli.AbstractShellCommand; | 29 | import org.onosproject.cli.AbstractShellCommand; |
33 | import org.onosproject.incubator.net.tunnel.Tunnel; | 30 | import org.onosproject.incubator.net.tunnel.Tunnel; |
34 | import org.onosproject.incubator.net.tunnel.TunnelService; | 31 | import org.onosproject.incubator.net.tunnel.TunnelService; |
35 | -import org.onosproject.net.ConnectPoint; | ||
36 | -import org.onosproject.net.DefaultLink; | ||
37 | import org.onosproject.net.DeviceId; | 32 | import org.onosproject.net.DeviceId; |
38 | -import org.onosproject.net.NetworkResource; | ||
39 | -import org.onosproject.net.PortNumber; | ||
40 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 33 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
41 | import org.onosproject.net.intent.Constraint; | 34 | import org.onosproject.net.intent.Constraint; |
42 | -import org.onosproject.net.provider.ProviderId; | ||
43 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
44 | import org.onosproject.pce.pceservice.constraint.CostConstraint; | 35 | import org.onosproject.pce.pceservice.constraint.CostConstraint; |
45 | import org.onosproject.pce.pceservice.LspType; | 36 | import org.onosproject.pce.pceservice.LspType; |
46 | import org.onosproject.pce.pceservice.api.PceService; | 37 | import org.onosproject.pce.pceservice.api.PceService; |
38 | + | ||
47 | import org.slf4j.Logger; | 39 | import org.slf4j.Logger; |
48 | 40 | ||
49 | /** | 41 | /** |
... | @@ -52,16 +44,6 @@ import org.slf4j.Logger; | ... | @@ -52,16 +44,6 @@ import org.slf4j.Logger; |
52 | @Command(scope = "onos", name = "pce-setup-path", description = "Supports creating pce path.") | 44 | @Command(scope = "onos", name = "pce-setup-path", description = "Supports creating pce path.") |
53 | public class PceSetupPathCommand extends AbstractShellCommand { | 45 | public class PceSetupPathCommand extends AbstractShellCommand { |
54 | private final Logger log = getLogger(getClass()); | 46 | private final Logger log = getLogger(getClass()); |
55 | - public static final byte SUBTYPE_DEVICEID = 0; | ||
56 | - public static final byte SUBTYPE_LINK = 1; | ||
57 | - public static final byte SUBTYPE_INDEX = 1; | ||
58 | - public static final byte TYPE_INDEX = 0; | ||
59 | - | ||
60 | - public static final byte DEVICEID_INDEX = 2; | ||
61 | - public static final byte SOURCE_DEVICEID_INDEX = 2; | ||
62 | - public static final byte SOURCE_PORTNO_INDEX = 3; | ||
63 | - public static final byte DESTINATION_DEVICEID_INDEX = 4; | ||
64 | - public static final byte DESTINATION_PORTNO_INDEX = 5; | ||
65 | 47 | ||
66 | @Argument(index = 0, name = "src", description = "source device.", required = true, multiValued = false) | 48 | @Argument(index = 0, name = "src", description = "source device.", required = true, multiValued = false) |
67 | String src = null; | 49 | String src = null; |
... | @@ -87,15 +69,6 @@ public class PceSetupPathCommand extends AbstractShellCommand { | ... | @@ -87,15 +69,6 @@ public class PceSetupPathCommand extends AbstractShellCommand { |
87 | + "Data rate unit is in BPS.", required = false, multiValued = false) | 69 | + "Data rate unit is in BPS.", required = false, multiValued = false) |
88 | double bandwidth = 0.0; | 70 | double bandwidth = 0.0; |
89 | 71 | ||
90 | - @Option(name = "-e", aliases = "--explicitPathObjects", description = "List of strict and loose hopes", | ||
91 | - required = false, multiValued = true) | ||
92 | - String[] explicitPathInfoStrings; | ||
93 | - | ||
94 | - //explicitPathInfo format : Type/SubType/Value(DeviceId or Link info) | ||
95 | - //If Value is Device : Type/SubType/deviceId | ||
96 | - //If Value is Link : Type/SubType/SourceDeviceId/SourcePortNo/DestinationDeviceId/DestinationPortNo | ||
97 | - List<ExplicitPathInfo> explicitPathInfo = Lists.newLinkedList(); | ||
98 | - | ||
99 | @Override | 72 | @Override |
100 | protected void execute() { | 73 | protected void execute() { |
101 | log.info("executing pce-setup-path"); | 74 | log.info("executing pce-setup-path"); |
... | @@ -141,50 +114,7 @@ public class PceSetupPathCommand extends AbstractShellCommand { | ... | @@ -141,50 +114,7 @@ public class PceSetupPathCommand extends AbstractShellCommand { |
141 | CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1]; | 114 | CostConstraint.Type costType = CostConstraint.Type.values()[cost - 1]; |
142 | listConstrnt.add(CostConstraint.of(costType)); | 115 | listConstrnt.add(CostConstraint.of(costType)); |
143 | 116 | ||
144 | - if (explicitPathInfoStrings != null) { | 117 | + if (!service.setupPath(srcDevice, dstDevice, name, listConstrnt, lspType)) { |
145 | - for (String str : explicitPathInfoStrings) { | ||
146 | - String[] splitted = str.split("/"); | ||
147 | - DeviceId deviceId; | ||
148 | - NetworkResource res = null; | ||
149 | - PortNumber portNo; | ||
150 | - int explicitPathType = Integer.parseInt(splitted[TYPE_INDEX]); | ||
151 | - if ((explicitPathType < 0) || (explicitPathType > 1)) { | ||
152 | - error("Explicit path validation failed"); | ||
153 | - return; | ||
154 | - } | ||
155 | - | ||
156 | - //subtype 0 = deviceId, 1 = link | ||
157 | - //subtype is required to store either as deviceId or Link | ||
158 | - if (splitted[DEVICEID_INDEX] != null && Integer.parseInt(splitted[SUBTYPE_INDEX]) == SUBTYPE_DEVICEID) { | ||
159 | - res = DeviceId.deviceId(splitted[DEVICEID_INDEX]); | ||
160 | - } else if (Integer.parseInt(splitted[SUBTYPE_INDEX]) == SUBTYPE_LINK | ||
161 | - && splitted[SOURCE_DEVICEID_INDEX] != null | ||
162 | - && splitted[SOURCE_PORTNO_INDEX] != null | ||
163 | - && splitted[DESTINATION_DEVICEID_INDEX] != null | ||
164 | - && splitted[DESTINATION_PORTNO_INDEX] != null) { | ||
165 | - | ||
166 | - deviceId = DeviceId.deviceId(splitted[SOURCE_DEVICEID_INDEX]); | ||
167 | - portNo = PortNumber.portNumber(splitted[SOURCE_PORTNO_INDEX]); | ||
168 | - ConnectPoint cpSrc = new ConnectPoint(deviceId, portNo); | ||
169 | - deviceId = DeviceId.deviceId(splitted[DESTINATION_DEVICEID_INDEX]); | ||
170 | - portNo = PortNumber.portNumber(splitted[DESTINATION_PORTNO_INDEX]); | ||
171 | - ConnectPoint cpDst = new ConnectPoint(deviceId, portNo); | ||
172 | - res = DefaultLink.builder() | ||
173 | - .providerId(ProviderId.NONE) | ||
174 | - .src(cpSrc) | ||
175 | - .dst(cpDst) | ||
176 | - .type(DIRECT) | ||
177 | - .state(ACTIVE) | ||
178 | - .build(); | ||
179 | - } else { | ||
180 | - error("Explicit path validation failed"); | ||
181 | - return; | ||
182 | - } | ||
183 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.values()[explicitPathType], res); | ||
184 | - explicitPathInfo.add(obj); | ||
185 | - } | ||
186 | - } | ||
187 | - if (!service.setupPath(srcDevice, dstDevice, name, listConstrnt, lspType, explicitPathInfo)) { | ||
188 | error("Path creation failed."); | 118 | error("Path creation failed."); |
189 | } | 119 | } |
190 | } | 120 | } | ... | ... |
... | @@ -18,18 +18,14 @@ package org.onosproject.pce.pceservice; | ... | @@ -18,18 +18,14 @@ package org.onosproject.pce.pceservice; |
18 | 18 | ||
19 | import static com.google.common.base.MoreObjects.toStringHelper; | 19 | import static com.google.common.base.MoreObjects.toStringHelper; |
20 | 20 | ||
21 | -import java.util.Collection; | ||
22 | -import java.util.List; | ||
23 | import java.util.Objects; | 21 | import java.util.Objects; |
24 | 22 | ||
25 | -import org.onlab.rest.BaseResource; | ||
26 | import org.onlab.util.DataRateUnit; | 23 | import org.onlab.util.DataRateUnit; |
27 | import org.onosproject.incubator.net.tunnel.Tunnel; | 24 | import org.onosproject.incubator.net.tunnel.Tunnel; |
28 | import org.onosproject.incubator.net.tunnel.TunnelId; | 25 | import org.onosproject.incubator.net.tunnel.TunnelId; |
29 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 26 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
30 | import org.onosproject.net.intent.Constraint; | 27 | import org.onosproject.net.intent.Constraint; |
31 | import org.onosproject.pce.pceservice.constraint.CostConstraint; | 28 | import org.onosproject.pce.pceservice.constraint.CostConstraint; |
32 | -import org.onosproject.pce.pcestore.api.PceStore; | ||
33 | 29 | ||
34 | /** | 30 | /** |
35 | * Implementation of an entity which provides functionalities of pce path. | 31 | * Implementation of an entity which provides functionalities of pce path. |
... | @@ -43,7 +39,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -43,7 +39,6 @@ public final class DefaultPcePath implements PcePath { |
43 | private String name; // symbolic-path-name | 39 | private String name; // symbolic-path-name |
44 | private Constraint costConstraint; // cost constraint | 40 | private Constraint costConstraint; // cost constraint |
45 | private Constraint bandwidthConstraint; // bandwidth constraint | 41 | private Constraint bandwidthConstraint; // bandwidth constraint |
46 | - private Collection<ExplicitPathInfo> explicitPathInfo; //list of explicit path info | ||
47 | 42 | ||
48 | /** | 43 | /** |
49 | * Initializes PCE path attributes. | 44 | * Initializes PCE path attributes. |
... | @@ -55,11 +50,10 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -55,11 +50,10 @@ public final class DefaultPcePath implements PcePath { |
55 | * @param name symbolic-path-name | 50 | * @param name symbolic-path-name |
56 | * @param costConstrnt cost constraint | 51 | * @param costConstrnt cost constraint |
57 | * @param bandwidthConstrnt bandwidth constraint | 52 | * @param bandwidthConstrnt bandwidth constraint |
58 | - * @param explicitPathInfo list of explicit path info | ||
59 | */ | 53 | */ |
60 | private DefaultPcePath(TunnelId id, String src, String dst, LspType lspType, | 54 | private DefaultPcePath(TunnelId id, String src, String dst, LspType lspType, |
61 | - String name, Constraint costConstrnt, Constraint bandwidthConstrnt, | 55 | + String name, Constraint costConstrnt, Constraint bandwidthConstrnt) { |
62 | - Collection<ExplicitPathInfo> explicitPathInfo) { | 56 | + |
63 | this.id = id; | 57 | this.id = id; |
64 | this.source = src; | 58 | this.source = src; |
65 | this.destination = dst; | 59 | this.destination = dst; |
... | @@ -67,7 +61,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -67,7 +61,6 @@ public final class DefaultPcePath implements PcePath { |
67 | this.name = name; | 61 | this.name = name; |
68 | this.costConstraint = costConstrnt; | 62 | this.costConstraint = costConstrnt; |
69 | this.bandwidthConstraint = bandwidthConstrnt; | 63 | this.bandwidthConstraint = bandwidthConstrnt; |
70 | - this.explicitPathInfo = explicitPathInfo; | ||
71 | } | 64 | } |
72 | 65 | ||
73 | @Override | 66 | @Override |
... | @@ -121,11 +114,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -121,11 +114,6 @@ public final class DefaultPcePath implements PcePath { |
121 | } | 114 | } |
122 | 115 | ||
123 | @Override | 116 | @Override |
124 | - public Collection<ExplicitPathInfo> explicitPathInfo() { | ||
125 | - return explicitPathInfo; | ||
126 | - } | ||
127 | - | ||
128 | - @Override | ||
129 | public PcePath copy(PcePath path) { | 117 | public PcePath copy(PcePath path) { |
130 | if (null != path.source()) { | 118 | if (null != path.source()) { |
131 | this.source = path.source(); | 119 | this.source = path.source(); |
... | @@ -150,8 +138,7 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -150,8 +138,7 @@ public final class DefaultPcePath implements PcePath { |
150 | 138 | ||
151 | @Override | 139 | @Override |
152 | public int hashCode() { | 140 | public int hashCode() { |
153 | - return Objects.hash(id, source, destination, lspType, name, costConstraint, bandwidthConstraint, | 141 | + return Objects.hash(id, source, destination, lspType, name, costConstraint, bandwidthConstraint); |
154 | - explicitPathInfo); | ||
155 | } | 142 | } |
156 | 143 | ||
157 | @Override | 144 | @Override |
... | @@ -167,8 +154,7 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -167,8 +154,7 @@ public final class DefaultPcePath implements PcePath { |
167 | && Objects.equals(lspType, that.lspType) | 154 | && Objects.equals(lspType, that.lspType) |
168 | && Objects.equals(name, that.name) | 155 | && Objects.equals(name, that.name) |
169 | && Objects.equals(costConstraint, that.costConstraint) | 156 | && Objects.equals(costConstraint, that.costConstraint) |
170 | - && Objects.equals(bandwidthConstraint, that.bandwidthConstraint) | 157 | + && Objects.equals(bandwidthConstraint, that.bandwidthConstraint); |
171 | - && Objects.equals(explicitPathInfo, that.explicitPathInfo); | ||
172 | } | 158 | } |
173 | return false; | 159 | return false; |
174 | } | 160 | } |
... | @@ -184,7 +170,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -184,7 +170,6 @@ public final class DefaultPcePath implements PcePath { |
184 | .add("name", name) | 170 | .add("name", name) |
185 | .add("costConstraint", costConstraint) | 171 | .add("costConstraint", costConstraint) |
186 | .add("bandwidthConstraint", bandwidthConstraint) | 172 | .add("bandwidthConstraint", bandwidthConstraint) |
187 | - .add("explicitPathInfo", explicitPathInfo) | ||
188 | .toString(); | 173 | .toString(); |
189 | } | 174 | } |
190 | 175 | ||
... | @@ -200,7 +185,7 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -200,7 +185,7 @@ public final class DefaultPcePath implements PcePath { |
200 | /** | 185 | /** |
201 | * Builder class for pce path. | 186 | * Builder class for pce path. |
202 | */ | 187 | */ |
203 | - public static final class Builder extends BaseResource implements PcePath.Builder { | 188 | + public static final class Builder implements PcePath.Builder { |
204 | private TunnelId id; | 189 | private TunnelId id; |
205 | private String source; | 190 | private String source; |
206 | private String destination; | 191 | private String destination; |
... | @@ -208,7 +193,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -208,7 +193,6 @@ public final class DefaultPcePath implements PcePath { |
208 | private String name; | 193 | private String name; |
209 | private Constraint costConstraint; | 194 | private Constraint costConstraint; |
210 | private Constraint bandwidthConstraint; | 195 | private Constraint bandwidthConstraint; |
211 | - private Collection<ExplicitPathInfo> explicitPathInfo; | ||
212 | 196 | ||
213 | @Override | 197 | @Override |
214 | public Builder id(String id) { | 198 | public Builder id(String id) { |
... | @@ -256,12 +240,6 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -256,12 +240,6 @@ public final class DefaultPcePath implements PcePath { |
256 | } | 240 | } |
257 | 241 | ||
258 | @Override | 242 | @Override |
259 | - public Builder explicitPathInfo(Collection<ExplicitPathInfo> explicitPathInfo) { | ||
260 | - this.explicitPathInfo = explicitPathInfo; | ||
261 | - return this; | ||
262 | - } | ||
263 | - | ||
264 | - @Override | ||
265 | public Builder of(Tunnel tunnel) { | 243 | public Builder of(Tunnel tunnel) { |
266 | this.id = TunnelId.valueOf(tunnel.tunnelId().id()); | 244 | this.id = TunnelId.valueOf(tunnel.tunnelId().id()); |
267 | this.source = tunnel.path().src().deviceId().toString(); | 245 | this.source = tunnel.path().src().deviceId().toString(); |
... | @@ -286,20 +264,13 @@ public final class DefaultPcePath implements PcePath { | ... | @@ -286,20 +264,13 @@ public final class DefaultPcePath implements PcePath { |
286 | DataRateUnit.valueOf("BPS")); | 264 | DataRateUnit.valueOf("BPS")); |
287 | } | 265 | } |
288 | 266 | ||
289 | - PceStore pceStore = get(PceStore.class); | ||
290 | - List<ExplicitPathInfo> explicitPathInfoList = pceStore | ||
291 | - .getTunnelNameExplicitPathInfoMap(tunnel.tunnelName().value()); | ||
292 | - if (explicitPathInfoList != null) { | ||
293 | - this.explicitPathInfo = explicitPathInfoList; | ||
294 | - } | ||
295 | - | ||
296 | return this; | 267 | return this; |
297 | } | 268 | } |
298 | 269 | ||
299 | @Override | 270 | @Override |
300 | public PcePath build() { | 271 | public PcePath build() { |
301 | return new DefaultPcePath(id, source, destination, lspType, name, | 272 | return new DefaultPcePath(id, source, destination, lspType, name, |
302 | - costConstraint, bandwidthConstraint, explicitPathInfo); | 273 | + costConstraint, bandwidthConstraint); |
303 | } | 274 | } |
304 | } | 275 | } |
305 | } | 276 | } | ... | ... |
1 | -/* | ||
2 | - * Copyright 2016-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 | - */ | ||
16 | -package org.onosproject.pce.pceservice; | ||
17 | - | ||
18 | -import org.onosproject.net.NetworkResource; | ||
19 | - | ||
20 | -import com.google.common.annotations.Beta; | ||
21 | - | ||
22 | -import java.util.Objects; | ||
23 | - | ||
24 | -/** | ||
25 | - * Representation of explicit path info consists of contraints (strict / loose) to compute path. | ||
26 | - */ | ||
27 | -@Beta | ||
28 | -public final class ExplicitPathInfo { | ||
29 | - | ||
30 | - private final Type type; | ||
31 | - | ||
32 | - //Can be Link or DeviceId | ||
33 | - private final NetworkResource value; | ||
34 | - | ||
35 | - public enum Type { | ||
36 | - /** | ||
37 | - * Signifies that path includes strict node or link. | ||
38 | - */ | ||
39 | - STRICT(0), | ||
40 | - | ||
41 | - /** | ||
42 | - * Signifies that path includes loose node or link. | ||
43 | - */ | ||
44 | - LOOSE(1); | ||
45 | - | ||
46 | - int value; | ||
47 | - | ||
48 | - /** | ||
49 | - * Assign val with the value as the type. | ||
50 | - * | ||
51 | - * @param val type | ||
52 | - */ | ||
53 | - Type(int val) { | ||
54 | - value = val; | ||
55 | - } | ||
56 | - | ||
57 | - /** | ||
58 | - * Returns value of type. | ||
59 | - * | ||
60 | - * @return type | ||
61 | - */ | ||
62 | - public byte type() { | ||
63 | - return (byte) value; | ||
64 | - } | ||
65 | - } | ||
66 | - | ||
67 | - /** | ||
68 | - * Creates instance of explicit path object. | ||
69 | - * | ||
70 | - * @param type specifies whether strict or loose node/link | ||
71 | - * @param value specifies deviceId or link | ||
72 | - */ | ||
73 | - public ExplicitPathInfo(Type type, NetworkResource value) { | ||
74 | - this.type = type; | ||
75 | - this.value = value; | ||
76 | - } | ||
77 | - | ||
78 | - /** | ||
79 | - * Returns explicit path type. | ||
80 | - * | ||
81 | - * @return explicit path type as strict/loose | ||
82 | - */ | ||
83 | - public Type type() { | ||
84 | - return type; | ||
85 | - } | ||
86 | - | ||
87 | - /** | ||
88 | - * Returns deviceId or link. | ||
89 | - * | ||
90 | - * @return deviceId or link | ||
91 | - */ | ||
92 | - public NetworkResource value() { | ||
93 | - return value; | ||
94 | - } | ||
95 | - | ||
96 | - @Override | ||
97 | - public int hashCode() { | ||
98 | - return Objects.hash(type, value); | ||
99 | - } | ||
100 | - | ||
101 | - @Override | ||
102 | - public boolean equals(Object obj) { | ||
103 | - if (this == obj) { | ||
104 | - return true; | ||
105 | - } | ||
106 | - if (obj instanceof ExplicitPathInfo) { | ||
107 | - final ExplicitPathInfo other = (ExplicitPathInfo) obj; | ||
108 | - return Objects.equals(this.type, other.type) | ||
109 | - && Objects.equals(this.value, other.value); | ||
110 | - } | ||
111 | - return false; | ||
112 | - } | ||
113 | -} |
... | @@ -24,7 +24,6 @@ import java.util.LinkedList; | ... | @@ -24,7 +24,6 @@ import java.util.LinkedList; |
24 | import java.util.List; | 24 | import java.util.List; |
25 | import java.util.Optional; | 25 | import java.util.Optional; |
26 | import java.util.Set; | 26 | import java.util.Set; |
27 | - | ||
28 | import org.apache.felix.scr.annotations.Activate; | 27 | import org.apache.felix.scr.annotations.Activate; |
29 | import org.apache.felix.scr.annotations.Component; | 28 | import org.apache.felix.scr.annotations.Component; |
30 | import org.apache.felix.scr.annotations.Deactivate; | 29 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -49,11 +48,9 @@ import org.onosproject.mastership.MastershipService; | ... | @@ -49,11 +48,9 @@ import org.onosproject.mastership.MastershipService; |
49 | import org.onosproject.net.config.NetworkConfigService; | 48 | import org.onosproject.net.config.NetworkConfigService; |
50 | import org.onosproject.net.DefaultAnnotations; | 49 | import org.onosproject.net.DefaultAnnotations; |
51 | import org.onosproject.net.DefaultAnnotations.Builder; | 50 | import org.onosproject.net.DefaultAnnotations.Builder; |
52 | -import org.onosproject.net.DefaultPath; | ||
53 | import org.onosproject.net.Device; | 51 | import org.onosproject.net.Device; |
54 | import org.onosproject.net.DeviceId; | 52 | import org.onosproject.net.DeviceId; |
55 | import org.onosproject.net.Link; | 53 | import org.onosproject.net.Link; |
56 | -import org.onosproject.net.NetworkResource; | ||
57 | import org.onosproject.net.Path; | 54 | import org.onosproject.net.Path; |
58 | import org.onosproject.net.device.DeviceService; | 55 | import org.onosproject.net.device.DeviceService; |
59 | import org.onosproject.net.intent.Constraint; | 56 | import org.onosproject.net.intent.Constraint; |
... | @@ -89,7 +86,6 @@ import org.slf4j.LoggerFactory; | ... | @@ -89,7 +86,6 @@ import org.slf4j.LoggerFactory; |
89 | 86 | ||
90 | import com.google.common.collect.ImmutableList; | 87 | import com.google.common.collect.ImmutableList; |
91 | import com.google.common.collect.ImmutableSet; | 88 | import com.google.common.collect.ImmutableSet; |
92 | -import com.google.common.collect.Sets; | ||
93 | 89 | ||
94 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; | 90 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT; |
95 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; | 91 | import static org.onosproject.incubator.net.tunnel.Tunnel.State.UNSTABLE; |
... | @@ -234,177 +230,10 @@ public class PceManager implements PceService { | ... | @@ -234,177 +230,10 @@ public class PceManager implements PceService { |
234 | return ImmutableSet.of(); | 230 | return ImmutableSet.of(); |
235 | } | 231 | } |
236 | 232 | ||
237 | - //Computes the partial path from partial computed path to specified dst. | ||
238 | - private List<Path> computePartialPath(List<Path> computedPath, DeviceId src, DeviceId dst, | ||
239 | - List<Constraint> constraints) { | ||
240 | - int size = computedPath.size(); | ||
241 | - Path path = null; | ||
242 | - DeviceId deviceId = size == 0 ? src : | ||
243 | - computedPath.get(size - 1).dst().deviceId(); | ||
244 | - | ||
245 | - Set<Path> tempComputePath = computePath(deviceId, dst, constraints); | ||
246 | - if (tempComputePath.isEmpty()) { | ||
247 | - return null; | ||
248 | - } | ||
249 | - | ||
250 | - //if path validation fails return null | ||
251 | - //Validate computed path to avoid loop in the path | ||
252 | - for (Path p : tempComputePath) { | ||
253 | - if (pathValidation(computedPath, p)) { | ||
254 | - path = p; | ||
255 | - break; | ||
256 | - } | ||
257 | - } | ||
258 | - if (path == null) { | ||
259 | - return null; | ||
260 | - } | ||
261 | - | ||
262 | - //Store the partial path result in a list | ||
263 | - computedPath.add(path); | ||
264 | - return computedPath; | ||
265 | - } | ||
266 | - | ||
267 | - private List<DeviceId> createListOfDeviceIds(List<? extends NetworkResource> list) { | ||
268 | - List<Link> links = new LinkedList<>(); | ||
269 | - if (!list.isEmpty() && list.iterator().next() instanceof Path) { | ||
270 | - for (Path path : (List<Path>) list) { | ||
271 | - links.addAll(path.links()); | ||
272 | - } | ||
273 | - } else if (!list.isEmpty() && list.iterator().next() instanceof Link) { | ||
274 | - links.addAll((List<Link>) list); | ||
275 | - } | ||
276 | - | ||
277 | - //List of devices for new path computed | ||
278 | - DeviceId source = null; | ||
279 | - DeviceId destination = null; | ||
280 | - List<DeviceId> devList = new LinkedList<>(); | ||
281 | - | ||
282 | - for (Link l : links) { | ||
283 | - if (!devList.contains(l.src().deviceId())) { | ||
284 | - devList.add(l.src().deviceId()); | ||
285 | - } | ||
286 | - if (!devList.contains(l.dst().deviceId())) { | ||
287 | - devList.add(l.dst().deviceId()); | ||
288 | - } | ||
289 | - } | ||
290 | - | ||
291 | - return devList; | ||
292 | - } | ||
293 | - | ||
294 | - //To dectect loops in the path i.e if the partial paths has intersection node avoid it. | ||
295 | - private boolean pathValidation(List<Path> partialPath, Path path) { | ||
296 | - | ||
297 | - //List of devices in new path computed | ||
298 | - List<DeviceId> newPartialPathDevList; | ||
299 | - newPartialPathDevList = createListOfDeviceIds(path.links()); | ||
300 | - | ||
301 | - //List of devices in partial computed path | ||
302 | - List<DeviceId> partialComputedPathDevList; | ||
303 | - partialComputedPathDevList = createListOfDeviceIds(partialPath); | ||
304 | - | ||
305 | - for (DeviceId deviceId : newPartialPathDevList) { | ||
306 | - for (DeviceId devId : partialComputedPathDevList) { | ||
307 | - if (!newPartialPathDevList.get(0).equals(deviceId) && | ||
308 | - !partialComputedPathDevList.get(partialComputedPathDevList.size() - 1).equals(devId) | ||
309 | - && deviceId.equals(devId)) { | ||
310 | - return false; | ||
311 | - } | ||
312 | - } | ||
313 | - } | ||
314 | - | ||
315 | - return true; | ||
316 | - } | ||
317 | - | ||
318 | - //Returns final computed explicit path (list of partial computed paths). | ||
319 | - private List<Path> computeExplicitPath(List<ExplicitPathInfo> explicitPathInfo, DeviceId src, DeviceId dst, | ||
320 | - List<Constraint> constraints) { | ||
321 | - List<Path> finalComputedPath = new LinkedList<>(); | ||
322 | - for (ExplicitPathInfo info : explicitPathInfo) { | ||
323 | - /* | ||
324 | - * If explicit path object is LOOSE, | ||
325 | - * 1) If specified as DeviceId (node) : | ||
326 | - * If it is source , compute from source to destination (partial computation not required), | ||
327 | - * otherwise compute from specified source to specified device | ||
328 | - * 2) If specified as Link : | ||
329 | - * Compute partial path from source to link's source , if path exists compute from link's source to dst | ||
330 | - */ | ||
331 | - if (info.type().equals(ExplicitPathInfo.Type.LOOSE)) { | ||
332 | - if (info.value() instanceof DeviceId) { | ||
333 | - // If deviceId is source no need to compute | ||
334 | - if (!(info.value()).equals(src)) { | ||
335 | - finalComputedPath = computePartialPath(finalComputedPath, src, (DeviceId) info.value(), | ||
336 | - constraints); | ||
337 | - } | ||
338 | - | ||
339 | - } else if (info.value() instanceof Link) { | ||
340 | - if ((((Link) info.value()).src().deviceId().equals(src)) | ||
341 | - || (!finalComputedPath.isEmpty() | ||
342 | - && finalComputedPath.get(finalComputedPath.size() - 1).dst().equals( | ||
343 | - ((Link) info.value()).src().deviceId()))) { | ||
344 | - | ||
345 | - finalComputedPath = computePartialPath(finalComputedPath, src, ((Link) info.value()).dst() | ||
346 | - .deviceId(), constraints); | ||
347 | - } else { | ||
348 | - | ||
349 | - finalComputedPath = computePartialPath(finalComputedPath, src, ((Link) info.value()).src() | ||
350 | - .deviceId(), constraints) != null ? computePartialPath(finalComputedPath, src, | ||
351 | - ((Link) info.value()).dst().deviceId(), constraints) : null; | ||
352 | - } | ||
353 | - } | ||
354 | - /* | ||
355 | - * If explicit path object is STRICT, | ||
356 | - * 1) If specified as DeviceId (node) : | ||
357 | - * Check whether partial computed path has reachable to strict specified node or | ||
358 | - * strict node is the source, if no set path as null else do nothing | ||
359 | - * 2) If specified as Link : | ||
360 | - * Check whether partial computed path has reachable to strict link's src, if yes compute | ||
361 | - * path from strict link's src to link's dst (to include specified link) | ||
362 | - */ | ||
363 | - } else if (info.type().equals(ExplicitPathInfo.Type.STRICT)) { | ||
364 | - if (info.value() instanceof DeviceId) { | ||
365 | - if (!(!finalComputedPath.isEmpty() && finalComputedPath.get(finalComputedPath.size() - 1).dst() | ||
366 | - .deviceId().equals(info.value())) | ||
367 | - && !info.value().equals(src)) { | ||
368 | - finalComputedPath = null; | ||
369 | - } | ||
370 | - | ||
371 | - } else if (info.value() instanceof Link) { | ||
372 | - | ||
373 | - finalComputedPath = ((Link) info.value()).src().deviceId().equals(src) | ||
374 | - || !finalComputedPath.isEmpty() | ||
375 | - && finalComputedPath.get(finalComputedPath.size() - 1).dst().deviceId() | ||
376 | - .equals(((Link) info.value()).src().deviceId()) ? computePartialPath( | ||
377 | - finalComputedPath, src, ((Link) info.value()).dst().deviceId(), constraints) : null; | ||
378 | - | ||
379 | - } | ||
380 | - } | ||
381 | - if (finalComputedPath == null) { | ||
382 | - return null; | ||
383 | - } | ||
384 | - } | ||
385 | - // Destination is not reached in Partial computed path then compute till destination | ||
386 | - if (finalComputedPath.isEmpty() || !finalComputedPath.isEmpty() | ||
387 | - && !finalComputedPath.get(finalComputedPath.size() - 1).dst().deviceId().equals(dst)) { | ||
388 | - | ||
389 | - finalComputedPath = computePartialPath(finalComputedPath, src, dst, constraints); | ||
390 | - if (finalComputedPath == null) { | ||
391 | - return null; | ||
392 | - } | ||
393 | - } | ||
394 | - | ||
395 | - return finalComputedPath; | ||
396 | - } | ||
397 | - | ||
398 | - @Override | ||
399 | - public boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, | ||
400 | - LspType lspType) { | ||
401 | - return setupPath(src, dst, tunnelName, constraints, lspType, null); | ||
402 | - } | ||
403 | - | ||
404 | //[TODO:] handle requests in queue | 233 | //[TODO:] handle requests in queue |
405 | @Override | 234 | @Override |
406 | public boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, | 235 | public boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, |
407 | - LspType lspType, List<ExplicitPathInfo> explicitPathInfo) { | 236 | + LspType lspType) { |
408 | checkNotNull(src); | 237 | checkNotNull(src); |
409 | checkNotNull(dst); | 238 | checkNotNull(dst); |
410 | checkNotNull(tunnelName); | 239 | checkNotNull(tunnelName); |
... | @@ -416,7 +245,7 @@ public class PceManager implements PceService { | ... | @@ -416,7 +245,7 @@ public class PceManager implements PceService { |
416 | 245 | ||
417 | if (srcDevice == null || dstDevice == null) { | 246 | if (srcDevice == null || dstDevice == null) { |
418 | // Device is not known. | 247 | // Device is not known. |
419 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo)); | 248 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
420 | return false; | 249 | return false; |
421 | } | 250 | } |
422 | 251 | ||
... | @@ -426,7 +255,7 @@ public class PceManager implements PceService { | ... | @@ -426,7 +255,7 @@ public class PceManager implements PceService { |
426 | 255 | ||
427 | if (srcLsrId == null || dstLsrId == null) { | 256 | if (srcLsrId == null || dstLsrId == null) { |
428 | // LSR id is not known. | 257 | // LSR id is not known. |
429 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo)); | 258 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
430 | return false; | 259 | return false; |
431 | } | 260 | } |
432 | 261 | ||
... | @@ -434,7 +263,7 @@ public class PceManager implements PceService { | ... | @@ -434,7 +263,7 @@ public class PceManager implements PceService { |
434 | DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(srcLsrId), DeviceCapability.class); | 263 | DeviceCapability cfg = netCfgService.getConfig(DeviceId.deviceId(srcLsrId), DeviceCapability.class); |
435 | if (cfg == null) { | 264 | if (cfg == null) { |
436 | log.debug("No session to ingress."); | 265 | log.debug("No session to ingress."); |
437 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo)); | 266 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
438 | return false; | 267 | return false; |
439 | } | 268 | } |
440 | 269 | ||
... | @@ -470,30 +299,12 @@ public class PceManager implements PceService { | ... | @@ -470,30 +299,12 @@ public class PceManager implements PceService { |
470 | constraints = new LinkedList<>(); | 299 | constraints = new LinkedList<>(); |
471 | constraints.add(CapabilityConstraint.of(CapabilityType.valueOf(lspType.name()))); | 300 | constraints.add(CapabilityConstraint.of(CapabilityType.valueOf(lspType.name()))); |
472 | } | 301 | } |
473 | - Set<Path> computedPathSet = Sets.newLinkedHashSet(); | ||
474 | 302 | ||
475 | - if (explicitPathInfo != null && !explicitPathInfo.isEmpty()) { | 303 | + Set<Path> computedPathSet = computePath(src, dst, constraints); |
476 | - List<Path> finalComputedPath = computeExplicitPath(explicitPathInfo, src, dst, constraints); | ||
477 | - if (finalComputedPath == null) { | ||
478 | - return false; | ||
479 | - } | ||
480 | - | ||
481 | - pceStore.tunnelNameExplicitPathInfoMap(tunnelName, explicitPathInfo); | ||
482 | - List<Link> links = new LinkedList<>(); | ||
483 | - double totalCost = 0; | ||
484 | - // Add all partial computed paths | ||
485 | - for (Path path : finalComputedPath) { | ||
486 | - links.addAll(path.links()); | ||
487 | - totalCost = totalCost + path.cost(); | ||
488 | - } | ||
489 | - computedPathSet.add(new DefaultPath(finalComputedPath.iterator().next().providerId(), links, totalCost)); | ||
490 | - } else { | ||
491 | - computedPathSet = computePath(src, dst, constraints); | ||
492 | - } | ||
493 | 304 | ||
494 | // NO-PATH | 305 | // NO-PATH |
495 | if (computedPathSet.isEmpty()) { | 306 | if (computedPathSet.isEmpty()) { |
496 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo)); | 307 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
497 | return false; | 308 | return false; |
498 | } | 309 | } |
499 | 310 | ||
... | @@ -528,15 +339,14 @@ public class PceManager implements PceService { | ... | @@ -528,15 +339,14 @@ public class PceManager implements PceService { |
528 | if (bwConstraintValue != 0) { | 339 | if (bwConstraintValue != 0) { |
529 | consumerId = reserveBandwidth(computedPath, bwConstraintValue, null); | 340 | consumerId = reserveBandwidth(computedPath, bwConstraintValue, null); |
530 | if (consumerId == null) { | 341 | if (consumerId == null) { |
531 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, | 342 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
532 | - lspType, explicitPathInfo)); | ||
533 | return false; | 343 | return false; |
534 | } | 344 | } |
535 | } | 345 | } |
536 | 346 | ||
537 | TunnelId tunnelId = tunnelService.setupTunnel(appId, src, tunnel, computedPath); | 347 | TunnelId tunnelId = tunnelService.setupTunnel(appId, src, tunnel, computedPath); |
538 | if (tunnelId == null) { | 348 | if (tunnelId == null) { |
539 | - pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType, explicitPathInfo)); | 349 | + pceStore.addFailedPathInfo(new PcePathInfo(src, dst, tunnelName, constraints, lspType)); |
540 | if (consumerId != null) { | 350 | if (consumerId != null) { |
541 | resourceService.release(consumerId); | 351 | resourceService.release(consumerId); |
542 | } | 352 | } |
... | @@ -553,7 +363,7 @@ public class PceManager implements PceService { | ... | @@ -553,7 +363,7 @@ public class PceManager implements PceService { |
553 | @Override | 363 | @Override |
554 | public boolean updatePath(TunnelId tunnelId, List<Constraint> constraints) { | 364 | public boolean updatePath(TunnelId tunnelId, List<Constraint> constraints) { |
555 | checkNotNull(tunnelId); | 365 | checkNotNull(tunnelId); |
556 | - Set<Path> computedPathSet = Sets.newLinkedHashSet(); | 366 | + Set<Path> computedPathSet = null; |
557 | Tunnel tunnel = tunnelService.queryTunnel(tunnelId); | 367 | Tunnel tunnel = tunnelService.queryTunnel(tunnelId); |
558 | 368 | ||
559 | if (tunnel == null) { | 369 | if (tunnel == null) { |
... | @@ -631,31 +441,9 @@ public class PceManager implements PceService { | ... | @@ -631,31 +441,9 @@ public class PceManager implements PceService { |
631 | constraints.add(costConstraint); | 441 | constraints.add(costConstraint); |
632 | } | 442 | } |
633 | 443 | ||
634 | - List<ExplicitPathInfo> explicitPathInfo = pceStore | 444 | + computedPathSet = computePath(links.get(0).src().deviceId(), links.get(links.size() - 1).dst().deviceId(), |
635 | - .getTunnelNameExplicitPathInfoMap(tunnel.tunnelName().value()); | ||
636 | - if (explicitPathInfo != null) { | ||
637 | - List<Path> finalComputedPath = computeExplicitPath(explicitPathInfo, | ||
638 | - tunnel.path().src().deviceId(), tunnel.path().dst().deviceId(), | ||
639 | constraints); | 445 | constraints); |
640 | 446 | ||
641 | - if (finalComputedPath == null) { | ||
642 | - return false; | ||
643 | - } | ||
644 | - | ||
645 | - List<Link> totalLinks = new LinkedList<>(); | ||
646 | - double totalCost = 0; | ||
647 | - //Add all partial computed paths | ||
648 | - for (Path path : finalComputedPath) { | ||
649 | - totalLinks.addAll(path.links()); | ||
650 | - totalCost = totalCost + path.cost(); | ||
651 | - } | ||
652 | - computedPathSet.add(new DefaultPath(finalComputedPath.iterator().next().providerId(), | ||
653 | - totalLinks, totalCost)); | ||
654 | - } else { | ||
655 | - computedPathSet = computePath(tunnel.path().src().deviceId(), tunnel.path().dst().deviceId(), | ||
656 | - constraints); | ||
657 | - } | ||
658 | - | ||
659 | // NO-PATH | 447 | // NO-PATH |
660 | if (computedPathSet.isEmpty()) { | 448 | if (computedPathSet.isEmpty()) { |
661 | return false; | 449 | return false; |
... | @@ -848,8 +636,7 @@ public class PceManager implements PceService { | ... | @@ -848,8 +636,7 @@ public class PceManager implements PceService { |
848 | // then PCInitiate (Remove) | 636 | // then PCInitiate (Remove) |
849 | pceStore.addFailedPathInfo(new PcePathInfo(tunnel.path().src().deviceId(), tunnel | 637 | pceStore.addFailedPathInfo(new PcePathInfo(tunnel.path().src().deviceId(), tunnel |
850 | .path().dst().deviceId(), tunnel.tunnelName().value(), constraintList, | 638 | .path().dst().deviceId(), tunnel.tunnelName().value(), constraintList, |
851 | - LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE)), | 639 | + LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE)))); |
852 | - pceStore.getTunnelNameExplicitPathInfoMap(tunnel.tunnelName().value()))); | ||
853 | //Release that tunnel calling PCInitiate | 640 | //Release that tunnel calling PCInitiate |
854 | releasePath(tunnel.tunnelId()); | 641 | releasePath(tunnel.tunnelId()); |
855 | } | 642 | } |
... | @@ -1045,9 +832,7 @@ public class PceManager implements PceService { | ... | @@ -1045,9 +832,7 @@ public class PceManager implements PceService { |
1045 | List<Link> links = tunnel.path().links(); | 832 | List<Link> links = tunnel.path().links(); |
1046 | pceStore.addFailedPathInfo(new PcePathInfo(links.get(0).src().deviceId(), | 833 | pceStore.addFailedPathInfo(new PcePathInfo(links.get(0).src().deviceId(), |
1047 | links.get(links.size() - 1).dst().deviceId(), | 834 | links.get(links.size() - 1).dst().deviceId(), |
1048 | - tunnel.tunnelName().value(), constraints, lspType, | 835 | + tunnel.tunnelName().value(), constraints, lspType)); |
1049 | - pceStore.getTunnelNameExplicitPathInfoMap(tunnel | ||
1050 | - .tunnelName().value()))); | ||
1051 | } | 836 | } |
1052 | 837 | ||
1053 | break; | 838 | break; |
... | @@ -1076,11 +861,6 @@ public class PceManager implements PceService { | ... | @@ -1076,11 +861,6 @@ public class PceManager implements PceService { |
1076 | } | 861 | } |
1077 | } | 862 | } |
1078 | 863 | ||
1079 | - @Override | ||
1080 | - public List<ExplicitPathInfo> explicitPathInfoList(String tunnelName) { | ||
1081 | - return pceStore.getTunnelNameExplicitPathInfoMap(tunnelName); | ||
1082 | - } | ||
1083 | - | ||
1084 | //Computes path from tunnel store and also path failed to setup. | 864 | //Computes path from tunnel store and also path failed to setup. |
1085 | private void callForOptimization() { | 865 | private void callForOptimization() { |
1086 | //Recompute the LSPs which it was delegated [LSPs stored in PCE store (failed paths)] | 866 | //Recompute the LSPs which it was delegated [LSPs stored in PCE store (failed paths)] |
... | @@ -1100,7 +880,7 @@ public class PceManager implements PceService { | ... | @@ -1100,7 +880,7 @@ public class PceManager implements PceService { |
1100 | */ | 880 | */ |
1101 | if (mastershipService.isLocalMaster(failedPathInfo.src())) { | 881 | if (mastershipService.isLocalMaster(failedPathInfo.src())) { |
1102 | if (setupPath(failedPathInfo.src(), failedPathInfo.dst(), failedPathInfo.name(), | 882 | if (setupPath(failedPathInfo.src(), failedPathInfo.dst(), failedPathInfo.name(), |
1103 | - failedPathInfo.constraints(), failedPathInfo.lspType(), failedPathInfo.explicitPathInfo())) { | 883 | + failedPathInfo.constraints(), failedPathInfo.lspType())) { |
1104 | // If computation is success remove that path | 884 | // If computation is success remove that path |
1105 | pceStore.removeFailedPathInfo(failedPathInfo); | 885 | pceStore.removeFailedPathInfo(failedPathInfo); |
1106 | return true; | 886 | return true; | ... | ... |
... | @@ -19,8 +19,7 @@ package org.onosproject.pce.pceservice; | ... | @@ -19,8 +19,7 @@ package org.onosproject.pce.pceservice; |
19 | import org.onosproject.incubator.net.tunnel.Tunnel; | 19 | import org.onosproject.incubator.net.tunnel.Tunnel; |
20 | import org.onosproject.incubator.net.tunnel.TunnelId; | 20 | import org.onosproject.incubator.net.tunnel.TunnelId; |
21 | import org.onosproject.net.intent.Constraint; | 21 | import org.onosproject.net.intent.Constraint; |
22 | - | 22 | +import org.onosproject.pce.pceservice.DefaultPcePath.Builder; |
23 | -import java.util.Collection; | ||
24 | 23 | ||
25 | /** | 24 | /** |
26 | * Abstraction of an entity which provides functionalities of pce path. | 25 | * Abstraction of an entity which provides functionalities of pce path. |
... | @@ -98,13 +97,6 @@ public interface PcePath { | ... | @@ -98,13 +97,6 @@ public interface PcePath { |
98 | Constraint bandwidthConstraint(); | 97 | Constraint bandwidthConstraint(); |
99 | 98 | ||
100 | /** | 99 | /** |
101 | - * Returns the list of explicit path objects. | ||
102 | - * | ||
103 | - * @return list of explicit path objects | ||
104 | - */ | ||
105 | - Collection<ExplicitPathInfo> explicitPathInfo(); | ||
106 | - | ||
107 | - /** | ||
108 | * Copies only non-null or non-zero member variables. | 100 | * Copies only non-null or non-zero member variables. |
109 | * | 101 | * |
110 | * @param id path-id | 102 | * @param id path-id |
... | @@ -182,14 +174,6 @@ public interface PcePath { | ... | @@ -182,14 +174,6 @@ public interface PcePath { |
182 | Builder of(Tunnel tunnel); | 174 | Builder of(Tunnel tunnel); |
183 | 175 | ||
184 | /** | 176 | /** |
185 | - * Returns the builder object of ExplicitPathInfo. | ||
186 | - * | ||
187 | - * @param explicitPathInfo list of explicit path obj | ||
188 | - * @return builder object of ExplicitPathInfo | ||
189 | - */ | ||
190 | - Builder explicitPathInfo(Collection<ExplicitPathInfo> explicitPathInfo); | ||
191 | - | ||
192 | - /** | ||
193 | * Builds object of pce path. | 177 | * Builds object of pce path. |
194 | * | 178 | * |
195 | * @return object of pce path. | 179 | * @return object of pce path. | ... | ... |
... | @@ -19,7 +19,6 @@ import java.util.List; | ... | @@ -19,7 +19,6 @@ import java.util.List; |
19 | 19 | ||
20 | import org.onosproject.net.DeviceId; | 20 | import org.onosproject.net.DeviceId; |
21 | import org.onosproject.net.intent.Constraint; | 21 | import org.onosproject.net.intent.Constraint; |
22 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
23 | import org.onosproject.pce.pceservice.LspType; | 22 | import org.onosproject.pce.pceservice.LspType; |
24 | import org.onosproject.incubator.net.tunnel.Tunnel; | 23 | import org.onosproject.incubator.net.tunnel.Tunnel; |
25 | import org.onosproject.incubator.net.tunnel.TunnelId; | 24 | import org.onosproject.incubator.net.tunnel.TunnelId; |
... | @@ -43,20 +42,6 @@ public interface PceService { | ... | @@ -43,20 +42,6 @@ public interface PceService { |
43 | boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, LspType lspType); | 42 | boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, LspType lspType); |
44 | 43 | ||
45 | /** | 44 | /** |
46 | - * Creates new path based on constraints and LSP type. | ||
47 | - * | ||
48 | - * @param src source device | ||
49 | - * @param dst destination device | ||
50 | - * @param tunnelName name of the tunnel | ||
51 | - * @param constraints list of constraints to be applied on path | ||
52 | - * @param lspType type of path to be setup | ||
53 | - * @param explicitPathInfo list of explicit path info | ||
54 | - * @return false on failure and true on successful path creation | ||
55 | - */ | ||
56 | - boolean setupPath(DeviceId src, DeviceId dst, String tunnelName, List<Constraint> constraints, LspType lspType, | ||
57 | - List<ExplicitPathInfo> explicitPathInfo); | ||
58 | - | ||
59 | - /** | ||
60 | * Updates an existing path. | 45 | * Updates an existing path. |
61 | * | 46 | * |
62 | * @param tunnelId tunnel identifier | 47 | * @param tunnelId tunnel identifier |
... | @@ -87,12 +72,4 @@ public interface PceService { | ... | @@ -87,12 +72,4 @@ public interface PceService { |
87 | * @return tunnel if path exists, otherwise null | 72 | * @return tunnel if path exists, otherwise null |
88 | */ | 73 | */ |
89 | Tunnel queryPath(TunnelId tunnelId); | 74 | Tunnel queryPath(TunnelId tunnelId); |
90 | - | ||
91 | - /** | ||
92 | - * Returns list of explicit path info. | ||
93 | - * | ||
94 | - * @param tunnelName tunnel name | ||
95 | - * @return list of explicit path info | ||
96 | - */ | ||
97 | - List<ExplicitPathInfo> explicitPathInfoList(String tunnelName); | ||
98 | } | 75 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull; |
19 | 19 | ||
20 | import com.google.common.collect.ImmutableSet; | 20 | import com.google.common.collect.ImmutableSet; |
21 | 21 | ||
22 | -import java.util.List; | ||
23 | import java.util.Map; | 22 | import java.util.Map; |
24 | import java.util.stream.Collectors; | 23 | import java.util.stream.Collectors; |
25 | 24 | ||
... | @@ -34,7 +33,6 @@ import org.onlab.util.KryoNamespace; | ... | @@ -34,7 +33,6 @@ import org.onlab.util.KryoNamespace; |
34 | import org.onosproject.incubator.net.tunnel.TunnelId; | 33 | import org.onosproject.incubator.net.tunnel.TunnelId; |
35 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 34 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
36 | import org.onosproject.net.resource.ResourceConsumer; | 35 | import org.onosproject.net.resource.ResourceConsumer; |
37 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
38 | import org.onosproject.pce.pceservice.constraint.CapabilityConstraint; | 36 | import org.onosproject.pce.pceservice.constraint.CapabilityConstraint; |
39 | import org.onosproject.pce.pceservice.constraint.CostConstraint; | 37 | import org.onosproject.pce.pceservice.constraint.CostConstraint; |
40 | import org.onosproject.pce.pceservice.TunnelConsumerId; | 38 | import org.onosproject.pce.pceservice.TunnelConsumerId; |
... | @@ -71,9 +69,6 @@ public class DistributedPceStore implements PceStore { | ... | @@ -71,9 +69,6 @@ public class DistributedPceStore implements PceStore { |
71 | // List of Failed path info | 69 | // List of Failed path info |
72 | private DistributedSet<PcePathInfo> failedPathSet; | 70 | private DistributedSet<PcePathInfo> failedPathSet; |
73 | 71 | ||
74 | - // Maintains tunnel name mapped to explicit path info | ||
75 | - private ConsistentMap<String, List<ExplicitPathInfo>> tunnelNameExplicitPathInfoMap; | ||
76 | - | ||
77 | private static final Serializer SERIALIZER = Serializer | 72 | private static final Serializer SERIALIZER = Serializer |
78 | .using(new KryoNamespace.Builder().register(KryoNamespaces.API) | 73 | .using(new KryoNamespace.Builder().register(KryoNamespaces.API) |
79 | .register(PcePathInfo.class) | 74 | .register(PcePathInfo.class) |
... | @@ -104,16 +99,6 @@ public class DistributedPceStore implements PceStore { | ... | @@ -104,16 +99,6 @@ public class DistributedPceStore implements PceStore { |
104 | .build() | 99 | .build() |
105 | .asDistributedSet(); | 100 | .asDistributedSet(); |
106 | 101 | ||
107 | - tunnelNameExplicitPathInfoMap = storageService.<String, List<ExplicitPathInfo>>consistentMapBuilder() | ||
108 | - .withName("onos-pce-explicitpathinfo") | ||
109 | - .withSerializer(Serializer.using( | ||
110 | - new KryoNamespace.Builder() | ||
111 | - .register(KryoNamespaces.API) | ||
112 | - .register(ExplicitPathInfo.class) | ||
113 | - .register(ExplicitPathInfo.Type.class) | ||
114 | - .build())) | ||
115 | - .build(); | ||
116 | - | ||
117 | log.info("Started"); | 102 | log.info("Started"); |
118 | } | 103 | } |
119 | 104 | ||
... | @@ -196,18 +181,4 @@ public class DistributedPceStore implements PceStore { | ... | @@ -196,18 +181,4 @@ public class DistributedPceStore implements PceStore { |
196 | } | 181 | } |
197 | return true; | 182 | return true; |
198 | } | 183 | } |
199 | - | ||
200 | - @Override | ||
201 | - public boolean tunnelNameExplicitPathInfoMap(String tunnelName, List<ExplicitPathInfo> explicitPathInfo) { | ||
202 | - checkNotNull(tunnelName); | ||
203 | - checkNotNull(explicitPathInfo); | ||
204 | - return tunnelNameExplicitPathInfoMap.put(tunnelName, explicitPathInfo) != null ? true : false; | ||
205 | - } | ||
206 | - | ||
207 | - @Override | ||
208 | - public List<ExplicitPathInfo> getTunnelNameExplicitPathInfoMap(String tunnelName) { | ||
209 | - checkNotNull(tunnelName); | ||
210 | - return tunnelNameExplicitPathInfoMap.get(tunnelName).value(); | ||
211 | - } | ||
212 | - | ||
213 | } | 184 | } | ... | ... |
... | @@ -22,7 +22,6 @@ import java.util.Objects; | ... | @@ -22,7 +22,6 @@ import java.util.Objects; |
22 | 22 | ||
23 | import org.onosproject.net.DeviceId; | 23 | import org.onosproject.net.DeviceId; |
24 | import org.onosproject.net.intent.Constraint; | 24 | import org.onosproject.net.intent.Constraint; |
25 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
26 | import org.onosproject.pce.pceservice.LspType; | 25 | import org.onosproject.pce.pceservice.LspType; |
27 | 26 | ||
28 | /** | 27 | /** |
... | @@ -41,8 +40,6 @@ public final class PcePathInfo { | ... | @@ -41,8 +40,6 @@ public final class PcePathInfo { |
41 | 40 | ||
42 | private LspType lspType; // lsp type | 41 | private LspType lspType; // lsp type |
43 | 42 | ||
44 | - private List<ExplicitPathInfo> explicitPathInfo; //Explicit path info to compute explicit path | ||
45 | - | ||
46 | /** | 43 | /** |
47 | * Initialization of member variables. | 44 | * Initialization of member variables. |
48 | * | 45 | * |
... | @@ -51,20 +48,17 @@ public final class PcePathInfo { | ... | @@ -51,20 +48,17 @@ public final class PcePathInfo { |
51 | * @param name tunnel name | 48 | * @param name tunnel name |
52 | * @param constraints list of constraints | 49 | * @param constraints list of constraints |
53 | * @param lspType lsp type | 50 | * @param lspType lsp type |
54 | - * @param explicitPathInfo explicit path info | ||
55 | */ | 51 | */ |
56 | public PcePathInfo(DeviceId src, | 52 | public PcePathInfo(DeviceId src, |
57 | DeviceId dst, | 53 | DeviceId dst, |
58 | String name, | 54 | String name, |
59 | List<Constraint> constraints, | 55 | List<Constraint> constraints, |
60 | - LspType lspType, | 56 | + LspType lspType) { |
61 | - List<ExplicitPathInfo> explicitPathInfo) { | ||
62 | this.src = src; | 57 | this.src = src; |
63 | this.dst = dst; | 58 | this.dst = dst; |
64 | this.name = name; | 59 | this.name = name; |
65 | this.constraints = constraints; | 60 | this.constraints = constraints; |
66 | this.lspType = lspType; | 61 | this.lspType = lspType; |
67 | - this.explicitPathInfo = explicitPathInfo; | ||
68 | } | 62 | } |
69 | 63 | ||
70 | /** | 64 | /** |
... | @@ -76,7 +70,6 @@ public final class PcePathInfo { | ... | @@ -76,7 +70,6 @@ public final class PcePathInfo { |
76 | this.name = null; | 70 | this.name = null; |
77 | this.constraints = null; | 71 | this.constraints = null; |
78 | this.lspType = null; | 72 | this.lspType = null; |
79 | - this.explicitPathInfo = null; | ||
80 | } | 73 | } |
81 | 74 | ||
82 | /** | 75 | /** |
... | @@ -169,27 +162,9 @@ public final class PcePathInfo { | ... | @@ -169,27 +162,9 @@ public final class PcePathInfo { |
169 | this.lspType = lspType; | 162 | this.lspType = lspType; |
170 | } | 163 | } |
171 | 164 | ||
172 | - /** | ||
173 | - * Returns list of explicit path info. | ||
174 | - * | ||
175 | - * @return list of explicit path info | ||
176 | - */ | ||
177 | - public List<ExplicitPathInfo> explicitPathInfo() { | ||
178 | - return explicitPathInfo; | ||
179 | - } | ||
180 | - | ||
181 | - /** | ||
182 | - * Sets list of explicit path info. | ||
183 | - * | ||
184 | - * @param explicitPathInfo list of explicit path info | ||
185 | - */ | ||
186 | - public void explicitPathInfo(List<ExplicitPathInfo> explicitPathInfo) { | ||
187 | - this.explicitPathInfo = explicitPathInfo; | ||
188 | - } | ||
189 | - | ||
190 | @Override | 165 | @Override |
191 | public int hashCode() { | 166 | public int hashCode() { |
192 | - return Objects.hash(src, dst, name, constraints, lspType, explicitPathInfo); | 167 | + return Objects.hash(src, dst, name, constraints, lspType); |
193 | } | 168 | } |
194 | 169 | ||
195 | @Override | 170 | @Override |
... | @@ -203,8 +178,7 @@ public final class PcePathInfo { | ... | @@ -203,8 +178,7 @@ public final class PcePathInfo { |
203 | Objects.equals(this.dst, other.dst) && | 178 | Objects.equals(this.dst, other.dst) && |
204 | Objects.equals(this.name, other.name) && | 179 | Objects.equals(this.name, other.name) && |
205 | Objects.equals(this.constraints, other.constraints) && | 180 | Objects.equals(this.constraints, other.constraints) && |
206 | - Objects.equals(this.lspType, other.lspType) && | 181 | + Objects.equals(this.lspType, other.lspType); |
207 | - Objects.equals(this.explicitPathInfo, other.explicitPathInfo); | ||
208 | } | 182 | } |
209 | return false; | 183 | return false; |
210 | } | 184 | } |
... | @@ -213,12 +187,11 @@ public final class PcePathInfo { | ... | @@ -213,12 +187,11 @@ public final class PcePathInfo { |
213 | public String toString() { | 187 | public String toString() { |
214 | return MoreObjects.toStringHelper(getClass()) | 188 | return MoreObjects.toStringHelper(getClass()) |
215 | .omitNullValues() | 189 | .omitNullValues() |
216 | - .add("Source", src) | 190 | + .add("Source", src.toString()) |
217 | - .add("Destination", dst) | 191 | + .add("Destination", dst.toString()) |
218 | - .add("Name", name) | 192 | + .add("Name", name.toString()) |
219 | - .add("Constraints", constraints) | 193 | + .add("Constraints", constraints.toString()) |
220 | - .add("explicitPathInfo", explicitPathInfo) | 194 | + .add("LspType", lspType.toString()) |
221 | - .add("LspType", lspType) | ||
222 | .toString(); | 195 | .toString(); |
223 | } | 196 | } |
224 | } | 197 | } | ... | ... |
... | @@ -15,11 +15,8 @@ | ... | @@ -15,11 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pce.pcestore.api; | 16 | package org.onosproject.pce.pcestore.api; |
17 | 17 | ||
18 | -import java.util.List; | ||
19 | - | ||
20 | import org.onosproject.incubator.net.tunnel.TunnelId; | 18 | import org.onosproject.incubator.net.tunnel.TunnelId; |
21 | import org.onosproject.net.resource.ResourceConsumer; | 19 | import org.onosproject.net.resource.ResourceConsumer; |
22 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
23 | import org.onosproject.pce.pcestore.PcePathInfo; | 20 | import org.onosproject.pce.pcestore.PcePathInfo; |
24 | 21 | ||
25 | import java.util.Map; | 22 | import java.util.Map; |
... | @@ -110,21 +107,4 @@ public interface PceStore { | ... | @@ -110,21 +107,4 @@ public interface PceStore { |
110 | * @return success or failure | 107 | * @return success or failure |
111 | */ | 108 | */ |
112 | boolean removeFailedPathInfo(PcePathInfo failedPathInfo); | 109 | boolean removeFailedPathInfo(PcePathInfo failedPathInfo); |
113 | - | ||
114 | - /** | ||
115 | - * Adds explicit path info to the map with corresponding tunnel name. | ||
116 | - * | ||
117 | - * @param tunnelName tunnel name as key | ||
118 | - * @param explicitPathInfo list of explicit path objects | ||
119 | - * @return whether it is added to map | ||
120 | - */ | ||
121 | - boolean tunnelNameExplicitPathInfoMap(String tunnelName, List<ExplicitPathInfo> explicitPathInfo); | ||
122 | - | ||
123 | - /** | ||
124 | - * Gets explicit path info based on tunnel name. | ||
125 | - * | ||
126 | - * @param tunnelName tunnel name as key | ||
127 | - * @return list of explicit path info | ||
128 | - */ | ||
129 | - List<ExplicitPathInfo> getTunnelNameExplicitPathInfoMap(String tunnelName); | ||
130 | } | 110 | } | ... | ... |
... | @@ -16,47 +16,21 @@ | ... | @@ -16,47 +16,21 @@ |
16 | 16 | ||
17 | package org.onosproject.pce.pceservice; | 17 | package org.onosproject.pce.pceservice; |
18 | 18 | ||
19 | -import com.google.common.collect.Lists; | ||
20 | - | ||
21 | -import org.junit.After; | ||
22 | -import org.junit.Before; | ||
23 | import org.junit.Test; | 19 | import org.junit.Test; |
24 | 20 | ||
25 | import static org.hamcrest.MatcherAssert.assertThat; | 21 | import static org.hamcrest.MatcherAssert.assertThat; |
26 | import static org.hamcrest.Matchers.is; | 22 | import static org.hamcrest.Matchers.is; |
27 | -import static org.onosproject.pce.pceservice.PathComputationTest.D2; | ||
28 | -import static org.easymock.EasyMock.createMock; | ||
29 | 23 | ||
30 | import com.google.common.testing.EqualsTester; | 24 | import com.google.common.testing.EqualsTester; |
31 | 25 | ||
32 | - | ||
33 | -import org.onlab.osgi.ServiceDirectory; | ||
34 | -import org.onlab.osgi.TestServiceDirectory; | ||
35 | -import org.onlab.rest.BaseResource; | ||
36 | import org.onosproject.incubator.net.tunnel.TunnelId; | 26 | import org.onosproject.incubator.net.tunnel.TunnelId; |
37 | import org.onosproject.pce.pceservice.constraint.CostConstraint; | 27 | import org.onosproject.pce.pceservice.constraint.CostConstraint; |
38 | -import org.onosproject.pce.pcestore.api.PceStore; | ||
39 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 28 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
40 | 29 | ||
41 | -import java.util.List; | ||
42 | - | ||
43 | /** | 30 | /** |
44 | * Unit tests for DefaultPcePath class. | 31 | * Unit tests for DefaultPcePath class. |
45 | */ | 32 | */ |
46 | public class DefaultPcePathTest { | 33 | public class DefaultPcePathTest { |
47 | - private PceStore pceStore = createMock(PceStore.class); | ||
48 | - | ||
49 | - @Before | ||
50 | - public void setup() { | ||
51 | - | ||
52 | - ServiceDirectory testDirectory = new TestServiceDirectory() | ||
53 | - .add(PceStore.class, pceStore); | ||
54 | - BaseResource.setServiceDirectory(testDirectory); | ||
55 | - } | ||
56 | - | ||
57 | - @After | ||
58 | - public void tearDownTest() { | ||
59 | - } | ||
60 | /** | 34 | /** |
61 | * Checks the operation of equals() methods. | 35 | * Checks the operation of equals() methods. |
62 | */ | 36 | */ |
... | @@ -69,9 +43,7 @@ public class DefaultPcePathTest { | ... | @@ -69,9 +43,7 @@ public class DefaultPcePathTest { |
69 | final String dst1 = "bee"; | 43 | final String dst1 = "bee"; |
70 | final String type1 = "1"; | 44 | final String type1 = "1"; |
71 | final String name1 = "pcc"; | 45 | final String name1 = "pcc"; |
72 | - final List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | 46 | + |
73 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId()); | ||
74 | - explicitPathInfoList.add(obj); | ||
75 | PcePath path1 = DefaultPcePath.builder() | 47 | PcePath path1 = DefaultPcePath.builder() |
76 | .source(src1) | 48 | .source(src1) |
77 | .destination(dst1) | 49 | .destination(dst1) |
... | @@ -79,7 +51,6 @@ public class DefaultPcePathTest { | ... | @@ -79,7 +51,6 @@ public class DefaultPcePathTest { |
79 | .name(name1) | 51 | .name(name1) |
80 | .costConstraint(cost1) | 52 | .costConstraint(cost1) |
81 | .bandwidthConstraint(bandwidth1) | 53 | .bandwidthConstraint(bandwidth1) |
82 | - .explicitPathInfo(explicitPathInfoList) | ||
83 | .build(); | 54 | .build(); |
84 | path1.id(TunnelId.valueOf("1")); | 55 | path1.id(TunnelId.valueOf("1")); |
85 | 56 | ||
... | @@ -91,7 +62,6 @@ public class DefaultPcePathTest { | ... | @@ -91,7 +62,6 @@ public class DefaultPcePathTest { |
91 | .name(name1) | 62 | .name(name1) |
92 | .costConstraint(cost1) | 63 | .costConstraint(cost1) |
93 | .bandwidthConstraint(bandwidth1) | 64 | .bandwidthConstraint(bandwidth1) |
94 | - .explicitPathInfo(explicitPathInfoList) | ||
95 | .build(); | 65 | .build(); |
96 | samePath1.id(TunnelId.valueOf("1")); | 66 | samePath1.id(TunnelId.valueOf("1")); |
97 | 67 | ||
... | @@ -110,7 +80,6 @@ public class DefaultPcePathTest { | ... | @@ -110,7 +80,6 @@ public class DefaultPcePathTest { |
110 | .name(name2) | 80 | .name(name2) |
111 | .costConstraint(cost2) | 81 | .costConstraint(cost2) |
112 | .bandwidthConstraint(bandwidth2) | 82 | .bandwidthConstraint(bandwidth2) |
113 | - .explicitPathInfo(explicitPathInfoList) | ||
114 | .build(); | 83 | .build(); |
115 | path2.id(TunnelId.valueOf("2")); | 84 | path2.id(TunnelId.valueOf("2")); |
116 | 85 | ||
... | @@ -128,9 +97,7 @@ public class DefaultPcePathTest { | ... | @@ -128,9 +97,7 @@ public class DefaultPcePathTest { |
128 | final String dst = "deccan"; | 97 | final String dst = "deccan"; |
129 | final String type = "2"; | 98 | final String type = "2"; |
130 | final String name = "pcc4"; | 99 | final String name = "pcc4"; |
131 | - final List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | 100 | + |
132 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId()); | ||
133 | - explicitPathInfoList.add(obj); | ||
134 | PcePath path = DefaultPcePath.builder() | 101 | PcePath path = DefaultPcePath.builder() |
135 | .source(src) | 102 | .source(src) |
136 | .destination(dst) | 103 | .destination(dst) |
... | @@ -138,7 +105,6 @@ public class DefaultPcePathTest { | ... | @@ -138,7 +105,6 @@ public class DefaultPcePathTest { |
138 | .name(name) | 105 | .name(name) |
139 | .costConstraint(cost) | 106 | .costConstraint(cost) |
140 | .bandwidthConstraint(bandwidth) | 107 | .bandwidthConstraint(bandwidth) |
141 | - .explicitPathInfo(explicitPathInfoList) | ||
142 | .build(); | 108 | .build(); |
143 | 109 | ||
144 | assertThat(path.source(), is(src)); | 110 | assertThat(path.source(), is(src)); | ... | ... |
... | @@ -14,12 +14,10 @@ import static org.onosproject.pce.pceservice.PathComputationTest.D1; | ... | @@ -14,12 +14,10 @@ import static org.onosproject.pce.pceservice.PathComputationTest.D1; |
14 | import static org.onosproject.pce.pceservice.PathComputationTest.D2; | 14 | import static org.onosproject.pce.pceservice.PathComputationTest.D2; |
15 | import static org.onosproject.pce.pceservice.PathComputationTest.D3; | 15 | import static org.onosproject.pce.pceservice.PathComputationTest.D3; |
16 | import static org.onosproject.pce.pceservice.PathComputationTest.D4; | 16 | import static org.onosproject.pce.pceservice.PathComputationTest.D4; |
17 | -import static org.onosproject.pce.pceservice.PathComputationTest.D5; | ||
18 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE1; | 17 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE1; |
19 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE2; | 18 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE2; |
20 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE3; | 19 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE3; |
21 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE4; | 20 | import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE4; |
22 | -import static org.onosproject.pce.pceservice.PathComputationTest.DEVICE5; | ||
23 | import static org.onosproject.pce.pceservice.PcepAnnotationKeys.LOCAL_LSP_ID; | 21 | import static org.onosproject.pce.pceservice.PcepAnnotationKeys.LOCAL_LSP_ID; |
24 | import static org.onosproject.pce.pceservice.PcepAnnotationKeys.PLSP_ID; | 22 | import static org.onosproject.pce.pceservice.PcepAnnotationKeys.PLSP_ID; |
25 | import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.COST; | 23 | import static org.onosproject.pce.pceservice.constraint.CostConstraint.Type.COST; |
... | @@ -34,8 +32,6 @@ import java.util.List; | ... | @@ -34,8 +32,6 @@ import java.util.List; |
34 | import java.util.Set; | 32 | import java.util.Set; |
35 | import java.util.concurrent.atomic.AtomicLong; | 33 | import java.util.concurrent.atomic.AtomicLong; |
36 | 34 | ||
37 | -import com.google.common.collect.Lists; | ||
38 | - | ||
39 | import org.junit.After; | 35 | import org.junit.After; |
40 | import org.junit.Before; | 36 | import org.junit.Before; |
41 | import org.junit.Test; | 37 | import org.junit.Test; |
... | @@ -124,9 +120,9 @@ public class PceManagerTest { | ... | @@ -124,9 +120,9 @@ public class PceManagerTest { |
124 | private static final String LABEL_STACK_CAPABILITY = "labelStackCapability"; | 120 | private static final String LABEL_STACK_CAPABILITY = "labelStackCapability"; |
125 | 121 | ||
126 | private TopologyGraph graph = null; | 122 | private TopologyGraph graph = null; |
127 | - private Device deviceD1, deviceD2, deviceD3, deviceD4, deviceD5; | 123 | + private Device deviceD1, deviceD2, deviceD3, deviceD4; |
128 | private Device pcepDeviceD1, pcepDeviceD2, pcepDeviceD3, pcepDeviceD4; | 124 | private Device pcepDeviceD1, pcepDeviceD2, pcepDeviceD3, pcepDeviceD4; |
129 | - private Link link1, link2, link3, link4, link5, link6; | 125 | + private Link link1, link2, link3, link4; |
130 | protected static int flowsDownloaded; | 126 | protected static int flowsDownloaded; |
131 | private TunnelListener tunnelListener; | 127 | private TunnelListener tunnelListener; |
132 | private TopologyListener listener; | 128 | private TopologyListener listener; |
... | @@ -168,15 +164,12 @@ public class PceManagerTest { | ... | @@ -168,15 +164,12 @@ public class PceManagerTest { |
168 | link2 = PathComputationTest.addLink(DEVICE2, 30, DEVICE4, 40, setCost, 20); | 164 | link2 = PathComputationTest.addLink(DEVICE2, 30, DEVICE4, 40, setCost, 20); |
169 | link3 = PathComputationTest.addLink(DEVICE1, 80, DEVICE3, 70, setCost, 100); | 165 | link3 = PathComputationTest.addLink(DEVICE1, 80, DEVICE3, 70, setCost, 100); |
170 | link4 = PathComputationTest.addLink(DEVICE3, 60, DEVICE4, 50, setCost, 80); | 166 | link4 = PathComputationTest.addLink(DEVICE3, 60, DEVICE4, 50, setCost, 80); |
171 | - link5 = PathComputationTest.addLink(DEVICE2, 60, DEVICE5, 50, setCost, 80); | ||
172 | - link6 = PathComputationTest.addLink(DEVICE4, 60, DEVICE5, 50, setCost, 80); | ||
173 | 167 | ||
174 | Set<TopologyVertex> vertexes = new HashSet<TopologyVertex>(); | 168 | Set<TopologyVertex> vertexes = new HashSet<TopologyVertex>(); |
175 | vertexes.add(D1); | 169 | vertexes.add(D1); |
176 | vertexes.add(D2); | 170 | vertexes.add(D2); |
177 | vertexes.add(D3); | 171 | vertexes.add(D3); |
178 | vertexes.add(D4); | 172 | vertexes.add(D4); |
179 | - vertexes.add(D5); | ||
180 | 173 | ||
181 | this.vertexes = vertexes; | 174 | this.vertexes = vertexes; |
182 | 175 | ||
... | @@ -193,12 +186,6 @@ public class PceManagerTest { | ... | @@ -193,12 +186,6 @@ public class PceManagerTest { |
193 | TopologyEdge edge4 = new DefaultTopologyEdge(D3, D4, link4); | 186 | TopologyEdge edge4 = new DefaultTopologyEdge(D3, D4, link4); |
194 | edges.add(edge4); | 187 | edges.add(edge4); |
195 | 188 | ||
196 | - TopologyEdge edge5 = new DefaultTopologyEdge(D2, D5, link5); | ||
197 | - edges.add(edge5); | ||
198 | - | ||
199 | - TopologyEdge edge6 = new DefaultTopologyEdge(D4, D5, link6); | ||
200 | - edges.add(edge6); | ||
201 | - | ||
202 | this.edges = edges; | 189 | this.edges = edges; |
203 | 190 | ||
204 | graph = new DefaultTopologyGraph(vertexes, edges); | 191 | graph = new DefaultTopologyGraph(vertexes, edges); |
... | @@ -207,7 +194,6 @@ public class PceManagerTest { | ... | @@ -207,7 +194,6 @@ public class PceManagerTest { |
207 | DefaultAnnotations.Builder builderDev2 = DefaultAnnotations.builder(); | 194 | DefaultAnnotations.Builder builderDev2 = DefaultAnnotations.builder(); |
208 | DefaultAnnotations.Builder builderDev3 = DefaultAnnotations.builder(); | 195 | DefaultAnnotations.Builder builderDev3 = DefaultAnnotations.builder(); |
209 | DefaultAnnotations.Builder builderDev4 = DefaultAnnotations.builder(); | 196 | DefaultAnnotations.Builder builderDev4 = DefaultAnnotations.builder(); |
210 | - DefaultAnnotations.Builder builderDev5 = DefaultAnnotations.builder(); | ||
211 | 197 | ||
212 | // Making L3 devices | 198 | // Making L3 devices |
213 | builderDev1.set(AnnotationKeys.TYPE, L3); | 199 | builderDev1.set(AnnotationKeys.TYPE, L3); |
... | @@ -222,20 +208,15 @@ public class PceManagerTest { | ... | @@ -222,20 +208,15 @@ public class PceManagerTest { |
222 | builderDev4.set(AnnotationKeys.TYPE, L3); | 208 | builderDev4.set(AnnotationKeys.TYPE, L3); |
223 | builderDev4.set(LSRID, "4.4.4.4"); | 209 | builderDev4.set(LSRID, "4.4.4.4"); |
224 | 210 | ||
225 | - builderDev5.set(AnnotationKeys.TYPE, L3); | ||
226 | - builderDev5.set(LSRID, "5.5.5.5"); | ||
227 | - | ||
228 | deviceD1 = new MockDevice(D1.deviceId(), builderDev1.build()); | 211 | deviceD1 = new MockDevice(D1.deviceId(), builderDev1.build()); |
229 | deviceD2 = new MockDevice(D2.deviceId(), builderDev2.build()); | 212 | deviceD2 = new MockDevice(D2.deviceId(), builderDev2.build()); |
230 | deviceD3 = new MockDevice(D3.deviceId(), builderDev3.build()); | 213 | deviceD3 = new MockDevice(D3.deviceId(), builderDev3.build()); |
231 | deviceD4 = new MockDevice(D4.deviceId(), builderDev4.build()); | 214 | deviceD4 = new MockDevice(D4.deviceId(), builderDev4.build()); |
232 | - deviceD5 = new MockDevice(D5.deviceId(), builderDev5.build()); | ||
233 | 215 | ||
234 | deviceService.addDevice(deviceD1); | 216 | deviceService.addDevice(deviceD1); |
235 | deviceService.addDevice(deviceD2); | 217 | deviceService.addDevice(deviceD2); |
236 | deviceService.addDevice(deviceD3); | 218 | deviceService.addDevice(deviceD3); |
237 | deviceService.addDevice(deviceD4); | 219 | deviceService.addDevice(deviceD4); |
238 | - deviceService.addDevice(deviceD5); | ||
239 | 220 | ||
240 | DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId("1.1.1.1"), DeviceCapability.class); | 221 | DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId("1.1.1.1"), DeviceCapability.class); |
241 | device1Cap.setLabelStackCap(setLabelStackCap) | 222 | device1Cap.setLabelStackCap(setLabelStackCap) |
... | @@ -261,25 +242,17 @@ public class PceManagerTest { | ... | @@ -261,25 +242,17 @@ public class PceManagerTest { |
261 | .setSrCap(setSrCap) | 242 | .setSrCap(setSrCap) |
262 | .apply(); | 243 | .apply(); |
263 | 244 | ||
264 | - DeviceCapability device5Cap = netConfigRegistry.addConfig(DeviceId.deviceId("5.5.5.5"), DeviceCapability.class); | ||
265 | - device4Cap.setLabelStackCap(setLabelStackCap) | ||
266 | - .setLocalLabelCap(setPceccCap) | ||
267 | - .setSrCap(setSrCap) | ||
268 | - .apply(); | ||
269 | - | ||
270 | if (bandwidth != 0) { | 245 | if (bandwidth != 0) { |
271 | List<Resource> resources = new LinkedList<>(); | 246 | List<Resource> resources = new LinkedList<>(); |
272 | resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class).resource(bandwidth)); | 247 | resources.add(continuous(link1.src().deviceId(), link1.src().port(), Bandwidth.class).resource(bandwidth)); |
273 | resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class).resource(bandwidth)); | 248 | resources.add(continuous(link2.src().deviceId(), link2.src().port(), Bandwidth.class).resource(bandwidth)); |
274 | resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class).resource(bandwidth)); | 249 | resources.add(continuous(link3.src().deviceId(), link3.src().port(), Bandwidth.class).resource(bandwidth)); |
275 | resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class).resource(bandwidth)); | 250 | resources.add(continuous(link4.src().deviceId(), link4.src().port(), Bandwidth.class).resource(bandwidth)); |
276 | - resources.add(continuous(link5.src().deviceId(), link5.src().port(), Bandwidth.class).resource(bandwidth)); | ||
277 | 251 | ||
278 | resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class).resource(bandwidth)); | 252 | resources.add(continuous(link1.dst().deviceId(), link1.dst().port(), Bandwidth.class).resource(bandwidth)); |
279 | resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class).resource(bandwidth)); | 253 | resources.add(continuous(link2.dst().deviceId(), link2.dst().port(), Bandwidth.class).resource(bandwidth)); |
280 | resources.add(continuous(link3.dst().deviceId(), link3.dst().port(), Bandwidth.class).resource(bandwidth)); | 254 | resources.add(continuous(link3.dst().deviceId(), link3.dst().port(), Bandwidth.class).resource(bandwidth)); |
281 | resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class).resource(bandwidth)); | 255 | resources.add(continuous(link4.dst().deviceId(), link4.dst().port(), Bandwidth.class).resource(bandwidth)); |
282 | - resources.add(continuous(link5.dst().deviceId(), link5.dst().port(), Bandwidth.class).resource(bandwidth)); | ||
283 | 256 | ||
284 | resourceService.allocate(IntentId.valueOf(bandwidth), resources); | 257 | resourceService.allocate(IntentId.valueOf(bandwidth), resources); |
285 | } | 258 | } |
... | @@ -295,7 +268,7 @@ public class PceManagerTest { | ... | @@ -295,7 +268,7 @@ public class PceManagerTest { |
295 | CostConstraint costConstraint = new CostConstraint(COST); | 268 | CostConstraint costConstraint = new CostConstraint(COST); |
296 | constraints.add(costConstraint); | 269 | constraints.add(costConstraint); |
297 | 270 | ||
298 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | 271 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
299 | assertThat(result, is(true)); | 272 | assertThat(result, is(true)); |
300 | } | 273 | } |
301 | 274 | ||
... | @@ -309,7 +282,7 @@ public class PceManagerTest { | ... | @@ -309,7 +282,7 @@ public class PceManagerTest { |
309 | CostConstraint costConstraint = new CostConstraint(COST); | 282 | CostConstraint costConstraint = new CostConstraint(COST); |
310 | constraints.add(costConstraint); | 283 | constraints.add(costConstraint); |
311 | 284 | ||
312 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | 285 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
313 | assertThat(result, is(false)); | 286 | assertThat(result, is(false)); |
314 | } | 287 | } |
315 | 288 | ||
... | @@ -324,7 +297,7 @@ public class PceManagerTest { | ... | @@ -324,7 +297,7 @@ public class PceManagerTest { |
324 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 297 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
325 | constraints.add(costConstraint); | 298 | constraints.add(costConstraint); |
326 | 299 | ||
327 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | 300 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
328 | assertThat(result, is(true)); | 301 | assertThat(result, is(true)); |
329 | } | 302 | } |
330 | 303 | ||
... | @@ -339,7 +312,7 @@ public class PceManagerTest { | ... | @@ -339,7 +312,7 @@ public class PceManagerTest { |
339 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 312 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
340 | constraints.add(costConstraint); | 313 | constraints.add(costConstraint); |
341 | 314 | ||
342 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | 315 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
343 | assertThat(result, is(false)); | 316 | assertThat(result, is(false)); |
344 | } | 317 | } |
345 | 318 | ||
... | @@ -355,7 +328,7 @@ public class PceManagerTest { | ... | @@ -355,7 +328,7 @@ public class PceManagerTest { |
355 | constraints.add(costConstraint); | 328 | constraints.add(costConstraint); |
356 | 329 | ||
357 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, | 330 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, |
358 | - WITHOUT_SIGNALLING_AND_WITHOUT_SR, null); | 331 | + WITHOUT_SIGNALLING_AND_WITHOUT_SR); |
359 | assertThat(result, is(true)); | 332 | assertThat(result, is(true)); |
360 | } | 333 | } |
361 | 334 | ||
... | @@ -371,7 +344,7 @@ public class PceManagerTest { | ... | @@ -371,7 +344,7 @@ public class PceManagerTest { |
371 | constraints.add(costConstraint); | 344 | constraints.add(costConstraint); |
372 | 345 | ||
373 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, | 346 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, |
374 | - WITHOUT_SIGNALLING_AND_WITHOUT_SR, null); | 347 | + WITHOUT_SIGNALLING_AND_WITHOUT_SR); |
375 | assertThat(result, is(true)); | 348 | assertThat(result, is(true)); |
376 | } | 349 | } |
377 | 350 | ||
... | @@ -387,7 +360,7 @@ public class PceManagerTest { | ... | @@ -387,7 +360,7 @@ public class PceManagerTest { |
387 | constraints.add(costConstraint); | 360 | constraints.add(costConstraint); |
388 | 361 | ||
389 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, | 362 | boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, |
390 | - WITHOUT_SIGNALLING_AND_WITHOUT_SR, null); | 363 | + WITHOUT_SIGNALLING_AND_WITHOUT_SR); |
391 | assertThat(result, is(false)); | 364 | assertThat(result, is(false)); |
392 | } | 365 | } |
393 | 366 | ||
... | @@ -404,8 +377,7 @@ public class PceManagerTest { | ... | @@ -404,8 +377,7 @@ public class PceManagerTest { |
404 | constraints.add(costConstraint); | 377 | constraints.add(costConstraint); |
405 | constraints.add(bwConstraint); | 378 | constraints.add(bwConstraint); |
406 | 379 | ||
407 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, | 380 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
408 | - WITH_SIGNALLING, null); | ||
409 | assertThat(result, is(false)); | 381 | assertThat(result, is(false)); |
410 | } | 382 | } |
411 | 383 | ||
... | @@ -422,8 +394,7 @@ public class PceManagerTest { | ... | @@ -422,8 +394,7 @@ public class PceManagerTest { |
422 | constraints.add(costConstraint); | 394 | constraints.add(costConstraint); |
423 | constraints.add(bwConstraint); | 395 | constraints.add(bwConstraint); |
424 | 396 | ||
425 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", | 397 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
426 | - constraints, WITH_SIGNALLING, null); | ||
427 | assertThat(result, is(false)); | 398 | assertThat(result, is(false)); |
428 | } | 399 | } |
429 | 400 | ||
... | @@ -437,8 +408,7 @@ public class PceManagerTest { | ... | @@ -437,8 +408,7 @@ public class PceManagerTest { |
437 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 408 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
438 | constraints.add(costConstraint); | 409 | constraints.add(costConstraint); |
439 | 410 | ||
440 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, | 411 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, SR_WITHOUT_SIGNALLING); |
441 | - SR_WITHOUT_SIGNALLING, null); | ||
442 | assertThat(result, is(false)); | 412 | assertThat(result, is(false)); |
443 | } | 413 | } |
444 | 414 | ||
... | @@ -455,8 +425,7 @@ public class PceManagerTest { | ... | @@ -455,8 +425,7 @@ public class PceManagerTest { |
455 | constraints.add(costConstraint); | 425 | constraints.add(costConstraint); |
456 | constraints.add(bwConstraint); | 426 | constraints.add(bwConstraint); |
457 | 427 | ||
458 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", | 428 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, SR_WITHOUT_SIGNALLING); |
459 | - constraints, SR_WITHOUT_SIGNALLING, null); | ||
460 | assertThat(result, is(true)); | 429 | assertThat(result, is(true)); |
461 | } | 430 | } |
462 | 431 | ||
... | @@ -467,141 +436,8 @@ public class PceManagerTest { | ... | @@ -467,141 +436,8 @@ public class PceManagerTest { |
467 | public void setupPathTest13() { | 436 | public void setupPathTest13() { |
468 | build4RouterTopo(false, false, false, false, 0); | 437 | build4RouterTopo(false, false, false, false, 0); |
469 | 438 | ||
470 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", null, WITH_SIGNALLING, null); | 439 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", null, WITH_SIGNALLING); |
471 | - assertThat(result, is(true)); | ||
472 | - } | ||
473 | - | ||
474 | - /** | ||
475 | - * Tests path setup with explicit path with loose node D2. | ||
476 | - */ | ||
477 | - @Test | ||
478 | - public void setupPathTest14() { | ||
479 | - build4RouterTopo(false, false, false, false, 0); | ||
480 | - | ||
481 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
482 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId()); | ||
483 | - explicitPathInfoList.add(obj); | ||
484 | - | ||
485 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", null, WITH_SIGNALLING, | ||
486 | - explicitPathInfoList); | ||
487 | - | ||
488 | - Tunnel tunnel = pceManager.queryAllPath().iterator().next(); | ||
489 | - List<Link> links = new LinkedList<>(); | ||
490 | - links.add(link1); | ||
491 | - links.add(link2); | ||
492 | - | ||
493 | assertThat(result, is(true)); | 440 | assertThat(result, is(true)); |
494 | - assertThat(tunnel.path().links().equals(links), is(true)); | ||
495 | - } | ||
496 | - | ||
497 | - /** | ||
498 | - * Tests path setup with explicit path with loose node D3. | ||
499 | - */ | ||
500 | - @Test | ||
501 | - public void setupPathTest15() { | ||
502 | - build4RouterTopo(false, false, false, false, 0); | ||
503 | - | ||
504 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
505 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D3.deviceId()); | ||
506 | - explicitPathInfoList.add(obj); | ||
507 | - | ||
508 | - boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING, | ||
509 | - explicitPathInfoList); | ||
510 | - | ||
511 | - Tunnel tunnel = pceManager.queryAllPath().iterator().next(); | ||
512 | - List<Link> links = new LinkedList<>(); | ||
513 | - links.add(link3); | ||
514 | - links.add(link4); | ||
515 | - links.add(link6); | ||
516 | - | ||
517 | - assertThat(result, is(true)); | ||
518 | - assertThat(tunnel.path().links().equals(links), is(true)); | ||
519 | - } | ||
520 | - | ||
521 | - /** | ||
522 | - * Tests path setup with explicit path with loose node D4 , D3 - path fails. | ||
523 | - */ | ||
524 | - @Test | ||
525 | - public void setupPathTest16() { | ||
526 | - build4RouterTopo(false, false, false, false, 0); | ||
527 | - | ||
528 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
529 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D4.deviceId()); | ||
530 | - explicitPathInfoList.add(obj); | ||
531 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D3.deviceId()); | ||
532 | - explicitPathInfoList.add(obj); | ||
533 | - | ||
534 | - boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING, | ||
535 | - explicitPathInfoList); | ||
536 | - | ||
537 | - assertThat(result, is(false)); | ||
538 | - } | ||
539 | - | ||
540 | - /** | ||
541 | - * Tests path setup with explicit path with strict node D2 - without reacble to src - path fails. | ||
542 | - */ | ||
543 | - @Test | ||
544 | - public void setupPathTest17() { | ||
545 | - build4RouterTopo(false, false, false, false, 0); | ||
546 | - | ||
547 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
548 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
549 | - explicitPathInfoList.add(obj); | ||
550 | - | ||
551 | - boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING, | ||
552 | - explicitPathInfoList); | ||
553 | - | ||
554 | - assertThat(result, is(false)); | ||
555 | - } | ||
556 | - | ||
557 | - /** | ||
558 | - * Tests path setup with explicit path with loose node D2, strict D2. | ||
559 | - */ | ||
560 | - @Test | ||
561 | - public void setupPathTest18() { | ||
562 | - build4RouterTopo(false, false, false, false, 0); | ||
563 | - | ||
564 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
565 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, D2.deviceId()); | ||
566 | - explicitPathInfoList.add(obj); | ||
567 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
568 | - explicitPathInfoList.add(obj); | ||
569 | - | ||
570 | - boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING, | ||
571 | - explicitPathInfoList); | ||
572 | - | ||
573 | - Tunnel tunnel = pceManager.queryAllPath().iterator().next(); | ||
574 | - List<Link> links = new LinkedList<>(); | ||
575 | - links.add(link1); | ||
576 | - links.add(link5); | ||
577 | - | ||
578 | - assertThat(result, is(true)); | ||
579 | - assertThat(tunnel.path().links().equals(links), is(true)); | ||
580 | - } | ||
581 | - | ||
582 | - /** | ||
583 | - * Tests path setup with explicit path with loose D1-D2, strict D2. | ||
584 | - */ | ||
585 | - @Test | ||
586 | - public void setupPathTest19() { | ||
587 | - build4RouterTopo(false, false, false, false, 0); | ||
588 | - | ||
589 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
590 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1); | ||
591 | - explicitPathInfoList.add(obj); | ||
592 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
593 | - explicitPathInfoList.add(obj); | ||
594 | - | ||
595 | - boolean result = pceManager.setupPath(D1.deviceId(), D5.deviceId(), "T123", null, WITH_SIGNALLING, | ||
596 | - explicitPathInfoList); | ||
597 | - | ||
598 | - Tunnel tunnel = pceManager.queryAllPath().iterator().next(); | ||
599 | - List<Link> links = new LinkedList<>(); | ||
600 | - links.add(link1); | ||
601 | - links.add(link5); | ||
602 | - | ||
603 | - assertThat(result, is(true)); | ||
604 | - assertThat(tunnel.path().links().equals(links), is(true)); | ||
605 | } | 441 | } |
606 | 442 | ||
607 | /** | 443 | /** |
... | @@ -618,8 +454,7 @@ public class PceManagerTest { | ... | @@ -618,8 +454,7 @@ public class PceManagerTest { |
618 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 454 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
619 | constraints.add(costConstraint); | 455 | constraints.add(costConstraint); |
620 | 456 | ||
621 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 457 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
622 | - constraints, WITH_SIGNALLING, null); | ||
623 | assertThat(result, is(true)); | 458 | assertThat(result, is(true)); |
624 | 459 | ||
625 | // Change constraint and update it. | 460 | // Change constraint and update it. |
... | @@ -657,8 +492,7 @@ public class PceManagerTest { | ... | @@ -657,8 +492,7 @@ public class PceManagerTest { |
657 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 492 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
658 | constraints.add(costConstraint); | 493 | constraints.add(costConstraint); |
659 | 494 | ||
660 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", | 495 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, SR_WITHOUT_SIGNALLING); |
661 | - constraints, SR_WITHOUT_SIGNALLING, null); | ||
662 | assertThat(result, is(true)); | 496 | assertThat(result, is(true)); |
663 | 497 | ||
664 | // Change constraint and update it. | 498 | // Change constraint and update it. |
... | @@ -689,8 +523,7 @@ public class PceManagerTest { | ... | @@ -689,8 +523,7 @@ public class PceManagerTest { |
689 | List<Constraint> constraints = new LinkedList<Constraint>(); | 523 | List<Constraint> constraints = new LinkedList<Constraint>(); |
690 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 524 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
691 | constraints.add(costConstraint); | 525 | constraints.add(costConstraint); |
692 | - boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", | 526 | + boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
693 | - constraints, WITH_SIGNALLING, null); | ||
694 | assertThat(result, is(true)); | 527 | assertThat(result, is(true)); |
695 | 528 | ||
696 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | 529 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); |
... | @@ -706,51 +539,6 @@ public class PceManagerTest { | ... | @@ -706,51 +539,6 @@ public class PceManagerTest { |
706 | } | 539 | } |
707 | 540 | ||
708 | /** | 541 | /** |
709 | - * Tests path update without cost/bandwidth constraints and with explicit path object. | ||
710 | - */ | ||
711 | - @Test | ||
712 | - public void updatePathTest4() { | ||
713 | - build4RouterTopo(false, true, true, true, 100); | ||
714 | - | ||
715 | - // Setup tunnel. | ||
716 | - List<Constraint> constraints = new LinkedList<>(); | ||
717 | - BandwidthConstraint bwConstraint = new BandwidthConstraint(Bandwidth.bps(60.0)); | ||
718 | - constraints.add(bwConstraint); | ||
719 | - CostConstraint costConstraint = new CostConstraint(TE_COST); | ||
720 | - constraints.add(costConstraint); | ||
721 | - | ||
722 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
723 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1); | ||
724 | - explicitPathInfoList.add(obj); | ||
725 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
726 | - explicitPathInfoList.add(obj); | ||
727 | - | ||
728 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | ||
729 | - constraints, WITH_SIGNALLING, explicitPathInfoList); | ||
730 | - assertThat(result, is(true)); | ||
731 | - | ||
732 | - // Change constraint and update it. | ||
733 | - constraints = new LinkedList<>(); | ||
734 | - bwConstraint = new BandwidthConstraint(Bandwidth.bps(50.0)); | ||
735 | - constraints.add(bwConstraint); | ||
736 | - constraints.add(costConstraint); | ||
737 | - | ||
738 | - Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | ||
739 | - assertThat(tunnels.size(), is(1)); | ||
740 | - | ||
741 | - Tunnel tunnel = tunnels.iterator().next(); | ||
742 | - | ||
743 | - // Stimulate the effect of LSP ids from protocol msg. | ||
744 | - tunnelService.updateTunnelWithLspIds(tunnel, "123", "1", State.ACTIVE); | ||
745 | - | ||
746 | - result = pceManager.updatePath(tunnel.tunnelId(), constraints); | ||
747 | - assertThat(result, is(true)); | ||
748 | - | ||
749 | - tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | ||
750 | - assertThat(tunnels.size(), is(2)); | ||
751 | - } | ||
752 | - | ||
753 | - /** | ||
754 | * Tests path release. | 542 | * Tests path release. |
755 | */ | 543 | */ |
756 | @Test | 544 | @Test |
... | @@ -762,13 +550,7 @@ public class PceManagerTest { | ... | @@ -762,13 +550,7 @@ public class PceManagerTest { |
762 | constraints.add(bwConst); | 550 | constraints.add(bwConst); |
763 | constraints.add(costConstraint); | 551 | constraints.add(costConstraint); |
764 | 552 | ||
765 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | 553 | + pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
766 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1); | ||
767 | - explicitPathInfoList.add(obj); | ||
768 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
769 | - explicitPathInfoList.add(obj); | ||
770 | - | ||
771 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, explicitPathInfoList); | ||
772 | 554 | ||
773 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | 555 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); |
774 | assertThat(tunnels.size(), is(1)); | 556 | assertThat(tunnels.size(), is(1)); |
... | @@ -791,7 +573,7 @@ public class PceManagerTest { | ... | @@ -791,7 +573,7 @@ public class PceManagerTest { |
791 | CostConstraint costConstraint = new CostConstraint(TE_COST); | 573 | CostConstraint costConstraint = new CostConstraint(TE_COST); |
792 | constraints.add(costConstraint); | 574 | constraints.add(costConstraint); |
793 | 575 | ||
794 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | 576 | + pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING); |
795 | 577 | ||
796 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | 578 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); |
797 | assertThat(tunnels.size(), is(1)); | 579 | assertThat(tunnels.size(), is(1)); |
... | @@ -805,31 +587,6 @@ public class PceManagerTest { | ... | @@ -805,31 +587,6 @@ public class PceManagerTest { |
805 | } | 587 | } |
806 | 588 | ||
807 | /** | 589 | /** |
808 | - * Tests path release failure. | ||
809 | - */ | ||
810 | - @Test | ||
811 | - public void releasePathTest3() { | ||
812 | - build4RouterTopo(false, false, false, false, 5); | ||
813 | - List<Constraint> constraints = new LinkedList<Constraint>(); | ||
814 | - CostConstraint costConstraint = new CostConstraint(TE_COST); | ||
815 | - BandwidthConstraint bwConst = new BandwidthConstraint(Bandwidth.bps(3)); | ||
816 | - constraints.add(bwConst); | ||
817 | - constraints.add(costConstraint); | ||
818 | - | ||
819 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, WITH_SIGNALLING, null); | ||
820 | - | ||
821 | - Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | ||
822 | - assertThat(tunnels.size(), is(1)); | ||
823 | - boolean result; | ||
824 | - for (Tunnel tunnel : tunnels) { | ||
825 | - result = pceManager.releasePath(tunnel.tunnelId()); | ||
826 | - assertThat(result, is(true)); | ||
827 | - } | ||
828 | - tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | ||
829 | - assertThat(tunnels.size(), is(0)); | ||
830 | - } | ||
831 | - | ||
832 | - /** | ||
833 | * Tests tunnel events added and removed. | 590 | * Tests tunnel events added and removed. |
834 | */ | 591 | */ |
835 | @Test | 592 | @Test |
... | @@ -842,7 +599,7 @@ public class PceManagerTest { | ... | @@ -842,7 +599,7 @@ public class PceManagerTest { |
842 | constraints.add(costConstraint); | 599 | constraints.add(costConstraint); |
843 | constraints.add(bwConstraint); | 600 | constraints.add(bwConstraint); |
844 | 601 | ||
845 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T1", constraints, SR_WITHOUT_SIGNALLING, null); | 602 | + pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T1", constraints, SR_WITHOUT_SIGNALLING); |
846 | assertThat(pceStore.getTunnelInfoCount(), is(1)); | 603 | assertThat(pceStore.getTunnelInfoCount(), is(1)); |
847 | 604 | ||
848 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); | 605 | Collection<Tunnel> tunnels = (Collection<Tunnel>) pceManager.queryAllPath(); |
... | @@ -873,8 +630,7 @@ public class PceManagerTest { | ... | @@ -873,8 +630,7 @@ public class PceManagerTest { |
873 | constraints.add(costConstraint); | 630 | constraints.add(costConstraint); |
874 | constraints.add(bwConstraint); | 631 | constraints.add(bwConstraint); |
875 | 632 | ||
876 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints, | 633 | + pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints, WITHOUT_SIGNALLING_AND_WITHOUT_SR); |
877 | - WITHOUT_SIGNALLING_AND_WITHOUT_SR, null); | ||
878 | assertThat(pceStore.getTunnelInfoCount(), is(1)); | 634 | assertThat(pceStore.getTunnelInfoCount(), is(1)); |
879 | 635 | ||
880 | TunnelEvent event; | 636 | TunnelEvent event; |
... | @@ -914,8 +670,7 @@ public class PceManagerTest { | ... | @@ -914,8 +670,7 @@ public class PceManagerTest { |
914 | constraints.add(costConstraint); | 670 | constraints.add(costConstraint); |
915 | constraints.add(bwConstraint); | 671 | constraints.add(bwConstraint); |
916 | 672 | ||
917 | - pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints, | 673 | + pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T2", constraints, WITHOUT_SIGNALLING_AND_WITHOUT_SR); |
918 | - WITHOUT_SIGNALLING_AND_WITHOUT_SR, null); | ||
919 | assertThat(pceStore.getTunnelInfoCount(), is(1)); | 674 | assertThat(pceStore.getTunnelInfoCount(), is(1)); |
920 | assertThat(pceStore.getFailedPathInfoCount(), is(0)); | 675 | assertThat(pceStore.getFailedPathInfoCount(), is(0)); |
921 | 676 | ||
... | @@ -953,8 +708,7 @@ public class PceManagerTest { | ... | @@ -953,8 +708,7 @@ public class PceManagerTest { |
953 | constraints.add(localBwConst); | 708 | constraints.add(localBwConst); |
954 | 709 | ||
955 | //Setup the path , tunnel created | 710 | //Setup the path , tunnel created |
956 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 711 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
957 | - constraints, WITH_SIGNALLING, null); | ||
958 | assertThat(result, is(true)); | 712 | assertThat(result, is(true)); |
959 | assertThat(pceStore.getTunnelInfoCount(), is(1)); | 713 | assertThat(pceStore.getTunnelInfoCount(), is(1)); |
960 | assertThat(pceStore.getFailedPathInfoCount(), is(0)); | 714 | assertThat(pceStore.getFailedPathInfoCount(), is(0)); |
... | @@ -996,8 +750,7 @@ public class PceManagerTest { | ... | @@ -996,8 +750,7 @@ public class PceManagerTest { |
996 | constraints.add(localBwConst); | 750 | constraints.add(localBwConst); |
997 | 751 | ||
998 | //Setup the path , tunnel created | 752 | //Setup the path , tunnel created |
999 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 753 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1000 | - constraints, WITH_SIGNALLING, null); | ||
1001 | assertThat(result, is(true)); | 754 | assertThat(result, is(true)); |
1002 | 755 | ||
1003 | List<Event> reasons = new LinkedList<>(); | 756 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1035,8 +788,7 @@ public class PceManagerTest { | ... | @@ -1035,8 +788,7 @@ public class PceManagerTest { |
1035 | constraints.add(localBwConst); | 788 | constraints.add(localBwConst); |
1036 | 789 | ||
1037 | //Setup the path , tunnel created | 790 | //Setup the path , tunnel created |
1038 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 791 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1039 | - constraints, WITH_SIGNALLING, null); | ||
1040 | assertThat(result, is(true)); | 792 | assertThat(result, is(true)); |
1041 | 793 | ||
1042 | List<Event> reasons = new LinkedList<>(); | 794 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1079,8 +831,7 @@ public class PceManagerTest { | ... | @@ -1079,8 +831,7 @@ public class PceManagerTest { |
1079 | constraints.add(localBwConst); | 831 | constraints.add(localBwConst); |
1080 | 832 | ||
1081 | //Setup the path , tunnel created | 833 | //Setup the path , tunnel created |
1082 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 834 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1083 | - constraints, WITH_SIGNALLING, null); | ||
1084 | assertThat(result, is(true)); | 835 | assertThat(result, is(true)); |
1085 | 836 | ||
1086 | List<Event> reasons = new LinkedList<>(); | 837 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1118,8 +869,7 @@ public class PceManagerTest { | ... | @@ -1118,8 +869,7 @@ public class PceManagerTest { |
1118 | constraints.add(localBwConst); | 869 | constraints.add(localBwConst); |
1119 | 870 | ||
1120 | //Setup the path , tunnel created | 871 | //Setup the path , tunnel created |
1121 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 872 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1122 | - constraints, WITH_SIGNALLING, null); | ||
1123 | assertThat(result, is(true)); | 873 | assertThat(result, is(true)); |
1124 | 874 | ||
1125 | List<Event> reasons = new LinkedList<>(); | 875 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1167,8 +917,7 @@ public class PceManagerTest { | ... | @@ -1167,8 +917,7 @@ public class PceManagerTest { |
1167 | constraints.add(localBwConst); | 917 | constraints.add(localBwConst); |
1168 | 918 | ||
1169 | //Setup the path , tunnel created | 919 | //Setup the path , tunnel created |
1170 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 920 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1171 | - constraints, WITH_SIGNALLING, null); | ||
1172 | assertThat(result, is(true)); | 921 | assertThat(result, is(true)); |
1173 | 922 | ||
1174 | List<Event> reasons = new LinkedList<>(); | 923 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1209,8 +958,7 @@ public class PceManagerTest { | ... | @@ -1209,8 +958,7 @@ public class PceManagerTest { |
1209 | constraints.add(localBwConst); | 958 | constraints.add(localBwConst); |
1210 | 959 | ||
1211 | //Setup the path , tunnel created | 960 | //Setup the path , tunnel created |
1212 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 961 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1213 | - constraints, WITH_SIGNALLING, null); | ||
1214 | assertThat(result, is(true)); | 962 | assertThat(result, is(true)); |
1215 | 963 | ||
1216 | List<Event> reasons = new LinkedList<>(); | 964 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1251,8 +999,7 @@ public class PceManagerTest { | ... | @@ -1251,8 +999,7 @@ public class PceManagerTest { |
1251 | constraints.add(localBwConst); | 999 | constraints.add(localBwConst); |
1252 | 1000 | ||
1253 | //Setup the path , tunnel created | 1001 | //Setup the path , tunnel created |
1254 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 1002 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1255 | - constraints, WITH_SIGNALLING, null); | ||
1256 | assertThat(result, is(true)); | 1003 | assertThat(result, is(true)); |
1257 | 1004 | ||
1258 | List<Event> reasons = new LinkedList<>(); | 1005 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1298,8 +1045,7 @@ public class PceManagerTest { | ... | @@ -1298,8 +1045,7 @@ public class PceManagerTest { |
1298 | constraints.add(localBwConst); | 1045 | constraints.add(localBwConst); |
1299 | 1046 | ||
1300 | //Setup the path , tunnel created | 1047 | //Setup the path , tunnel created |
1301 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | 1048 | + boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", constraints, WITH_SIGNALLING); |
1302 | - constraints, WITH_SIGNALLING, null); | ||
1303 | assertThat(result, is(true)); | 1049 | assertThat(result, is(true)); |
1304 | 1050 | ||
1305 | List<Event> reasons = new LinkedList<>(); | 1051 | List<Event> reasons = new LinkedList<>(); |
... | @@ -1331,54 +1077,6 @@ public class PceManagerTest { | ... | @@ -1331,54 +1077,6 @@ public class PceManagerTest { |
1331 | assertThat(pathService.paths().iterator().next().cost(), is((double) 180)); | 1077 | assertThat(pathService.paths().iterator().next().cost(), is((double) 180)); |
1332 | } | 1078 | } |
1333 | 1079 | ||
1334 | - /** | ||
1335 | - * Tests resilency when link2 availability is changed. | ||
1336 | - */ | ||
1337 | - @Test | ||
1338 | - public void resilencyTest12() { | ||
1339 | - build4RouterTopo(true, false, false, false, 10); | ||
1340 | - | ||
1341 | - List<Constraint> constraints = new LinkedList<Constraint>(); | ||
1342 | - CostConstraint costConstraint = new CostConstraint(COST); | ||
1343 | - constraints.add(costConstraint); | ||
1344 | - BandwidthConstraint localBwConst = new BandwidthConstraint(Bandwidth.bps(10)); | ||
1345 | - constraints.add(localBwConst); | ||
1346 | - | ||
1347 | - List<ExplicitPathInfo> explicitPathInfoList = Lists.newLinkedList(); | ||
1348 | - ExplicitPathInfo obj = new ExplicitPathInfo(ExplicitPathInfo.Type.LOOSE, link1); | ||
1349 | - explicitPathInfoList.add(obj); | ||
1350 | - obj = new ExplicitPathInfo(ExplicitPathInfo.Type.STRICT, D2.deviceId()); | ||
1351 | - explicitPathInfoList.add(obj); | ||
1352 | - | ||
1353 | - //Setup the path , tunnel created | ||
1354 | - boolean result = pceManager.setupPath(D1.deviceId(), D4.deviceId(), "T123", | ||
1355 | - constraints, WITH_SIGNALLING, explicitPathInfoList); | ||
1356 | - assertThat(result, is(true)); | ||
1357 | - assertThat(pceStore.getTunnelInfoCount(), is(1)); | ||
1358 | - assertThat(pceStore.getFailedPathInfoCount(), is(0)); | ||
1359 | - | ||
1360 | - List<Event> reasons = new LinkedList<>(); | ||
1361 | - final LinkEvent linkEvent = new LinkEvent(LinkEvent.Type.LINK_REMOVED, link2); | ||
1362 | - reasons.add(linkEvent); | ||
1363 | - final TopologyEvent event = new TopologyEvent( | ||
1364 | - TopologyEvent.Type.TOPOLOGY_CHANGED, | ||
1365 | - topology, | ||
1366 | - reasons); | ||
1367 | - | ||
1368 | - //Change Topology : remove link2 | ||
1369 | - Set<TopologyEdge> tempEdges = new HashSet<>(); | ||
1370 | - tempEdges.add(new DefaultTopologyEdge(D2, D4, link2)); | ||
1371 | - topologyService.changeInTopology(getGraph(null, tempEdges)); | ||
1372 | - listener.event(event); | ||
1373 | - | ||
1374 | - List<Link> links = new LinkedList<>(); | ||
1375 | - links.add(link3); | ||
1376 | - links.add(link4); | ||
1377 | - | ||
1378 | - //Path fails - no alternate path | ||
1379 | - assertThat(pathService.paths().iterator().hasNext(), is(false)); | ||
1380 | - } | ||
1381 | - | ||
1382 | @After | 1080 | @After |
1383 | public void tearDown() { | 1081 | public void tearDown() { |
1384 | pceManager.deactivate(); | 1082 | pceManager.deactivate(); | ... | ... |
... | @@ -120,7 +120,7 @@ public class DistributedPceStoreTest { | ... | @@ -120,7 +120,7 @@ public class DistributedPceStoreTest { |
120 | Constraint bandwidth1 = BandwidthConstraint.of(200, DataRateUnit.BPS); | 120 | Constraint bandwidth1 = BandwidthConstraint.of(200, DataRateUnit.BPS); |
121 | constraints1.add(bandwidth1); | 121 | constraints1.add(bandwidth1); |
122 | 122 | ||
123 | - failedPathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1, null); | 123 | + failedPathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1); |
124 | 124 | ||
125 | // Creates failedPathInfo2 | 125 | // Creates failedPathInfo2 |
126 | DeviceId src2 = DeviceId.deviceId("foo2"); | 126 | DeviceId src2 = DeviceId.deviceId("foo2"); |
... | @@ -131,7 +131,7 @@ public class DistributedPceStoreTest { | ... | @@ -131,7 +131,7 @@ public class DistributedPceStoreTest { |
131 | Constraint bandwidth2 = BandwidthConstraint.of(400, DataRateUnit.BPS); | 131 | Constraint bandwidth2 = BandwidthConstraint.of(400, DataRateUnit.BPS); |
132 | constraints2.add(bandwidth2); | 132 | constraints2.add(bandwidth2); |
133 | 133 | ||
134 | - failedPathInfo2 = new PcePathInfo(src2, dst2, name2, constraints2, lspType2, null); | 134 | + failedPathInfo2 = new PcePathInfo(src2, dst2, name2, constraints2, lspType2); |
135 | 135 | ||
136 | // Creates failedPathInfo3 | 136 | // Creates failedPathInfo3 |
137 | DeviceId src3 = DeviceId.deviceId("foo3"); | 137 | DeviceId src3 = DeviceId.deviceId("foo3"); |
... | @@ -142,7 +142,7 @@ public class DistributedPceStoreTest { | ... | @@ -142,7 +142,7 @@ public class DistributedPceStoreTest { |
142 | Constraint bandwidth3 = BandwidthConstraint.of(500, DataRateUnit.BPS); | 142 | Constraint bandwidth3 = BandwidthConstraint.of(500, DataRateUnit.BPS); |
143 | constraints3.add(bandwidth3); | 143 | constraints3.add(bandwidth3); |
144 | 144 | ||
145 | - failedPathInfo3 = new PcePathInfo(src3, dst3, name3, constraints3, lspType3, null); | 145 | + failedPathInfo3 = new PcePathInfo(src3, dst3, name3, constraints3, lspType3); |
146 | 146 | ||
147 | // Creates failedPathInfo4 | 147 | // Creates failedPathInfo4 |
148 | DeviceId src4 = DeviceId.deviceId("foo4"); | 148 | DeviceId src4 = DeviceId.deviceId("foo4"); |
... | @@ -153,7 +153,7 @@ public class DistributedPceStoreTest { | ... | @@ -153,7 +153,7 @@ public class DistributedPceStoreTest { |
153 | Constraint bandwidth4 = BandwidthConstraint.of(600, DataRateUnit.BPS); | 153 | Constraint bandwidth4 = BandwidthConstraint.of(600, DataRateUnit.BPS); |
154 | constraints4.add(bandwidth4); | 154 | constraints4.add(bandwidth4); |
155 | 155 | ||
156 | - failedPathInfo4 = new PcePathInfo(src4, dst4, name4, constraints4, lspType4, null); | 156 | + failedPathInfo4 = new PcePathInfo(src4, dst4, name4, constraints4, lspType4); |
157 | } | 157 | } |
158 | 158 | ||
159 | @After | 159 | @After | ... | ... |
... | @@ -53,10 +53,10 @@ public class PcePathInfoTest { | ... | @@ -53,10 +53,10 @@ public class PcePathInfoTest { |
53 | Constraint bandwidth13 = BandwidthConstraint.of(300, DataRateUnit.BPS); | 53 | Constraint bandwidth13 = BandwidthConstraint.of(300, DataRateUnit.BPS); |
54 | constraints1.add(bandwidth13); | 54 | constraints1.add(bandwidth13); |
55 | 55 | ||
56 | - PcePathInfo pathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1, null); | 56 | + PcePathInfo pathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1); |
57 | 57 | ||
58 | // create same object as above object | 58 | // create same object as above object |
59 | - PcePathInfo samePathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1, null); | 59 | + PcePathInfo samePathInfo1 = new PcePathInfo(src1, dst1, name1, constraints1, lspType1); |
60 | 60 | ||
61 | // Create different object. | 61 | // Create different object. |
62 | DeviceId src2 = DeviceId.deviceId("foo2"); | 62 | DeviceId src2 = DeviceId.deviceId("foo2"); |
... | @@ -69,7 +69,7 @@ public class PcePathInfoTest { | ... | @@ -69,7 +69,7 @@ public class PcePathInfoTest { |
69 | Constraint bandwidth22 = BandwidthConstraint.of(800, DataRateUnit.BPS); | 69 | Constraint bandwidth22 = BandwidthConstraint.of(800, DataRateUnit.BPS); |
70 | constraints2.add(bandwidth22); | 70 | constraints2.add(bandwidth22); |
71 | 71 | ||
72 | - PcePathInfo pathInfo2 = new PcePathInfo(src2, dst2, name2, constraints2, lspType2, null); | 72 | + PcePathInfo pathInfo2 = new PcePathInfo(src2, dst2, name2, constraints2, lspType2); |
73 | 73 | ||
74 | new EqualsTester().addEqualityGroup(pathInfo1, samePathInfo1) | 74 | new EqualsTester().addEqualityGroup(pathInfo1, samePathInfo1) |
75 | .addEqualityGroup(pathInfo2) | 75 | .addEqualityGroup(pathInfo2) |
... | @@ -93,7 +93,7 @@ public class PcePathInfoTest { | ... | @@ -93,7 +93,7 @@ public class PcePathInfoTest { |
93 | Constraint bandwidth3 = BandwidthConstraint.of(300, DataRateUnit.BPS); | 93 | Constraint bandwidth3 = BandwidthConstraint.of(300, DataRateUnit.BPS); |
94 | constraints.add(bandwidth3); | 94 | constraints.add(bandwidth3); |
95 | 95 | ||
96 | - PcePathInfo pathInfo = new PcePathInfo(src, dst, name, constraints, lspType, null); | 96 | + PcePathInfo pathInfo = new PcePathInfo(src, dst, name, constraints, lspType); |
97 | 97 | ||
98 | assertThat(src, is(pathInfo.src())); | 98 | assertThat(src, is(pathInfo.src())); |
99 | assertThat(dst, is(pathInfo.dst())); | 99 | assertThat(dst, is(pathInfo.dst())); | ... | ... |
... | @@ -22,14 +22,13 @@ import java.util.concurrent.ConcurrentMap; | ... | @@ -22,14 +22,13 @@ import java.util.concurrent.ConcurrentMap; |
22 | 22 | ||
23 | import java.util.HashMap; | 23 | import java.util.HashMap; |
24 | import java.util.HashSet; | 24 | import java.util.HashSet; |
25 | -import java.util.List; | ||
26 | import java.util.Map; | 25 | import java.util.Map; |
27 | import java.util.Set; | 26 | import java.util.Set; |
28 | import java.util.stream.Collectors; | 27 | import java.util.stream.Collectors; |
29 | 28 | ||
30 | import org.onosproject.incubator.net.tunnel.TunnelId; | 29 | import org.onosproject.incubator.net.tunnel.TunnelId; |
30 | +import org.onosproject.net.DeviceId; | ||
31 | import org.onosproject.net.resource.ResourceConsumer; | 31 | import org.onosproject.net.resource.ResourceConsumer; |
32 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
33 | import org.onosproject.pce.pcestore.PcePathInfo; | 32 | import org.onosproject.pce.pcestore.PcePathInfo; |
34 | import org.onosproject.pce.pcestore.api.PceStore; | 33 | import org.onosproject.pce.pcestore.api.PceStore; |
35 | 34 | ||
... | @@ -44,8 +43,8 @@ public class PceStoreAdapter implements PceStore { | ... | @@ -44,8 +43,8 @@ public class PceStoreAdapter implements PceStore { |
44 | // Set of Path info | 43 | // Set of Path info |
45 | private Set<PcePathInfo> failedPathInfoSet = new HashSet<>(); | 44 | private Set<PcePathInfo> failedPathInfoSet = new HashSet<>(); |
46 | 45 | ||
47 | - // Locally maintain with tunnel name as key and corresponding list of explicit path object | 46 | + // Locally maintain LSRID to device id mapping for better performance. |
48 | - private Map<String, List<ExplicitPathInfo>> tunnelNameExplicitPathInfoMap = new HashMap<>(); | 47 | + private Map<String, DeviceId> lsrIdDeviceIdMap = new HashMap<>(); |
49 | 48 | ||
50 | @Override | 49 | @Override |
51 | public boolean existsTunnelInfo(TunnelId tunnelId) { | 50 | public boolean existsTunnelInfo(TunnelId tunnelId) { |
... | @@ -109,15 +108,4 @@ public class PceStoreAdapter implements PceStore { | ... | @@ -109,15 +108,4 @@ public class PceStoreAdapter implements PceStore { |
109 | } | 108 | } |
110 | return true; | 109 | return true; |
111 | } | 110 | } |
112 | - | ||
113 | - @Override | ||
114 | - public boolean tunnelNameExplicitPathInfoMap(String tunnelName, List<ExplicitPathInfo> explicitPathInfo) { | ||
115 | - tunnelNameExplicitPathInfoMap.put(tunnelName, explicitPathInfo); | ||
116 | - return false; | ||
117 | - } | ||
118 | - | ||
119 | - @Override | ||
120 | - public List<ExplicitPathInfo> getTunnelNameExplicitPathInfoMap(String tunnelName) { | ||
121 | - return tunnelNameExplicitPathInfoMap.get(tunnelName); | ||
122 | - } | ||
123 | } | 111 | } | ... | ... |
... | @@ -16,22 +16,9 @@ | ... | @@ -16,22 +16,9 @@ |
16 | package org.onosproject.pcerest; | 16 | package org.onosproject.pcerest; |
17 | 17 | ||
18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
19 | -import static org.onosproject.net.Link.State.ACTIVE; | ||
20 | -import static org.onosproject.net.Link.Type.DIRECT; | ||
21 | - | ||
22 | -import com.fasterxml.jackson.databind.node.ArrayNode; | ||
23 | -import com.google.common.collect.ImmutableList; | ||
24 | -import com.google.common.collect.Lists; | ||
25 | 19 | ||
26 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
27 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
28 | -import org.onosproject.net.ConnectPoint; | ||
29 | -import org.onosproject.net.DefaultLink; | ||
30 | -import org.onosproject.net.DeviceId; | ||
31 | -import org.onosproject.net.NetworkResource; | ||
32 | -import org.onosproject.net.PortNumber; | ||
33 | -import org.onosproject.net.provider.ProviderId; | ||
34 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
35 | import org.onosproject.pce.pceservice.PcePath; | 22 | import org.onosproject.pce.pceservice.PcePath; |
36 | import org.onosproject.pce.pceservice.DefaultPcePath; | 23 | import org.onosproject.pce.pceservice.DefaultPcePath; |
37 | import org.onosproject.net.intent.constraint.BandwidthConstraint; | 24 | import org.onosproject.net.intent.constraint.BandwidthConstraint; |
... | @@ -42,11 +29,6 @@ import org.slf4j.LoggerFactory; | ... | @@ -42,11 +29,6 @@ import org.slf4j.LoggerFactory; |
42 | import com.fasterxml.jackson.databind.node.ObjectNode; | 29 | import com.fasterxml.jackson.databind.node.ObjectNode; |
43 | import com.fasterxml.jackson.databind.JsonNode; | 30 | import com.fasterxml.jackson.databind.JsonNode; |
44 | 31 | ||
45 | -import java.util.Collection; | ||
46 | -import java.util.Collections; | ||
47 | -import java.util.LinkedList; | ||
48 | -import java.util.List; | ||
49 | - | ||
50 | /** | 32 | /** |
51 | * PCE path json codec. | 33 | * PCE path json codec. |
52 | */ | 34 | */ |
... | @@ -60,13 +42,7 @@ public final class PcePathCodec extends JsonCodec<PcePath> { | ... | @@ -60,13 +42,7 @@ public final class PcePathCodec extends JsonCodec<PcePath> { |
60 | private static final String COST = "cost"; | 42 | private static final String COST = "cost"; |
61 | private static final String BANDWIDTH = "bandwidth"; | 43 | private static final String BANDWIDTH = "bandwidth"; |
62 | private static final String PATH_ID = "pathId"; | 44 | private static final String PATH_ID = "pathId"; |
63 | - private static final String EXPLICIT_PATH_INFO = "explicitPathInfo"; | ||
64 | private static final String MISSING_MEMBER_MESSAGE = " member is required in pce-path"; | 45 | private static final String MISSING_MEMBER_MESSAGE = " member is required in pce-path"; |
65 | - public static final String JSON_NOT_NULL = "JsonNode can not be null"; | ||
66 | - public static final byte SOURCE_DEVICEID_INDEX = 0; | ||
67 | - public static final byte SOURCE_PORTNO_INDEX = 1; | ||
68 | - public static final byte DESTINATION_DEVICEID_INDEX = 2; | ||
69 | - public static final byte DESTINATION_PORTNO_INDEX = 3; | ||
70 | 46 | ||
71 | @Override | 47 | @Override |
72 | public PcePath decode(ObjectNode json, CodecContext context) { | 48 | public PcePath decode(ObjectNode json, CodecContext context) { |
... | @@ -138,87 +114,9 @@ public final class PcePathCodec extends JsonCodec<PcePath> { | ... | @@ -138,87 +114,9 @@ public final class PcePathCodec extends JsonCodec<PcePath> { |
138 | } | 114 | } |
139 | } | 115 | } |
140 | 116 | ||
141 | - // Retrieve explicit path info | ||
142 | - JsonNode explicitPathInfo = json.get(EXPLICIT_PATH_INFO); | ||
143 | - if (explicitPathInfo != null) { | ||
144 | - List<ExplicitPathInfo> explicitPathInfoList = | ||
145 | - ImmutableList.copyOf(jsonNodeToExplicitPathInfo(explicitPathInfo)); | ||
146 | - if (explicitPathInfoList != null) { | ||
147 | - resultBuilder.explicitPathInfo(explicitPathInfoList); | ||
148 | - } | ||
149 | - } | ||
150 | - | ||
151 | return resultBuilder.build(); | 117 | return resultBuilder.build(); |
152 | } | 118 | } |
153 | 119 | ||
154 | - private ExplicitPathInfo createListOfExplicitPathObj(JsonNode node) { | ||
155 | - int explicitPathType = Integer.parseInt(node.get("type").asText()); | ||
156 | - DeviceId deviceId; | ||
157 | - PortNumber portNo; | ||
158 | - NetworkResource res; | ||
159 | - LinkedList<ExplicitPathInfo> list = Lists.newLinkedList(); | ||
160 | - if ((explicitPathType < 0) || (explicitPathType > 1)) { | ||
161 | - return null; | ||
162 | - } | ||
163 | - ExplicitPathInfo.Type type = ExplicitPathInfo.Type.values()[explicitPathType]; | ||
164 | - String subType = node.get("subtype").asText(); | ||
165 | - if (Integer.parseInt(subType) == 0) { | ||
166 | - res = DeviceId.deviceId(node.get("value").asText()); | ||
167 | - } else if (Integer.parseInt(subType) == 1) { | ||
168 | - | ||
169 | - String[] splitted = node.get("value").asText().split("/"); | ||
170 | - | ||
171 | - if (splitted[SOURCE_DEVICEID_INDEX] != null | ||
172 | - && splitted[SOURCE_PORTNO_INDEX] != null | ||
173 | - && splitted[DESTINATION_DEVICEID_INDEX] != null | ||
174 | - && splitted[DESTINATION_PORTNO_INDEX] != null) { | ||
175 | - return null; | ||
176 | - } | ||
177 | - deviceId = DeviceId.deviceId(splitted[SOURCE_DEVICEID_INDEX]); | ||
178 | - portNo = PortNumber.portNumber(splitted[SOURCE_PORTNO_INDEX]); | ||
179 | - ConnectPoint cpSrc = new ConnectPoint(deviceId, portNo); | ||
180 | - deviceId = DeviceId.deviceId(splitted[DESTINATION_DEVICEID_INDEX]); | ||
181 | - portNo = PortNumber.portNumber(splitted[DESTINATION_PORTNO_INDEX]); | ||
182 | - ConnectPoint cpDst = new ConnectPoint(deviceId, portNo); | ||
183 | - res = DefaultLink.builder() | ||
184 | - .providerId(ProviderId.NONE) | ||
185 | - .src(cpSrc) | ||
186 | - .dst(cpDst) | ||
187 | - .type(DIRECT) | ||
188 | - .state(ACTIVE) | ||
189 | - .build(); | ||
190 | - } else { | ||
191 | - return null; | ||
192 | - } | ||
193 | - | ||
194 | - return new ExplicitPathInfo(type, res); | ||
195 | - } | ||
196 | - | ||
197 | - private Collection<ExplicitPathInfo> jsonNodeToExplicitPathInfo(JsonNode explicitPathInfo) { | ||
198 | - checkNotNull(explicitPathInfo, JSON_NOT_NULL); | ||
199 | - | ||
200 | - Integer i = 0; | ||
201 | - NetworkResource res; | ||
202 | - LinkedList<ExplicitPathInfo> list = Lists.newLinkedList(); | ||
203 | - if (explicitPathInfo.isArray()) { | ||
204 | - for (JsonNode node : explicitPathInfo) { | ||
205 | - ExplicitPathInfo obj = createListOfExplicitPathObj(node); | ||
206 | - if (obj == null) { | ||
207 | - return null; | ||
208 | - } | ||
209 | - list.add(obj); | ||
210 | - } | ||
211 | - } else { | ||
212 | - ExplicitPathInfo obj = createListOfExplicitPathObj(explicitPathInfo); | ||
213 | - if (obj == null) { | ||
214 | - return null; | ||
215 | - } | ||
216 | - list.add(obj); | ||
217 | - } | ||
218 | - | ||
219 | - return Collections.unmodifiableCollection(list); | ||
220 | - } | ||
221 | - | ||
222 | @Override | 120 | @Override |
223 | public ObjectNode encode(PcePath path, CodecContext context) { | 121 | public ObjectNode encode(PcePath path, CodecContext context) { |
224 | checkNotNull(path, "path output cannot be null"); | 122 | checkNotNull(path, "path output cannot be null"); |
... | @@ -235,18 +133,6 @@ public final class PcePathCodec extends JsonCodec<PcePath> { | ... | @@ -235,18 +133,6 @@ public final class PcePathCodec extends JsonCodec<PcePath> { |
235 | .put(COST, ((CostConstraint) path.costConstraint()).type().type()) | 133 | .put(COST, ((CostConstraint) path.costConstraint()).type().type()) |
236 | .put(BANDWIDTH, ((BandwidthConstraint) path.bandwidthConstraint()).bandwidth().bps()); | 134 | .put(BANDWIDTH, ((BandwidthConstraint) path.bandwidthConstraint()).bandwidth().bps()); |
237 | 135 | ||
238 | - if (path.explicitPathInfo() != null && !path.explicitPathInfo().isEmpty()) { | ||
239 | - ArrayNode arrayNode = context.mapper().createArrayNode(); | ||
240 | - for (ExplicitPathInfo e : path.explicitPathInfo()) { | ||
241 | - ObjectNode node = context.mapper() | ||
242 | - .createObjectNode() | ||
243 | - .put("type", e.type().toString()) | ||
244 | - .put("value", e.value().toString()); | ||
245 | - arrayNode.add(node); | ||
246 | - } | ||
247 | - result.set(EXPLICIT_PATH_INFO, arrayNode); | ||
248 | - } | ||
249 | - | ||
250 | result.set(CONSTRAINT, constraintNode); | 136 | result.set(CONSTRAINT, constraintNode); |
251 | return result; | 137 | return result; |
252 | } | 138 | } | ... | ... |
... | @@ -35,13 +35,11 @@ import javax.ws.rs.Produces; | ... | @@ -35,13 +35,11 @@ import javax.ws.rs.Produces; |
35 | import javax.ws.rs.core.MediaType; | 35 | import javax.ws.rs.core.MediaType; |
36 | import javax.ws.rs.core.Response; | 36 | import javax.ws.rs.core.Response; |
37 | 37 | ||
38 | -import com.google.common.collect.ImmutableList; | ||
39 | import org.onosproject.incubator.net.tunnel.Tunnel; | 38 | import org.onosproject.incubator.net.tunnel.Tunnel; |
40 | import org.onosproject.incubator.net.tunnel.TunnelId; | 39 | import org.onosproject.incubator.net.tunnel.TunnelId; |
41 | import org.onosproject.incubator.net.tunnel.TunnelService; | 40 | import org.onosproject.incubator.net.tunnel.TunnelService; |
42 | import org.onosproject.net.DeviceId; | 41 | import org.onosproject.net.DeviceId; |
43 | import org.onosproject.net.intent.Constraint; | 42 | import org.onosproject.net.intent.Constraint; |
44 | -import org.onosproject.pce.pceservice.ExplicitPathInfo; | ||
45 | import org.onosproject.pce.pceservice.api.PceService; | 43 | import org.onosproject.pce.pceservice.api.PceService; |
46 | import org.onosproject.pce.pceservice.PcePath; | 44 | import org.onosproject.pce.pceservice.PcePath; |
47 | import org.onosproject.pce.pceservice.DefaultPcePath; | 45 | import org.onosproject.pce.pceservice.DefaultPcePath; |
... | @@ -152,14 +150,8 @@ public class PcePathWebResource extends AbstractWebResource { | ... | @@ -152,14 +150,8 @@ public class PcePathWebResource extends AbstractWebResource { |
152 | // Add cost | 150 | // Add cost |
153 | listConstrnt.add(path.costConstraint()); | 151 | listConstrnt.add(path.costConstraint()); |
154 | 152 | ||
155 | - List<ExplicitPathInfo> explicitPathInfoList = null; | ||
156 | - if (explicitPathInfoList != null) { | ||
157 | - explicitPathInfoList = ImmutableList.copyOf(path.explicitPathInfo()); | ||
158 | - } | ||
159 | - | ||
160 | Boolean issuccess = nullIsNotFound(get(PceService.class) | 153 | Boolean issuccess = nullIsNotFound(get(PceService.class) |
161 | - .setupPath(srcDevice, dstDevice, path.name(), listConstrnt, | 154 | + .setupPath(srcDevice, dstDevice, path.name(), listConstrnt, lspType), |
162 | - lspType, explicitPathInfoList), | ||
163 | PCE_SETUP_PATH_FAILED); | 155 | PCE_SETUP_PATH_FAILED); |
164 | return Response.status(OK).entity(issuccess.toString()).build(); | 156 | return Response.status(OK).entity(issuccess.toString()).build(); |
165 | } catch (IOException e) { | 157 | } catch (IOException e) { | ... | ... |
... | @@ -64,7 +64,6 @@ import org.onosproject.net.DeviceId; | ... | @@ -64,7 +64,6 @@ import org.onosproject.net.DeviceId; |
64 | import org.onosproject.net.Link; | 64 | import org.onosproject.net.Link; |
65 | import org.onosproject.pce.pceservice.api.PceService; | 65 | import org.onosproject.pce.pceservice.api.PceService; |
66 | import org.onosproject.pce.pceservice.PcepAnnotationKeys; | 66 | import org.onosproject.pce.pceservice.PcepAnnotationKeys; |
67 | -import org.onosproject.pce.pcestore.api.PceStore; | ||
68 | import org.onosproject.net.Path; | 67 | import org.onosproject.net.Path; |
69 | import org.onosproject.net.PortNumber; | 68 | import org.onosproject.net.PortNumber; |
70 | import org.onosproject.net.provider.ProviderId; | 69 | import org.onosproject.net.provider.ProviderId; |
... | @@ -74,7 +73,6 @@ import org.onosproject.net.provider.ProviderId; | ... | @@ -74,7 +73,6 @@ import org.onosproject.net.provider.ProviderId; |
74 | */ | 73 | */ |
75 | public class PcePathResourceTest extends PceResourceTest { | 74 | public class PcePathResourceTest extends PceResourceTest { |
76 | private final PceService pceService = createMock(PceService.class); | 75 | private final PceService pceService = createMock(PceService.class); |
77 | - private final PceStore pceStore = createMock(PceStore.class); | ||
78 | private final TunnelService tunnelService = createMock(TunnelService.class); | 76 | private final TunnelService tunnelService = createMock(TunnelService.class); |
79 | private final TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); | 77 | private final TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); |
80 | private final TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); | 78 | private final TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); |
... | @@ -104,7 +102,6 @@ public class PcePathResourceTest extends PceResourceTest { | ... | @@ -104,7 +102,6 @@ public class PcePathResourceTest extends PceResourceTest { |
104 | MockPceCodecContext context = new MockPceCodecContext(); | 102 | MockPceCodecContext context = new MockPceCodecContext(); |
105 | ServiceDirectory testDirectory = new TestServiceDirectory().add(PceService.class, pceService) | 103 | ServiceDirectory testDirectory = new TestServiceDirectory().add(PceService.class, pceService) |
106 | .add(TunnelService.class, tunnelService) | 104 | .add(TunnelService.class, tunnelService) |
107 | - .add(PceStore.class, pceStore) | ||
108 | .add(CodecService.class, context.codecManager()); | 105 | .add(CodecService.class, context.codecManager()); |
109 | BaseResource.setServiceDirectory(testDirectory); | 106 | BaseResource.setServiceDirectory(testDirectory); |
110 | 107 | ||
... | @@ -236,7 +233,7 @@ public class PcePathResourceTest extends PceResourceTest { | ... | @@ -236,7 +233,7 @@ public class PcePathResourceTest extends PceResourceTest { |
236 | */ | 233 | */ |
237 | @Test | 234 | @Test |
238 | public void testPost() { | 235 | public void testPost() { |
239 | - expect(pceService.setupPath(anyObject(), anyObject(), anyObject(), anyObject(), anyObject(), anyObject())) | 236 | + expect(pceService.setupPath(anyObject(), anyObject(), anyObject(), anyObject(), anyObject())) |
240 | .andReturn(true) | 237 | .andReturn(true) |
241 | .anyTimes(); | 238 | .anyTimes(); |
242 | replay(pceService); | 239 | replay(pceService); | ... | ... |
1 | {"path": {"source":"11.0.0.1", | 1 | {"path": {"source":"11.0.0.1", |
2 | "destination":"11.0.0.2", | 2 | "destination":"11.0.0.2", |
3 | - "pathType":"0", | 3 | + "pathType":"2", |
4 | - "name":"rsvp11", | 4 | + "name":"pcc2", |
5 | + "description":"path-create", | ||
5 | "constraint": | 6 | "constraint": |
6 | - {"cost":1, | 7 | + {"cost":2, |
7 | - "bandwidth":300 | 8 | + "bandwidth":200.0 |
8 | - }, | ||
9 | - "explicitPathInfo" : | ||
10 | - {"type":1, | ||
11 | - "subtype":0, | ||
12 | - "value":"11.0.0.2" | ||
13 | } | 9 | } |
14 | } | 10 | } |
15 | } | 11 | } | ... | ... |
... | @@ -507,9 +507,7 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -507,9 +507,7 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
507 | break; | 507 | break; |
508 | } | 508 | } |
509 | 509 | ||
510 | - //TODO: need to get explicit paths [temporarily using null as the value] | 510 | + path = pceService.setupPath((DeviceId) src, (DeviceId) dst, tunnelName, listConstrnt, lspTypeVal); |
511 | - path = pceService.setupPath((DeviceId) src, (DeviceId) dst, tunnelName, listConstrnt, lspTypeVal, | ||
512 | - null); | ||
513 | if (!path) { | 511 | if (!path) { |
514 | log.error("setup path is failed"); | 512 | log.error("setup path is failed"); |
515 | return; | 513 | return; | ... | ... |
-
Please register or login to post a comment