Esempio n. 1
0
File: dns.py Progetto: benroeder/HEN
    def __writeReverseLookupStartingBlock(self, outputFile, subnetType):
        """\brief Writes the starting block for the reverse lookup DNS files
        \param outputFile (\c File) The File object to write the starting block to
        \param subnetType (\c string) The subnet type (experimental or infrastructure)        
        """
        string = "$TTL " + str(self.__dnsConfigInfo.getTTL()) + "\n" + \
                 "@\t\t\tIN\tSOA\t"

        if (subnetType == "experimental"):
            string += str(reverseIPAddress(self.__dnsConfigInfo.getExperimentalBaseNetworkAddress())) + ".in-addr.arpa"
        elif (subnetType == "virtual"):
            string += str(reverseIPAddress(self.__dnsConfigInfo.getVirtualBaseNetworkAddress())) + ".in-addr.arpa"
        else:
            string += str(reverseIPAddress(self.__dnsConfigInfo.getInfrastructureBaseNetworkAddress())) + ".in-addr.arpa"


        string += ".\t" + str(self.__dnsConfigInfo.getContact()) + ".\t(\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__serialTime + "\t; serial\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getRefreshTime() + "\t; refresh\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getRetryTime() + "\t; retry\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getExpiryTime() + "\t; expiry\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getMinimumTime() + ")\t; minimum\n\n" + \
                  "\t\t\tIN\tNS\t"

        if (subnetType == "experimental"):
            string += str(self.__dnsConfigInfo.getExperimentalServerAddress()) + ".\n\n"
        elif (subnetType == "virtual"):
            string += str(self.__dnsConfigInfo.getVirtualServerAddress()) + ".\n\n"
        else:
            string += str(self.__dnsConfigInfo.getInfrastructureServerAddress()) + ".\n\n"

        try:
            outputFile.write(string + "\n")
        except:
            print "Error while writing in __writeReverseLookupStartingBlock"
Esempio n. 2
0
File: dns.py Progetto: sohonet/HEN
    def __writeReverseLookupNodeEntry(self, outputFile, subnetType, nodeID,
                                      nodeIP):
        """\brief Writes a node entry in a reverse lookup file
        \param outputFile (\c File) The File object to write the node entry to
        \param subnetType (\c string) The subnet type (experimental or infrastructure)
        \param nodeID (\c string) The node's id
        \param nodeIP (\c string) The node's IP address        
        """
        if ((nodeIP == None) or (nodeIP == "None")):
            return

        string = str(reverseIPAddress(
            nodeIP)) + ".in-addr.arpa.\t\tIN\tPTR\t" + str(nodeID) + "."

        if (subnetType == "experimental"):
            string += str(self.__dnsConfigInfo.getExperimentalDomainName().
                          strip('"')) + "."
        elif (subnetType == "virtual"):
            string += str(
                self.__dnsConfigInfo.getVirtualDomainName().strip('"')) + "."
        else:
            string += str(self.__dnsConfigInfo.getInfrastructureDomainName().
                          strip('"')) + "."

        try:
            outputFile.write(string + "\n")
        except:
            print "Error while writing in __writeReverseLookupNode"
Esempio n. 3
0
File: dns.py Progetto: sohonet/HEN
    def __writeReverseLookupStartingBlock(self, outputFile, subnetType):
        """\brief Writes the starting block for the reverse lookup DNS files
        \param outputFile (\c File) The File object to write the starting block to
        \param subnetType (\c string) The subnet type (experimental or infrastructure)        
        """
        string = "$TTL " + str(self.__dnsConfigInfo.getTTL()) + "\n" + \
                 "@\t\t\tIN\tSOA\t"

        if (subnetType == "experimental"):
            string += str(
                reverseIPAddress(
                    self.__dnsConfigInfo.getExperimentalBaseNetworkAddress())
            ) + ".in-addr.arpa"
        elif (subnetType == "virtual"):
            string += str(
                reverseIPAddress(
                    self.__dnsConfigInfo.getVirtualBaseNetworkAddress())
            ) + ".in-addr.arpa"
        else:
            string += str(
                reverseIPAddress(
                    self.__dnsConfigInfo.getInfrastructureBaseNetworkAddress())
            ) + ".in-addr.arpa"


        string += ".\t" + str(self.__dnsConfigInfo.getContact()) + ".\t(\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__serialTime + "\t; serial\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getRefreshTime() + "\t; refresh\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getRetryTime() + "\t; retry\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getExpiryTime() + "\t; expiry\n" + \
                  "\t\t\t\t\t\t\t\t\t" + self.__dnsConfigInfo.getMinimumTime() + ")\t; minimum\n\n" + \
                  "\t\t\tIN\tNS\t"

        if (subnetType == "experimental"):
            string += str(
                self.__dnsConfigInfo.getExperimentalServerAddress()) + ".\n\n"
        elif (subnetType == "virtual"):
            string += str(
                self.__dnsConfigInfo.getVirtualServerAddress()) + ".\n\n"
        else:
            string += str(self.__dnsConfigInfo.getInfrastructureServerAddress(
            )) + ".\n\n"

        try:
            outputFile.write(string + "\n")
        except:
            print "Error while writing in __writeReverseLookupStartingBlock"
Esempio n. 4
0
File: dns.py Progetto: benroeder/HEN
    def __writeReverseLookupNodeEntry(self, outputFile, subnetType, nodeID, nodeIP):
        """\brief Writes a node entry in a reverse lookup file
        \param outputFile (\c File) The File object to write the node entry to
        \param subnetType (\c string) The subnet type (experimental or infrastructure)
        \param nodeID (\c string) The node's id
        \param nodeIP (\c string) The node's IP address        
        """
        if ((nodeIP == None) or (nodeIP == "None")):
            return
                    
        
        string = str(reverseIPAddress(nodeIP)) + ".in-addr.arpa.\t\tIN\tPTR\t" + str(nodeID) + "."

        if (subnetType == "experimental"):
            string += str(self.__dnsConfigInfo.getExperimentalDomainName().strip('"')) + "."
        elif (subnetType == "virtual"):
            string += str(self.__dnsConfigInfo.getVirtualDomainName().strip('"')) + "."
        else:
            string += str(self.__dnsConfigInfo.getInfrastructureDomainName().strip('"')) + "."

        try:
            outputFile.write(string + "\n")
        except:
            print "Error while writing in __writeReverseLookupNode"