package org.opennaas.extensions.openflowswitch.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Isart Canyameres Gimenez (i2cat)
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class OpenDaylightOFFlow extends OFFlow {
/**
* <switch ID> ID of the switch (data path) that this rule should be added to xx:xx:xx:xx:xx:xx:xx:xx
*/
protected String switchId;
/**
* Default constructor
*/
public OpenDaylightOFFlow() {
}
/**
* Copy constructor
*
* @param opendaylightOFFlow
*/
public OpenDaylightOFFlow(OpenDaylightOFFlow opendaylightOFFlow) {
super(opendaylightOFFlow);
this.switchId = opendaylightOFFlow.switchId;
}
/**
* Copy constructor based on OFFlow and switchId
*
* @param ofFlow
* OFFlow to copy
* @param switchId
*/
public OpenDaylightOFFlow(OFFlow ofFlow, String switchId) {
super(ofFlow);
this.switchId = switchId;
}
/**
* @return the switchId
*/
public String getSwitchId() {
return switchId;
}
/**
* @param switchId
* the switchId to set
*/
public void setSwitchId(String switchId) {
this.switchId = switchId;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((actions == null) ? 0 : actions.hashCode());
result = prime * result + (active ? 1231 : 1237);
result = prime * result + ((match == null) ? 0 : match.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result
+ ((priority == null) ? 0 : priority.hashCode());
result = prime * result
+ ((switchId == null) ? 0 : switchId.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OpenDaylightOFFlow other = (OpenDaylightOFFlow) obj;
if (actions == null) {
if (other.actions != null)
return false;
} else if (!actions.equals(other.actions))
return false;
if (active != other.active)
return false;
if (match == null) {
if (other.match != null)
return false;
} else if (!match.equals(other.match))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (priority == null) {
if (other.priority != null)
return false;
} else if (!priority.equals(other.priority))
return false;
if (switchId == null) {
if (other.switchId != null)
return false;
} else if (!switchId.equals(other.switchId))
return false;
return true;
}
}