3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.action;
12 import java.net.InetAddress;
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 * Set network source address action
24 @XmlAccessorType(XmlAccessType.NONE)
26 public class SetNwSrc extends Action {
29 /* Dummy constructor for JAXB */
33 public SetNwSrc(InetAddress address) {
34 type = ActionType.SET_NW_SRC;
35 this.address = address;
39 * Returns the network address this action will set
43 public InetAddress getAddress() {
47 @XmlElement (name="address")
48 public String getAddressAsString() {
49 return address.getHostAddress();
53 public boolean equals(Object obj) {
56 if (!super.equals(obj))
58 if (getClass() != obj.getClass())
60 SetNwSrc other = (SetNwSrc) obj;
61 if (address == null) {
62 if (other.address != null)
64 } else if (!address.equals(other.address))
70 public int hashCode() {
72 int result = super.hashCode();
73 result = prime * result + ((address == null) ? 0 : address.hashCode());
78 public String toString() {
79 return type + "[address = " + address + "]";