package org.opennaas.extensions.sdnnetwork.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.opennaas.extensions.openflowswitch.model.OFFlow;
/**
* A class representing a flow crossing a network, from a single source port to a single destination port.
*
* Ingress port in match attribute is the source port of the flow in the network. The flow MUST include an FloodlightOFAction with type=="output". The
* value of that FloodlightOFAction is the destination port of the flow in the network.
*
* Route represents the path of the flow in the network topology. The route MUST be composed of NetworkConnection elements.
*
* @author Isart Canyameres Gimenez (i2cat)
* @author Julio Carlos Barrera
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class SDNNetworkOFFlow extends OFFlow {
protected Route route;
/**
* Default constructor
*/
public SDNNetworkOFFlow() {
}
/**
* Copy constructor
*
* @param sdnNetworkOFFlow
* SDNNetworkOFFlow to copy
*/
public SDNNetworkOFFlow(SDNNetworkOFFlow sdnNetworkOFFlow) {
super(sdnNetworkOFFlow);
this.route = new Route(sdnNetworkOFFlow.route);
}
/**
* @return the route
*/
public Route getRoute() {
return route;
}
/**
* @param route
* the route to set
*/
public void setRoute(Route route) {
this.route = route;
}
/*
* (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
+ ((route == null) ? 0 : route.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;
SDNNetworkOFFlow other = (SDNNetworkOFFlow) 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 (route == null) {
if (other.route != null)
return false;
} else if (!route.equals(other.route))
return false;
return true;
}
}