use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method decodeRequestGroup.
private static MultipartRequestGroupCase decodeRequestGroup(ByteBuf output) {
MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
MultipartRequestGroupBuilder builder = new MultipartRequestGroupBuilder();
builder.setGroupId(new GroupId(output.readUnsignedInt()));
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY);
caseBuilder.setMultipartRequestGroup(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.
the class GroupActionDeserializerTest method testDeserialize.
@Test
public void testDeserialize() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int groupId = 10;
writeHeader(in);
in.writeInt(groupId);
final Action action = deserializeAction(in);
assertTrue(GroupActionCase.class.isInstance(action));
assertEquals(groupId, GroupActionCase.class.cast(action).getGroupAction().getGroupId().intValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method createGroupDesc.
private static List<GroupDesc> createGroupDesc() {
GroupDescBuilder builder = new GroupDescBuilder();
builder.setType(GroupType.forValue(1));
builder.setGroupId(new GroupId(1L));
builder.setBucketsList(createBucketsList());
List<GroupDesc> list = new ArrayList<>();
list.add(builder.build());
return list;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.
the class GroupModInputMessageFactoryTest method testGroupModInputWithNoBuckets.
/**
* Testing of {@link GroupModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testGroupModInputWithNoBuckets() throws Exception {
GroupModInputBuilder builder = new GroupModInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setCommand(GroupModCommand.forValue(2));
builder.setType(GroupType.forValue(3));
builder.setGroupId(new GroupId(256L));
GroupModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
groupModFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, 16);
Assert.assertEquals("Wrong command", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readUnsignedByte());
out.skipBytes(PADDING_IN_GROUP_MOD_MESSAGE);
Assert.assertEquals("Wrong groupId", message.getGroupId().getValue().intValue(), out.readUnsignedInt());
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateTunnelAggregationGroup.
private void updateTunnelAggregationGroup(InterfaceParentEntry parentEntry) {
String logicTunnelName = parentEntry.getParentInterface();
InternalTunnel logicInternalTunnel = ItmUtils.ITM_CACHE.getInternalTunnel(logicTunnelName);
if (logicInternalTunnel == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: {} not found in internal tunnels list", logicTunnelName);
return;
}
InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
BigInteger srcDpnId = logicInternalTunnel.getSourceDPN();
List<Bucket> listBuckets = new ArrayList<>();
List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", parentEntry.getParentInterface());
return;
}
for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
String curChildName = interfaceChildEntry.getChildInterface();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface childIface = ItmUtils.getInterface(curChildName, interfaceManager);
IfTunnel ifTunnel = childIface != null ? childIface.getAugmentation(IfTunnel.class) : null;
if (ifTunnel == null || !ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: not tunnel interface {} found in group {}", curChildName, logicTunnelName);
continue;
}
ParentRefs parentRefs = childIface.getAugmentation(ParentRefs.class);
if (parentRefs == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: parent refs not specified for interface {} in group {}", curChildName, logicTunnelName);
continue;
}
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildName);
if (ifInfo == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: interface state not found for {} in groupId {}", curChildName, groupId);
continue;
}
int bucketId = interfaceChildEntries.indexOf(interfaceChildEntry);
LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateTunnelAggregationGroup - add bucketId {} to groupId {}", bucketId, groupId);
listBuckets.add(createBucket(curChildName, ifTunnel, bucketId, ifInfo.getPortNo()));
}
if (!listBuckets.isEmpty()) {
Group group = MDSALUtil.buildGroup(groupId, logicTunnelName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(listBuckets));
mdsalManager.syncInstallGroup(srcDpnId, group);
}
}
Aggregations