private static void setTableFeatureProperty(ApplySetfieldMiss propType, TableFeaturePropertiesBuilder propBuilder) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMiss applySetfieldMiss = ((ApplySetfieldMiss) propType).getApplySetfieldMiss();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMiss applySetfieldMiss = propType.getApplySetfieldMiss();
if (null != applySetfieldMiss) {
setFieldMatch = applySetfieldMiss.getSetFieldMatch();
private static void setTableFeatureProperty(ApplySetfield propType, TableFeaturePropertiesBuilder propBuilder) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfield applySetfield = ((ApplySetfield) propType).getApplySetfield();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfield applySetfield = propType.getApplySetfield();
if (null != applySetfield) {
setFieldMatch = applySetfield.getSetFieldMatch();
private static void setTableFeatureProperty(WriteSetfieldMiss propType, TableFeaturePropertiesBuilder propBuilder) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMiss writeSetfieldMiss = ((WriteSetfieldMiss) propType).getWriteSetfieldMiss();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMiss writeSetfieldMiss = propType.getWriteSetfieldMiss();
if (null != writeSetfieldMiss) {
setFieldMatch = writeSetfieldMiss.getSetFieldMatch();
private static void setTableFeatureProperty(WriteSetfield propType, TableFeaturePropertiesBuilder propBuilder) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfield writeSetField = ((WriteSetfield) propType).getWriteSetfield();
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfield writeSetField = propType.getWriteSetfield();
if (null != writeSetField) {
setFieldMatch = writeSetField.getSetFieldMatch();
private static void setTableFeatureProperty(Wildcards propType, TableFeaturePropertiesBuilder propBuilder) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
- WildcardSetfield wildcardSetField = ((Wildcards) propType).getWildcardSetfield();
+ WildcardSetfield wildcardSetField = propType.getWildcardSetfield();
if (null != wildcardSetField) {
setFieldMatch = wildcardSetField.getSetFieldMatch();
}
private static void setTableFeatureProperty(Match propType, TableFeaturePropertiesBuilder propBuilder) {
- MatchSetfield matchSetField = ((Match) propType).getMatchSetfield();
+ MatchSetfield matchSetField = propType.getMatchSetfield();
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
if (null != matchSetField) {
}
private static void setTableFeatureProperty(ApplyActionsMiss propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMiss applyActionsMiss = ((ApplyActionsMiss) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMiss applyActionsMiss = propType
.getApplyActionsMiss();
setActionTableFeatureProperty(
propBuilder,
}
private static void setTableFeatureProperty(ApplyActions propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActions applyActions = ((ApplyActions) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActions applyActions = propType
.getApplyActions();
setActionTableFeatureProperty(
propBuilder,
}
private static void setTableFeatureProperty(WriteActionsMiss propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMiss writeActionsMiss = ((WriteActionsMiss) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMiss writeActionsMiss = propType
.getWriteActionsMiss();
setActionTableFeatureProperty(
propBuilder,
}
private static void setTableFeatureProperty(WriteActions propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActions writeActions = ((WriteActions) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActions writeActions = propType
.getWriteActions();
setActionTableFeatureProperty(
propBuilder,
}
private static void setTableFeatureProperty(NextTableMiss propType, TableFeaturePropertiesBuilder propBuilder) {
- TablesMiss tables = ((NextTableMiss) propType)
+ TablesMiss tables = propType
.getTablesMiss();
setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
(tables == null) ? new ArrayList<Short>() : tables.getTableIds());
}
private static void setTableFeatureProperty(NextTable propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.Tables tables = ((NextTable) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.Tables tables = propType
.getTables();
setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLES,
(tables == null) ? new ArrayList<Short>() : tables.getTableIds());
}
private static void setTableFeatureProperty(InstructionsMiss propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMiss instructions = ((InstructionsMiss) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMiss instructions = propType
.getInstructionsMiss();
setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
(instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
}
private static void setTableFeatureProperty(Instructions propType, TableFeaturePropertiesBuilder propBuilder) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = ((Instructions) propType)
+ org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = propType
.getInstructions();
setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
(instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
import static org.mockito.Mockito.when;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
+import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
@RunWith(MockitoJUnitRunner.class)
public class TableFeaturesConvertorTest extends TestCase {
- @MockitoAnnotations.Mock
+ @Mock
private TableFeatures tableFeatures;
private static final TablePropertiesBuilder tablePropertiesBuilder = new TablePropertiesBuilder();
- private static final Map<Class<? extends TableFeaturePropType>, Object> augmentationsMap = new HashMap<>();
+ private static final Map<Class<? extends TableFeaturePropType>, TableFeaturePropType> augmentationsMap = new HashMap<>();
private static final List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction> instructionsList = new ArrayList<>();
private static final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions = new ArrayList<>();
private static final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> fieldTableFeatures = new ArrayList<>();
- private void setupInstructionsList() {
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new GoToTableCaseBuilder().build());
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new WriteMetadataCaseBuilder().build());
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new WriteActionsCaseBuilder().build());
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new ApplyActionsCaseBuilder().build());
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new ClearActionsCaseBuilder().build());
- instructionsList.add((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) new MeterCaseBuilder().build());
+ private static void setupInstructionsList() {
+ instructionsList.add(new GoToTableCaseBuilder().build());
+ instructionsList.add(new WriteMetadataCaseBuilder().build());
+ instructionsList.add(new WriteActionsCaseBuilder().build());
+ instructionsList.add(new ApplyActionsCaseBuilder().build());
+ instructionsList.add(new ClearActionsCaseBuilder().build());
+ instructionsList.add(new MeterCaseBuilder().build());
}
- private void setupFieldTableFeatures() {
+ private static void setupFieldTableFeatures() {
SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
setFieldMatchBuilder.setHasMask(true);
setFieldMatchBuilder.setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class);
fieldTableFeatures.add(setFieldMatchBuilder.build());
}
- private void setupActions() {
+ private static void setupActions() {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder _actionBuilder = new ActionBuilder();
OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
}
- private TableProperties getTableProperties() {
+ private static TableProperties getTableProperties() {
TableFeaturePropertiesBuilder tableFeaturePropertiesBuilder = new TableFeaturePropertiesBuilder();
List<TableFeatureProperties> tableFeaturePropertieses = new ArrayList<>();
int counter = 0;
- for (Map.Entry entry : augmentationsMap.entrySet()) {
+ for (Entry<Class<? extends TableFeaturePropType>, TableFeaturePropType> entry : augmentationsMap.entrySet()) {
counter++;
- tableFeaturePropertiesBuilder.setTableFeaturePropType((TableFeaturePropType) entry.getValue());
+ tableFeaturePropertiesBuilder.setTableFeaturePropType(entry.getValue());
tableFeaturePropertiesBuilder.setOrder(counter);
tableFeaturePropertieses.add(tableFeaturePropertiesBuilder.build());
}