Sho SHIMIZU
Committed by Thomas Vachuska

Remove constructs deprecated in Emu from old resource API

Change-Id: Ia4fd5d4c45d91b82b78ace18e96512c800adfcd6
Showing 22 changed files with 0 additions and 1656 deletions
1 -/*
2 - * Copyright 2015 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.net.resource;
17 -
18 -import com.google.common.annotations.Beta;
19 -
20 -/**
21 - * Exception thrown for resource allocation errors.
22 - */
23 -@Beta
24 -public class ResourceAllocationException extends ResourceException {
25 - public ResourceAllocationException() {
26 - super();
27 - }
28 -
29 - public ResourceAllocationException(String message) {
30 - super(message);
31 - }
32 -
33 - public ResourceAllocationException(String message, Throwable cause) {
34 - super(message, cause);
35 - }
36 -}
1 -/*
2 - * Copyright 2015 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.net.resource;
17 -
18 -import com.google.common.annotations.Beta;
19 -
20 -/**
21 - * Represents a resource related error.
22 - */
23 -@Beta
24 -public class ResourceException extends RuntimeException {
25 -
26 - /**
27 - * Constructs an exception with no message and no underlying cause.
28 - */
29 - public ResourceException() {
30 - }
31 -
32 - /**
33 - * Constructs an exception with the specified message.
34 - *
35 - * @param message the message describing the specific nature of the error
36 - */
37 - public ResourceException(String message) {
38 - super(message);
39 - }
40 -
41 - /**
42 - * Constructs an exception with the specified message and the underlying cause.
43 - *
44 - * @param message the message describing the specific nature of the error
45 - * @param cause the underlying cause of this error
46 - */
47 - public ResourceException(String message, Throwable cause) {
48 - super(message, cause);
49 - }
50 -
51 -}
1 -/*
2 - * Copyright 2014-2015 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.net.resource.link;
17 -
18 -import org.onlab.util.Bandwidth;
19 -import org.onlab.util.DataRateUnit;
20 -import java.util.Objects;
21 -
22 -import static com.google.common.base.Preconditions.checkNotNull;
23 -
24 -/**
25 - * Representation of bandwidth resource in bps.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public final class BandwidthResource implements LinkResource {
31 -
32 - private final Bandwidth bandwidth;
33 -
34 - /**
35 - * Creates a new instance with given bandwidth.
36 - *
37 - * @param bandwidth bandwidth value to be assigned
38 - */
39 - public BandwidthResource(Bandwidth bandwidth) {
40 - this.bandwidth = checkNotNull(bandwidth);
41 - }
42 -
43 - // Constructor for serialization
44 - private BandwidthResource() {
45 - this.bandwidth = null;
46 - }
47 -
48 - /**
49 - * Creates a new bandwidth resource.
50 - *
51 - * @param v amount of bandwidth to request
52 - * @param unit {@link DataRateUnit} of {@code v}
53 - * @return {@link BandwidthResource} instance with given bandwidth
54 - */
55 - public static BandwidthResource of(double v, DataRateUnit unit) {
56 - return new BandwidthResource(Bandwidth.of(v, unit));
57 - }
58 -
59 - /**
60 - * Returns bandwidth as a double value.
61 - *
62 - * @return bandwidth as a double value
63 - */
64 - public double toDouble() {
65 - return bandwidth.bps();
66 - }
67 -
68 - @Override
69 - public boolean equals(Object obj) {
70 - if (obj instanceof BandwidthResource) {
71 - BandwidthResource that = (BandwidthResource) obj;
72 - return Objects.equals(this.bandwidth, that.bandwidth);
73 - }
74 - return false;
75 - }
76 -
77 - @Override
78 - public int hashCode() {
79 - return Objects.hashCode(this.bandwidth);
80 - }
81 -
82 - @Override
83 - public String toString() {
84 - return String.valueOf(this.bandwidth);
85 - }
86 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import com.google.common.base.MoreObjects;
19 -import org.onosproject.net.resource.ResourceAllocation;
20 -import org.onosproject.net.resource.ResourceType;
21 -
22 -import java.util.Objects;
23 -
24 -/**
25 - * Representation of allocated bandwidth resource.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public class BandwidthResourceAllocation implements ResourceAllocation {
31 - private final BandwidthResource bandwidth;
32 -
33 - /**
34 - * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
35 - * object.
36 - *
37 - * @param bandwidth {@link BandwidthResource} object to be requested
38 - */
39 - public BandwidthResourceAllocation(BandwidthResource bandwidth) {
40 - this.bandwidth = bandwidth;
41 - }
42 -
43 - /**
44 - * Returns the bandwidth resource.
45 - *
46 - * @return the bandwidth resource
47 - */
48 - public BandwidthResource bandwidth() {
49 - return bandwidth;
50 - }
51 -
52 - @Override
53 - public ResourceType type() {
54 - return ResourceType.BANDWIDTH;
55 - }
56 -
57 - @Override
58 - public int hashCode() {
59 - return bandwidth.hashCode();
60 - }
61 -
62 - @Override
63 - public boolean equals(Object obj) {
64 - if (this == obj) {
65 - return true;
66 - }
67 - if (obj == null || getClass() != obj.getClass()) {
68 - return false;
69 - }
70 - final BandwidthResourceAllocation other = (BandwidthResourceAllocation) obj;
71 - return Objects.equals(this.bandwidth, other.bandwidth());
72 - }
73 -
74 - @Override
75 - public String toString() {
76 - return MoreObjects.toStringHelper(this)
77 - .add("bandwidth", bandwidth)
78 - .toString();
79 - }
80 -}
1 -/*
2 - * Copyright 2014-2015 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.net.resource.link;
17 -
18 -import java.util.Objects;
19 -
20 -import com.google.common.base.MoreObjects;
21 -import org.onosproject.net.resource.ResourceRequest;
22 -import org.onosproject.net.resource.ResourceType;
23 -
24 -/**
25 - * Representation of a request for bandwidth resource.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public class BandwidthResourceRequest implements ResourceRequest {
31 - private final BandwidthResource bandwidth;
32 -
33 - /**
34 - * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
35 - * object.
36 - *
37 - * @param bandwidth {@link BandwidthResource} object to be requested
38 - */
39 - public BandwidthResourceRequest(BandwidthResource bandwidth) {
40 - this.bandwidth = bandwidth;
41 - }
42 -
43 - /**
44 - * Returns the bandwidth resource.
45 - *
46 - * @return the bandwidth resource
47 - */
48 - public BandwidthResource bandwidth() {
49 - return bandwidth;
50 - }
51 -
52 - @Override
53 - public ResourceType type() {
54 - return ResourceType.BANDWIDTH;
55 - }
56 -
57 - @Override
58 - public int hashCode() {
59 - return bandwidth.hashCode();
60 - }
61 -
62 - @Override
63 - public boolean equals(Object obj) {
64 - if (this == obj) {
65 - return true;
66 - }
67 - if (obj == null || getClass() != obj.getClass()) {
68 - return false;
69 - }
70 - final BandwidthResourceRequest other = (BandwidthResourceRequest) obj;
71 - return Objects.equals(this.bandwidth, other.bandwidth());
72 - }
73 -
74 - @Override
75 - public String toString() {
76 - return MoreObjects.toStringHelper(this)
77 - .add("bandwidth", bandwidth)
78 - .toString();
79 - }
80 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import static com.google.common.base.Preconditions.checkNotNull;
19 -
20 -import com.google.common.base.MoreObjects;
21 -import com.google.common.collect.ImmutableMap;
22 -import com.google.common.collect.ImmutableSet;
23 -
24 -import org.onosproject.net.Link;
25 -import org.onosproject.net.intent.IntentId;
26 -import org.onosproject.net.resource.ResourceAllocation;
27 -import org.onosproject.net.resource.ResourceRequest;
28 -import org.onosproject.net.resource.ResourceType;
29 -
30 -import java.util.Collection;
31 -import java.util.Collections;
32 -import java.util.Map;
33 -import java.util.Objects;
34 -import java.util.Map.Entry;
35 -import java.util.Set;
36 -
37 -/**
38 - * Implementation of {@link LinkResourceAllocations}.
39 - *
40 - * @deprecated in Emu Release
41 - */
42 -@Deprecated
43 -public class DefaultLinkResourceAllocations implements LinkResourceAllocations {
44 - private final LinkResourceRequest request;
45 - // TODO: probably should be using LinkKey instead
46 - private final Map<Link, Set<ResourceAllocation>> allocations;
47 -
48 - /**
49 - * Creates a new link resource allocations.
50 - *
51 - * @param request requested resources
52 - * @param allocations allocated resources
53 - */
54 - public DefaultLinkResourceAllocations(LinkResourceRequest request,
55 - Map<Link, Set<ResourceAllocation>> allocations) {
56 - this.request = checkNotNull(request);
57 - ImmutableMap.Builder<Link, Set<ResourceAllocation>> builder
58 - = ImmutableMap.builder();
59 - for (Entry<Link, Set<ResourceAllocation>> e : allocations.entrySet()) {
60 - builder.put(e.getKey(), ImmutableSet.copyOf(e.getValue()));
61 - }
62 - this.allocations = builder.build();
63 - }
64 -
65 - public IntentId intentId() {
66 - return request.intentId();
67 - }
68 -
69 - public Collection<Link> links() {
70 - return request.links();
71 - }
72 -
73 - public Set<ResourceRequest> resources() {
74 - return request.resources();
75 - }
76 -
77 - @Override
78 - public ResourceType type() {
79 - return null;
80 - }
81 -
82 - @Override
83 - public Set<ResourceAllocation> getResourceAllocation(Link link) {
84 - Set<ResourceAllocation> result = allocations.get(link);
85 - if (result == null) {
86 - result = Collections.emptySet();
87 - }
88 - return result;
89 - }
90 -
91 - @Override
92 - public int hashCode() {
93 - return Objects.hash(request, allocations);
94 - }
95 -
96 - @Override
97 - public boolean equals(Object obj) {
98 - if (this == obj) {
99 - return true;
100 - }
101 - if (obj == null || getClass() != obj.getClass()) {
102 - return false;
103 - }
104 - final DefaultLinkResourceAllocations other = (DefaultLinkResourceAllocations) obj;
105 - return Objects.equals(this.request, other.request)
106 - && Objects.equals(this.allocations, other.allocations);
107 - }
108 -
109 - @Override
110 - public String toString() {
111 - return MoreObjects.toStringHelper(this)
112 - .add("allocations", allocations)
113 - .toString();
114 - }
115 -}
1 -/*
2 - * Copyright 2014-2015 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.net.resource.link;
17 -
18 -import java.util.Collection;
19 -import java.util.HashMap;
20 -import java.util.HashSet;
21 -import java.util.Map;
22 -import java.util.Set;
23 -import java.util.Objects;
24 -import java.util.stream.Collectors;
25 -
26 -import com.google.common.annotations.Beta;
27 -import com.google.common.collect.ImmutableMap;
28 -import org.onlab.util.Bandwidth;
29 -import org.onosproject.net.Link;
30 -import org.onosproject.net.intent.Constraint;
31 -import org.onosproject.net.intent.IntentId;
32 -
33 -import org.onosproject.net.intent.constraint.BandwidthConstraint;
34 -import org.onosproject.net.resource.ResourceRequest;
35 -import org.onosproject.net.resource.ResourceType;
36 -
37 -import static com.google.common.base.Preconditions.checkNotNull;
38 -
39 -/**
40 - * Implementation of {@link LinkResourceRequest}.
41 - *
42 - * @deprecated in Emu Release
43 - */
44 -@Deprecated
45 -public final class DefaultLinkResourceRequest implements LinkResourceRequest {
46 -
47 - private final IntentId intentId;
48 - protected final Map<Link, Set<ResourceRequest>> requests;
49 -
50 - /**
51 - * Creates a new link resource request with the specified Intent ID,
52 - * and resource requests over links.
53 - *
54 - * @param intentId intent ID associated with this request
55 - * @param requests resource requests over links
56 - */
57 - private DefaultLinkResourceRequest(IntentId intentId, Map<Link, Set<ResourceRequest>> requests) {
58 - this.intentId = checkNotNull(intentId);
59 - this.requests = checkNotNull(ImmutableMap.copyOf(requests));
60 - }
61 -
62 - @Override
63 - public ResourceType type() {
64 - return null;
65 - }
66 -
67 - @Override
68 - public IntentId intentId() {
69 - return intentId;
70 - }
71 -
72 - @Override
73 - public Collection<Link> links() {
74 - return requests.keySet();
75 - }
76 -
77 - @Override
78 - public Set<ResourceRequest> resources() {
79 - return requests.values().stream()
80 - .flatMap(Collection::stream)
81 - .collect(Collectors.toSet());
82 - }
83 -
84 - @Override
85 - public Set<ResourceRequest> resources(Link link) {
86 - return requests.get(link);
87 - }
88 -
89 - /**
90 - * Returns builder of link resource request.
91 - *
92 - * @param intentId intent ID related to this request
93 - * @param links a set of links for the request
94 - * @return builder of link resource request
95 - */
96 - public static LinkResourceRequest.Builder builder(
97 - IntentId intentId, Collection<Link> links) {
98 - return new Builder(intentId, links);
99 - }
100 -
101 - /**
102 - * Builder of link resource request.
103 - */
104 - public static final class Builder implements LinkResourceRequest.Builder {
105 - private IntentId intentId;
106 - private Map<Link, Set<ResourceRequest>> requests;
107 -
108 - /**
109 - * Creates a new link resource request.
110 - *
111 - * @param intentId intent ID related to this request
112 - * @param links a set of links for the request
113 - */
114 - private Builder(IntentId intentId, Collection<Link> links) {
115 - this.intentId = intentId;
116 - this.requests = new HashMap<>();
117 - for (Link link : links) {
118 - requests.put(link, new HashSet<>());
119 - }
120 - }
121 -
122 - /**
123 - * Adds lambda request.
124 - *
125 - * @return self
126 - * @deprecated in Emu Release
127 - */
128 - @Deprecated
129 - @Override
130 - public Builder addLambdaRequest() {
131 - for (Link link : requests.keySet()) {
132 - requests.get(link).add(new LambdaResourceRequest());
133 - }
134 - return this;
135 - }
136 -
137 - @Beta
138 - @Override
139 - public LinkResourceRequest.Builder addLambdaRequest(LambdaResource lambda) {
140 - for (Link link : requests.keySet()) {
141 - requests.get(link).add(new LambdaResourceRequest(lambda));
142 - }
143 - return this;
144 - }
145 -
146 - /**
147 - * Adds Mpls request.
148 - *
149 - * @return self
150 - * @deprecated in Emu Release
151 - */
152 - @Deprecated
153 - @Override
154 - public Builder addMplsRequest() {
155 - for (Link link : requests.keySet()) {
156 - requests.get(link).add(new MplsLabelResourceRequest());
157 - }
158 - return this;
159 - }
160 -
161 - @Beta
162 - @Override
163 - public Builder addMplsRequest(MplsLabel label) {
164 - for (Link link : requests.keySet()) {
165 - requests.get(link).add(new MplsLabelResourceRequest(label));
166 - }
167 - return this;
168 - }
169 -
170 - @Beta
171 - @Override
172 - public LinkResourceRequest.Builder addMplsRequest(Map<Link, MplsLabel> labels) {
173 - for (Link link : labels.keySet()) {
174 - if (!requests.containsKey(link)) {
175 - requests.put(link, new HashSet<>());
176 - }
177 - requests.get(link).add(new MplsLabelResourceRequest(labels.get(link)));
178 - }
179 -
180 - return this;
181 - }
182 -
183 - /**
184 - * Adds bandwidth request with bandwidth value.
185 - *
186 - * @param bandwidth bandwidth value in bits per second to be requested
187 - * @return self
188 - */
189 - @Override
190 - public Builder addBandwidthRequest(double bandwidth) {
191 - for (Link link : requests.keySet()) {
192 - requests.get(link).add(new BandwidthResourceRequest(new BandwidthResource(Bandwidth.bps(bandwidth))));
193 - }
194 - return this;
195 - }
196 -
197 - @Override
198 - public LinkResourceRequest.Builder addConstraint(Constraint constraint) {
199 - if (constraint instanceof BandwidthConstraint) {
200 - BandwidthConstraint bw = (BandwidthConstraint) constraint;
201 - return addBandwidthRequest(bw.bandwidth().bps());
202 - }
203 - return this;
204 - }
205 -
206 - /**
207 - * Returns link resource request.
208 - *
209 - * @return link resource request
210 - */
211 - @Override
212 - public LinkResourceRequest build() {
213 - return new DefaultLinkResourceRequest(intentId, requests);
214 - }
215 - }
216 -
217 - @Override
218 - public int hashCode() {
219 - return Objects.hash(intentId, links());
220 - }
221 -
222 - @Override
223 - public boolean equals(Object obj) {
224 - if (this == obj) {
225 - return true;
226 - }
227 - if (obj == null || getClass() != obj.getClass()) {
228 - return false;
229 - }
230 - final DefaultLinkResourceRequest other = (DefaultLinkResourceRequest) obj;
231 - return Objects.equals(this.intentId, other.intentId)
232 - && Objects.equals(this.links(), other.links());
233 - }
234 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import org.onosproject.net.IndexedLambda;
19 -
20 -import java.util.Objects;
21 -
22 -import static com.google.common.base.Preconditions.checkNotNull;
23 -
24 -/**
25 - * Representation of lambda resource.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public final class LambdaResource implements LinkResource {
31 -
32 - private final IndexedLambda lambda;
33 -
34 - /**
35 - * Creates a new instance with given lambda.
36 - *
37 - * @param lambda lambda to be assigned
38 - */
39 - private LambdaResource(IndexedLambda lambda) {
40 - this.lambda = checkNotNull(lambda);
41 - }
42 -
43 - // Constructor for serialization
44 - private LambdaResource() {
45 - this.lambda = null;
46 - }
47 -
48 - /**
49 - * Creates a new instance with the given index of lambda.
50 - *
51 - * @param lambda index value of lambda to be assigned
52 - * @return {@link LambdaResource} instance with the given lambda
53 - */
54 - public static LambdaResource valueOf(int lambda) {
55 - return valueOf(new IndexedLambda(lambda));
56 - }
57 -
58 - /**
59 - * Creates a new instance with the given lambda.
60 - *
61 - * @param lambda lambda to be assigned
62 - * @return {@link LambdaResource} instance with the given lambda
63 - */
64 - public static LambdaResource valueOf(IndexedLambda lambda) {
65 - return new LambdaResource(lambda);
66 - }
67 -
68 - /**
69 - * Returns lambda as an int value.
70 - *
71 - * @return lambda as an int value
72 - */
73 - public int toInt() {
74 - return (int) lambda.index();
75 - }
76 -
77 - @Override
78 - public boolean equals(Object obj) {
79 - if (obj instanceof LambdaResource) {
80 - LambdaResource that = (LambdaResource) obj;
81 - return Objects.equals(this.lambda, that.lambda);
82 - }
83 - return false;
84 - }
85 -
86 - @Override
87 - public int hashCode() {
88 - return lambda.hashCode();
89 - }
90 -
91 - @Override
92 - public String toString() {
93 - return String.valueOf(this.lambda);
94 - }
95 -
96 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import com.google.common.base.MoreObjects;
19 -import org.onosproject.net.resource.ResourceAllocation;
20 -import org.onosproject.net.resource.ResourceType;
21 -
22 -import java.util.Objects;
23 -
24 -/**
25 - * Representation of allocated lambda resource.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public class LambdaResourceAllocation implements ResourceAllocation {
31 - private final LambdaResource lambda;
32 -
33 - @Override
34 - public ResourceType type() {
35 - return ResourceType.LAMBDA;
36 - }
37 -
38 - /**
39 - * Creates a new {@link LambdaResourceAllocation} with {@link LambdaResource}
40 - * object.
41 - *
42 - * @param lambda allocated lambda
43 - */
44 - public LambdaResourceAllocation(LambdaResource lambda) {
45 - this.lambda = lambda;
46 - }
47 -
48 - /**
49 - * Returns the lambda resource.
50 - *
51 - * @return the lambda resource
52 - */
53 - public LambdaResource lambda() {
54 - return lambda;
55 - }
56 -
57 - @Override
58 - public int hashCode() {
59 - return Objects.hashCode(lambda);
60 - }
61 -
62 - @Override
63 - public boolean equals(Object obj) {
64 - if (this == obj) {
65 - return true;
66 - }
67 - if (obj == null || getClass() != obj.getClass()) {
68 - return false;
69 - }
70 - final LambdaResourceAllocation other = (LambdaResourceAllocation) obj;
71 - return Objects.equals(this.lambda, other.lambda);
72 - }
73 -
74 - @Override
75 - public String toString() {
76 - return MoreObjects.toStringHelper(this)
77 - .add("lambda", lambda)
78 - .toString();
79 - }
80 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import com.google.common.annotations.Beta;
19 -import com.google.common.base.MoreObjects;
20 -import org.onosproject.net.resource.ResourceRequest;
21 -import org.onosproject.net.resource.ResourceType;
22 -
23 -import static com.google.common.base.Preconditions.checkNotNull;
24 -
25 -/**
26 - * Representation of a request for lambda resource.
27 - *
28 - * @deprecated in Emu Release
29 - */
30 -@Deprecated
31 -public class LambdaResourceRequest implements ResourceRequest {
32 -
33 - private final LambdaResource lambda;
34 -
35 - /**
36 - * Constructs a request specifying the given lambda.
37 - *
38 - * @param lambda lambda to be requested
39 - */
40 - @Beta
41 - public LambdaResourceRequest(LambdaResource lambda) {
42 - this.lambda = checkNotNull(lambda);
43 - }
44 -
45 - /**
46 - * Constructs a request asking an arbitrary available lambda.
47 - *
48 - * @deprecated in Emu Release
49 - */
50 - @Deprecated
51 - public LambdaResourceRequest() {
52 - this.lambda = null;
53 - }
54 -
55 - /**
56 - * Returns the lambda this request expects.
57 - *
58 - * @return the lambda this request expects
59 - */
60 - @Beta
61 - public LambdaResource lambda() {
62 - return lambda;
63 - }
64 -
65 - @Override
66 - public ResourceType type() {
67 - return ResourceType.LAMBDA;
68 - }
69 -
70 - @Override
71 - public String toString() {
72 - return MoreObjects.toStringHelper(this)
73 - .add("lambda", lambda)
74 - .toString();
75 - }
76 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -/**
19 - * Abstraction of link resource.
20 - *
21 - * @deprecated in Emu Release
22 - */
23 -@Deprecated
24 -public interface LinkResource {
25 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import java.util.Collection;
19 -
20 -import org.onosproject.event.AbstractEvent;
21 -
22 -import com.google.common.collect.ImmutableList;
23 -
24 -/**
25 - * Describes an event related to a Link Resource.
26 - *
27 - * @deprecated in Emu Release
28 - */
29 -@Deprecated
30 -public final class LinkResourceEvent
31 - extends AbstractEvent<LinkResourceEvent.Type, Collection<LinkResourceAllocations>> {
32 -
33 - /**
34 - * Type of resource this event is for.
35 - */
36 - public enum Type {
37 - /** Additional resources are now available. */
38 - ADDITIONAL_RESOURCES_AVAILABLE
39 - }
40 -
41 - /**
42 - * Constructs a link resource event.
43 - *
44 - * @param type type of resource event to create
45 - * @param linkResourceAllocations allocations that are now available
46 - */
47 - public LinkResourceEvent(Type type,
48 - Collection<LinkResourceAllocations> linkResourceAllocations) {
49 - super(type, ImmutableList.copyOf(linkResourceAllocations));
50 - }
51 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import org.onosproject.event.EventListener;
19 -
20 -/**
21 - * Entity for receiving link resource events.
22 - *
23 - * @deprecated in Emu Release
24 - */
25 -@Deprecated
26 -public interface LinkResourceListener extends EventListener<LinkResourceEvent> {
27 -}
1 -/*
2 - * Copyright 2014-2015 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.net.resource.link;
17 -
18 -import java.util.Collection;
19 -import java.util.Map;
20 -import java.util.Set;
21 -
22 -import com.google.common.annotations.Beta;
23 -import org.onosproject.net.Link;
24 -import org.onosproject.net.intent.Constraint;
25 -import org.onosproject.net.intent.IntentId;
26 -import org.onosproject.net.resource.ResourceRequest;
27 -
28 -/**
29 - * Representation of a request for link resource.
30 - *
31 - * @deprecated in Emu Release
32 - */
33 -@Deprecated
34 -public interface LinkResourceRequest extends ResourceRequest {
35 -
36 - /**
37 - * Returns the {@link IntentId} associated with the request.
38 - *
39 - * @return the {@link IntentId} associated with the request
40 - */
41 - IntentId intentId();
42 -
43 - /**
44 - * Returns the set of target links.
45 - *
46 - * @return the set of target links
47 - */
48 - Collection<Link> links();
49 -
50 - /**
51 - * Returns the set of resource requests.
52 - *
53 - * @return the set of resource requests
54 - */
55 - Set<ResourceRequest> resources();
56 -
57 - /**
58 - * Returns the set of resource request against the specified link.
59 - *
60 - * @param link link whose associated resource request is to be returned
61 - * @return set of resource request against the specified link
62 - */
63 - @Beta
64 - Set<ResourceRequest> resources(Link link);
65 -
66 - /**
67 - * Builder of link resource request.
68 - */
69 - interface Builder {
70 - /**
71 - * Adds lambda request.
72 - *
73 - * @return self
74 - * @deprecated in Emu Release
75 - */
76 - @Deprecated
77 - Builder addLambdaRequest();
78 -
79 - /**
80 - * Adds lambda request.
81 - *
82 - * @param lambda lambda to be requested
83 - * @return self
84 - */
85 - @Beta
86 - Builder addLambdaRequest(LambdaResource lambda);
87 -
88 - /**
89 - * Adds MPLS request.
90 - *
91 - * @return self
92 - * @deprecated in Emu Release
93 - */
94 - @Deprecated
95 - Builder addMplsRequest();
96 -
97 - /**
98 - * Adds MPLS request.
99 - *
100 - * @param label MPLS label to be requested
101 - * @return self
102 - */
103 - @Beta
104 - Builder addMplsRequest(MplsLabel label);
105 -
106 - /**
107 - * Adds MPLS request against the specified links.
108 - *
109 - * @param labels MPLS labels to be requested against links
110 - * @return self
111 - */
112 - @Beta
113 - Builder addMplsRequest(Map<Link, MplsLabel> labels);
114 -
115 - /**
116 - * Adds bandwidth request with bandwidth value.
117 - *
118 - * @param bandwidth bandwidth value to be requested
119 - * @return self
120 - */
121 - Builder addBandwidthRequest(double bandwidth);
122 -
123 - /**
124 - * Adds the resources required for a constraint.
125 - *
126 - * @param constraint the constraint
127 - * @return self
128 - */
129 - Builder addConstraint(Constraint constraint);
130 -
131 - /**
132 - * Returns link resource request.
133 - *
134 - * @return link resource request
135 - */
136 - LinkResourceRequest build();
137 - }
138 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import org.onosproject.store.StoreDelegate;
19 -
20 -/**
21 - * Link resource store delegate abstraction.
22 - *
23 - * @deprecated in Emu Release
24 - */
25 -@Deprecated
26 -public interface LinkResourceStoreDelegate extends StoreDelegate<LinkResourceEvent> {
27 -}
1 -/*
2 - * Copyright 2014 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.net.resource.link;
17 -
18 -import java.util.Set;
19 -
20 -/**
21 - * Abstraction of a resources of a link.
22 - *
23 - * @deprecated in Emu Release
24 - */
25 -@Deprecated
26 -public interface LinkResources {
27 -
28 - /**
29 - * Returns resources as a set of {@link LinkResource}s.
30 - *
31 - * @return a set of {@link LinkResource}s
32 - */
33 - Set<LinkResource> resources();
34 -
35 - /**
36 - * Builder of {@link LinkResources}.
37 - *
38 - * @deprecated in Emu Release
39 - */
40 - @Deprecated
41 - interface Builder {
42 -
43 - /**
44 - * Adds bandwidth resource.
45 - * <p>
46 - * This operation adds given bandwidth to previous bandwidth and
47 - * generates single bandwidth resource.
48 - *
49 - * @param bandwidth bandwidth value to be added
50 - * @return self
51 - */
52 - Builder addBandwidth(double bandwidth);
53 -
54 - /**
55 - * Adds lambda resource.
56 - *
57 - * @param lambda lambda value to be added
58 - * @return self
59 - */
60 - Builder addLambda(int lambda);
61 -
62 - /**
63 - * Builds an immutable link resources.
64 - *
65 - * @return link resources
66 - */
67 - LinkResources build();
68 - }
69 -}
1 -/*
2 - * Copyright 2014-2015 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 -
17 -package org.onosproject.net.resource.link;
18 -
19 -import java.util.Objects;
20 -
21 -/**
22 - * Representation of MPLS label resource.
23 - *
24 - * @deprecated in Emu Release
25 - */
26 -@Deprecated
27 -public final class MplsLabel implements LinkResource {
28 -
29 - private final org.onlab.packet.MplsLabel mplsLabel;
30 -
31 -
32 - /**
33 - * Creates a new instance with given MPLS label.
34 - *
35 - * @param mplsLabel MPLS Label value to be assigned
36 - */
37 - public MplsLabel(int mplsLabel) {
38 - this.mplsLabel = org.onlab.packet.MplsLabel.mplsLabel(mplsLabel);
39 - }
40 -
41 - /**
42 - * Creates a new instance with given MPLS label.
43 - *
44 - * @param mplsLabel mplsLabel value to be assigned
45 - * @return {@link MplsLabel} instance with given bandwidth
46 - */
47 - public static MplsLabel valueOf(int mplsLabel) {
48 - return new MplsLabel(mplsLabel);
49 - }
50 -
51 - /**
52 - * Returns MPLS Label as an MPLS Label Object.
53 - *
54 - * @return MPLS label as an MPLS Label Object.
55 - */
56 - public org.onlab.packet.MplsLabel label() {
57 - return mplsLabel;
58 - }
59 -
60 - @Override
61 - public boolean equals(Object obj) {
62 - if (obj instanceof MplsLabel) {
63 - MplsLabel that = (MplsLabel) obj;
64 - return Objects.equals(this.mplsLabel, that.mplsLabel);
65 - }
66 - return false;
67 - }
68 -
69 - @Override
70 - public int hashCode() {
71 - return Objects.hashCode(this.mplsLabel);
72 - }
73 -
74 - @Override
75 - public String toString() {
76 - return String.valueOf(this.mplsLabel);
77 - }
78 -}
1 - /*
2 - * Copyright 2014-2015 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 -
17 -package org.onosproject.net.resource.link;
18 -
19 -import com.google.common.base.MoreObjects;
20 -import org.onosproject.net.resource.ResourceAllocation;
21 -import org.onosproject.net.resource.ResourceType;
22 -
23 -import java.util.Objects;
24 -
25 -/**
26 - * Representation of allocated MPLS label resource.
27 - *
28 - * @deprecated in Emu Release
29 - */
30 -@Deprecated
31 -public class MplsLabelResourceAllocation implements ResourceAllocation {
32 - private final MplsLabel mplsLabel;
33 -
34 - @Override
35 - public ResourceType type() {
36 - return ResourceType.MPLS_LABEL;
37 - }
38 -
39 - /**
40 - * Creates a new {@link MplsLabelResourceAllocation} with {@link MplsLabel}
41 - * object.
42 - *
43 - * @param mplsLabel allocated MPLS Label
44 - */
45 - public MplsLabelResourceAllocation(MplsLabel mplsLabel) {
46 - this.mplsLabel = mplsLabel;
47 - }
48 -
49 - /**
50 - * Returns the MPLS label resource.
51 - *
52 - * @return the MPLS label resource
53 - */
54 - public MplsLabel mplsLabel() {
55 - return mplsLabel;
56 - }
57 -
58 - @Override
59 - public int hashCode() {
60 - return Objects.hashCode(mplsLabel);
61 - }
62 -
63 - @Override
64 - public boolean equals(Object obj) {
65 - if (this == obj) {
66 - return true;
67 - }
68 - if (obj == null || getClass() != obj.getClass()) {
69 - return false;
70 - }
71 - final MplsLabelResourceAllocation other = (MplsLabelResourceAllocation) obj;
72 - return Objects.equals(this.mplsLabel, other.mplsLabel);
73 - }
74 -
75 - @Override
76 - public String toString() {
77 - return MoreObjects.toStringHelper(this)
78 - .add("mplsLabel", mplsLabel)
79 - .toString();
80 - }
81 -}
1 -/*
2 - * Copyright 2014-2015 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.net.resource.link;
17 -
18 -import com.google.common.annotations.Beta;
19 -import com.google.common.base.MoreObjects;
20 -import org.onosproject.net.resource.ResourceRequest;
21 -import org.onosproject.net.resource.ResourceType;
22 -
23 -import static com.google.common.base.Preconditions.checkNotNull;
24 -
25 -/**
26 - * Representation of a request for lambda resource.
27 - *
28 - * @deprecated in Emu Release
29 - */
30 -@Deprecated
31 -public class MplsLabelResourceRequest implements ResourceRequest {
32 -
33 - private final MplsLabel mplsLabel;
34 -
35 - /**
36 - * Constructs a request specifying the given MPLS label.
37 - *
38 - * @param mplsLabel MPLS label to be requested
39 - */
40 - @Beta
41 - public MplsLabelResourceRequest(MplsLabel mplsLabel) {
42 - this.mplsLabel = checkNotNull(mplsLabel);
43 - }
44 -
45 - /**
46 - * Constructs a request asking an arbitrary available MPLS label.
47 - *
48 - * @deprecated in Emu Release
49 - */
50 - @Deprecated
51 - public MplsLabelResourceRequest() {
52 - this.mplsLabel = null;
53 - }
54 -
55 - /**
56 - * Returns the MPLS label this request expects.
57 - *
58 - * @return the MPLS label this request expects
59 - */
60 - @Beta
61 - public MplsLabel mplsLabel() {
62 - return mplsLabel;
63 - }
64 -
65 - @Override
66 - public ResourceType type() {
67 - return ResourceType.MPLS_LABEL;
68 - }
69 -
70 - @Override
71 - public String toString() {
72 - return MoreObjects.toStringHelper(this)
73 - .add("mplsLabel", mplsLabel)
74 - .toString();
75 - }
76 -}
1 -/*
2 - * Copyright 2015 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.net.resource;
17 -
18 -import org.junit.Test;
19 -
20 -import com.google.common.testing.EqualsTester;
21 -import org.onosproject.net.resource.link.MplsLabel;
22 -import org.onosproject.net.resource.link.MplsLabelResourceAllocation;
23 -
24 -import static org.hamcrest.MatcherAssert.assertThat;
25 -import static org.hamcrest.Matchers.is;
26 -
27 -/**
28 - * Unit tests for MPLS objects.
29 - */
30 -public class MplsObjectsTest {
31 -
32 - MplsLabel label1 = MplsLabel.valueOf(1);
33 - MplsLabel label2 = MplsLabel.valueOf(2);
34 - MplsLabel sameAsLabel1 = MplsLabel.valueOf(1);
35 - MplsLabel sameAsLabel2 = MplsLabel.valueOf(2);
36 - MplsLabel label3 = MplsLabel.valueOf(3);
37 -
38 - /**
39 - * Tests creation of MPLS label objects.
40 - */
41 - @Test
42 - public void checkLabelConstruction() {
43 - assertThat(label1.label().toInt(), is(1));
44 - }
45 -
46 - /**
47 - * Tests the operation of equals(), hashCode() and toString().
48 - */
49 - @Test
50 - public void testLabelEqualsOperation() {
51 - new EqualsTester()
52 - .addEqualityGroup(label1, sameAsLabel1)
53 - .addEqualityGroup(label2, sameAsLabel2)
54 - .addEqualityGroup(label3)
55 - .testEquals();
56 - }
57 -
58 - MplsLabelResourceAllocation labelAllocation1 =
59 - new MplsLabelResourceAllocation(label1);
60 - MplsLabelResourceAllocation sameAsLabelAllocation1 =
61 - new MplsLabelResourceAllocation(label1);
62 - MplsLabelResourceAllocation labelAllocation2 =
63 - new MplsLabelResourceAllocation(label2);
64 - MplsLabelResourceAllocation sameAsLabelAllocation2 =
65 - new MplsLabelResourceAllocation(label2);
66 - MplsLabelResourceAllocation labelAllocation3 =
67 - new MplsLabelResourceAllocation(label3);
68 -
69 - /**
70 - * Tests creation of MPLS label objects.
71 - */
72 - @Test
73 - public void checkLabelResourceAllocationConstruction() {
74 - assertThat(labelAllocation1.mplsLabel().label().toInt(), is(1));
75 - assertThat(labelAllocation1.type(), is(ResourceType.MPLS_LABEL));
76 - }
77 -
78 - /**
79 - * Tests the operation of equals(), hashCode() and toString().
80 - */
81 - @Test
82 - public void testLabelResourceAllocationEqualsOperation() {
83 - new EqualsTester()
84 - .addEqualityGroup(labelAllocation1, sameAsLabelAllocation1)
85 - .addEqualityGroup(labelAllocation2, sameAsLabelAllocation2)
86 - .addEqualityGroup(labelAllocation3)
87 - .testEquals();
88 - }
89 -}
...@@ -188,18 +188,6 @@ import org.onosproject.net.packet.DefaultOutboundPacket; ...@@ -188,18 +188,6 @@ import org.onosproject.net.packet.DefaultOutboundPacket;
188 import org.onosproject.net.packet.DefaultPacketRequest; 188 import org.onosproject.net.packet.DefaultPacketRequest;
189 import org.onosproject.net.packet.PacketPriority; 189 import org.onosproject.net.packet.PacketPriority;
190 import org.onosproject.net.provider.ProviderId; 190 import org.onosproject.net.provider.ProviderId;
191 -import org.onosproject.net.resource.link.BandwidthResource;
192 -import org.onosproject.net.resource.link.BandwidthResourceAllocation;
193 -import org.onosproject.net.resource.link.BandwidthResourceRequest;
194 -import org.onosproject.net.resource.link.DefaultLinkResourceAllocations;
195 -import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
196 -import org.onosproject.net.resource.link.LambdaResource;
197 -import org.onosproject.net.resource.link.LambdaResourceAllocation;
198 -import org.onosproject.net.resource.link.LambdaResourceRequest;
199 -import org.onosproject.net.resource.link.LinkResourceRequest;
200 -import org.onosproject.net.resource.link.MplsLabel;
201 -import org.onosproject.net.resource.link.MplsLabelResourceAllocation;
202 -import org.onosproject.net.resource.link.MplsLabelResourceRequest;
203 import org.onosproject.security.Permission; 191 import org.onosproject.security.Permission;
204 import org.onosproject.store.Timestamp; 192 import org.onosproject.store.Timestamp;
205 import org.onosproject.store.primitives.MapUpdate; 193 import org.onosproject.store.primitives.MapUpdate;
...@@ -438,15 +426,6 @@ public final class KryoNamespaces { ...@@ -438,15 +426,6 @@ public final class KryoNamespaces {
438 OpticalConnectivityIntent.class, 426 OpticalConnectivityIntent.class,
439 OpticalPathIntent.class, 427 OpticalPathIntent.class,
440 OpticalCircuitIntent.class, 428 OpticalCircuitIntent.class,
441 - LinkResourceRequest.class,
442 - DefaultLinkResourceRequest.class,
443 - BandwidthResourceRequest.class,
444 - LambdaResourceRequest.class,
445 - LambdaResource.class,
446 - BandwidthResource.class,
447 - DefaultLinkResourceAllocations.class,
448 - BandwidthResourceAllocation.class,
449 - LambdaResourceAllocation.class,
450 DiscreteResource.class, 429 DiscreteResource.class,
451 ContinuousResource.class, 430 ContinuousResource.class,
452 DiscreteResourceId.class, 431 DiscreteResourceId.class,
...@@ -521,9 +500,6 @@ public final class KryoNamespaces { ...@@ -521,9 +500,6 @@ public final class KryoNamespaces {
521 .register( 500 .register(
522 MplsIntent.class, 501 MplsIntent.class,
523 MplsPathIntent.class, 502 MplsPathIntent.class,
524 - MplsLabelResourceAllocation.class,
525 - MplsLabelResourceRequest.class,
526 - MplsLabel.class,
527 org.onlab.packet.MplsLabel.class, 503 org.onlab.packet.MplsLabel.class,
528 org.onlab.packet.MPLS.class 504 org.onlab.packet.MPLS.class
529 ) 505 )
......
...@@ -45,7 +45,6 @@ import org.onosproject.net.DeviceId; ...@@ -45,7 +45,6 @@ import org.onosproject.net.DeviceId;
45 import org.onosproject.net.GridType; 45 import org.onosproject.net.GridType;
46 import org.onosproject.net.HostLocation; 46 import org.onosproject.net.HostLocation;
47 import org.onosproject.net.Link; 47 import org.onosproject.net.Link;
48 -import org.onosproject.net.Link.Type;
49 import org.onosproject.net.LinkKey; 48 import org.onosproject.net.LinkKey;
50 import org.onosproject.net.OchPort; 49 import org.onosproject.net.OchPort;
51 import org.onosproject.net.OchSignal; 50 import org.onosproject.net.OchSignal;
...@@ -65,14 +64,6 @@ import org.onosproject.net.flow.FlowRuleBatchEntry; ...@@ -65,14 +64,6 @@ import org.onosproject.net.flow.FlowRuleBatchEntry;
65 import org.onosproject.net.intent.IntentId; 64 import org.onosproject.net.intent.IntentId;
66 import org.onosproject.net.newresource.Resources; 65 import org.onosproject.net.newresource.Resources;
67 import org.onosproject.net.provider.ProviderId; 66 import org.onosproject.net.provider.ProviderId;
68 -import org.onosproject.net.resource.link.BandwidthResource;
69 -import org.onosproject.net.resource.link.BandwidthResourceAllocation;
70 -import org.onosproject.net.resource.link.DefaultLinkResourceAllocations;
71 -import org.onosproject.net.resource.link.DefaultLinkResourceRequest;
72 -import org.onosproject.net.resource.link.LambdaResource;
73 -import org.onosproject.net.resource.link.LambdaResourceAllocation;
74 -import org.onosproject.net.resource.link.LinkResourceRequest;
75 -import org.onosproject.net.resource.ResourceAllocation;
76 import org.onosproject.net.intent.constraint.AnnotationConstraint; 67 import org.onosproject.net.intent.constraint.AnnotationConstraint;
77 import org.onosproject.net.intent.constraint.BandwidthConstraint; 68 import org.onosproject.net.intent.constraint.BandwidthConstraint;
78 import org.onosproject.net.intent.constraint.LatencyConstraint; 69 import org.onosproject.net.intent.constraint.LatencyConstraint;
...@@ -92,9 +83,6 @@ import org.onlab.util.KryoNamespace; ...@@ -92,9 +83,6 @@ import org.onlab.util.KryoNamespace;
92 import java.nio.ByteBuffer; 83 import java.nio.ByteBuffer;
93 import java.util.Arrays; 84 import java.util.Arrays;
94 import java.util.Collections; 85 import java.util.Collections;
95 -import java.util.HashMap;
96 -import java.util.Map;
97 -import java.util.Set;
98 import java.time.Duration; 86 import java.time.Duration;
99 87
100 import static java.util.Arrays.asList; 88 import static java.util.Arrays.asList;
...@@ -367,31 +355,6 @@ public class KryoSerializerTest { ...@@ -367,31 +355,6 @@ public class KryoSerializerTest {
367 } 355 }
368 356
369 @Test 357 @Test
370 - public void testDefaultLinkResourceRequest() {
371 - testSerializable(DefaultLinkResourceRequest.builder(IntentId.valueOf(2501), ImmutableList.of())
372 - .addLambdaRequest()
373 - .addBandwidthRequest(32.195)
374 - .build()
375 - );
376 - }
377 -
378 - @Test
379 - public void testDefaultLinkResourceAllocations() {
380 - LinkResourceRequest request = DefaultLinkResourceRequest
381 - .builder(IntentId.valueOf(2501), ImmutableList.of())
382 - .addLambdaRequest()
383 - .addBandwidthRequest(32.195)
384 - .build();
385 - Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
386 - allocations.put(DefaultLink.builder()
387 - .providerId(PID)
388 - .src(CP1).dst(CP2).type(Type.DIRECT).build(),
389 - ImmutableSet.of(new BandwidthResourceAllocation(new BandwidthResource(Bandwidth.bps(10.0))),
390 - new LambdaResourceAllocation(LambdaResource.valueOf(1))));
391 - testSerializable(new DefaultLinkResourceAllocations(request, allocations));
392 - }
393 -
394 - @Test
395 public void testResource() { 358 public void testResource() {
396 testSerializedEquals(Resources.discrete(DID1, P1, VLAN1).resource()); 359 testSerializedEquals(Resources.discrete(DID1, P1, VLAN1).resource());
397 } 360 }
......