示例#1
0
<Purpose>
   This is the API that should be used to generate new public/private key pairs.
"""

import traceback

from seattlegeni.common.exceptions import *

from seattlegeni.common.util import log

from seattlegeni.common.util.decorators import log_function_call_without_return

from seattle import repyhelper
from seattle import repyportability

repyhelper.translate_and_import("rsa.repy")

# Set to True to obtain keys from the key daemon, false to generate keys
# directly (potentially making some parts of seattlegeni run very slow).
USE_KEYDAEMON = False

KEYDAEMON_HOST = "127.0.0.1"

KEYDAEMON_PORT = "8030"

# If USE_KEYDAEMON is False and so we manually/directly generate keys, this
# is the bit size of the keys we generate.
MANUAL_GENERATION_BITSIZE = 1024


@log_function_call_without_return
from seattlegeni.common.api import maindb
from seattlegeni.common.api import backend
from seattlegeni.common.api import lockserver
from seattlegeni.common.api import nodemanager

# For setting the backend authcode.
import seattlegeni.backend.config

from seattlegeni.common.util.decorators import log_function_call

from seattlegeni.common.exceptions import *

from seattlegeni.website import settings

# Import all the repy files.
repyhelper.translate_and_import('advertise.repy')
repyhelper.translate_and_import('rsa.repy')
repyhelper.translate_and_import('listops.repy')
repyhelper.translate_and_import('parallelize.repy')
repyhelper.translate_and_import('random.repy')





# Whether _init_node_transition_lib() has been called yet.
is_initialized = False



示例#3
0
#pragma out

# The seattlegeni testlib must be imported first.
from seattlegeni.tests import testlib

from seattlegeni.node_state_transitions import node_transition_lib
from seattlegeni.node_state_transitions import transition_canonical_to_onepercentmanyevents

from seattlegeni.common.api import maindb

from seattlegeni.node_state_transitions.tests import mockutil

from seattle import repyhelper
from seattle import repyportability

repyhelper.translate_and_import('rsa.repy')





#vessel dictionary for this test
vessels_dict = {}
vessels_dict[mockutil.extra_vessel_name] = {"userkeys" : [node_transition_lib.transition_state_keys['canonical']],
                                   "ownerkey" : mockutil.donor_key,
                                   "ownerinfo" : "",
                                   "status" : "",
                                   "advertise" : True}
vessels_dict["vessel_non_seattlegeni"] = {"userkeys" : [node_transition_lib.transition_state_keys['canonical']],
                                   "ownerkey" : mockutil.donor_key,
                                   "ownerinfo" : "",
示例#4
0
  Justin Samuel

<Purpose>
  This module just provides a convenience function for using the repy
  parallelize module for parallelizing a function call. This is just to
  keep other code clean and prevent accidental leakage of the handles
  provided by the repy module for parallelized function.
"""

import time
import traceback

from seattle import repyhelper
from seattle import repyportability

repyhelper.translate_and_import("parallelize.repy")




# The number of threads to be running at a given time for each parallelized
# function call.
CONCURRENT_THREADS_PER_CALL = 10





def run_parallelized(first_arg_list, func, *additional_args):
  """
   <Purpose>
示例#5
0
"""

import random
import traceback

from seattlegeni.common.util.assertions import *

from seattlegeni.common.exceptions import *

from seattlegeni.common.util.decorators import log_function_call_without_first_argument

from seattle import repyhelper
from seattle import repyportability

from fastnmclient import *
repyhelper.translate_and_import("listops.repy")
repyhelper.translate_and_import("time.repy")





# The number of times to try to do a time update before init_nodemanager() will
# raise an exception.
MAX_TIME_UPDATE_ATTEMPTS = 5

# Ports to use for UDP listening when doing a time update.
TIME_UPDATE_POSSIBLE_PORTS = range(10000, 60001)


示例#6
0
文件: views.py 项目: sburnett/seattle
from seattlegeni.common.exceptions import *

from seattlegeni.common.util import assertions
from seattlegeni.common.util import log

# This is the logging decorator we use.
from seattlegeni.common.util.decorators import log_function_call
from seattlegeni.common.util.decorators import log_function_call_without_first_argument

# All of the work that needs to be done is passed through the controller interface.
from seattlegeni.website.control import interface

