Example #1
0
 def update_del(self, vIP):
     '''
     This handles the Endpoint Update with the DPS_ENDPOINT_UPDATE_DELETE
     option
     @param vIP: The IP Address of the Endpoint
     @type vIP: IPAddressLocation
     '''
     #Add vIP: Again a needed HACK for mass transfer case
     self.vIP_add(vIP)
     #Mark self type as In Migration State
     self.in_migration = True
     if len(DpsCollection.Endpoint_Expiration_Timer_Queue) < DpsCollection.Max_Endpoint_Timer_Queue_Length:
         #Put on the global expiration timer list
         #Remove from Tunnel since it could be a followed by migration. 
         #But keep a reference to the old tunnel till a new tunnel claims it.
         #Even if the old tunnel is removed this reference will keep the tunnel 
         #object around.
         #THIS IS A HACK that keeps endpoint.tunnel_endpoint a valid entity.
         #Otherwise we would have to have the following checks every
         #if endpoint.tunnel_endpoint != None: <---- TOO MANY PLACES!!!
         TunnelEndpoint.endpoint_del(self.tunnel_endpoint, self)
         DpsCollection.Endpoint_Expiration_Timer_Queue[self] = 3
     else:
         self.delete()
     return
Example #2
0
 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
Example #3
0
 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
Example #4
0
 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