package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
import static org.junit.Assert.assertEquals;
+
import java.math.BigInteger;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;
private static final VlanId DEFAULT_VLAN_ID = new VlanId(42);
private static final Ipv4Address DEFAULT_IPV4_ADDRESS = new Ipv4Address("10.0.0.1");
private static final short DEFAULT_MASK = 24;
+ private ConvertorManager convertorManager;
@Before
public void setup() {
OpenflowPortsUtil.init();
+ convertorManager = ConvertorManagerFactory.createDefaultManager();
}
@Test
* Test method for {@link MatchConvertorV10Impl#convert(Match,BigInteger)}
*/
public void testConvert() {
- MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build());
+ MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build(), null);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
- matchV10 = matchConvertorV10.convert(createL4TcpMatch().build());
+ matchV10 = matchConvertorV10.convert(createL4TcpMatch().build(), null);
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
- matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build());
+ matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build(), null);
assertEquals(DEFAULT_VLAN_ID.getValue().intValue(), matchV10.getDlVlan().intValue());
}
/**
* ICMPv4 match test for
- * {@link MatchConvertorV10Impl#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)}.
+ * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor#convert(Object, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}.
*/
@Test
public void testConvertIcmpv4() {
MatchBuilder matchBuilder = createMatchBuilderWithDefaults();
Match match = matchBuilder.build();
- MatchV10 matchV10 = matchConvertorV10.convert(match);
+ MatchV10 matchV10 = matchConvertorV10.convert(match, convertorManager);
Integer zero = 0;
boolean wcTpSrc = true;
boolean wcTpDst = true;
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());
wcTpDst, wcTpSrc);
match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
build();
- matchV10 = matchConvertorV10.convert(match);
+ matchV10 = matchConvertorV10.convert(match, convertorManager);
assertEquals(ZERO_MAC, matchV10.getDlDst());
assertEquals(FF_MAC, matchV10.getDlSrc());
assertEquals(0, matchV10.getDlType().intValue());