2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. 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
8 package org.opendaylight.vpnservice.mdsalutil;
10 import java.math.BigInteger;
11 import java.util.List;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
19 public class FlowEntity extends AbstractSwitchEntity {
20 private static final long serialVersionUID = 1L;
22 private short m_shTableId;
23 private String m_sFlowId;
24 private int m_nPriority;
25 private String m_sFlowName;
26 private int m_nIdleTimeOut;
27 private int m_nHardTimeOut;
28 private BigInteger m_biCookie;
29 private List<MatchInfo> m_listMatchInfo;
30 private List<InstructionInfo> m_listInstructionInfo;
32 private boolean m_bStrictFlag;
33 private boolean m_bSendFlowRemFlag;
35 private transient FlowBuilder m_flowBuilder;
37 public FlowEntity(BigInteger dpnId) {
42 public String toString() {
43 return "FlowEntity [m_shTableId=" + m_shTableId + ", m_sFlowId=" + m_sFlowId + ", m_nPriority=" + m_nPriority
44 + ", m_sFlowName=" + m_sFlowName + ", m_nIdleTimeOut=" + m_nIdleTimeOut + ", m_nHardTimeOut="
45 + m_nHardTimeOut + ", m_biCookie=" + m_biCookie + ", m_listMatchInfo=" + m_listMatchInfo
46 + ", m_listInstructionInfo=" + m_listInstructionInfo + ", m_bStrictFlag=" + m_bStrictFlag
47 + ", m_bSendFlowRemFlag=" + m_bSendFlowRemFlag + ", toString()=" + super.toString() + "]";
50 public BigInteger getCookie() {
54 public String getFlowId() {
58 public String getFlowName() {
62 public int getHardTimeOut() {
63 return m_nHardTimeOut;
66 public int getIdleTimeOut() {
67 return m_nIdleTimeOut;
70 public List<InstructionInfo> getInstructionInfoList() {
71 return m_listInstructionInfo;
74 public List<MatchInfo> getMatchInfoList() {
75 return m_listMatchInfo;
78 public int getPriority() {
82 public boolean getSendFlowRemFlag() {
83 return m_bSendFlowRemFlag;
86 public boolean getStrictFlag() {
90 public short getTableId() {
94 public void setCookie(BigInteger biCookie) {
95 m_biCookie = biCookie;
99 public FlowBuilder getFlowBuilder() {
100 if (m_flowBuilder == null) {
101 m_flowBuilder = new FlowBuilder();
103 m_flowBuilder.setKey(new FlowKey(new FlowId(getFlowId())));
105 m_flowBuilder.setTableId(getTableId());
106 m_flowBuilder.setPriority(getPriority());
107 m_flowBuilder.setFlowName(getFlowName());
108 m_flowBuilder.setIdleTimeout(getIdleTimeOut());
109 m_flowBuilder.setHardTimeout(getHardTimeOut());
110 m_flowBuilder.setCookie(new FlowCookie(getCookie()));
111 m_flowBuilder.setMatch(MDSALUtil.buildMatches(getMatchInfoList()));
112 m_flowBuilder.setInstructions(MDSALUtil.buildInstructions(getInstructionInfoList()));
114 m_flowBuilder.setStrict(getStrictFlag());
116 //m_flowBuilder.setResyncFlag(getResyncFlag());
117 if (getSendFlowRemFlag()) {
118 m_flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true));
121 m_flowBuilder.setBarrier(false);
122 m_flowBuilder.setInstallHw(true);
125 return m_flowBuilder;
128 public void setFlowId(String sFlowId) {
130 if (m_flowBuilder != null) {
131 m_flowBuilder.setKey(new FlowKey(new FlowId(sFlowId)));
135 public void setFlowName(String sFlowName) {
136 m_sFlowName = sFlowName;
137 m_flowBuilder = null;
140 public void setHardTimeOut(int nHardTimeOut) {
141 m_nHardTimeOut = nHardTimeOut;
142 m_flowBuilder = null;
145 public void setIdleTimeOut(int nIdleTimeOut) {
146 m_nIdleTimeOut = nIdleTimeOut;
147 m_flowBuilder = null;
150 public void setInstructionInfoList(List<InstructionInfo> listInstructionInfo) {
151 m_listInstructionInfo = listInstructionInfo;
152 m_flowBuilder = null;
155 public void setMatchInfoList(List<MatchInfo> listMatchInfo) {
156 m_listMatchInfo = listMatchInfo;
157 m_flowBuilder = null;
160 public void setPriority(int nPriority) {
161 m_nPriority = nPriority;
162 m_flowBuilder = null;
165 public void setSendFlowRemFlag(boolean bSendFlowRemFlag) {
166 m_bSendFlowRemFlag = bSendFlowRemFlag;
167 m_flowBuilder = null;
170 public void setStrictFlag(boolean bStrictFlag) {
171 m_bStrictFlag = bStrictFlag;
172 m_flowBuilder = null;
175 public void setTableId(short shTableId) {
176 m_shTableId = shTableId;
177 m_flowBuilder = null;