2 * Copyright (C) 2014 Red Hat, Inc. 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.Iterator;
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;
20 * OpenStack Neutron v2.0 Security Group bindings.
21 * See OpenStack Network API v2.0 Reference for description of
22 * annotated attributes. The current fields are as follows:
24 * id uuid-str unique ID for the security group.
25 * name String name of the security group.
26 * tenant_id uuid-str Owner of security rule..
30 @XmlAccessorType(XmlAccessType.NONE)
32 public class NeutronSecurityGroup extends NeutronObject implements Serializable, INeutronObject {
33 private static final long serialVersionUID = 1L;
35 @XmlElement(name = "name")
36 String securityGroupName;
38 public NeutronSecurityGroup() {
41 public String getSecurityGroupName() {
42 return securityGroupName;
45 public void setSecurityGroupName(String securityGroupName) {
46 this.securityGroupName = securityGroupName;
49 public NeutronSecurityGroup extractFields(List<String> fields) {
50 NeutronSecurityGroup ans = new NeutronSecurityGroup ();
51 Iterator<String> i = fields.iterator ();
52 while (i.hasNext ()) {
54 if (s.equals ("id")) {
55 ans.setID (this.getID ());
57 if (s.equals ("name")) {
58 ans.setSecurityGroupName (this.getSecurityGroupName ());
60 if (s.equals ("tenant_id")) {
61 ans.setTenantID (this.getTenantID ());
68 public String toString() {
69 return "NeutronSecurityGroup{" +
70 "securityGroupUUID='" + uuid + '\'' +
71 ", securityGroupName='" + securityGroupName + '\'' +
72 ", securityGroupTenantID='" + tenantID + '\'' +
77 public void initDefaults() {
78 //TODO verify no defaults values are nessecary required.