def __init__(self, domain, dvg, vnid, client_type, transaction_type, tunnel_endpoint, vMac, vIP, version): ''' Constructor: @param domain: The Domain Object @type domain: Domain @param dvg: The DVG Object @type dvg: DVG @param vnid: The VNID (Maybe different from dvg.unique_id for Domain/DVG 0) @type vnid: Integer @param client_type: The Type of Client: should be in DpsClientType.types @type client_type: Integer @param transaction_type: The Type of Transaction: should be in DpsTransactionType @type transaction_type: Integer @param tunnel_endpoint: The DOVE Switch on which the Endpoint is hosted Maybe(None) - Then dove_gateway must be valid @type tunnel_endpoint: The Tunnel Endpoint @param vMAC: The Virtual MAC Address @type vMAC: ByteArray/String @param vIP: The IP Address of the Endpoint @type vIP: IPAddressLocation @param version: The version to start with @type version: integer ''' if DpsCollection.Endpoints_Count >= DpsCollection.Endpoints_Count_Max: raise MemoryError('Out of Memory') self.domain = domain self.dvg = dvg self.vnid = vnid self.client_type = client_type self.vMac = vMac self.tunnel_endpoint = tunnel_endpoint self.vIP_set = {} self.vIP_set_show = {} if vIP is not None: self.vIP_set[vIP.ip_value] = vIP self.vIP_set_show[vIP.ip_value] = vIP #self.version = self.version_start self.version = version self.valid = True self.in_migration = False ############################################################# #TODO:To be finished #Add to the appropriate DPS Client List #log.info('__init__: Adding to TunnelEndpoint\r') TunnelEndpoint.endpoint_add(tunnel_endpoint, self, transaction_type) #log.info('__init__: Added to TunnelEndpoint\r') #Add to the appropriate Domain Lists Domain.endpoint_add(domain, self) #log.info('__init__: Added to Domain\r') #Add to the appropriate DVG/VNID Lists DVG.endpoint_add(dvg, self) #log.info('__init__: Added to DVG\r') #self.show(None) DpsCollection.Endpoints_Count += 1
def vmotion(self, dvg, vnid, client_type, tunnel_endpoint, transaction_type): ''' This routine handles the scenario where the Endpoint has vmotioned (without being explicitly told by the migration source). This routine will unlink the Endpoint from the existing DpsClient and remove the vIPs @param dvg: The DVG Object @type dvg: DVG @param vnid: The VNID (Maybe different from dvg.unique_id for Domain/DVG 0) @type vnid: Integer @param client_type: The Type of Client: should be in DpsClientType.types @type client_type: Integer @param tunnel_endpoint: The New Tunnel Endpoint on which the endpoint exists @type tunnel_endpoint: TunnelEndpoint @param transaction_type: The Type of Transaction: should be in DpsTransactionType @type transaction_type: Integer ''' ####################################################################### #Remove from old values ####################################################################### if self.tunnel_endpoint is not None: TunnelEndpoint.endpoint_del(self.tunnel_endpoint, self) self.tunnel_endpoint = None if self.dvg is not None: DVG.endpoint_del(self.dvg, self) if self.dvg != dvg: #Change in VNIDs. Clear all IPs DVG.endpoint_del(self.dvg, self) self.vIP_delete_all() self.vIP_set_show.clear() ####################################################################### #Add to new values ####################################################################### self.dvg = dvg self.vnid = vnid DVG.endpoint_add(dvg, self) self.tunnel_endpoint = tunnel_endpoint self.client_type = client_type self.in_migration = False TunnelEndpoint.endpoint_add(self.tunnel_endpoint, self, transaction_type) return