public final class HandlerUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
areValidLinkEndPoints(int tenantId,
long srcDpid,
short ovxSrcPort,
long dstDpid,
short ovxDstPort,
List<PhysicalLink> physicalLinks)
Checks that the virtual ports (virtual link end-points) are mapped on the
same physical ports that delimit the physical path.
|
static <T> T |
fetchField(String fieldName,
Map<String,Object> map,
boolean required,
T def) |
static List<PhysicalLink> |
getPhysicalPath(String pathString)
Gets the list of physical link instances based on the given
path string.
|
static void |
isControllerAvailable(String controllerAddress,
int controllerPort,
int tenantId)
Check that the controller host and port that we are trying to connect
with is not already being used by another virtual network in our system.
|
static void |
isUniqueHostMAC(MACAddress mac)
Checks if the host MAC address is not yet registered in the map.
|
static void |
isValidDPID(int tenantId,
List<Long> dpids)
Checks that the physical dpids that are provided all actually refer to a
physical switch in the physical network.
|
static void |
isValidHostId(int tenantId,
int hostId)
Checks that the host ID specified refers to a valid host in the virtual
network.
|
static void |
isValidLinkId(int tenantId,
int linkId)
Checks that the link id specified refers to a pair of virtual links in the
virtual network.
|
static void |
isValidOVXBigSwitch(int tenantId,
long dpid)
Checks that the switch id specified belongs to the virtual network and is
of type OVXBigSwitch.
|
static void |
isValidOVXPort(int tenantId,
long dpid,
short portNumber)
Checks if the virtual port number specified is present on the virtual switch.
|
static void |
isValidOVXSwitch(int tenantId,
long dpid)
Checks that the switch id specified belongs to the virtual network.
|
static void |
isValidPhysicalPort(int tenantId,
long dpid,
short portNumber)
Checks if the physical port number specified is present on the physical
switch.
|
static void |
isValidPriority(int priority)
Checks if the priority specified is in the allowed range [0,127].
|
static void |
isValidRouteId(int tenantId,
long dpid,
int routeId)
Checks that the route id specified refers to a pair of virtual route in
the big-switch belonging to the virtual network.
|
static void |
isValidTenantId(int tenantId)
Checks that the tenant id specified refers to a virtual network in the
system.
|
static void |
isValidVirtualLink(List<PhysicalLink> physicalLinks)
Checks that the virtual link we are trying to create is valid (e.g.,
dstSwitch of a physical Link is a SrcSwitch of the next physical link and
the physical ports are different).
|
public static <T> T fetchField(String fieldName, Map<String,Object> map, boolean required, T def) throws ClassCastException, MissingRequiredField
public static void isControllerAvailable(String controllerAddress, int controllerPort, int tenantId) throws ControllerUnavailableException
controllerAddress
- the controller addresscontrollerPort
- the controller porttenantId
- the tenant IDControllerUnavailableException
- if controller port and address are already in usepublic static void isValidTenantId(int tenantId) throws InvalidTenantIdException
tenantId
- the tenant IDInvalidTenantIdException
- if tenant ID is invalidpublic static void isValidHostId(int tenantId, int hostId) throws InvalidHostException, NetworkMappingException
tenantId
- the tenant IDhostId
- the host IDInvalidHostException
NetworkMappingException
public static void isValidLinkId(int tenantId, int linkId) throws InvalidTenantIdException
tenantId
- the tenant IDlinkId
- the link IDInvalidLinkException
InvalidTenantIdException
public static void isValidRouteId(int tenantId, long dpid, int routeId) throws InvalidRouteException, NetworkMappingException
tenantId
- the tenant IDdpid
- the datapath IDrouteId
- the route IDInvalidRouteException
NetworkMappingException
public static void isValidOVXSwitch(int tenantId, long dpid) throws InvalidTenantIdException, InvalidDPIDException
tenantId
- the tenant IDdpid
- the datapath IDInvalidDPIDException
InvalidTenantIdException
public static void isValidOVXBigSwitch(int tenantId, long dpid) throws NetworkMappingException
tenantId
- the tenant IDdpid
- the datapath IDNetworkMappingException
InvalidDPIDException
public static void isValidDPID(int tenantId, List<Long> dpids) throws InvalidDPIDException
tenantId
- tenant IDdpids
- the list of datapath IDsInvalidDPIDException
public static void isValidOVXPort(int tenantId, long dpid, short portNumber) throws InvalidPortException, NetworkMappingException
tenantId
- the tenant IDdpid
- the datapath IDportNumber
- the port numberInvalidPortException
NetworkMappingException
public static void isValidPriority(int priority) throws InvalidPriorityException
priority
- the priority valueInvalidPriorityException
public static void isUniqueHostMAC(MACAddress mac) throws DuplicateMACException
mac
- the MAC addressInvalidPriorityException
DuplicateMACException
public static void isValidPhysicalPort(int tenantId, long dpid, short portNumber) throws InvalidPortException, InvalidDPIDException, SwitchMappingException
tenantId
- the tenant IDdpid
- the datapath IDportNumber
- the port numberInvalidPortException
SwitchMappingException
InvalidDPIDException
public static void isValidVirtualLink(List<PhysicalLink> physicalLinks) throws VirtualLinkException
physicalLinks
- the pathVirtualLinkException
public static void areValidLinkEndPoints(int tenantId, long srcDpid, short ovxSrcPort, long dstDpid, short ovxDstPort, List<PhysicalLink> physicalLinks) throws NetworkMappingException
tenantId
- the tenant IDsrcDpid
- the virtual source datapath IDovxSrcPort
- the source port numberdstDpid
- the virtual destination datapath IDovxDstPort
- the destination port numberphysicalLinks
- the pathNetworkMappingException
VirtualLinkException
public static List<PhysicalLink> getPhysicalPath(String pathString)
pathString
- the path stringCopyright © 2015. All rights reserved.