4db17cdf0954d0f80275414851e10e4a18c703dc
[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     private static final long serialVersionUID = 1L;
23
24     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
25     // for description of annotated attributes
26
27     @XmlElement(name = "port_pair_groups")
28     List<String> portPairGroupsUUID;
29
30     @XmlElement(name = "flow_classifiers")
31     List<String> flowClassifiersUUID;
32
33     @XmlElement(name = "chain_parameters")
34     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
35     Map<String, String> chainParameters;
36
37     public NeutronSFCPortChain() {
38     }
39
40     public List<String> getPortPairGroupsUUID() {
41         return portPairGroupsUUID;
42     }
43
44     public void setPortPairGroupsUUID(List<String> portPairGroupsUUID) {
45         this.portPairGroupsUUID = portPairGroupsUUID;
46     }
47
48     public List<String> getFlowClassifiersUUID() {
49         return flowClassifiersUUID;
50     }
51
52     public void setFlowClassifiersUUID(List<String> flowClassifiersUUID) {
53         this.flowClassifiersUUID = flowClassifiersUUID;
54     }
55
56     public Map<String, String> getChainParameters() {
57         return chainParameters;
58     }
59
60     public void setChainParameters(Map<String, String> chainParameters) {
61         this.chainParameters = chainParameters;
62     }
63
64     @Override
65     protected boolean extractField(String field, NeutronSFCPortChain ans) {
66         switch (field) {
67             case "port_pair_groups":
68                 ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
69                 break;
70             case "flow_classifiers":
71                 ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
72                 break;
73             case "chain_parameters":
74                 ans.setChainParameters(this.getChainParameters());
75                 break;
76             default:
77                 return super.extractField(field, ans);
78         }
79         return true;
80     }
81
82     @Override
83     public String toString() {
84         return "NeutronSFCPortChain[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\''
85                 + ", portPairGroupsUUID=" + portPairGroupsUUID + ", flowClassifiersUUID='" + flowClassifiersUUID + '\''
86                 + ", chainParameters=" + chainParameters + ']';
87     }
88 }