Priyankab-Huawei

Revert "[ONOS-5187] Compute path with Explicit path objects"

This reverts commit a32f6da9.

Change-Id: Ic023d701d18f0ae7af2579bc43777714a0e701dc
Showing 22 changed files with 48 additions and 576 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> 108 + </dependencies>
109 - <groupId>org.easymock</groupId>
110 - <artifactId>easymock</artifactId>
111 - <scope>test</scope>
112 - </dependency>
113 - </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,28 +72,17 @@ public class PceQueryPathCommand extends AbstractShellCommand { ...@@ -75,28 +72,17 @@ 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) 75 + print("\npath-id : %s \n" +
79 - .explicitPathInfoList(tunnel.tunnelName().value()); 76 + "source : %s \n" +
80 - 77 + "destination : %s \n" +
81 - print("\npath-id : %s \n" + 78 + "path-type : %s \n" +
82 - "source : %s \n" + 79 + "symbolic-path-name : %s \n" +
83 - "destination : %s \n" +
84 - "path-type : %s \n" +
85 - "symbolic-path-name : %s \n" +
86 "constraints: \n" + 80 "constraints: \n" +
87 - " cost : %s \n" + 81 + " cost : %s \n" +
88 - " bandwidth : %s", 82 + " bandwidth : %s",
89 tunnel.tunnelId().id(), tunnel.path().src().deviceId().toString(), 83 tunnel.tunnelId().id(), tunnel.path().src().deviceId().toString(),
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 -}
...@@ -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));
......
...@@ -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);
......
...@@ -7,10 +7,5 @@ ...@@ -7,10 +7,5 @@
7 "constraint": 7 "constraint":
8 { "cost":2, 8 { "cost":2,
9 "bandwidth":200.0 9 "bandwidth":200.0
10 - }, 10 + }
11 - "explicitPathInfo" :
12 - {"type":1,
13 - "subtype":0,
14 - "value":"11.0.0.2"
15 - }
16 } 11 }
......
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;
......