<commit_before>import os
import sys
import datetime
import time
import xmlrpclib

from geni.util.geniserver import GeniServer
from geni.util.geniclient import *
from geni.util.cert import Keypair, Certificate
from geni.util.credential import Credential
from geni.util.trustedroot import TrustedRootList
from geni.util.excep import *
from geni.util.misc import *
from geni.util.config import Config
from geni.util.rspec import Rspec
from geni.util.specdict import *
from geni.util.storage import SimpleStorage

class AltAggregate(GeniServer):

    hrn = None
    nodes_ttl = None
    nodes = None
    slices = None 
    policy = None
    timestamp = None
    threshold = None    
    shell = None
    registry = None
    key_file = None
    cert_file = None
    credential = None
  
    ##
    # Create a new aggregate object.
    #
    # @param ip the ip address to listen on
    # @param port the port to listen on
    # @param key_file private key filename of registry
    # @param cert_file certificate filename containing public key (could be a GID file)     

    def __init__(self, ip, port, key_file, cert_file, config = "/usr/share/geniwrapper/geni/util/geni_config"):
        GeniServer.__init__(self, ip, port, key_file, cert_file)
        self.key_file = key_file
        self.cert_file = cert_file
        self.config = Config(config)
        self.basedir = self.config.GENI_BASE_DIR + os.sep
        self.server_basedir = self.basedir + os.sep + "geni" + os.sep
        self.hrn = self.config.GENI_INTERFACE_HRN
        
        nodes_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.components'])
        self.nodes = SimpleStorage(nodes_file)
        self.nodes.load()
       
        slices_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.slices'])
        self.slices = SimpleStorage(slices_file)
        self.slices.load()
 
        policy_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.policy'])
        self.policy = SimpleStorage(policy_file, {'whitelist': [], 'blacklist': []})
        self.policy.load()
        
        timestamp_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.timestamp']) 
        self.timestamp = SimpleStorage(timestamp_file)

        self.nodes_ttl = 1

        self.connectRegistry()
        #self.loadCredential()

    def connectRegistry(self):
        """
        Connect to the registry
        """
        # connect to registry using GeniClient
        address = self.config.GENI_REGISTRY_HOSTNAME
        port = self.config.GENI_REGISTRY_PORT<commit_msg>GENI_REGISTRY_HOSTNAME is should be GENI_REGISTRY_HOST<commit_after>import os
import sys
import datetime
import time
import xmlrpclib

from geni.util.geniserver import GeniServer
from geni.util.geniclient import *
from geni.util.cert import Keypair, Certificate
from geni.util.credential import Credential
from geni.util.trustedroot import TrustedRootList
from geni.util.excep import *
from geni.util.misc import *
from geni.util.config import Config
from geni.util.rspec import Rspec
from geni.util.specdict import *
from geni.util.storage import SimpleStorage

class AltAggregate(GeniServer):

    hrn = None
    nodes_ttl = None
    nodes = None
    slices = None 
    policy = None
    timestamp = None
    threshold = None    
    shell = None
    registry = None
    key_file = None
    cert_file = None
    credential = None
  
    ##
    # Create a new aggregate object.
    #
    # @param ip the ip address to listen on
    # @param port the port to listen on
    # @param key_file private key filename of registry
    # @param cert_file certificate filename containing public key (could be a GID file)     

    def __init__(self, ip, port, key_file, cert_file, config = "/usr/share/geniwrapper/geni/util/geni_config"):
        GeniServer.__init__(self, ip, port, key_file, cert_file)
        self.key_file = key_file
        self.cert_file = cert_file
        self.config = Config(config)
        self.basedir = self.config.GENI_BASE_DIR + os.sep
        self.server_basedir = self.basedir + os.sep + "geni" + os.sep
        self.hrn = self.config.GENI_INTERFACE_HRN
        
        nodes_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.components'])
        self.nodes = SimpleStorage(nodes_file)
        self.nodes.load()
       
        slices_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.slices'])
        self.slices = SimpleStorage(slices_file)
        self.slices.load()
 
        policy_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.policy'])
        self.policy = SimpleStorage(policy_file, {'whitelist': [], 'blacklist': []})
        self.policy.load()
        
        timestamp_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.timestamp']) 
        self.timestamp = SimpleStorage(timestamp_file)

        self.nodes_ttl = 1

        self.connectRegistry()
        #self.loadCredential()

    def connectRegistry(self):
        """
        Connect to the registry
        """
        # connect to registry using GeniClient
        address = self.config.GENI_REGISTRY_HOST
        port = self.config.GENI_REGISTRY_PORT
{'fraction_non_alphanumeric': 0.09707986849738928, 'fraction_numerical': 0.00038677238445175013, 'mean_word_length': 2.7451122375090513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '473281', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1608, 'n_words': 397}