use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList in project openflowplugin by opendaylight.
the class GroupConvertor method convert.
@Override
public GroupModInputBuilder convert(Group source, VersionDatapathIdConvertorData data) {
GroupModInputBuilder groupModInputBuilder = new GroupModInputBuilder();
if (source instanceof AddGroupInput) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCADD);
} else if (source instanceof RemoveGroupInput) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCDELETE);
} else if (source instanceof UpdatedGroup) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCMODIFY);
}
if (GroupTypes.GroupAll.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTALL);
}
if (GroupTypes.GroupSelect.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTSELECT);
}
if (GroupTypes.GroupIndirect.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTINDIRECT);
}
if (GroupTypes.GroupFf.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTFF);
}
groupModInputBuilder.setGroupId(new GroupId(source.getGroupId().getValue()));
// During group deletion do not push the buckets
if (groupModInputBuilder.getCommand() != GroupModCommand.OFPGCDELETE) {
if (source.getBuckets() != null && source.getBuckets().getBucket().size() != 0) {
Collections.sort(source.getBuckets().getBucket(), COMPARATOR);
List<BucketsList> bucketLists = salToOFBucketList(source.getBuckets(), data.getVersion(), source.getGroupType().getIntValue(), data.getDatapathId());
groupModInputBuilder.setBucketsList(bucketLists);
}
}
groupModInputBuilder.setVersion(data.getVersion());
return groupModInputBuilder;
}
Aggregations