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/core/api/src/main/java/org/onosproject/net/group | |
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/core/api/src/main/java/org/onosproject/net/group')
22 files changed, 0 insertions, 2081 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java deleted file mode 100644 index 97f8aedf..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java +++ /dev/null @@ -1,229 +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.net.group; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; - -import org.onosproject.core.GroupId; -import org.onosproject.net.DeviceId; - -/** - * ONOS implementation of default group that is stored in the system. - */ -public class DefaultGroup extends DefaultGroupDescription - implements Group, StoredGroupEntry { - - private GroupState state; - private boolean isGroupStateAddedFirstTime; - private long life; - private long packets; - private long bytes; - private long referenceCount; - private GroupId id; - - /** - * Initializes default values. - * - * @param newId group id for new group - */ - private void initialize(GroupId newId) { - id = newId; - state = GroupState.PENDING_ADD; - life = 0; - packets = 0; - bytes = 0; - referenceCount = 0; - } - - /** - * Default group object constructor with the parameters. - * - * @param id group identifier - * @param groupDesc group description parameters - */ - public DefaultGroup(GroupId id, GroupDescription groupDesc) { - super(groupDesc); - initialize(id); - } - - /** - * Default group object constructor with the available information - * from data plane. - * - * @param id group identifier - * @param deviceId device identifier - * @param type type of the group - * @param buckets immutable list of group bucket - */ - public DefaultGroup(GroupId id, - DeviceId deviceId, - GroupDescription.Type type, - GroupBuckets buckets) { - super(deviceId, type, buckets); - initialize(id); - } - - /** - * Returns group identifier associated with a group object. - * - * @return GroupId Group Identifier - */ - @Override - public GroupId id() { - return this.id; - } - - /** - * Returns current state of a group object. - * - * @return GroupState Group State - */ - @Override - public GroupState state() { - return this.state; - } - - /** - * Returns the number of milliseconds this group has been alive. - * - * @return number of millis - */ - @Override - public long life() { - return this.life; - } - - /** - * Returns the number of packets processed by this group. - * - * @return number of packets - */ - @Override - public long packets() { - return this.packets; - } - - /** - * Returns the number of bytes processed by this group. - * - * @return number of bytes - */ - @Override - public long bytes() { - return this.bytes; - } - - /** - * Sets the new state for this entry. - * - * @param newState new group entry state. - */ - @Override - public void setState(Group.GroupState newState) { - this.state = newState; - } - - /** - * Sets how long this entry has been entered in the system. - * - * @param life epoch time - */ - @Override - public void setLife(long life) { - this.life = life; - } - - /** - * Sets number of packets processed by this group entry. - * - * @param packets a long value - */ - @Override - public void setPackets(long packets) { - this.packets = packets; - } - - /** - * Sets number of bytes processed by this group entry. - * - * @param bytes a long value - */ - @Override - public void setBytes(long bytes) { - this.bytes = bytes; - } - - @Override - public void setReferenceCount(long referenceCount) { - this.referenceCount = referenceCount; - } - - @Override - public long referenceCount() { - return referenceCount; - } - - /* - * The deviceId, type and buckets are used for hash. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), id); - } - - /* - * The deviceId, groupId, type and buckets should be same. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultGroup) { - DefaultGroup that = (DefaultGroup) obj; - return super.equals(obj) && - Objects.equals(id, that.id); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("description", super.toString()) - .add("groupid", id) - .add("state", state) - .toString(); - } - - @Override - public void setIsGroupStateAddedFirstTime(boolean isGroupStateAddedFirstTime) { - this.isGroupStateAddedFirstTime = isGroupStateAddedFirstTime; - } - - @Override - public boolean isGroupStateAddedFirstTime() { - return isGroupStateAddedFirstTime; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupBucket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupBucket.java deleted file mode 100644 index 9d942ee4..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupBucket.java +++ /dev/null @@ -1,266 +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.net.group; - -import org.onosproject.core.GroupId; -import org.onosproject.net.PortNumber; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.flow.instructions.Instruction; - -import java.util.List; -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Group bucket implementation. A group bucket is collection of - * instructions that can be performed on a traffic flow. A select - * Group can have one or more Buckets where traffic will be - * processed by a single bucket in the group, based on device - * specific selection algorithm (e.g. hash on some fields of the - * incoming traffic flows or round robin) and hence can contains - * optional weight field to define the weights among the buckets - * in the group. A failover group bucket is associated with a - * specific port or group that controls its liveness. - */ -public final class DefaultGroupBucket implements GroupBucket, StoredGroupBucketEntry { - private final GroupDescription.Type type; - private final TrafficTreatment treatment; - private final short weight; - private final PortNumber watchPort; - private final GroupId watchGroup; - private long packets; - private long bytes; - - /** - * Group bucket constructor with the parameters. - * - * @param type group bucket type - * @param treatment traffic treatment associated with group bucket - * @param weight optional weight associated with group bucket - * @param watchPort port that determines the liveness of group bucket - * @param watchGroup group that determines the liveness of group bucket - */ - private DefaultGroupBucket(GroupDescription.Type type, - TrafficTreatment treatment, - short weight, - PortNumber watchPort, - GroupId watchGroup) { - this.type = type; - this.treatment = checkNotNull(treatment); - this.weight = weight; - this.watchPort = watchPort; - this.watchGroup = watchGroup; - } - - /** - * Creates indirect group bucket. - * - * @param treatment traffic treatment associated with group bucket - * @return indirect group bucket object - */ - public static GroupBucket createIndirectGroupBucket( - TrafficTreatment treatment) { - return new DefaultGroupBucket(GroupDescription.Type.INDIRECT, - treatment, - (short) -1, - null, - null); - } - - /** - * Creates select group bucket with weight as 1. - * - * @param treatment traffic treatment associated with group bucket - * @return select group bucket object - */ - public static GroupBucket createSelectGroupBucket( - TrafficTreatment treatment) { - return new DefaultGroupBucket(GroupDescription.Type.SELECT, - treatment, - (short) 1, - null, - null); - } - - /** - * Creates select group bucket with specified weight. - * - * @param treatment traffic treatment associated with group bucket - * @param weight weight associated with group bucket - * @return select group bucket object - */ - public static GroupBucket createSelectGroupBucket( - TrafficTreatment treatment, - short weight) { - if (weight == 0) { - return null; - } - - return new DefaultGroupBucket(GroupDescription.Type.SELECT, - treatment, - weight, - null, - null); - } - - /** - * Creates failover group bucket with watchport or watchgroup. - * - * @param treatment traffic treatment associated with group bucket - * @param watchPort port that determines the liveness of group bucket - * @param watchGroup group that determines the liveness of group bucket - * @return failover group bucket object - */ - public static GroupBucket createFailoverGroupBucket( - TrafficTreatment treatment, - PortNumber watchPort, - GroupId watchGroup) { - checkArgument(((watchPort != null) || (watchGroup != null))); - return new DefaultGroupBucket(GroupDescription.Type.FAILOVER, - treatment, - (short) -1, - watchPort, - watchGroup); - } - - /** - * Creates all group bucket. - * - * @param treatment traffic treatment associated with group bucket - * @return all group bucket object - */ - public static GroupBucket createAllGroupBucket(TrafficTreatment treatment) { - return new DefaultGroupBucket(GroupDescription.Type.ALL, - treatment, - (short) -1, - null, - null); - } - - @Override - public GroupDescription.Type type() { - return this.type; - } - - /** - * Returns list of Traffic instructions that are part of the bucket. - * - * @return TrafficTreatment Traffic instruction list - */ - @Override - public TrafficTreatment treatment() { - return treatment; - } - - /** - * Returns weight of select group bucket. - * - * @return short weight associated with a bucket - */ - @Override - public short weight() { - return weight; - } - - /** - * Returns port number used for liveness detection for a - * failover bucket. - * - * @return PortNumber port number used for liveness detection - */ - @Override - public PortNumber watchPort() { - return watchPort; - } - - /** - * Returns group identifier used for liveness detection for a - * failover bucket. - * - * @return GroupId group identifier to be used for liveness detection - */ - @Override - public GroupId watchGroup() { - return watchGroup; - } - - /* - * The type and treatment can change on a given bucket - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public int hashCode() { - return Objects.hash(type, treatment); - } - - /* - * The priority and statistics can change on a given treatment and selector - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultGroupBucket) { - DefaultGroupBucket that = (DefaultGroupBucket) obj; - List<Instruction> myInstructions = this.treatment.allInstructions(); - List<Instruction> theirInstructions = that.treatment.allInstructions(); - - return Objects.equals(type, that.type) && - myInstructions.containsAll(theirInstructions) && - theirInstructions.containsAll(myInstructions); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("type", type) - .add("treatment", treatment) - .add("packets", packets) - .add("bytes", bytes) - .toString(); - } - - @Override - public long packets() { - return packets; - } - - @Override - public long bytes() { - return bytes; - } - - @Override - public void setPackets(long packets) { - this.packets = packets; - } - - @Override - public void setBytes(long bytes) { - this.bytes = bytes; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java deleted file mode 100644 index 1580d835..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java +++ /dev/null @@ -1,204 +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.net.group; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -/** - * Default implementation of group description interface. - */ -public class DefaultGroupDescription implements GroupDescription { - private final GroupDescription.Type type; - private final GroupBuckets buckets; - private final GroupKey appCookie; - private final ApplicationId appId; - private final DeviceId deviceId; - private final Integer givenGroupId; - - /** - * Constructor to be used by north bound applications. - * NOTE: The caller of this subsystem MUST ensure the appCookie - * provided in this API is immutable. - * NOTE: The caller may choose to pass in 'null' for the groupId. This is - * the typical case, where the caller allows the group subsystem to choose - * the groupId in a globally unique way. If the caller passes in the groupId, - * the caller MUST ensure that the id is globally unique (not just unique - * per device). - * - * @param deviceId device identifier - * @param type type of the group - * @param buckets immutable list of group bucket - * @param appCookie immutable application cookie of type DefaultGroupKey - * to be associated with the group - * @param groupId group identifier - * @param appId application id - */ - public DefaultGroupDescription(DeviceId deviceId, - GroupDescription.Type type, - GroupBuckets buckets, - GroupKey appCookie, - Integer groupId, - ApplicationId appId) { - this.type = checkNotNull(type); - this.deviceId = checkNotNull(deviceId); - this.buckets = checkNotNull(buckets); - this.appCookie = appCookie; - this.givenGroupId = groupId; - this.appId = appId; - } - - /** - * Constructor to be used by group subsystem internal components. - * Creates group description object from another object of same type. - * - * @param groupDesc group description object - * - */ - public DefaultGroupDescription(GroupDescription groupDesc) { - this.type = groupDesc.type(); - this.deviceId = groupDesc.deviceId(); - this.buckets = groupDesc.buckets(); - this.appCookie = groupDesc.appCookie(); - this.appId = groupDesc.appId(); - this.givenGroupId = groupDesc.givenGroupId(); - } - - /** - * Constructor to be used by group subsystem internal components. - * Creates group description object from the information retrieved - * from data plane. - * - * @param deviceId device identifier - * @param type type of the group - * @param buckets immutable list of group bucket - * - */ - public DefaultGroupDescription(DeviceId deviceId, - GroupDescription.Type type, - GroupBuckets buckets) { - this(deviceId, type, buckets, null, null, null); - } - - /** - * Returns type of a group object. - * - * @return GroupType group type - */ - @Override - public GroupDescription.Type type() { - return this.type; - } - - /** - * Returns device identifier on which this group object is created. - * - * @return DeviceId device identifier - */ - @Override - public DeviceId deviceId() { - return this.deviceId; - } - - /** - * Returns application identifier that has created this group object. - * - * @return ApplicationId application identifier - */ - @Override - public ApplicationId appId() { - return this.appId; - } - - /** - * Returns application cookie associated with a group object. - * - * @return GroupKey application cookie - */ - @Override - public GroupKey appCookie() { - return this.appCookie; - } - - /** - * Returns group buckets of a group. - * - * @return GroupBuckets immutable list of group bucket - */ - @Override - public GroupBuckets buckets() { - return this.buckets; - } - - /** - * Returns groupId passed in by application. - * - * @return Integer group Id passed in by caller. May be null if caller passed - * in null during GroupDescription creation. - */ - @Override - public Integer givenGroupId() { - return this.givenGroupId; - } - - @Override - /* - * The deviceId, type and buckets are used for hash. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public int hashCode() { - return Objects.hash(deviceId, type, buckets); - } - - @Override - /* - * The deviceId, type and buckets should be same. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultGroupDescription) { - DefaultGroupDescription that = (DefaultGroupDescription) obj; - return Objects.equals(deviceId, that.deviceId) && - Objects.equals(type, that.type) && - Objects.equals(buckets, that.buckets); - - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("deviceId", deviceId) - .add("type", type) - .add("buckets", buckets) - .add("appId", appId) - .add("givenGroupId", givenGroupId) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java deleted file mode 100644 index e1eacd1e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java +++ /dev/null @@ -1,72 +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.net.group; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Arrays; - -/** - * Default implementation of group key interface. - */ -public class DefaultGroupKey implements GroupKey { - - private final byte[] key; - protected static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - - public DefaultGroupKey(byte[] key) { - this.key = checkNotNull(key); - } - - @Override - public byte[] key() { - return key; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof DefaultGroupKey)) { - return false; - } - DefaultGroupKey that = (DefaultGroupKey) o; - return (Arrays.equals(this.key, that.key)); - } - - @Override - public int hashCode() { - return Arrays.hashCode(this.key); - } - - /** - * Returns a hex string representation of the byte array that is used - * as a group key. This solution was adapted from - * http://stackoverflow.com/questions/9655181/ - */ - @Override - public String toString() { - char[] hexChars = new char[key.length * 2]; - for (int j = 0; j < key.length; j++) { - int v = key[j] & 0xFF; - hexChars[j * 2] = HEX_ARRAY[v >>> 4]; - hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; - } - return "GroupKey:0x" + new String(hexChars); - } - -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/Group.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/Group.java deleted file mode 100644 index 54407752..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/Group.java +++ /dev/null @@ -1,99 +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.net.group; - -import org.onosproject.core.GroupId; - -/** - * ONOS representation of group that is stored in the system. - */ -public interface Group extends GroupDescription { - /** - * State of the group object in ONOS. - */ - enum GroupState { - /** - * Group create request is queued as group AUDIT is in progress. - */ - WAITING_AUDIT_COMPLETE, - /** - * Group create request is processed by ONOS and not yet - * received the confirmation from data plane. - */ - PENDING_ADD, - /** - * Group is missing in data plane and retrying GROUP ADD request. - */ - PENDING_ADD_RETRY, - /** - * Group is created in the data plane. - */ - ADDED, - /** - * Group update request is processed by ONOS and not - * received the confirmation from data plane post which - * state moves to ADDED state. - */ - PENDING_UPDATE, - /** - * Group delete request is processed by ONOS and not - * received the confirmation from data plane. - */ - PENDING_DELETE - } - - /** - * Returns group identifier associated with a group object. - * - * @return GroupId Group Identifier - */ - GroupId id(); - - /** - * Returns current state of a group object. - * - * @return GroupState Group State - */ - GroupState state(); - - /** - * Returns the number of milliseconds this group has been alive. - * - * @return number of millis - */ - long life(); - - /** - * Returns the number of packets processed by this group. - * - * @return number of packets - */ - long packets(); - - /** - * Returns the number of bytes processed by this group. - * - * @return number of bytes - */ - long bytes(); - - /** - * Returns the number of flow rules or other groups reference this group. - * - * @return number of flow rules or other groups pointing to this group - */ - long referenceCount(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBucket.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBucket.java deleted file mode 100644 index a503c154..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBucket.java +++ /dev/null @@ -1,80 +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.net.group; - -import org.onosproject.core.GroupId; -import org.onosproject.net.PortNumber; -import org.onosproject.net.flow.TrafficTreatment; - -/** - * Group Bucket definition. A default group Bucket is collection of - * Instructions that can be performed on a traffic flow. A failover - * group bucket is associated with a specific port or group that - * controls its liveness. A select group bucket contains optional - * weight field to define the weights among the buckets in the group. - */ -public interface GroupBucket { - /** - * Returns group type of the bucket. - * - * @return GroupType group type - */ - GroupDescription.Type type(); - - /** - * Returns list of Traffic instructions that are part of the bucket. - * - * @return TrafficTreatment traffic instruction list - */ - TrafficTreatment treatment(); - - /** - * Returns weight of select group bucket. - * - * @return short weight associated with a bucket - */ - short weight(); - - /** - * Returns port number used for liveness detection for a - * failover bucket. - * - * @return PortNumber port number used for liveness detection - */ - PortNumber watchPort(); - - /** - * Returns group identifier used for liveness detection for a - * failover bucket. - * - * @return GroupId group identifier to be used for liveness detection - */ - GroupId watchGroup(); - - /** - * Returns the number of packets processed by this group bucket. - * - * @return number of packets - */ - long packets(); - - /** - * Returns the number of bytes processed by this group bucket. - * - * @return number of bytes - */ - long bytes(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBuckets.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBuckets.java deleted file mode 100644 index c0b5e5c6..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupBuckets.java +++ /dev/null @@ -1,76 +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.net.group; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.List; - -import com.google.common.collect.ImmutableList; - -/** - * Immutable collection of group bucket. - */ -public final class GroupBuckets { - private final List<GroupBucket> buckets; - - /** - * Creates a immutable list of group bucket. - * - * @param buckets list of group bucket - */ - public GroupBuckets(List<GroupBucket> buckets) { - this.buckets = ImmutableList.copyOf(checkNotNull(buckets)); - } - - /** - * Returns immutable list of group buckets. - * - * @return list of group bucket - */ - public List<GroupBucket> buckets() { - return buckets; - } - - @Override - public int hashCode() { - int result = 17; - int combinedHash = 0; - for (GroupBucket bucket:buckets) { - combinedHash = combinedHash + bucket.hashCode(); - } - result = 31 * result + combinedHash; - - return result; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof GroupBuckets) { - return (this.buckets.containsAll(((GroupBuckets) obj).buckets) && - ((GroupBuckets) obj).buckets.containsAll(this.buckets)); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("buckets", buckets.toString()) - .toString(); - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupDescription.java deleted file mode 100644 index 671b9a54..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupDescription.java +++ /dev/null @@ -1,91 +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.net.group; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.DeviceId; - -/** - * ONOS representation of group description that is used to create - * a group. It contains immutable properties of a ONOS group construct - * such as "type", "DeviceId", "appCookie", "appId" and "buckets" - */ -public interface GroupDescription { - /** - * Types of the group supported by ONOS. - */ - enum Type { - /** - * Load-balancing among different buckets in a group. - */ - SELECT, - /** - * Single Bucket Group. - */ - INDIRECT, - /** - * Multicast to all buckets in a group. - */ - ALL, - /** - * Uses the first live bucket in a group. - */ - FAILOVER - } - - /** - * Returns type of a group object. - * - * @return GroupType group type - */ - Type type(); - - /** - * Returns device identifier on which this group object is created. - * - * @return DeviceId device identifier - */ - DeviceId deviceId(); - - /** - * Returns application identifier that has created this group object. - * - * @return ApplicationId application identifier - */ - ApplicationId appId(); - - /** - * Returns application cookie associated with a group object. - * - * @return GroupKey application cookie - */ - GroupKey appCookie(); - - /** - * Returns groupId passed in by caller. - * - * @return Integer group id passed in by caller. May be null if caller - * passed in null to let groupService determin the group id. - */ - Integer givenGroupId(); - - /** - * Returns group buckets of a group. - * - * @return GroupBuckets immutable list of group bucket - */ - GroupBuckets buckets(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupEvent.java deleted file mode 100644 index 45fbb3ed..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupEvent.java +++ /dev/null @@ -1,99 +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.net.group; - -import org.onosproject.event.AbstractEvent; - -/** - * Describes group events. - */ -public class GroupEvent extends AbstractEvent<GroupEvent.Type, Group> { - - /** - * Type of flow rule events. - */ - public enum Type { - /** - * Signifies that a new Group has been detected. - */ - GROUP_ADDED, - - /** - * Signifies that a Group has been removed. - */ - GROUP_REMOVED, - - /** - * Signifies that a Group has been updated. - */ - GROUP_UPDATED, - - /** - * Signifies that a request to create Group has failed. - */ - GROUP_ADD_FAILED, - - /** - * Signifies that a request to remove Group has failed. - */ - GROUP_REMOVE_FAILED, - - /** - * Signifies that a request to update Group has failed. - */ - GROUP_UPDATE_FAILED, - - // internal event between Manager <-> Store - - /* - * Signifies that a request to create Group has been added to the store. - */ - GROUP_ADD_REQUESTED, - /* - * Signifies that a request to update Group has been added to the store. - */ - GROUP_UPDATE_REQUESTED, - /* - * Signifies that a request to delete Group has been added to the store. - */ - GROUP_REMOVE_REQUESTED, - - - } - - /** - * Creates an event of a given type and for the specified Group and the - * current time. - * - * @param type Group event type - * @param group event subject - */ - public GroupEvent(Type type, Group group) { - super(type, group); - } - - /** - * Creates an event of a given type and for the specified Group and time. - * - * @param type Group event type - * @param group event subject - * @param time occurrence time - */ - public GroupEvent(Type type, Group group, long time) { - super(type, group, time); - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupKey.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupKey.java deleted file mode 100644 index a63bee27..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupKey.java +++ /dev/null @@ -1,31 +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.net.group; - -/** - * Representation of generalized Key that would be used to store - * groups in < Key, Value > store. This key uses a generic - * byte array so that applications can associate their groups with - * any of their data by translating it into a byte array. - */ -public interface GroupKey { - /** - * Returns the byte representation of key. - * - * @return byte array - */ - byte[] key(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupListener.java deleted file mode 100644 index 349ce6a7..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupListener.java +++ /dev/null @@ -1,24 +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.net.group; - -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving Group related events. - */ -public interface GroupListener extends EventListener<GroupEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperation.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperation.java deleted file mode 100644 index e4173b30..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperation.java +++ /dev/null @@ -1,181 +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.net.group; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.core.GroupId; - -/** - * Group operation definition to be used between core and provider - * layers of group subsystem. - * - */ -public final class GroupOperation { - private final Type opType; - private final GroupId groupId; - private final GroupDescription.Type groupType; - private final GroupBuckets buckets; - - public enum Type { - /** - * Create a group in a device with the specified parameters. - */ - ADD, - /** - * Modify a group in a device with the specified parameters. - */ - MODIFY, - /** - * Delete a specified group. - */ - DELETE - } - - /** - * Group operation constructor with the parameters. - * - * @param opType group operation type - * @param groupId group Identifier - * @param groupType type of the group - * @param buckets immutable list of group buckets to be part of group - */ - private GroupOperation(Type opType, - GroupId groupId, - GroupDescription.Type groupType, - GroupBuckets buckets) { - this.opType = checkNotNull(opType); - this.groupId = checkNotNull(groupId); - this.groupType = checkNotNull(groupType); - this.buckets = buckets; - } - - /** - * Creates ADD group operation object. - * - * @param groupId group Identifier - * @param groupType type of the group - * @param buckets immutable list of group buckets to be part of group - * @return add group operation object - */ - public static GroupOperation createAddGroupOperation(GroupId groupId, - GroupDescription.Type groupType, - GroupBuckets buckets) { - checkNotNull(buckets); - return new GroupOperation(Type.ADD, groupId, groupType, buckets); - } - - /** - * Creates MODIFY group operation object. - * - * @param groupId group Identifier - * @param groupType type of the group - * @param buckets immutable list of group buckets to be part of group - * @return modify group operation object - */ - public static GroupOperation createModifyGroupOperation(GroupId groupId, - GroupDescription.Type groupType, - GroupBuckets buckets) { - checkNotNull(buckets); - return new GroupOperation(Type.MODIFY, groupId, groupType, buckets); - - } - - /** - * Creates DELETE group operation object. - * - * @param groupId group Identifier - * @param groupType type of the group - * @return delete group operation object - */ - public static GroupOperation createDeleteGroupOperation(GroupId groupId, - GroupDescription.Type groupType) { - return new GroupOperation(Type.DELETE, groupId, groupType, null); - - } - - /** - * Returns group operation type. - * - * @return GroupOpType group operation type - */ - public Type opType() { - return this.opType; - } - - /** - * Returns group identifier attribute of the operation. - * - * @return GroupId group identifier - */ - public GroupId groupId() { - return this.groupId; - } - - /** - * Returns group type attribute of the operation. - * - * @return GroupType group type - */ - public GroupDescription.Type groupType() { - return this.groupType; - } - - /** - * Returns group buckets associated with the operation. - * - * @return GroupBuckets group buckets - */ - public GroupBuckets buckets() { - return this.buckets; - } - - @Override - /* - * The deviceId, type and buckets are used for hash. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public int hashCode() { - return (buckets != null) ? Objects.hash(groupId, opType, buckets) : - Objects.hash(groupId, opType); - } - - @Override - /* - * The deviceId, type and buckets should be same. - * - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof GroupOperation) { - GroupOperation that = (GroupOperation) obj; - return Objects.equals(groupId, that.groupId) && - Objects.equals(groupType, that.groupType) && - Objects.equals(opType, that.opType) && - Objects.equals(buckets, that.buckets); - - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperations.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperations.java deleted file mode 100644 index bc03628d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupOperations.java +++ /dev/null @@ -1,50 +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.net.group; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.List; - -import com.google.common.collect.ImmutableList; - -/** - * Immutable collection of group operation to be used between - * core and provider layers of group subsystem. - * - */ -public final class GroupOperations { - private final List<GroupOperation> operations; - - /** - * Creates a immutable list of group operation. - * - * @param operations list of group operation - */ - public GroupOperations(List<GroupOperation> operations) { - this.operations = ImmutableList.copyOf(checkNotNull(operations)); - } - - /** - * Returns immutable list of group operation. - * - * @return list of group operation - */ - public List<GroupOperation> operations() { - return operations; - } - -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProvider.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProvider.java deleted file mode 100644 index 6757e669..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProvider.java +++ /dev/null @@ -1,37 +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.net.group; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of group provider. - */ -public interface GroupProvider extends Provider { - - /** - * Performs a batch of group operation in the specified device with the - * specified parameters. - * - * @param deviceId device identifier on which the batch of group - * operations to be executed - * @param groupOps immutable list of group operation - */ - void performGroupOperation(DeviceId deviceId, - GroupOperations groupOps); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderRegistry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderRegistry.java deleted file mode 100644 index d45789db..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderRegistry.java +++ /dev/null @@ -1,25 +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.net.group; - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction for a group provider registry. - */ -public interface GroupProviderRegistry - extends ProviderRegistry<GroupProvider, GroupProviderService> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderService.java deleted file mode 100644 index 076de498..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupProviderService.java +++ /dev/null @@ -1,47 +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.net.group; - -import java.util.Collection; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -/** - * Service through which Group providers can inject information into - * the core. - */ -public interface GroupProviderService extends ProviderService<GroupProvider> { - - /** - * Notifies core if any failure from data plane during group operations. - * - * @param deviceId the device ID - * @param operation offended group operation - */ - void groupOperationFailed(DeviceId deviceId, GroupOperation operation); - - /** - * Pushes the collection of group detected in the data plane along - * with statistics. - * - * @param deviceId device identifier - * @param groupEntries collection of group entries as seen in data plane - */ - void pushGroupMetrics(DeviceId deviceId, - Collection<Group> groupEntries); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupService.java deleted file mode 100644 index 4163248f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupService.java +++ /dev/null @@ -1,139 +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.net.group; - -import org.onosproject.core.ApplicationId; -import org.onosproject.event.ListenerService; -import org.onosproject.net.DeviceId; - -/** - * Service for create/update/delete "group" in the devices. - * Flow entries can point to a "group" defined in the devices that enables - * to represent additional methods of forwarding like load-balancing or - * failover among different group of ports or multicast to all ports - * specified in a group. - * "group" can also be used for grouping common actions of different flows, - * so that in some scenarios only one group entry required to be modified - * for all the referencing flow entries instead of modifying all of them. - * - * This implements semantics of a distributed authoritative group store - * where the master copy of the groups lies with the controller and - * the devices hold only the 'cached' copy. - */ -public interface GroupService - extends ListenerService<GroupEvent, GroupListener> { - - /** - * Creates a group in the specified device with the provided buckets. - * This API provides an option for application to associate a cookie - * while creating a group, so that applications can look-up the - * groups based on the cookies. These Groups will be retained by - * the core system and re-applied if any groups found missing in the - * device when it reconnects. This API would immediately return after - * submitting the request locally or to a remote Master controller - * instance. As a response to this API invocation, GROUP_ADDED or - * GROUP_ADD_FAILED notifications would be provided along with cookie - * depending on the result of the operation on the device in the - * data plane. The caller may also use "getGroup" API to get the - * Group object created as part of this request. - * - * @param groupDesc group creation parameters - * - */ - void addGroup(GroupDescription groupDesc); - - /** - * Returns a group object associated to an application cookie. - * - * NOTE1: The presence of group object in the system does not - * guarantee that the "group" is actually created in device. - * GROUP_ADDED notification would confirm the creation of - * this group in data plane. - * - * @param deviceId device identifier - * @param appCookie application cookie to be used for lookup - * @return group associated with the application cookie or - * NULL if Group is not found for the provided cookie - */ - Group getGroup(DeviceId deviceId, GroupKey appCookie); - - /** - * Appends buckets to existing group. The caller can optionally - * associate a new cookie during this updation. GROUP_UPDATED or - * GROUP_UPDATE_FAILED notifications would be provided along with - * cookie depending on the result of the operation on the device. - * - * @param deviceId device identifier - * @param oldCookie cookie to be used to retrieve the existing group - * @param buckets immutable list of group bucket to be added - * @param newCookie immutable cookie to be used post update operation - * @param appId Application Id - */ - void addBucketsToGroup(DeviceId deviceId, - GroupKey oldCookie, - GroupBuckets buckets, - GroupKey newCookie, - ApplicationId appId); - - /** - * Removes buckets from existing group. The caller can optionally - * associate a new cookie during this updation. GROUP_UPDATED or - * GROUP_UPDATE_FAILED notifications would be provided along with - * cookie depending on the result of the operation on the device. - * - * @param deviceId device identifier - * @param oldCookie cookie to be used to retrieve the existing group - * @param buckets immutable list of group bucket to be removed - * @param newCookie immutable cookie to be used post update operation - * @param appId Application Id - */ - void removeBucketsFromGroup(DeviceId deviceId, - GroupKey oldCookie, - GroupBuckets buckets, - GroupKey newCookie, - ApplicationId appId); - - /** - * Deletes a group associated to an application cookie. - * GROUP_DELETED or GROUP_DELETE_FAILED notifications would be - * provided along with cookie depending on the result of the - * operation on the device. - * - * @param deviceId device identifier - * @param appCookie application cookie to be used for lookup - * @param appId Application Id - */ - void removeGroup(DeviceId deviceId, GroupKey appCookie, ApplicationId appId); - - /** - * Retrieves all groups created by an application in the specified device - * as seen by current controller instance. - * - * @param deviceId device identifier - * @param appId application id - * @return collection of immutable group objects created by the application - */ - Iterable<Group> getGroups(DeviceId deviceId, ApplicationId appId); - - /** - * Returns all groups associated with the given device. - * - * @param deviceId device ID to get groups for - * @return iterable of device's groups - */ - Iterable<Group> getGroups(DeviceId deviceId); - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStore.java deleted file mode 100644 index 8b6df5d9..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStore.java +++ /dev/null @@ -1,175 +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.net.group; - -import java.util.Collection; - -import org.onosproject.core.GroupId; -import org.onosproject.net.DeviceId; -import org.onosproject.store.Store; - -/** - * Manages inventory of groups per device; not intended for direct use. - */ -public interface GroupStore extends Store<GroupEvent, GroupStoreDelegate> { - - enum UpdateType { - /** - * Modify existing group entry by adding provided information. - */ - ADD, - /** - * Modify existing group by removing provided information from it. - */ - REMOVE - } - - /** - * Returns the number of groups for the specified device in the store. - * - * @param deviceId the device ID - * @return number of groups for the specified device - */ - int getGroupCount(DeviceId deviceId); - - /** - * Returns the groups associated with a device. - * - * @param deviceId the device ID - * @return the group entries - */ - Iterable<Group> getGroups(DeviceId deviceId); - - /** - * Returns the stored group entry. - * - * @param deviceId the device ID - * @param appCookie the group key - * @return a group associated with the key - */ - Group getGroup(DeviceId deviceId, GroupKey appCookie); - - /** - * Returns the stored group entry for an id. - * - * @param deviceId the device ID - * @param groupId the group identifier - * @return a group associated with the key - */ - Group getGroup(DeviceId deviceId, GroupId groupId); - - /** - * Stores a new group entry using the information from group description. - * - * @param groupDesc group description to be used to store group entry - */ - void storeGroupDescription(GroupDescription groupDesc); - - /** - * Updates the existing group entry with the information - * from group description. - * - * @param deviceId the device ID - * @param oldAppCookie the current group key - * @param type update type - * @param newBuckets group buckets for updates - * @param newAppCookie optional new group key - */ - void updateGroupDescription(DeviceId deviceId, - GroupKey oldAppCookie, - UpdateType type, - GroupBuckets newBuckets, - GroupKey newAppCookie); - - /** - * Triggers deleting the existing group entry. - * - * @param deviceId the device ID - * @param appCookie the group key - */ - void deleteGroupDescription(DeviceId deviceId, - GroupKey appCookie); - - /** - * Stores a new group entry, or updates an existing entry. - * - * @param group group entry - */ - void addOrUpdateGroupEntry(Group group); - - /** - * Removes the group entry from store. - * - * @param group group entry - */ - void removeGroupEntry(Group group); - - /** - * A group entry that is present in switch but not in the store. - * - * @param group group entry - */ - void addOrUpdateExtraneousGroupEntry(Group group); - - /** - * Remove the group entry from extraneous database. - * - * @param group group entry - */ - void removeExtraneousGroupEntry(Group group); - - /** - * Returns the extraneous groups associated with a device. - * - * @param deviceId the device ID - * - * @return the extraneous group entries - */ - Iterable<Group> getExtraneousGroups(DeviceId deviceId); - - /** - * Indicates the first group audit is completed. - * - * @param deviceId the device ID - * @param completed initial audit status - */ - void deviceInitialAuditCompleted(DeviceId deviceId, boolean completed); - - /** - * Retrieves the initial group audit status for a device. - * - * @param deviceId the device ID - * - * @return initial group audit status - */ - boolean deviceInitialAuditStatus(DeviceId deviceId); - - /** - * Indicates the group operations failed. - * - * @param deviceId the device ID - * @param operation the group operation failed - */ - void groupOperationFailed(DeviceId deviceId, GroupOperation operation); - - /** - * Submits the group metrics to store for a given device ID. - * - * @param deviceId the device ID - * @param groupEntries the group entries as received from southbound - */ - void pushGroupMetrics(DeviceId deviceId, Collection<Group> groupEntries); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStoreDelegate.java deleted file mode 100644 index 308ebb1c..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/GroupStoreDelegate.java +++ /dev/null @@ -1,24 +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.net.group; - -import org.onosproject.store.StoreDelegate; - -/** - * Group store delegate abstraction. - */ -public interface GroupStoreDelegate extends StoreDelegate<GroupEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupBucketEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupBucketEntry.java deleted file mode 100644 index 131875b3..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupBucketEntry.java +++ /dev/null @@ -1,37 +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.net.group; - -/** - * Generic group bucket entry representation that is stored in a - * group object. A group bucket entry provides additional info of - * group bucket like statistics...etc - */ -public interface StoredGroupBucketEntry extends GroupBucket { - /** - * Sets number of packets processed by this group bucket entry. - * - * @param packets a long value - */ - void setPackets(long packets); - - /** - * Sets number of bytes processed by this group bucket entry. - * - * @param bytes a long value - */ - void setBytes(long bytes); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupEntry.java deleted file mode 100644 index 47d36122..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/StoredGroupEntry.java +++ /dev/null @@ -1,75 +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.net.group; - -/** - * Interface that defines set methods for a group entry - * that is stored in the system. - */ -public interface StoredGroupEntry extends Group { - - /** - * Sets the new state for this entry. - * - * @param newState new group entry state. - */ - void setState(Group.GroupState newState); - - /** - * Sets if group has transitioned to ADDED state for the first time. - * This is to differentiate state transitions "from PENDING_ADD to ADDED" - * and "from PENDING_UPDATE to ADDED". For internal use only. - * - * @param isGroupAddedFirstTime true if group moves to ADDED state - * for the first time. - */ - void setIsGroupStateAddedFirstTime(boolean isGroupAddedFirstTime); - - /** - * Returns the isGroupStateAddedFirstTime value. For internal use only. - * - * @return isGroupStateAddedFirstTime value - */ - boolean isGroupStateAddedFirstTime(); - - /** - * Sets how long this entry has been entered in the system. - * - * @param life epoch time - */ - void setLife(long life); - - /** - * Sets number of packets processed by this group entry. - * - * @param packets a long value - */ - void setPackets(long packets); - - /** - * Sets number of bytes processed by this group entry. - * - * @param bytes a long value - */ - void setBytes(long bytes); - - /** - * Sets number of flow rules or groups referencing this group entry. - * - * @param referenceCount reference count - */ - void setReferenceCount(long referenceCount); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/package-info.java deleted file mode 100644 index 26528c48..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/group/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. - */ - -/** - * Abstractions for interacting with device port groups. - */ -package org.onosproject.net.group;
\ No newline at end of file |