use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.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.openflow.common.types.rev130731.GroupId in project netvirt by opendaylight.
the class ElanInterfaceManager method removeElanBroadcastGroup.
public void removeElanBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
int bucketId = 0;
int actionKey = 0;
Long elanTag = elanInfo.getElanTag();
List<Bucket> listBuckets = new ArrayList<>();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(++actionKey, ElanUtils.getElanLocalBCGId(elanTag)).buildAction());
listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, elanTag));
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getElanRemoteBCGId(elanInfo.getElanTag());
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleting the remoteBroadCast group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project netvirt by opendaylight.
the class ElanInterfaceManager method removeLocalBroadcastGroup.
public void removeLocalBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getElanLocalBCGId(elanInfo.getElanTag());
List<Bucket> listBuckets = new ArrayList<>();
int bucketId = 0;
listBuckets.add(getLocalBCGroupBucketInfo(interfaceInfo, bucketId));
// listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, 1,
// interfaceInfo));
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleted the localBroadCast Group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project netvirt by opendaylight.
the class ElanInterfaceManager method removeLeavesEtreeBroadcastGroup.
private void removeLeavesEtreeBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
long etreeTag = etreeInstance.getEtreeLeafTagVal().getValue();
int bucketId = 0;
int actionKey = 0;
List<Bucket> listBuckets = new ArrayList<>();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeTag)).buildAction(++actionKey));
listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, etreeTag));
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleting the remoteBroadCast group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId in project netvirt by opendaylight.
the class ElanInterfaceManager method setElanAndEtreeBCGrouponOtherDpns.
private void setElanAndEtreeBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId) {
int elanTag = elanInfo.getElanTag().intValue();
long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
setBCGrouponOtherDpns(elanInfo, dpId, elanTag, groupId);
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
int etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue().intValue();
long etreeLeafGroupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
setBCGrouponOtherDpns(elanInfo, dpId, etreeLeafTag, etreeLeafGroupId);
}
}
Aggregations