diff options
author | CNlucius <lukai1@huawei.com> | 2016-09-13 11:40:12 +0800 |
---|---|---|
committer | CNlucius <lukai1@huawei.com> | 2016-09-13 11:41:53 +0800 |
commit | b731e2f1dd0972409b136aebc7b463dd72c9cfad (patch) | |
tree | 5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource | |
parent | ee93993458266114c29271a481ef9ce7ce621b2a (diff) |
ONOSFW-171
O/S-SFC-ONOS scenario documentation
Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource')
15 files changed, 0 insertions, 1075 deletions
diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java deleted file mode 100644 index 1065503a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderId; -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * the implementation of a label resource of a device. - */ -@Beta -public final class DefaultLabelResource implements LabelResource { - - private DeviceId deviceId; - - private LabelResourceId labelResourceId; - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(String deviceId, long labelResourceId) { - this.deviceId = DeviceId.deviceId(deviceId); - this.labelResourceId = LabelResourceId.labelResourceId(labelResourceId); - } - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(DeviceId deviceId, - LabelResourceId labelResourceId) { - this.deviceId = deviceId; - this.labelResourceId = labelResourceId; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public LabelResourceId labelResourceId() { - return labelResourceId; - } - - @Override - public Annotations annotations() { - return null; - } - - @Override - public ProviderId providerId() { - return null; - } - - @Override - public int hashCode() { - return Objects.hash(deviceId, labelResourceId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof DefaultLabelResource) { - DefaultLabelResource that = (DefaultLabelResource) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.labelResourceId, - that.labelResourceId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("deviceId", deviceId) - .add("labelResourceId", labelResourceId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java deleted file mode 100644 index 6d5a90be..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotated; -import org.onosproject.net.DeviceId; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Provided; - -/** - * Representation of label resource. - */ -@Beta -public interface LabelResource extends Annotated, Provided, NetworkResource { - /** - * Returns device id. - * @return DeviceId - */ - DeviceId deviceId(); - - /** - * Returns label resource identifier. - * - * @return resource id - */ - LabelResourceId labelResourceId(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java deleted file mode 100644 index a6108bb6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -/** - * Service for managing label resource. - */ -@Beta -public interface LabelResourceAdminService { - /** - * Creates the only label resource of some device id from begin label to end - * label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the only global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java deleted file mode 100644 index ae88be57..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Label resource store delegate. - */ -@Beta -public interface LabelResourceDelegate extends StoreDelegate<LabelResourceEvent> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java deleted file mode 100644 index dd02ae21..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes label resource event. - */ -@Beta -public final class LabelResourceEvent - extends AbstractEvent<LabelResourceEvent.Type, LabelResourcePool> { - - /** - * Type of label resource event. - */ - public enum Type { - /** - * Signifies that a new pool has been administratively created. - */ - POOL_CREATED, - /** - * Signifies that a new pool has been administratively destroyed. - */ - POOL_DESTROYED, - /** - * Signifies that a new pool has been administratively changed. - */ - POOL_CAPACITY_CHANGED - } - - /** - * Creates an event of a given type and the given LabelResourcePool. - * - * @param type event type - * @param subject pool - */ - public LabelResourceEvent(Type type, LabelResourcePool subject) { - super(type, subject); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java deleted file mode 100644 index 6fe7067d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.resource.ResourceId; - -import java.util.Objects; - -/** - * Representation of a label. - */ -@Beta -public final class LabelResourceId implements ResourceId { - - private long labelId; - - public static LabelResourceId labelResourceId(long labelResourceId) { - return new LabelResourceId(labelResourceId); - } - - // Public construction is prohibited - private LabelResourceId(long labelId) { - this.labelId = labelId; - } - - public long labelId() { - return labelId; - } - - @Override - public int hashCode() { - return Objects.hashCode(labelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceId) { - LabelResourceId that = (LabelResourceId) obj; - return Objects.equals(this.labelId, that.labelId); - } - return false; - } - - @Override - public String toString() { - return String.valueOf(this.labelId); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java deleted file mode 100644 index b7f907c6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving label resource related events. - */ -@Beta -public interface LabelResourceListener extends EventListener<LabelResourceEvent> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java deleted file mode 100644 index 75916af0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Collections; -import java.util.Objects; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Abstraction of the capacity of device label resource or global label - * resource. It's contiguous range of label resource. When a application apply - * some labels of some device, first catch from Set that store - * available labels, if the size of the Set less than the apply number, then get - * labels by calculating with three attributes, beginLabel,endLabel and - * currentUsedMaxLabelId. - */ -@Beta -public class LabelResourcePool { - - private final DeviceId deviceId; - private final LabelResourceId beginLabel; - private final LabelResourceId endLabel; - private final long totalNum; // capacity of label resource pool - private final long usedNum; // have used label number - private final LabelResourceId currentUsedMaxLabelId; // the maximal label - // number id - private ImmutableSet<LabelResource> releaseLabelId; // Set of released label - - /** - * Creates a pool by device id,begin label id,end label id. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel) { - this(deviceId, beginLabel, endLabel, endLabel - beginLabel + 1, 0L, - beginLabel, ImmutableSet.copyOf(Collections.emptySet())); - } - - /** - * Creates a pool by device id,begin label id,end label id. - * Used to update a pool in the store. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - * @param totalNum capacity of label resource pool - * @param usedNum have used label number - * @param currentUsedMaxLabelId the maximal label number id - * @param releaseLabelId Set of released label - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel, - long totalNum, long usedNum, - long currentUsedMaxLabelId, - ImmutableSet<LabelResource> releaseLabelId) { - checkArgument(endLabel >= beginLabel, - "endLabel %s must be greater than or equal to beginLabel %s", - endLabel, beginLabel); - this.deviceId = DeviceId.deviceId(deviceId); - this.beginLabel = LabelResourceId.labelResourceId(beginLabel); - this.endLabel = LabelResourceId.labelResourceId(endLabel); - this.totalNum = totalNum; - this.usedNum = usedNum; - this.currentUsedMaxLabelId = LabelResourceId - .labelResourceId(currentUsedMaxLabelId); - this.releaseLabelId = releaseLabelId; - } - - /** - * Returns a device id. - * - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns a begin Label id. - * - * @return begin Label id - */ - public LabelResourceId beginLabel() { - return beginLabel; - } - - /** - * Returns an end Label id. - * - * @return end Label id - */ - public LabelResourceId endLabel() { - return endLabel; - } - - /** - * Returns a begin Label id. - * - * @return current Used Maximal Label Id - */ - public LabelResourceId currentUsedMaxLabelId() { - return currentUsedMaxLabelId; - } - - /** - * Returns total number. - * - * @return the total label number - */ - public long totalNum() { - return totalNum; - } - - /** - * Returns used number. - * - * @return the used label number - */ - public long usedNum() { - return usedNum; - } - - /** - * Returns the Set of released label before. - * - * @return the Set of LabelResource - */ - public Set<LabelResource> releaseLabelId() { - return releaseLabelId; - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.beginLabel, this.endLabel, - this.totalNum, this.usedNum, - this.currentUsedMaxLabelId, this.releaseLabelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourcePool) { - LabelResourcePool that = (LabelResourcePool) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.beginLabel, that.beginLabel) - && Objects.equals(this.endLabel, that.endLabel) - && Objects.equals(this.totalNum, that.totalNum) - && Objects.equals(this.usedNum, that.usedNum) - && Objects.equals(this.currentUsedMaxLabelId, - that.currentUsedMaxLabelId) - && Objects.equals(this.releaseLabelId, that.releaseLabelId); - } - return false; - } - - @Override - public String toString() { - // TODO Auto-generated method stub - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("beginLabel", this.beginLabel) - .add("endLabel", this.endLabel).add("totalNum", this.totalNum) - .add("usedNum", this.usedNum) - .add("currentUsedMaxLabelId", this.currentUsedMaxLabelId) - .add("releaseLabelId", this.releaseLabelId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java deleted file mode 100644 index 821177a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of an entity providing information about label resource - * to the core. - */ -@Beta -public interface LabelResourceProvider extends Provider { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java deleted file mode 100644 index e6234974..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an label resource provider registry. - */ -@Beta -public interface LabelResourceProviderRegistry - extends ProviderRegistry<LabelResourceProvider, LabelResourceProviderService> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java deleted file mode 100644 index 9a1472d6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -/** - * Means for injecting label information into the core. - */ -@Beta -public interface LabelResourceProviderService extends ProviderService<LabelResourceProvider> { - - /** - * Signals that a device label resource pool has been detected. - * @param deviceId device identifier - * @param beginLabel the begin label number of resource - * @param endLabel the end label number of resource - */ - void deviceLabelResourcePoolDetected(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Signals that an label resource pool has been destroyed. - * @param deviceId device identifier - */ - void deviceLabelResourcePoolDestroyed(DeviceId deviceId); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java deleted file mode 100644 index 9ff6a587..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import java.util.Collection; -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Represents for a label request. - */ -@Beta -public class LabelResourceRequest { - - private final DeviceId deviceId; - private final Type type; - private final long applyNum; - private ImmutableSet<LabelResource> releaseCollection; - - /** - * Creates LabelResourceRequest object. - * @param deviceId device identifier - * @param type request type - * @param applyNum apply the number of labels - * @param releaseCollection Set of released label - */ - public LabelResourceRequest(DeviceId deviceId, - Type type, - long applyNum, - ImmutableSet<LabelResource> releaseCollection) { - this.deviceId = deviceId; - this.type = type; - this.applyNum = applyNum; - this.releaseCollection = releaseCollection; - } - /** - * Returns a device id. - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns request type. - * @return Type - */ - public Type type() { - return type; - } - - /** - * Returns apply label number. - * @return label number - */ - public long applyNum() { - return applyNum; - } - - /** - * Returns the collection of release labels. - * @return Collection of DefaultLabelResource - */ - public Collection<LabelResource> releaseCollection() { - return releaseCollection; - } - - /** - * Request type. - */ - public enum Type { - APPLY, //apple label request - RELEASE //release label request - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.applyNum, this.type, - this.releaseCollection); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceRequest) { - LabelResourceRequest that = (LabelResourceRequest) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.applyNum, that.applyNum) - && Objects.equals(this.type, that.type) - && Objects.equals(this.releaseCollection, - that.releaseCollection); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("applyNum", this.applyNum).add("type", this.type) - .add("releaseCollection", this.releaseCollection).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java deleted file mode 100644 index bb86d475..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.event.ListenerService; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.Multimap; - -/** - * Service for providing label resource allocation. - */ -@Beta -public interface LabelResourceService - extends ListenerService<LabelResourceEvent, LabelResourceListener> { - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set<LabelResourceId> release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused label number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool of a label resource by a specific device - * id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java deleted file mode 100644 index 5322d013..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.incubator.net.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.store.Store; - -import com.google.common.collect.Multimap; - -/** - * Manages inventory of label; not intended for direct use. - * - */ -@Beta -public interface LabelResourceStore - extends Store<LabelResourceEvent, LabelResourceDelegate> { - - /** - * Creates a label resource of some device id from begin label to end label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys a the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum apply the number of labels - * @return collection of labels - */ - Collection<LabelResource> applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set<LabelResourceId> release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool by a specific device id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java deleted file mode 100644 index 9df466e9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Service for reserving labels as network resources. - */ -package org.onosproject.incubator.net.resource.label;
\ No newline at end of file |