本文整理汇总了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));
}