from seattle import repyhelper
from seattle import repyportability

repyhelper.translate_and_import("rsa.repy")




# The number of bytes of random padding data, not including the "!" separator,
# which is included in the encrypted API key.
# Don't change this without changing the API spec and the xmlrpc client.
ENCRYPTED_API_KEY_PADDING_BYTES = 20



# XMLRPC Fault Code Constants
FAULTCODE_INTERNALERROR = 100
FAULTCODE_AUTHERROR = 101
FAULTCODE_INVALIDREQUEST = 102
示例#7
0
"""

import random
import traceback

from seattlegeni.common.util.assertions import *

from seattlegeni.common.exceptions import *

from seattlegeni.common.util.decorators import log_function_call_without_first_argument

from seattle import repyhelper
from seattle import repyportability

from fastnmclient import *
repyhelper.translate_and_import("listops.repy")
repyhelper.translate_and_import("time.repy")

# The number of times to try to do a time update before init_nodemanager() will
# raise an exception.
MAX_TIME_UPDATE_ATTEMPTS = 5

# Ports to use for UDP listening when doing a time update.
TIME_UPDATE_POSSIBLE_PORTS = range(10000, 60001)


def init_nodemanager():
    """
    <Purpose>
      Initializes the nodemanager api. Must be called before other operations.
    <Arguments>
示例#8
0
  Justin Samuel

<Purpose>
  This module just provides a convenience function for using the repy
  parallelize module for parallelizing a function call. This is just to
  keep other code clean and prevent accidental leakage of the handles
  provided by the repy module for parallelized function.
"""

import time
import traceback

from seattle import repyhelper
from seattle import repyportability

repyhelper.translate_and_import("parallelize.repy")

# The number of threads to be running at a given time for each parallelized
# function call.
CONCURRENT_THREADS_PER_CALL = 10


def run_parallelized(first_arg_list, func, *additional_args):
    """
   <Purpose>
      Call a function with each argument in a list in parallel.
   <Arguments>
      first_arg_list:
          The list of arguments the function should be called with. Each
          argument is passed once to the function.
      func:
示例#9
0
The above is a date (2009-10-29 14:30), followed by two numbers (472 and 3).
"""

from seattlegeni.website.control.models import Node
from seattlegeni.website.control.models import Vessel
from seattlegeni.website import settings

from seattlegeni.common.api import maindb

import datetime
import sys

# Import necessary repy files
from seattle import repyhelper
repyhelper.translate_and_import('advertise.repy')
repyhelper.translate_and_import('rsa.repy')

# This is the v2.publickey, the key is advertised by every single node manager thats up and running.
v2key = {'e': 22599311712094481841033180665237806588790054310631222126405381271924089573908627143292516781530652411806621379822579071415593657088637116149593337977245852950266439908269276789889378874571884748852746045643368058107460021117918657542413076791486130091963112612854591789518690856746757312472362332259277422867L, 'n': 12178066700672820207562107598028055819349361776558374610887354870455226150556699526375464863913750313427968362621410763996856543211502978012978982095721782038963923296750730921093699612004441897097001474531375768746287550135361393961995082362503104883364653410631228896653666456463100850609343988203007196015297634940347643303507210312220744678194150286966282701307645064974676316167089003178325518359863344277814551559197474590483044733574329925947570794508677779986459413166439000241765225023677767754555282196241915500996842713511830954353475439209109249856644278745081047029879999022462230957427158692886317487753201883260626152112524674984510719269715422340038620826684431748131325669940064404757120601727362881317222699393408097596981355810257955915922792648825991943804005848347665699744316223963851263851853483335699321871483966176480839293125413057603561724598227617736944260269994111610286827287926594015501020767105358832476708899657514473423153377514660641699383445065369199724043380072146246537039577390659243640710339329506620575034175016766639538091937167987100329247642670588246573895990251211721839517713790413170646177246216366029853604031421932123167115444834908424556992662935981166395451031277981021820123445253L}




def main():
  arg_to_func_dict = {"node_overview" : get_node_overview_line, 
                      "node_type": get_node_type_line, 
                      "vessels" : get_vessels_line,
                      "advertise" : get_advertise_line}
    
  if len(sys.argv) < 2 or sys.argv[1] not in arg_to_func_dict: