Add missing license headers
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / util / MatchUtilTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.impl.util;
10
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Test;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
18
19 public class MatchUtilTest {
20
21     private static final MacAddress ZERO_MAC_ADDRESS = new MacAddress("00:00:00:00:00:00");
22     private static final Ipv4Address ZERO_IPV4_ADDRESS = new Ipv4Address("0.0.0.0");
23
24     @Test
25     public void createEmptyV10MatchTest() {
26         MatchV10Builder expectedV10Match = expectedV10Match();
27         MatchV10Builder emptyV10Match = MatchUtil.createEmptyV10Match();
28         assertEquals(expectedV10Match.build(),emptyV10Match.build());
29     }
30
31     private MatchV10Builder expectedV10Match() {
32         Short zeroShort = Short.valueOf("0");
33         Integer zeroInteger = Integer.valueOf(0);
34         MatchV10Builder matchV10Builder = new MatchV10Builder();
35         matchV10Builder.setDlDst( ZERO_MAC_ADDRESS);
36         matchV10Builder.setDlSrc(ZERO_MAC_ADDRESS);
37         matchV10Builder.setDlType(zeroInteger);
38         matchV10Builder.setDlVlan(zeroInteger);
39         matchV10Builder.setDlVlanPcp(zeroShort);
40         matchV10Builder.setInPort(zeroInteger);
41         matchV10Builder.setNwDst(ZERO_IPV4_ADDRESS);
42         matchV10Builder.setNwDstMask(zeroShort);
43         matchV10Builder.setNwProto(zeroShort);
44         matchV10Builder.setNwSrc(ZERO_IPV4_ADDRESS);
45         matchV10Builder.setNwSrcMask(zeroShort);
46         matchV10Builder.setNwTos(zeroShort);
47         matchV10Builder.setTpDst(zeroInteger);
48         matchV10Builder.setTpSrc(zeroInteger);
49         FlowWildcardsV10 flowWildcardsV10 = new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true);
50         matchV10Builder.setWildcards(flowWildcardsV10);
51         return matchV10Builder;
52     }
53 }