Save developers from wasting hours on wrong bucket type
Enforce bucket type to be consistent with group type
Update unit tests accordingly
Change-Id: Ia5f56ca4b5445268ebee09e321c34ed3f3f39827
(cherry picked from commit 5c00be8b143eb73d42b98820641da5c20e458579)
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
index 0867213..19c9671 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
@@ -76,23 +76,22 @@
@Test
public void codecEncodeTest() {
- GroupBucket bucket1 = DefaultGroupBucket
- .createSelectGroupBucket(DefaultTrafficTreatment.emptyTreatment());
- GroupBucket bucket2 = DefaultGroupBucket
- .createIndirectGroupBucket(DefaultTrafficTreatment.emptyTreatment());
- GroupBuckets buckets = new GroupBuckets(ImmutableList.of(bucket1, bucket2));
- GroupBuckets bucketsIndirect = new GroupBuckets(ImmutableList.of(bucket2));
+ GroupBucket bucket1 = DefaultGroupBucket.createAllGroupBucket(DefaultTrafficTreatment.emptyTreatment());
+ GroupBucket bucket2 = DefaultGroupBucket.createAllGroupBucket(DefaultTrafficTreatment.emptyTreatment());
+ GroupBucket bucket3 = DefaultGroupBucket.createIndirectGroupBucket(DefaultTrafficTreatment.emptyTreatment());
+ GroupBuckets allBuckets = new GroupBuckets(ImmutableList.of(bucket1, bucket2));
+ GroupBuckets indirectBuckets = new GroupBuckets(ImmutableList.of(bucket3));
DefaultGroup group = new DefaultGroup(
new GroupId(1),
NetTestTools.did("d1"),
ALL,
- buckets);
+ allBuckets);
DefaultGroup group1 = new DefaultGroup(
new GroupId(2),
NetTestTools.did("d2"),
INDIRECT,
- bucketsIndirect);
+ indirectBuckets);
MockCodecContext context = new MockCodecContext();
GroupCodec codec = new GroupCodec();
diff --git a/core/common/src/test/java/org/onosproject/utils/ComparatorsTest.java b/core/common/src/test/java/org/onosproject/utils/ComparatorsTest.java
index 6047719..d616e71 100644
--- a/core/common/src/test/java/org/onosproject/utils/ComparatorsTest.java
+++ b/core/common/src/test/java/org/onosproject/utils/ComparatorsTest.java
@@ -129,8 +129,7 @@
private final ConnectPoint cp =
new ConnectPoint(DeviceId.deviceId("of:00001"), PortNumber.portNumber(100));
private final GroupBucket testBucket =
- DefaultGroupBucket.createSelectGroupBucket(
- DefaultTrafficTreatment.emptyTreatment());
+ DefaultGroupBucket.createAllGroupBucket(DefaultTrafficTreatment.emptyTreatment());
private final GroupBuckets groupBuckets =
new GroupBuckets(ImmutableList.of(testBucket));
private final GroupDescription groupDesc1 =