Exemple #1
0
    def __init__(self, domain_id, active):
        '''
        Constructor:
        @param domain_id: The Domain ID
        @type domain_id: Integer
        @param active: Whether the Domain is active
        @type active: Boolean
        '''
        if domain_id < 0 or domain_id > 16777215:
            raise Exception('Domain ID %s not valid' % (domain_id))
        self.IP_Subnet_List = IPSubnetList()
        self.active = active
        self.replication_factor = 1
        self.mass_transfer = None
        #Set of nodes to forward updates after Mass Transfer is complete
        #and waiting for all other nodes to see this new DPS Node
        #as part of the domain.
        self.mass_transfer_forward_nodes = {}
        #Create Timer for the Domain Object
        #Create the Replication Dictionary
        #The Replication dictionary
        self.replication_query_id_server = {}
        self.replication_query_id_client = {}
        #Based on Object Model Chapter 5.1: Domain Object
        #Collection of DVGs hashed by DVG id.
        #TODO: Add to Domain Object in Domain Object Model
        self.DVG_Hash = {}
        #############################################################
        #Endpoint Object Tables (Requirement 1.1 and 1.2)
        #############################################################
        #Endpoint Object Hash Table (IP Address)
        #Separating IPv4 and IPv6 into different Hashes since one
        #will be hashed by integer, the other string
        self.Endpoint_Hash_IPv4 = {}
        self.Endpoint_Hash_IPv6 = {}
        #Endpoint Object Hash Table (MAC Address)
        self.Endpoint_Hash_MAC = {}
        #############################################################
        #Policy Object Hash Table (Requirement 1.2)
        #The first index is for unicast policy, the second for multicast
        #############################################################
        self.Policy_Hash_DVG = [{}, {}]
        #############################################################
        #DPS Client Hash Tables (Requirement 1.5)
        #############################################################
        #This is to store the DPS Client IPs Address (Different from
        #the DOVE Switch/Gateway IP address)
        self.DPSClients_Hash_IPv4 = {}
        self.DPSClients_Hash_IPv6 = {}
        #This is to store the Tunnel Endpoint IP Address
        self.Tunnel_Endpoints_Hash_IPv4 = {}
        self.Tunnel_Endpoints_Hash_IPv6 = {}
        #List of Implicit Gateway IP Address for this Domain
        self.ImplicitGatewayIPListv4 = IPAddressList(socket.AF_INET)
        self.ImplicitGatewayIPListv6 = IPAddressList(socket.AF_INET6)
        #Multicast Object
        self.Multicast = Multicast(self, domain_id)
        #Address Resolution
        self.AddressResolution = AddressResolution(domain_id)
        self.ConflictDetection = ConflictDetection(domain_id)
        #############################################################
        #Add the domain into DPS Collection Hash Table
        #############################################################
        DpsCollection.Domain_Hash[domain_id] = self
        #DpsCollection.VNID_Hash[domain_id] = domain_id
        #############################################################
        #Statistics
        #############################################################
        self.Stats_Array = []
        curr_time = time.time()
        self.Stats_Array.append([curr_time, 0, 0, 0])

        self.Endpoint_Update_Count = 0
        self.Endpoint_Update_Count_Delta = 0
        self.Endpoint_Lookup_Count = 0
        self.Endpoint_Lookup_Count_Delta = 0
        self.Policy_Lookup_Count = 0
        self.Policy_Lookup_Count_Delta = 0
        self.Multicast_Lookup_Count = 0
        self.Internal_Gateway_Lookup_Count = 0
        #############################################################
        #To be finished
        #############################################################
        # Initialize the common part
        dcs_object.__init__(self, domain_id)