1 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
3 import junit.framework.Assert;
5 import org.junit.Before;
7 import org.opendaylight.openflowplugin.openflow.md.OFConstants;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
18 * match conversion and injection test
20 public class MatchReactorTest {
22 private MatchBuilder matchBuilder;
29 matchBuilder = new MatchBuilder();
30 EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
31 EthernetTypeBuilder ethernetTypeBuilder = new EthernetTypeBuilder();
32 ethernetTypeBuilder.setType(new EtherType(42L));
33 ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
34 matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
38 * convert for OF-1.3, inject into {@link FlowModInputBuilder}
41 public void testMatchConvertorV13_flow() {
42 FlowModInputBuilder target = new FlowModInputBuilder();
43 MatchReactor.getInstance().convert(matchBuilder.build(),
44 OFConstants.OFP_VERSION_1_3, target);
45 Assert.assertNotNull(target.getMatch());
49 * convert for OF-1.0, inject into {@link FlowModInputBuilder}
52 public void testMatchConvertorV10_flow() {
53 FlowModInputBuilder target = new FlowModInputBuilder();
54 MatchReactor.getInstance().convert(matchBuilder.build(),
55 OFConstants.OFP_VERSION_1_0, target);
56 Assert.assertNotNull(target.getMatchV10());
60 * convert for OF-1.3, inject into {@link OxmFieldsActionBuilder}
63 public void testMatchConvertorV13_action() {
64 OxmFieldsActionBuilder target = new OxmFieldsActionBuilder();
65 MatchReactor.getInstance().convert(matchBuilder.build(),
66 OFConstants.OFP_VERSION_1_3, target);
67 Assert.assertNotNull(target.getMatchEntries());
71 * convert for OF-1.3, inject into {@link MultipartRequestFlowBuilder}
74 public void testMatchConvertorV13_mpRequestFlow() {
75 MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
76 MatchReactor.getInstance().convert(matchBuilder.build(),
77 OFConstants.OFP_VERSION_1_3, target);
78 Assert.assertNotNull(target.getMatch());
82 * convert for OF-1.0, inject into {@link MultipartRequestFlowBuilder}
85 public void testMatchConvertorV10_mpRequestFlow() {
86 MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
87 MatchReactor.getInstance().convert(matchBuilder.build(),
88 OFConstants.OFP_VERSION_1_0, target);
89 Assert.assertNotNull(target.getMatchV10());
93 * convert for OF-1.3, inject into {@link MultipartRequestAggregateBuilder}
96 public void testMatchConvertorV13_mpRequestAggregate() {
97 MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
98 MatchReactor.getInstance().convert(matchBuilder.build(),
99 OFConstants.OFP_VERSION_1_3, target);
100 Assert.assertNotNull(target.getMatch());
104 * convert for OF-1.0, inject into {@link MultipartRequestAggregateBuilder}
107 public void testMatchConvertorV10_mpRequestAggregate() {
108 MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
109 MatchReactor.getInstance().convert(matchBuilder.build(),
110 OFConstants.OFP_VERSION_1_0, target);
111 Assert.assertNotNull(target.getMatchV10());