public final class OVXMap extends Object implements Mappable
Modifier and Type | Method and Description |
---|---|
void |
addIP(PhysicalIPAddress physicalIP,
OVXIPAddress virtualIP)
This is the generic function which takes as arguments the
PhysicalIPAddress and the OVXIPAddress.
|
void |
addLinks(List<PhysicalLink> physicalLinks,
OVXLink virtualLink)
Creates the mapping between PhysicalLinks and a VirtualLink.
|
void |
addMAC(MACAddress mac,
Integer tenantId)
Creates the maping between the MAC address and tenant ID.
|
void |
addNetwork(OVXNetwork virtualNetwork)
Maintain a list of all the virtualNetworks in the system indexed by the
tenant id mapping to OVXNetworks.
|
void |
addRoute(SwitchRoute route,
List<PhysicalLink> physicalLinks)
Adds a mapping between a SwitchRoute and the PhysicalLinks making it up.
|
void |
addSwitches(List<PhysicalSwitch> physicalSwitches,
OVXSwitch virtualSwitch)
Creates the mapping between PhysicalSwithes and a VirtualSwitch.
|
Iterable<CharSequence> |
getAllKeys() |
static OVXMap |
getInstance()
Gets the instance of the class and if this already exists
then the existing object will be returned.
|
Integer |
getMAC(MACAddress mac)
Gets the tenant ID associated with the given MAC address.
|
PhysicalIPAddress |
getPhysicalIP(OVXIPAddress ip,
Integer tenantId) |
List<PhysicalLink> |
getPhysicalLinks(OVXLink virtualLink)
Gets the physicalLinks that all make up a specified OVXLink.
|
List<PhysicalSwitch> |
getPhysicalSwitches(OVXSwitch virtualSwitch)
Gets the physical switches that are contained in the OVXSwitch.
|
List<PhysicalLink> |
getRoute(SwitchRoute route)
Gets the current path as a list of physical links for the given route.
|
Set<SwitchRoute> |
getSwitchRoutes(PhysicalLink physicalLink,
Integer tenantId)
Gets the switch routes that use the given physical link in
the specified virtual network.
|
OVXIPAddress |
getVirtualIP(PhysicalIPAddress ip) |
List<OVXLink> |
getVirtualLinks(PhysicalLink physicalLink,
Integer tenantId)
Gets the list of OVXLinks that are part of virtual network identified by
tenantId and which include the specified physicalLink.
|
OVXNetwork |
getVirtualNetwork(Integer tenantId)
Gets the virtual network instance based on the tenant ID.
|
OVXSwitch |
getVirtualSwitch(PhysicalSwitch physicalSwitch,
Integer tenantId)
Gets the OVXSwitch which has been specified by the physicalSwitch and
tenantId.
|
boolean |
hasMAC(MACAddress mac)
Checks if the given MAC address is registered in the map.
|
boolean |
hasOVXLinks(PhysicalLink physicalLink,
Integer tenantId)
Checks if the given physical link is part of a virtual link in the
virtual network identified by the tenant ID.
|
boolean |
hasPhysicalIP(OVXIPAddress vip,
Integer tenantId)
Checks if the given virtual IP address is mapped to a physical IP
in the virtual network identified by the tenant ID.
|
boolean |
hasSwitchRoutes(PhysicalLink physicalLink,
Integer tenantId)
Checks if the given physical link is part of a virtual switch route
in the virtual network identified by the tenant ID.
|
boolean |
hasVirtualIP(PhysicalIPAddress ip) |
boolean |
hasVirtualSwitch(PhysicalSwitch physicalSwitch,
int tenantId) |
void |
knownLink(PhysicalLink that)
Sets the linkid back to the original linkid for a physical link that
previously existed and has gone away and come back.
|
Map<Integer,OVXNetwork> |
listVirtualNetworks()
Obtains an immutable copy of the list of virtual networks.
|
void |
removeMAC(MACAddress mac)
Removes MAC address from the map.
|
void |
removeNetwork(OVXNetwork network)
Removes the virtual network from the map.
|
void |
removePhysicalLink(PhysicalLink physicalLink)
Removes a PhysicalLink from a Mappable, including mappings to OVXLinks
and SwitchRoutes.
|
void |
removePhysicalSwitch(PhysicalSwitch physicalSwitch)
Removes a PhysicalSwitch from Mappable mappings.
|
void |
removeRoute(SwitchRoute route)
Removes a SwitchRoute from the map.
|
void |
removeVirtualIPs(int tenantId)
Delete all the IPs associated to a single virtual network.
|
void |
removeVirtualLink(OVXLink virtualLink)
Removes the virtual link from the map.
|
void |
removeVirtualSwitch(OVXSwitch virtualSwitch)
Delete the OVXSwitch object.
|
static void |
reset()
Resets the map instance.
|
public static OVXMap getInstance()
public static void reset()
public void addSwitches(List<PhysicalSwitch> physicalSwitches, OVXSwitch virtualSwitch)
addSwitches
in interface Mappable
physicalSwitches
- the list of physical switchesvirtualSwitch
- the virtual switchpublic void addLinks(List<PhysicalLink> physicalLinks, OVXLink virtualLink)
public Iterable<CharSequence> getAllKeys()
public void addIP(PhysicalIPAddress physicalIP, OVXIPAddress virtualIP)
public void addNetwork(OVXNetwork virtualNetwork)
addNetwork
in interface Mappable
virtualNetwork
- An OVXNetwork object which keeps track of all the elements in
the Virtual networkpublic void addMAC(MACAddress mac, Integer tenantId)
Mappable
public void addRoute(SwitchRoute route, List<PhysicalLink> physicalLinks)
Mappable
public PhysicalIPAddress getPhysicalIP(OVXIPAddress ip, Integer tenantId) throws AddressMappingException
getPhysicalIP
in interface Mappable
AddressMappingException
public OVXIPAddress getVirtualIP(PhysicalIPAddress ip) throws AddressMappingException
getVirtualIP
in interface Mappable
AddressMappingException
public OVXSwitch getVirtualSwitch(PhysicalSwitch physicalSwitch, Integer tenantId) throws SwitchMappingException
getVirtualSwitch
in interface Mappable
physicalSwitch
- A PhysicalSwitch object is a single switch in the
PhysicalNetworktenantId
- the tenant IDSwitchMappingException
- if the physical switch is invalidpublic List<OVXLink> getVirtualLinks(PhysicalLink physicalLink, Integer tenantId) throws LinkMappingException
getVirtualLinks
in interface Mappable
physicalLink
- A PhysicalLink object which represent a single source and
destination PhysicalPort and PhysicalSwitchtenantId
- the tenant IDLinkMappingException
- if the physical link is invalidpublic List<PhysicalLink> getPhysicalLinks(OVXLink virtualLink) throws LinkMappingException
getPhysicalLinks
in interface Mappable
virtualLink
- An OVXLink object which represents a single link in the
OVXNetworkLinkMappingException
- if the virtual link is invalidpublic List<PhysicalSwitch> getPhysicalSwitches(OVXSwitch virtualSwitch) throws SwitchMappingException
getPhysicalSwitches
in interface Mappable
virtualSwitch
- A OVXSwitch object representing a single switch in the virtual
networkSwitchMappingException
- if the virtual switch is invalidpublic OVXNetwork getVirtualNetwork(Integer tenantId) throws NetworkMappingException
getVirtualNetwork
in interface Mappable
tenantId
- This is an Integer that represents a unique number for each
virtualNetworkNetworkMappingException
- if the tenant ID is invalidpublic Integer getMAC(MACAddress mac) throws AddressMappingException
Mappable
getMAC
in interface Mappable
mac
- the MAC addressAddressMappingException
public Map<Integer,OVXNetwork> listVirtualNetworks()
Mappable
listVirtualNetworks
in interface Mappable
public void removeNetwork(OVXNetwork network)
removeNetwork
in interface Mappable
network
- the virtual network instancepublic void removeVirtualLink(OVXLink virtualLink)
removeVirtualLink
in interface Mappable
virtualLink
- the virtual linkpublic void removePhysicalLink(PhysicalLink physicalLink)
Mappable
removePhysicalLink
in interface Mappable
physicalLink
- the physical linkpublic void removeVirtualSwitch(OVXSwitch virtualSwitch)
Mappable
removeVirtualSwitch
in interface Mappable
public void removeVirtualIPs(int tenantId)
Mappable
removeVirtualIPs
in interface Mappable
tenantId
- This is an Integer that represents a unique number for each
virtualNetworkpublic void removeMAC(MACAddress mac)
public List<PhysicalLink> getRoute(SwitchRoute route) throws LinkMappingException
Mappable
getRoute
in interface Mappable
route
- the switch routeLinkMappingException
public Set<SwitchRoute> getSwitchRoutes(PhysicalLink physicalLink, Integer tenantId) throws LinkMappingException
Mappable
getSwitchRoutes
in interface Mappable
physicalLink
- the physical linktenantId
- the tenant IDLinkMappingException
public void removeRoute(SwitchRoute route)
Mappable
removeRoute
in interface Mappable
route
- the switch routepublic void removePhysicalSwitch(PhysicalSwitch physicalSwitch)
Mappable
removePhysicalSwitch
in interface Mappable
physicalSwitch
- the physical switchpublic boolean hasPhysicalIP(OVXIPAddress vip, Integer tenantId)
hasPhysicalIP
in interface Mappable
vip
- the virtual IP addresstenantId
- the tenant IDpublic boolean hasVirtualIP(PhysicalIPAddress ip)
hasVirtualIP
in interface Mappable
ip
- The physical IP addresspublic boolean hasMAC(MACAddress mac)
public boolean hasSwitchRoutes(PhysicalLink physicalLink, Integer tenantId)
hasSwitchRoutes
in interface Mappable
physicalLink
- the physical linktenantId
- the tenant Idpublic boolean hasOVXLinks(PhysicalLink physicalLink, Integer tenantId)
hasOVXLinks
in interface Mappable
physicalLink
- the physical linktenantId
- the tenant IDpublic boolean hasVirtualSwitch(PhysicalSwitch physicalSwitch, int tenantId)
hasVirtualSwitch
in interface Mappable
physicalSwitch
- the PhysicalSwitch mapped to the OVXSwitch we want to check
fortenantId
- TenantID of OVXSwitchpublic void knownLink(PhysicalLink that)
Mappable
Copyright © 2015. All rights reserved.