b25ae3c1a2faec88c771137234389e02dd1fa936
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortChain.java
1 /*
2  * Copyright (c) 2016 Brocade Communications 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 package org.opendaylight.neutron.spi;
9
10 import java.io.Serializable;
11 import java.util.List;
12 import java.util.Map;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
18
19 @XmlRootElement
20 @XmlAccessorType(XmlAccessType.NONE)
21 public final class NeutronSFCPortChain extends NeutronBaseAttributes<NeutronSFCPortChain> implements Serializable {
22
23     private static final long serialVersionUID = 1L;
24
25     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
26     // for description of annotated attributes
27
28     @XmlElement(name = "port_pair_groups")
29     List<String> portPairGroupsUUID;
30
31     @XmlElement(name = "flow_classifiers")
32     List<String> flowClassifiersUUID;
33
34     @XmlElement(name = "chain_parameters")
35     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
36     Map<String, String> chainParameters;
37
38     public NeutronSFCPortChain() {
39     }
40
41     public List<String> getPortPairGroupsUUID() {
42         return portPairGroupsUUID;
43     }
44
45     public void setPortPairGroupsUUID(List<String> portPairGroupsUUID) {
46         this.portPairGroupsUUID = portPairGroupsUUID;
47     }
48
49     public List<String> getFlowClassifiersUUID() {
50         return flowClassifiersUUID;
51     }
52
53     public void setFlowClassifiersUUID(List<String> flowClassifiersUUID) {
54         this.flowClassifiersUUID = flowClassifiersUUID;
55     }
56
57     public Map<String, String> getChainParameters() {
58         return chainParameters;
59     }
60
61     public void setChainParameters(Map<String, String> chainParameters) {
62         this.chainParameters = chainParameters;
63     }
64
65     /**
66      * This method copies selected fields from the object and returns them
67      * as a new object, suitable for marshaling.
68      *
69      * @param fields List of attributes to be extracted
70      * @return an OpenStack Neutron SFC Port Chain object with only the selected fields
71      * populated
72      */
73
74     public NeutronSFCPortChain extractFields(List<String> fields) {
75         NeutronSFCPortChain ans = new NeutronSFCPortChain();
76         for (String s : fields) {
77             extractField(s, ans);
78             if (s.equals("port_pair_groups")) {
79                 ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
80             }
81             if (s.equals("flow_classifiers")) {
82                 ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
83             }
84             if (s.equals("chain_parameters")) {
85                 ans.setChainParameters(this.getChainParameters());
86             }
87         }
88         return ans;
89     }
90
91     @Override
92     public String toString() {
93         return "NeutronSFCPortChain[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\''
94                 + ", portPairGroupsUUID=" + portPairGroupsUUID + ", flowClassifiersUUID='" + flowClassifiersUUID + '\''
95                 + ", chainParameters=" + chainParameters + ']';
96     }
97 }