2 * Copyright (c) 2017 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
9 package org.opendaylight.neutron.spi;
11 import java.io.Serializable;
12 import java.util.ArrayList;
13 import java.util.List;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
19 @XmlRootElement(name = "trunk")
20 @XmlAccessorType(XmlAccessType.NONE)
21 public final class NeutronTrunk extends NeutronAdminAttributes<NeutronTrunk> implements Serializable {
22 private static final long serialVersionUID = 1L;
24 @XmlElement(name = "port_id")
27 @XmlElement(name = "sub_ports")
28 List<NeutronTrunkSubPort> subPorts;
30 public NeutronTrunk() {
34 public void initDefaults() {
35 // In order to override super.initDefaults()
36 // status needs to be checked before calling super.initDefaults()
41 if (subPorts == null) {
42 subPorts = new ArrayList<>();
46 public String getPortId() {
50 public void setPortId(String portId) {
54 public List<NeutronTrunkSubPort> getSubPorts() {
58 public void setSubPorts(List<NeutronTrunkSubPort> subPorts) {
59 this.subPorts = subPorts;
63 protected boolean extractField(String field, NeutronTrunk ans) {
66 ans.setPortId(this.getPortId());
69 List<NeutronTrunkSubPort> subPortList = new ArrayList<>();
70 subPortList.addAll(this.getSubPorts());
71 ans.setSubPorts(subPortList);
74 return super.extractField(field, ans);
80 public String toString() {
81 return "NeutronTrunk{" + "trunkUUID='" + uuid + '\'' + ", trunkName='" + name + '\''
82 + ", tenantID='" + tenantID + '\'' + ", adminStateUp='" + adminStateUp + '\''
83 + ", status='" + status + '\'' + ", portId='" + portId + '\''
84 + ", subPorts='" + subPorts + '\'' + '}';