Merge "changed approach to device context synchronization"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / util / MatchUtil.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 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
15
16 /**
17  * Created by Martin Bobak <mbobak@cisco.com> on 21.4.2015.
18  */
19 public final class MatchUtil {
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     private MatchUtil(){
24         throw new IllegalStateException("This class should not be instantiated.");
25     }
26
27
28     public static MatchV10Builder createEmptyV10Match() {
29         Short zeroShort = Short.valueOf("0");
30         Integer zeroInteger = Integer.valueOf(0);
31         MatchV10Builder matchV10Builder = new MatchV10Builder();
32         matchV10Builder.setDlDst(ZERO_MAC_ADDRESS);
33         matchV10Builder.setDlSrc(ZERO_MAC_ADDRESS);
34         matchV10Builder.setDlType(zeroInteger);
35         matchV10Builder.setDlVlan(zeroInteger);
36         matchV10Builder.setDlVlanPcp(zeroShort);
37         matchV10Builder.setInPort(zeroInteger);
38         matchV10Builder.setNwDst(ZERO_IPV4_ADDRESS);
39         matchV10Builder.setNwDstMask(zeroShort);
40         matchV10Builder.setNwProto(zeroShort);
41         matchV10Builder.setNwSrc(ZERO_IPV4_ADDRESS);
42         matchV10Builder.setNwSrcMask(zeroShort);
43         matchV10Builder.setNwTos(zeroShort);
44         matchV10Builder.setTpDst(zeroInteger);
45         matchV10Builder.setTpSrc(zeroInteger);
46         FlowWildcardsV10 flowWildcardsV10 = new FlowWildcardsV10(false, false, false, false, false, false, false, false, false, false);
47         matchV10Builder.setWildcards(flowWildcardsV10);
48         return matchV10Builder;
49     }
50
51
52
53 }