Example #1
0
    def setupTxns(self, key, force: bool = False):
        """
        Create base transactions

        :param key: ledger
        :param force: replace existing transaction files
        """
        import data
        dataDir = os.path.dirname(data.__file__)

        # TODO: Need to get "test" and "live" from ENVS property in config.py
        # but that gives error due to some dependency issue
        allEnvs = {
            "local":
            Environment("pool_transactions_local", "transactions_local"),
            "test":
            Environment("pool_transactions_sandbox", "transactions_sandbox"),
            "live":
            Environment("pool_transactions_live", "transactions_live")
        }
        for env in allEnvs.values():
            fileName = getattr(env, key, None)
            if not fileName:
                continue
            sourceFilePath = os.path.join(dataDir, fileName)
            if not os.path.exists(sourceFilePath):
                continue
            destFilePath = os.path.join(self.base_dir, fileName)
            if os.path.exists(destFilePath) and not force:
                continue
            copyfile(sourceFilePath, destFilePath)

        return self
Example #2
0
def newCLI(looper,
           tdir,
           subDirectory=None,
           conf=None,
           poolDir=None,
           domainDir=None,
           multiPoolNodes=None):
    tempDir = os.path.join(tdir, subDirectory) if subDirectory else tdir
    if poolDir or domainDir:
        initDirWithGenesisTxns(tempDir, conf, poolDir, domainDir)

    if multiPoolNodes:
        conf.ENVS = {}
        for pool in multiPoolNodes:
            conf.poolTransactionsFile = "pool_transactions_{}".format(
                pool.name)
            conf.domainTransactionsFile = "transactions_{}".format(pool.name)
            conf.ENVS[pool.name] = \
                Environment("pool_transactions_{}".format(pool.name),
                                "transactions_{}".format(pool.name))
            initDirWithGenesisTxns(
                tempDir, conf, os.path.join(pool.tdirWithPoolTxns, pool.name),
                os.path.join(pool.tdirWithDomainTxns, pool.name))

    return newPlenumCLI(looper,
                        tempDir,
                        cliClass=TestCLI,
                        nodeClass=TestNode,
                        clientClass=TestClient,
                        config=conf)
Example #3
0
def newCLI(looper, tdir, subDirectory=None, conf=None, poolDir=None,
           domainDir=None, multiPoolNodes=None, unique_name=None,
           logFileName=None, cliClass=TestCLI, name=None, agent=None):
    tempDir = os.path.join(tdir, subDirectory) if subDirectory else tdir
    if poolDir or domainDir:
        initDirWithGenesisTxns(tempDir, conf, poolDir, domainDir)

    if multiPoolNodes:
        conf.ENVS = {}
        for pool in multiPoolNodes:
            conf.poolTransactionsFile = "pool_transactions_{}".format(pool.name)
            conf.domainTransactionsFile = "transactions_{}".format(pool.name)
            conf.ENVS[pool.name] = \
                Environment("pool_transactions_{}".format(pool.name),
                                "transactions_{}".format(pool.name))
            initDirWithGenesisTxns(
                tempDir, conf, os.path.join(pool.tdirWithPoolTxns, pool.name),
                os.path.join(pool.tdirWithDomainTxns, pool.name))
    from sovrin_node.test.helper import TestNode
    new_cli = newPlenumCLI(looper, tempDir, cliClass=cliClass,
                           nodeClass=TestNode, clientClass=TestClient, config=conf,
                           unique_name=unique_name, logFileName=logFileName,
                           name=name, agentCreator=True)
    if isinstance(new_cli, SovrinCli) and agent is not None:
        new_cli.agent = agent
    return new_cli
Example #4
0
    def setupTxns(self, key):
        import data
        dataDir = os.path.dirname(data.__file__)

        # TODO: Need to get "test" and "live" from ENVS property in config.py
        # but that gives error due to some dependency issue
        allEnvs = {
            "local": Environment("pool_transactions_local",
                                 "transactions_local"),
            "test": Environment("pool_transactions_sandbox",
                                "transactions_sandbox"),
            "live": Environment("pool_transactions_live",
                                "transactions_live")
        }
        for envName, env in allEnvs.items():
            for keyName, fileName in env._asdict().items():
                if keyName == key:
                    sourceFilePath = os.path.join(dataDir, fileName)
                    if os.path.exists(sourceFilePath):
                        destFilePath = os.path.join(self.base_dir, fileName)
                        copyfile(sourceFilePath, destFilePath)

        return self
Example #5
0
    def setupTxns(self):
        import data
        dataDir = os.path.dirname(data.__file__)

        tmpENVS = {
            "local": Environment("pool_transactions_local",
                                 "transactions_local"),
        }
        tmpENVS.update(ENVS)
        for envName, env in tmpENVS.items():
            for _, fileName in env._asdict().items():
                sourceFilePath = os.path.join(dataDir, fileName)
                if os.path.exists(sourceFilePath):
                    destFilePath = os.path.join(self.base_dir, fileName)
                    copyfile(sourceFilePath, destFilePath)

        return self
Example #6
0
are file and OrientDB.

Possible values: "orientdb"|"file"
'''
ReqReplyStore = "file"

RAETLogLevel = "concise"
RAETLogLevelCli = "mute"
RAETLogFilePath = os.path.join(os.path.expanduser(baseDir), "raet.log")
RAETLogFilePathCli = None
RAETMessageTimeout = 30

PluginsToLoad = []

ENVS = {
    "test": Environment("pool_transactions_sandbox", "transactions_sandbox"),
    "live": Environment("pool_transactions_live", "transactions_live")
}

# File that stores the version of the Node ran the last time it started. (It
# might be incorrect sometimes if Node failed to update the file and crashed)
lastRunVersionFile = 'last_version'

# File that stores the version of the code to which the update has to be made.
# This is used to detect if there was an error while upgrading. Once it has
# been found out that there was error while upgrading, then it can be upgraded.
nextVersionFile = 'next_version'

# Minimum time difference (seconds) between the code update of 2 nodes
MinSepBetweenNodeUpgrades = 300
Example #7
0
nodeReg = OrderedDict([('Alpha', ('127.0.0.1', 9701)),
                       ('Beta', ('127.0.0.1', 9703)),
                       ('Gamma', ('127.0.0.1', 9705)),
                       ('Delta', ('127.0.0.1', 9707))])

cliNodeReg = OrderedDict([('AlphaC', ('127.0.0.1', 9702)),
                          ('BetaC', ('127.0.0.1', 9704)),
                          ('GammaC', ('127.0.0.1', 9706)),
                          ('DeltaC', ('127.0.0.1', 9708))])

baseDir = "~/.sovrin"

ENVS = {
    "test":
    Environment(pool_transactions_file_base + "_sandbox",
                domain_transactions_file_base + "_sandbox"),
    "live":
    Environment(pool_transactions_file_base + "_live",
                domain_transactions_file_base + "_live")
}

current_env = "test"
domainTransactionsFile = ENVS[current_env].domainLedger
poolTransactionsFile = ENVS[current_env].poolLedger
configTransactionsFile = "config_transactions"

logFilePath = "cli.log"

outFilePath = "cli_output.log"

clientBootStrategy = ClientBootStrategy.Custom