e58b8dfafe1c46e03fa405cf786863901a883305
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronTapFlow.java
1 /*
2  * Copyright (c) 2017 Intel Corporation.  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.neutron.spi;
10
11 import java.io.Serializable;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronTapFlow extends NeutronBaseAttributes<NeutronTapFlow> implements Serializable {
20     private static final long serialVersionUID = 1L;
21
22     @XmlElement(name = "tap_service_id")
23     String tapServiceID;
24
25     @XmlElement(name = "direction")
26     String tapFlowDirection;
27
28     @XmlElement(name = "source_port")
29     String tapFlowSourcePort;
30
31     public String getTapFlowServiceID() {
32         return tapServiceID;
33     }
34
35     public void setTapFlowServiceID(String tapService) {
36         this.tapServiceID = tapService;
37     }
38
39     public String getTapFlowDirection() {
40         return tapFlowDirection;
41     }
42
43     public void setTapFlowDirection(String direction) {
44         this.tapFlowDirection = direction;
45     }
46
47     public String getTapFlowSourcePort() {
48         return tapFlowSourcePort;
49     }
50
51     public void setTapFlowSourcePort(String sourcePort) {
52         this.tapFlowSourcePort = sourcePort;
53     }
54
55     @Override
56     protected boolean extractField(String field, NeutronTapFlow ans) {
57         switch (field) {
58             case "source_port":
59                 ans.setTapFlowSourcePort(this.getTapFlowSourcePort());
60                 break;
61             case "direction":
62                 ans.setTapFlowDirection(this.getTapFlowDirection());
63                 break;
64             case "tap_service_id":
65                 ans.setTapFlowServiceID(this.getTapFlowServiceID());
66                 break;
67             default:
68                 return super.extractField(field, ans);
69         }
70         return true;
71     }
72
73     @Override
74     public String toString() {
75         return "NeutronTapFlow[" + "tapFlowUUID='" + uuid + '\'' + ", tapFlowTenantID='" + tenantID + '\''
76                 + ", tapFlowName='" + name + '\'' + ", tapFlowServiceID='" + tapServiceID + '\''
77                 + ", tapFlowSourcePort='" + tapFlowSourcePort + '\''
78                 + ", tapFlowDirection='" + tapFlowDirection + '\'' + ']';
79     }
80 }