Пример #1
0
 def ip_add(self, dvg, fregister, client_type, inet_type, ip_value,
            transaction_type):
     '''
     This adds a tunnel IP address
     @param dvg: The DVG on which this registration occurred
     @type dvg: DVG
     @param fregister: Whether this is an explicit tunnel register
     @param fregister: Boolean
     @param client_type: The Type of Client: should be in DpsClientType.types
     @type client_type: Integer 
     @param inet_type: AF_INET or AF_INET6
     @type inet_type: Integer
     @param ip_value: The IP address value
     @type ip_value: Integer or String
     @param transaction_type: The Type of Transaction: should be in DpsTransactionType
     @type transaction_type: Integer
     '''
     while True:
         try:
             client_type_value = DpsClientType.types[client_type]
         except Exception:
             break
         self.DVG_Hash[client_type][dvg.unique_id] = dvg
         #Add to Tunnels List even though it may have come through other DVGs as well
         if inet_type == socket.AF_INET:
             if not self.ip_listv4.search(ip_value):
                 self.ip_listv4.add(inet_type, ip_value)
         elif inet_type == socket.AF_INET6:
             if not self.ip_listv4.search(ip_value):
                 self.ip_listv6.add(inet_type, ip_value)
         #log.info('ip_add: Adding to DPS Client %s', ip_value)
         #Add DVG to self.
         #Add IP to DPS Client
         DPSClient.tunnel_endpoint_add_IP(self.dps_client, self, inet_type,
                                          ip_value)
         #Add IP to this DVGs
         DVG.tunnel_endpoint_add_IP(dvg, fregister, self, client_type,
                                    inet_type, ip_value, transaction_type)
         try:
             vnid_hash_ip = self.VNID_Hash_IP[client_type][dvg.unique_id]
         except Exception:
             self.VNID_Hash_IP[client_type][dvg.unique_id] = {}
             vnid_hash_ip = self.VNID_Hash_IP[client_type][dvg.unique_id]
         vnid_hash_ip[ip_value] = True
         #Add DVGs to IP hash
         try:
             ip_hash_vnid = self.IP_Hash_VNID[client_type][ip_value]
         except Exception:
             self.IP_Hash_VNID[client_type][ip_value] = {}
             ip_hash_vnid = self.IP_Hash_VNID[client_type][ip_value]
         ip_hash_vnid[dvg.unique_id] = True
         #Add IP to Domain
         #log.info('ip_add: Adding to domain %s', self.domain.unique_id)
         Domain.tunnel_endpoint_add_IP(self.domain, self, inet_type,
                                       ip_value)
         break
     return
Пример #2
0
 def ip_add(self, dvg, fregister, client_type, inet_type, ip_value, transaction_type):
     '''
     This adds a tunnel IP address
     @param dvg: The DVG on which this registration occurred
     @type dvg: DVG
     @param fregister: Whether this is an explicit tunnel register
     @param fregister: Boolean
     @param client_type: The Type of Client: should be in DpsClientType.types
     @type client_type: Integer 
     @param inet_type: AF_INET or AF_INET6
     @type inet_type: Integer
     @param ip_value: The IP address value
     @type ip_value: Integer or String
     @param transaction_type: The Type of Transaction: should be in DpsTransactionType
     @type transaction_type: Integer
     '''
     while True:
         try:
             client_type_value = DpsClientType.types[client_type]
         except Exception:
             break
         self.DVG_Hash[client_type][dvg.unique_id] = dvg
         #Add to Tunnels List even though it may have come through other DVGs as well
         if inet_type == socket.AF_INET:
             if not self.ip_listv4.search(ip_value):
                 self.ip_listv4.add(inet_type, ip_value)
         elif inet_type == socket.AF_INET6:
             if not self.ip_listv4.search(ip_value):
                 self.ip_listv6.add(inet_type, ip_value)
         #log.info('ip_add: Adding to DPS Client %s', ip_value)
         #Add DVG to self.
         #Add IP to DPS Client
         DPSClient.tunnel_endpoint_add_IP(self.dps_client, self, inet_type, ip_value)
         #Add IP to this DVGs
         DVG.tunnel_endpoint_add_IP(dvg, fregister, self, client_type, inet_type, ip_value, transaction_type)
         try:
             vnid_hash_ip = self.VNID_Hash_IP[client_type][dvg.unique_id]
         except Exception:
             self.VNID_Hash_IP[client_type][dvg.unique_id] = {}
             vnid_hash_ip = self.VNID_Hash_IP[client_type][dvg.unique_id]
         vnid_hash_ip[ip_value] = True
         #Add DVGs to IP hash
         try:
             ip_hash_vnid = self.IP_Hash_VNID[client_type][ip_value]
         except Exception:
             self.IP_Hash_VNID[client_type][ip_value] = {}
             ip_hash_vnid = self.IP_Hash_VNID[client_type][ip_value]
         ip_hash_vnid[dvg.unique_id] = True 
         #Add IP to Domain
         #log.info('ip_add: Adding to domain %s', self.domain.unique_id)
         Domain.tunnel_endpoint_add_IP(self.domain, self, inet_type, ip_value)
         break
     return