def update(self, dvg, vnid, client_type, transaction_type, version, operation, vIP): ''' This handle Endpoint Update on an Endpoint. The domain and DPS Client (on which the endpoint resides) should have been resolved before this step i.e. Migration and New Endpoint Scenario handled before this routine is called. @param dvg: The DVG based on Endpoint Update Parameters @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 version: The Object Version Number @type version: Integer @param operation: Should be a dps_endpoint_update_option @type operation: Integer @param vIP: The IP Address of the Endpoint @type vIP: IPAddressLocation ''' self.in_migration = False #The Delete operation can set it to True. #Update client type self.client_type = client_type self.vnid = vnid #Since we got an update on this endpoint from an entity, #we can remove from Endpoint Expiration Timer List try: del DpsCollection.Endpoint_Expiration_Timer_Queue[self] except Exception: pass if self.dvg != dvg: #Remove self from old DVG DVG.endpoint_del(self.dvg, self) #Remove all old vIPs self.vIP_delete_all() self.vIP_set_show.clear() self.dvg = dvg DVG.endpoint_add(self.dvg, self) if transaction_type == DpsTransactionType.mass_transfer: #Don't verify version for mass transfer. Just stay at the highest rev if self.version < version: self.version = version else: if version == Endpoint.version_start: self.version = Endpoint.version_start elif version == self.version: self.version = version else: if version != self.version + 1: raise Exception('Invalid Version: Expecting %s, got %s!!!'%(self.version + 1, version)) self.version = version try: self.update_function_table[operation](self, vIP) except Exception: #log.warning('update: operation %s not supported\r', operation) pass return
def delete(self): ''' Destructor: ''' if not self.valid: return self.valid = False #Remove from Conflict Detection List self.domain.ConflictDetection.endpoint_delete(self) #Remove from DPS Client List TunnelEndpoint.endpoint_del(self.tunnel_endpoint, self) #Remove from Domain Collection Domain.endpoint_del(self.domain, self) #Remove from VNID/DVG collection DVG.endpoint_del(self.dvg, self) #Remove vIPs self.vIP_set.clear() self.vIP_set_show.clear() DpsCollection.Endpoints_Count -= 1 return
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