af119b1bd92d2ea04102e53d425b55ea39459311
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / flowflag / FlowFlagsConvertorImpl.java
1 /**
2  * Copyright (c) 2013 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.openflow.md.core.sal.convertor.flowflag;
10
11 import java.math.BigInteger;
12
13 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConvertor;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
15
16 /**
17  * 
18  */
19 public class FlowFlagsConvertorImpl implements FlowFlagConvertor<FlowModFlags> {
20
21     @Override
22     public FlowModFlags convert(
23             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags source, BigInteger datapathid) {
24     
25         FlowModFlags ofFlowModFlags = null;
26         if (source != null) {
27             ofFlowModFlags = new FlowModFlags(
28                     source.isCHECKOVERLAP(), source.isNOBYTCOUNTS(), source.isNOPKTCOUNTS(),
29                     source.isRESETCOUNTS(), source.isSENDFLOWREM());
30         } else {
31             ofFlowModFlags = new FlowModFlags(
32                     FlowConvertor.DEFAULT_OFPFF_CHECK_OVERLAP, 
33                     FlowConvertor.DEFAULT_OFPFF_NO_BYT_COUNTS, 
34                     FlowConvertor.DEFAULT_OFPFF_NO_PKT_COUNTS,
35                     FlowConvertor.DEFAULT_OFPFF_RESET_COUNTS, 
36                     FlowConvertor.DEFAULT_OFPFF_FLOW_REM);
37         }
38         
39         return ofFlowModFlags;
40     }
41 }