2 * Copyright (c) 2013 Ericsson AB. All rights reserved.
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
10 package org.opendaylight.vpnservice.mdsalutil;
12 import java.math.BigInteger;
13 import java.util.List;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
21 public class FlowEntity extends AbstractSwitchEntity {
22 private static final long serialVersionUID = 1L;
24 private short m_shTableId;
25 private String m_sFlowId;
26 private int m_nPriority;
27 private String m_sFlowName;
28 private int m_nIdleTimeOut;
29 private int m_nHardTimeOut;
30 private BigInteger m_biCookie;
31 private List<MatchInfo> m_listMatchInfo;
32 private List<InstructionInfo> m_listInstructionInfo;
34 private boolean m_bStrictFlag;
35 private boolean m_bSendFlowRemFlag;
37 private transient FlowBuilder m_flowBuilder;
39 public FlowEntity(long lDpnId) {
44 public String toString() {
45 return "FlowEntity [m_shTableId=" + m_shTableId + ", m_sFlowId=" + m_sFlowId + ", m_nPriority=" + m_nPriority
46 + ", m_sFlowName=" + m_sFlowName + ", m_nIdleTimeOut=" + m_nIdleTimeOut + ", m_nHardTimeOut="
47 + m_nHardTimeOut + ", m_biCookie=" + m_biCookie + ", m_listMatchInfo=" + m_listMatchInfo
48 + ", m_listInstructionInfo=" + m_listInstructionInfo + ", m_bStrictFlag=" + m_bStrictFlag
49 + ", m_bSendFlowRemFlag=" + m_bSendFlowRemFlag + ", toString()=" + super.toString() + "]";
52 public BigInteger getCookie() {
56 public String getFlowId() {
60 public String getFlowName() {
64 public int getHardTimeOut() {
65 return m_nHardTimeOut;
68 public int getIdleTimeOut() {
69 return m_nIdleTimeOut;
72 public List<InstructionInfo> getInstructionInfoList() {
73 return m_listInstructionInfo;
76 public List<MatchInfo> getMatchInfoList() {
77 return m_listMatchInfo;
80 public int getPriority() {
84 public boolean getSendFlowRemFlag() {
85 return m_bSendFlowRemFlag;
88 public boolean getStrictFlag() {
92 public short getTableId() {
96 public void setCookie(BigInteger biCookie) {
97 m_biCookie = biCookie;
101 public FlowBuilder getFlowBuilder() {
102 if (m_flowBuilder == null) {
103 m_flowBuilder = new FlowBuilder();
105 m_flowBuilder.setKey(new FlowKey(new FlowId(getFlowId())));
107 m_flowBuilder.setTableId(getTableId());
108 m_flowBuilder.setPriority(getPriority());
109 m_flowBuilder.setFlowName(getFlowName());
110 m_flowBuilder.setIdleTimeout(getIdleTimeOut());
111 m_flowBuilder.setHardTimeout(getHardTimeOut());
112 m_flowBuilder.setCookie(new FlowCookie(getCookie()));
113 m_flowBuilder.setMatch(MDSALUtil.buildMatches(getMatchInfoList()));
114 m_flowBuilder.setInstructions(MDSALUtil.buildInstructions(getInstructionInfoList()));
116 m_flowBuilder.setStrict(getStrictFlag());
118 //m_flowBuilder.setResyncFlag(getResyncFlag());
119 if (getSendFlowRemFlag()) {
120 m_flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true));
123 m_flowBuilder.setBarrier(false);
124 m_flowBuilder.setInstallHw(true);
127 return m_flowBuilder;
130 public void setFlowId(String sFlowId) {
132 if (m_flowBuilder != null) {
133 m_flowBuilder.setKey(new FlowKey(new FlowId(sFlowId)));
137 public void setFlowName(String sFlowName) {
138 m_sFlowName = sFlowName;
139 m_flowBuilder = null;
142 public void setHardTimeOut(int nHardTimeOut) {
143 m_nHardTimeOut = nHardTimeOut;
144 m_flowBuilder = null;
147 public void setIdleTimeOut(int nIdleTimeOut) {
148 m_nIdleTimeOut = nIdleTimeOut;
149 m_flowBuilder = null;
152 public void setInstructionInfoList(List<InstructionInfo> listInstructionInfo) {
153 m_listInstructionInfo = listInstructionInfo;
154 m_flowBuilder = null;
157 public void setMatchInfoList(List<MatchInfo> listMatchInfo) {
158 m_listMatchInfo = listMatchInfo;
159 m_flowBuilder = null;
162 public void setPriority(int nPriority) {
163 m_nPriority = nPriority;
164 m_flowBuilder = null;
167 public void setSendFlowRemFlag(boolean bSendFlowRemFlag) {
168 m_bSendFlowRemFlag = bSendFlowRemFlag;
169 m_flowBuilder = null;
172 public void setStrictFlag(boolean bStrictFlag) {
173 m_bStrictFlag = bStrictFlag;
174 m_flowBuilder = null;
177 public void setTableId(short shTableId) {
178 m_shTableId = shTableId;
179 m_flowBuilder = null;