import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
* match conversion and injection test
*/
public class MatchReactorTest {
-
private MatchBuilder matchBuilder;
+ private ConvertorManager convertorManager;
/**
* prepare input match
ethernetTypeBuilder.setType(new EtherType(42L));
ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
/**
public void testMatchConvertorV13_flow() {
FlowModInputBuilder target = new FlowModInputBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV10_flow() {
FlowModInputBuilder target = new FlowModInputBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV13_mpRequestFlow() {
MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV10_mpRequestFlow() {
MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV10_null() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(null,
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}
public void testMatchConvertorV13_mpRequestAggregate() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
}
public void testMatchConvertorV13_null() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(null,
- OFConstants.OFP_VERSION_1_3, target);
+ OFConstants.OFP_VERSION_1_3, target, convertorManager);
Assert.assertNotNull(target.getMatch());
Assert.assertEquals(0, target.getMatch().getMatchEntry().size());
}
public void testMatchConvertorV10_mpRequestAggregate() {
MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
MatchReactor.getInstance().convert(matchBuilder.build(),
- OFConstants.OFP_VERSION_1_0, target);
+ OFConstants.OFP_VERSION_1_0, target, convertorManager);
Assert.assertNotNull(target.getMatchV10());
}