本文整理匯總了Java中org.onosproject.net.behaviour.DefaultNextGroup類的典型用法代碼示例。如果您正苦於以下問題:Java DefaultNextGroup類的具體用法?Java DefaultNextGroup怎麽用?Java DefaultNextGroup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DefaultNextGroup類屬於org.onosproject.net.behaviour包,在下文中一共展示了DefaultNextGroup類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNextGroup
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Override
public NextGroup getNextGroup(Integer nextId) {
if (nextId != 4) {
byte[] data = new byte[1];
data[0] = 5;
return new DefaultNextGroup(data);
} else {
return null;
}
}
示例2: getNextGroup
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Override
public NextGroup getNextGroup(Integer nextId) {
Versioned<byte[]> versionGroup = nextGroups.get(nextId);
if (versionGroup != null) {
return new DefaultNextGroup(versionGroup.value());
}
return null;
}
示例3: removeNextGroup
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Override
public NextGroup removeNextGroup(Integer nextId) {
Versioned<byte[]> versionGroup = nextGroups.remove(nextId);
if (versionGroup != null) {
return new DefaultNextGroup(versionGroup.value());
}
return null;
}
示例4: testFlowObjectiveStore
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Test
public void testFlowObjectiveStore() {
NextGroup group2 = new DefaultNextGroup("2".getBytes(Charsets.US_ASCII));
int group1Id = store.allocateNextId();
int group2Id = store.allocateNextId();
NextGroup group1add = store.getNextGroup(group1Id);
assertThat(group1add, nullValue());
store.putNextGroup(group2Id, group2);
NextGroup group2Query = store.getNextGroup(group2Id);
assertThat(group2Query.data(), is(group2.data()));
}
示例5: getNextGroup
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Override
public NextGroup getNextGroup(NetworkId networkId, Integer nextId) {
ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
byte[] groupData = nextGroups.get(nextId);
if (groupData != null) {
return new DefaultNextGroup(groupData);
}
return null;
}
示例6: removeNextGroup
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Override
public NextGroup removeNextGroup(NetworkId networkId, Integer nextId) {
ConcurrentMap<Integer, byte[]> nextGroups = getNextGroups(networkId);
byte[] nextGroup = nextGroups.remove(nextId);
updateNextGroupsMap(networkId, nextGroups);
eventQ.add(new VirtualObjectiveEvent(networkId, ObjectiveEvent.Type.REMOVE, nextId));
return new DefaultNextGroup(nextGroup);
}
示例7: testFlowObjectiveStore
import org.onosproject.net.behaviour.DefaultNextGroup; //導入依賴的package包/類
@Test
public void testFlowObjectiveStore() {
NextGroup group1 = new DefaultNextGroup("1".getBytes(Charsets.US_ASCII));
NextGroup group2 = new DefaultNextGroup("2".getBytes(Charsets.US_ASCII));
NextGroup group3 = new DefaultNextGroup("3".getBytes(Charsets.US_ASCII));
int group1Id = store.allocateNextId();
int group2Id = store.allocateNextId();
int group3Id = store.allocateNextId();
NextGroup group1add = store.getNextGroup(group1Id);
assertThat(group1add, nullValue());
NextGroup dif = store.getNextGroup(3);
assertThat(dif, is(nullValue()));
store.putNextGroup(group1Id, group1);
store.putNextGroup(group2Id, group2);
NextGroup group2Query = store.getNextGroup(group2Id);
assertThat(group2Query.data(), is(group2.data()));
assertTrue(store.getAllGroups().containsKey(group2Id));
assertTrue(store.getAllGroups().containsKey(group1Id));
store.removeNextGroup(group2Id);
assertTrue(store.getAllGroups().containsKey(group1Id));
assertFalse(store.getAllGroups().containsKey(group2Id));
store.removeNextGroup(group1Id);
assertEquals(store.getAllGroups(), Collections.emptyMap());
store.putNextGroup(group3Id, group3);
store.removeNextGroup(group2Id);
NextGroup nullGroup = store.getNextGroup(group2Id);
assertThat(nullGroup, nullValue());
assertThat(store.getAllGroups().size(), is(1));
assertThat(store.getAllGroups(), IsMapContaining.hasKey(group3Id));
}