renamed stack.devices to stack.estates

This commit is contained in:
Samuel M Smith 2014-03-03 16:10:25 -07:00
parent e9886657b0
commit 08599fe7eb
12 changed files with 104 additions and 104 deletions

View File

@ -8,7 +8,7 @@ __init__.py file for raet package
# Import raet modules
from . import raeting
from . import nacling
from . import devicing
from . import estating
from . import yarding
from . import keeping
from . import packeting
@ -18,5 +18,5 @@ from . import behaving
from . import salting
__all__ = ['raeting', 'nacling', 'devicing', 'yarding', 'keeping', 'packeting',
__all__ = ['raeting', 'nacling', 'estating', 'yarding', 'keeping', 'packeting',
'stacking', 'transacting', 'behaving', 'salting']

View File

@ -43,7 +43,7 @@ from ioflo.base import deeding
from ioflo.base.consoling import getConsole
console = getConsole()
from . import raeting, packeting, devicing, yarding, stacking
from . import raeting, packeting, estating, yarding, stacking
class StackUdpRaet(deeding.Deed): # pylint: disable=W0232
@ -72,7 +72,7 @@ class StackUdpRaet(deeding.Deed): # pylint: disable=W0232
ha = (self.local.data.host, self.local.data.port)
name = self.local.data.name
eid = self.local.data.eid
estate = devicing.LocalEstate( eid=eid,
estate = estating.LocalEstate( eid=eid,
name=name,
ha=ha,
sigkey=sigkey,
@ -142,8 +142,8 @@ class JoinedStackUdpRaet(deeding.Deed): # pylint: disable=W0232
stack = self.stack.value
joined = False
if stack and isinstance(stack, stacking.StackUdp):
if stack.devices:
joined = stack.devices.values()[0].joined
if stack.estates:
joined = stack.estates.values()[0].joined
self.status.update(joined=joined)
class AllowerStackUdpRaet(deeding.Deed): # pylint: disable=W0232
@ -182,8 +182,8 @@ class AllowedStackUdpRaet(deeding.Deed): # pylint: disable=W0232
stack = self.stack.value
allowed = False
if stack and isinstance(stack, stacking.StackUdp):
if stack.devices:
allowed = stack.devices.values()[0].allowed
if stack.estates:
allowed = stack.estates.values()[0].allowed
self.status.update(allowed=allowed)
class IdledStackUdpRaet(deeding.Deed): # pylint: disable=W0232

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
'''
devicing.py raet protocol estate classes
estating.py raet protocol estate classes
'''
# pylint: skip-file
# pylint: disable=W0611
@ -31,7 +31,7 @@ class Estate(object):
self.stack = stack # Stack object that manages this estate
if eid is None:
if self.stack:
while Estate.Did in self.stack.devices:
while Estate.Did in self.stack.estates:
Estate.Did += 1
eid = Estate.Did
else:

View File

@ -21,7 +21,7 @@ from ioflo.base import aiding
from . import raeting
from . import nacling
from . import packeting
from . import devicing
from . import estating
from . import transacting
from ioflo.base.consoling import getConsole

View File

@ -480,7 +480,7 @@ class TxPacket(Packet):
Return (cipher, nonce) duple resulting from encrypting message
with short term keys
'''
remote = self.stack.devices[self.data['dd']]
remote = self.stack.estates[self.data['dd']]
return (remote.privee.encrypt(msg, remote.publee.key))
def pack(self):
@ -576,14 +576,14 @@ class RxPacket(Packet):
'''
Return result of verifying msg with signature
'''
return (self.stack.devices[self.data['sd']].verfer.verify(signature, msg))
return (self.stack.estates[self.data['sd']].verfer.verify(signature, msg))
def decrypt(self, cipher, nonce):
'''
Return msg resulting from decrypting cipher and nonce
with short term keys
'''
remote = self.stack.devices[self.data['sd']]
remote = self.stack.estates[self.data['sd']]
return (remote.privee.decrypt(cipher, nonce, remote.publee.key))
def parse(self, packed=None):

View File

@ -43,7 +43,7 @@ from ioflo.base import deeding
from ioflo.base.consoling import getConsole
console = getConsole()
from . import raeting, packeting, stacking, devicing
from . import raeting, packeting, stacking, estating
class JoinerStackUdpRaetSalt(deeding.Deed): # pylint: disable=W0232

View File

@ -22,7 +22,7 @@ from ioflo.base import storing
from . import raeting
from . import nacling
from . import packeting
from . import devicing
from . import estating
from . import yarding
from . import keeping
from . import transacting
@ -63,10 +63,10 @@ class StackUdp(object):
self.name = name
self.version = version
self.store = store or storing.Store(stamp=0.0)
self.devices = odict() # remote devices attached to this stack by eid
self.estates = odict() # remote devices attached to this stack by eid
self.eids = odict() # reverse lookup eid by estate.name
# local estate for this stack
self.estate = estate or devicing.LocalEstate(stack=self, eid=eid, ha=ha)
self.estate = estate or estating.LocalEstate(stack=self, eid=eid, ha=ha)
self.transactions = odict() #transactions
self.rxMsgs = rxMsgs if rxMsgs is not None else deque() # messages received
self.txMsgs = txMsgs if txMsgs is not None else deque() # messages to transmit
@ -87,7 +87,7 @@ class StackUdp(object):
Search for remote estate with matching (host, port)
Return estate if found Otherwise return None
'''
for estate in self.devices.values():
for estate in self.estates.values():
if estate.host == host and estate.port == port:
return estate
@ -98,7 +98,7 @@ class StackUdp(object):
Search for remote estate with matching name
Return estate if found Otherwise return None
'''
return self.devices.get(self.eids.get(name))
return self.estates.get(self.eids.get(name))
def addRemoteDevice(self, estate, eid=None):
'''
@ -107,11 +107,11 @@ class StackUdp(object):
if eid is None:
eid = estate.eid
if eid in self.devices:
if eid in self.estates:
emsg = "Device with id '{0}' alreadys exists".format(eid)
raise raeting.StackError(emsg)
estate.stack = self
self.devices[eid] = estate
self.estates[eid] = estate
if estate.name in self.eids:
emsg = "Device with name '{0}' alreadys exists".format(estate.name)
raise raeting.StackError(emsg)
@ -121,20 +121,20 @@ class StackUdp(object):
'''
Move estate at key old eid to key new eid but keep same index
'''
if new in self.devices:
if new in self.estates:
emsg = "Cannot move, '{0}' already exists".format(new)
raise raeting.StackError(emsg)
if old not in self.devices:
if old not in self.estates:
emsg = "Cannot move '{0}' does not exist".format(old)
raise raeting.StackError(emsg)
estate = self.devices[old]
index = self.devices.keys().index(old)
estate = self.estates[old]
index = self.estates.keys().index(old)
estate.eid = new
self.eids[estate.name] = new
del self.devices[old]
self.devices.insert(index, estate.eid, estate)
del self.estates[old]
self.estates.insert(index, estate.eid, estate)
def renameRemoteDevice(self, old, new):
'''
@ -149,7 +149,7 @@ class StackUdp(object):
raise raeting.StackError(emsg)
eid = self.eids[old]
estate = self.devices[eid]
estate = self.estates[eid]
estate.name = new
index = self.eids.keys().index(old)
del self.eids[old]
@ -159,12 +159,12 @@ class StackUdp(object):
'''
Remove estate at key eid
'''
if eid not in self.devices:
if eid not in self.estates:
emsg = "Cannot remove, '{0}' does not exist".format(eid)
raise raeting.StackError(emsg)
estate = self.devices[eid]
del self.devices[eid]
estate = self.estates[eid]
del self.estates[eid]
del self.eids[estate.name]
def addTransaction(self, index, transaction):
@ -242,10 +242,10 @@ class StackUdp(object):
Where da is the ip destination (host,port) address associated with
the estate with deid
'''
if deid not in self.devices:
if deid not in self.estates:
msg = "Invalid destination estate id '{0}'".format(deid)
raise raeting.StackError(msg)
self.udpTxes.append((packed, self.devices[deid].ha))
self.udpTxes.append((packed, self.estates[deid].ha))
def txMsg(self, msg, deid=None):
'''

View File

@ -9,7 +9,7 @@ import os
from ioflo.base.odicting import odict
from salt.transport.road.raet import (raeting, nacling, devicing, keeping)
from salt.transport.road.raet import (raeting, nacling, estating, keeping)
def test():
@ -32,16 +32,16 @@ def test():
minionPubKeyHex = privateer.pubhex
#master stack
estate = devicing.LocalEstate(eid=1,
estate = estating.LocalEstate(eid=1,
sigkey=masterSignKeyHex,
prikey=masterPriKeyHex)
remote0 = devicing.RemoteEstate(eid=2,
remote0 = estating.RemoteEstate(eid=2,
ha=('127.0.0.1', 7532),
verkey=minionVerKeyHex,
pubkey=minionPubKeyHex,)
remote1 = devicing.RemoteEstate(eid=3,
remote1 = estating.RemoteEstate(eid=3,
ha=('127.0.0.1', 7533),
verkey=minionVerKeyHex,
pubkey=minionPubKeyHex,)

View File

@ -9,7 +9,7 @@ Tests to try out packeting. Potentially ephemeral
from ioflo.base.odicting import odict
from salt.transport.road.raet import (raeting, nacling, packeting,
devicing, transacting, stacking)
estating, transacting, stacking)
def test():
@ -58,24 +58,24 @@ def test():
minionPubKeyHex = privateer.pubhex
#master stack
estate = devicing.LocalEstate(eid=1,
estate = estating.LocalEstate(eid=1,
sigkey=masterSignKeyHex,
prikey=masterPriKeyHex)
stack0 = stacking.StackUdp(estate=estate)
remote1 = devicing.RemoteEstate( eid=2,
remote1 = estating.RemoteEstate( eid=2,
verkey=minionVerKeyHex,
pubkey=minionPubKeyHex,)
stack0.addRemoteDevice(remote1)
#minion stack
estate = devicing.LocalEstate( eid=2,
estate = estating.LocalEstate( eid=2,
ha=("", raeting.RAET_TEST_PORT),
sigkey=minionSignKeyHex,
prikey=minionPriKeyHex,)
stack1 = stacking.StackUdp(estate=estate)
remote0 = devicing.RemoteEstate( eid=1,
remote0 = estating.RemoteEstate( eid=1,
ha=('127.0.0.1', raeting.RAET_PORT),
verkey=masterVerKeyHex,
pubkey=masterPubKeyHex,)

View File

@ -11,7 +11,7 @@ from ioflo.base.consoling import getConsole
console = getConsole()
from salt.transport.road.raet import (raeting, nacling, packeting,
devicing, yarding, transacting, stacking)
estating, yarding, transacting, stacking)
def testStackUdp():
@ -36,14 +36,14 @@ def testStackUdp():
minionPriKeyHex = privateer.keyhex
#master stack
estate = devicing.LocalEstate( eid=1,
estate = estating.LocalEstate( eid=1,
name='master',
sigkey=masterSignKeyHex,
prikey=masterPriKeyHex,)
stack0 = stacking.StackUdp(estate=estate)
#minion stack
estate = devicing.LocalEstate( eid=0,
estate = estating.LocalEstate( eid=0,
name='minion1',
ha=("", raeting.RAET_TEST_PORT),
sigkey=minionSignKeyHex,
@ -71,17 +71,17 @@ def testStackUdp():
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} dids=\n{1}".format(stack0.name, stack0.eids)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
for estate in stack0.devices.values():
for estate in stack0.estates.values():
print "Remote Device {0} joined= {1}".format(estate.eid, estate.joined)
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} dids=\n{1}".format(stack1.name, stack1.eids)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
for estate in stack1.devices.values():
for estate in stack1.estates.values():
print "Remote Device {0} joined= {1}".format(estate.eid, estate.joined)
@ -117,17 +117,17 @@ def testStackUdp():
stack1.serviceUdpRx()
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} dids=\n{1}".format(stack0.name, stack0.eids)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
for estate in stack0.devices.values():
for estate in stack0.estates.values():
print "Remote Device {0} allowed= {1}".format(estate.eid, estate.allowed)
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} dids=\n{1}".format(stack1.name, stack1.eids)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
for estate in stack1.devices.values():
for estate in stack1.estates.values():
print "Remote Device {0} allowed= {1}".format(estate.eid, estate.allowed)
@ -150,13 +150,13 @@ def testStackUdp():
stack1.serviceUdpRx()
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} dids=\n{1}".format(stack0.name, stack0.eids)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
print "{0} Received Messages =\n{1}".format(stack0.name, stack0.rxMsgs)
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} dids=\n{1}".format(stack1.name, stack1.eids)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
print "{0} Received Messages =\n{1}".format(stack1.name, stack1.rxMsgs)
@ -180,13 +180,13 @@ def testStackUdp():
stack0.serviceUdpRx()
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} dids=\n{1}".format(stack0.name, stack0.eids)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
print "{0} Received Messages =\n{1}".format(stack0.name, stack0.rxMsgs)
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} dids=\n{1}".format(stack1.name, stack1.eids)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
print "{0} Received Messages =\n{1}".format(stack1.name, stack1.rxMsgs)
@ -233,14 +233,14 @@ def testStackUdp():
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
print "{0} Received Messages".format(stack0.name)
for msg in stack0.rxMsgs:
print msg
print
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
print "{0} Received Messages".format(stack1.name)
for msg in stack1.rxMsgs:
@ -275,14 +275,14 @@ def testStackUdp():
print "{0} eid={1}".format(stack0.name, stack0.estate.eid)
print "{0} devices=\n{1}".format(stack0.name, stack0.devices)
print "{0} devices=\n{1}".format(stack0.name, stack0.estates)
print "{0} transactions=\n{1}".format(stack0.name, stack0.transactions)
print "{0} Received Messages".format(stack0.name)
for msg in stack0.rxMsgs:
print msg
print
print "{0} eid={1}".format(stack1.name, stack1.estate.eid)
print "{0} devices=\n{1}".format(stack1.name, stack1.devices)
print "{0} devices=\n{1}".format(stack1.name, stack1.estates)
print "{0} transactions=\n{1}".format(stack1.name, stack1.transactions)
print "{0} Received Messages".format(stack1.name)
for msg in stack1.rxMsgs:

View File

@ -22,7 +22,7 @@ from ioflo.base import aiding
from . import raeting
from . import nacling
from . import packeting
from . import devicing
from . import estating
from ioflo.base.consoling import getConsole
console = getConsole()
@ -78,10 +78,10 @@ class Transaction(object):
#ld = self.stack.estate.ha
rd = self.reid
if rd == 0:
host = self.stack.devices[self.reid].host
host = self.stack.estates[self.reid].host
if host == '0.0.0.0':
host = '127.0.0.1'
rd = (host, self.stack.devices[self.reid].port)
rd = (host, self.stack.estates[self.reid].port)
#rd = self.stack.devices[self.reid].ha
return ((self.rmt, ld, rd, self.sid, self.tid, self.bcst,))
@ -175,13 +175,13 @@ class Joiner(Initiator):
mha = ('127.0.0.1', raeting.RAET_PORT)
if self.reid is None:
if not self.stack.devices: # no channel master so make one
master = devicing.RemoteEstate(eid=0, ha=mha)
if not self.stack.estates: # no channel master so make one
master = estating.RemoteEstate(eid=0, ha=mha)
self.stack.addRemoteDevice(master)
self.reid = self.stack.devices.values()[0].eid # zeroth is channel master
self.reid = self.stack.estates.values()[0].eid # zeroth is channel master
self.sid = 0
self.tid = self.stack.devices[self.reid].nextTid()
self.tid = self.stack.estates[self.reid].nextTid()
self.prep()
self.add(self.index)
@ -203,8 +203,8 @@ class Joiner(Initiator):
'''
self.txData.update( sh=self.stack.estate.host,
sp=self.stack.estate.port,
dh=self.stack.devices[self.reid].host,
dp=self.stack.devices[self.reid].port,
dh=self.stack.estates[self.reid].host,
dp=self.stack.estates[self.reid].port,
sd=self.stack.estate.eid,
dd=self.reid,
tk=self.kind,
@ -219,7 +219,7 @@ class Joiner(Initiator):
'''
Send join request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
@ -286,7 +286,7 @@ class Joiner(Initiator):
index = self.index # save before we change it
self.stack.estate.eid = leid
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
remote.verfer = nacling.Verifier(key=verhex)
remote.pubber = nacling.Publican(key=pubhex)
if remote.eid != reid: #move remote estate to new index
@ -377,7 +377,7 @@ class Joinent(Correspondent):
remote = devicing.RemoteEstate( stack=self.stack,
remote = estating.RemoteEstate( stack=self.stack,
name=name,
host=data['sh'],
port=data['sp'],
@ -394,13 +394,13 @@ class Joinent(Correspondent):
'''
Send ack to join request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
#since bootstrap transaction use updated self.rid
self.txData.update( dh=self.stack.devices[self.reid].host,
dp=self.stack.devices[self.reid].port,)
self.txData.update( dh=self.stack.estates[self.reid].host,
dp=self.stack.estates[self.reid].port,)
body = odict()
packet = packeting.TxPacket(stack=self.stack,
kind=raeting.pcktKinds.ack,
@ -419,11 +419,11 @@ class Joinent(Correspondent):
'''
Send accept response to join request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
body = odict([ ('leid', self.reid),
('reid', self.stack.estate.eid),
@ -458,8 +458,8 @@ class Allower(Initiator):
super(Allower, self).__init__(**kwa)
self.oreo = None # cookie from correspondent needed until handshake completed
if self.reid is None:
self.reid = self.stack.devices.values()[0].eid # zeroth is channel master
remote = self.stack.devices[self.reid]
self.reid = self.stack.estates.values()[0].eid # zeroth is channel master
remote = self.stack.estates[self.reid]
if not remote.joined:
emsg = "Must be joined first"
raise raeting.TransactionError(emsg)
@ -485,7 +485,7 @@ class Allower(Initiator):
'''
Prepare .txData
'''
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
self.txData.update( sh=self.stack.estate.host,
sp=self.stack.estate.port,
dh=remote.host,
@ -502,11 +502,11 @@ class Allower(Initiator):
'''
Send hello request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
plain = binascii.hexlify("".rjust(32, '\x00'))
cipher, nonce = remote.privee.encrypt(plain, remote.pubber.key)
body = raeting.HELLO_PACKER.pack(plain, remote.privee.pubraw, cipher, nonce)
@ -542,7 +542,7 @@ class Allower(Initiator):
cipher, nonce = raeting.COOKIE_PACKER.unpack(body)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
msg = remote.privee.decrypt(cipher, nonce, remote.pubber.key)
if len(msg) != raeting.COOKIESTUFF_PACKER.size:
@ -564,11 +564,11 @@ class Allower(Initiator):
'''
Send initiate request to cookie response to hello request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
vcipher, vnonce = self.stack.estate.priver.encrypt(remote.privee.pubraw,
remote.pubber.key)
@ -608,7 +608,7 @@ class Allower(Initiator):
'''
if not self.stack.parseInner(self.rxPacket):
return
self.stack.devices[self.reid].allowed = True
self.stack.estates[self.reid].allowed = True
self.remove()
class Allowent(Correspondent):
@ -625,7 +625,7 @@ class Allowent(Correspondent):
emsg = "Missing required keyword argumens: '{0}'".format('reid')
raise TypeError(emsg)
super(Allowent, self).__init__(**kwa)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
if not remote.joined:
emsg = "Must be joined first"
raise raeting.TransactionError(emsg)
@ -656,7 +656,7 @@ class Allowent(Correspondent):
'''
Prepare .txData
'''
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
self.txData.update( sh=self.stack.estate.host,
sp=self.stack.estate.port,
dh=remote.host,
@ -688,7 +688,7 @@ class Allowent(Correspondent):
plain, shortraw, cipher, nonce = raeting.HELLO_PACKER.unpack(body)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
remote.publee = nacling.Publican(key=shortraw)
msg = self.stack.estate.priver.decrypt(cipher, nonce, remote.publee.key)
if msg != plain :
@ -701,11 +701,11 @@ class Allowent(Correspondent):
'''
Send Cookie Packet
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
oreo = self.stack.estate.priver.nonce()
self.oreo = binascii.hexlify(oreo)
@ -747,7 +747,7 @@ class Allowent(Correspondent):
shortraw, oreo, cipher, nonce = raeting.INITIATE_PACKER.unpack(body)
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
if shortraw != remote.publee.keyraw:
emsg = "Mismatch of short term public key in initiate packet"
@ -785,7 +785,7 @@ class Allowent(Correspondent):
'''
Send ack to initiate request
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
msg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(msg)
@ -809,7 +809,7 @@ class Allowent(Correspondent):
'''
Perform allowment
'''
self.stack.devices[self.reid].allowed = True
self.stack.estates[self.reid].allowed = True
#self.remove()
# keep around for 2 minutes to save cookie (self.oreo)
@ -826,8 +826,8 @@ class Messenger(Initiator):
super(Messenger, self).__init__(**kwa)
self.segmentage = None # special packet to hold segments if any
if self.reid is None:
self.reid = self.stack.devices.values()[0].eid # zeroth is channel master
remote = self.stack.devices[self.reid]
self.reid = self.stack.estates.values()[0].eid # zeroth is channel master
remote = self.stack.estates[self.reid]
if not remote.allowed:
emsg = "Must be allowed first"
raise raeting.TransactionError(emsg)
@ -850,7 +850,7 @@ class Messenger(Initiator):
'''
Prepare .txData
'''
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
self.txData.update( sh=self.stack.estate.host,
sp=self.stack.estate.port,
dh=remote.host,
@ -867,7 +867,7 @@ class Messenger(Initiator):
'''
Send message
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
emsg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(emsg)
@ -912,7 +912,7 @@ class Messengent(Correspondent):
raise TypeError(emsg)
super(Messengent, self).__init__(**kwa)
self.segmentage = None # special packet to hold segments if any
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
if not remote.allowed:
emsg = "Must be allowed first"
raise raeting.TransactionError(emsg)
@ -940,7 +940,7 @@ class Messengent(Correspondent):
'''
Prepare .txData
'''
remote = self.stack.devices[self.reid]
remote = self.stack.estates[self.reid]
self.txData.update( sh=self.stack.estate.host,
sp=self.stack.estate.port,
dh=remote.host,
@ -982,7 +982,7 @@ class Messengent(Correspondent):
'''
Send ack to message
'''
if self.reid not in self.stack.devices:
if self.reid not in self.stack.estates:
msg = "Invalid remote destination estate id '{0}'".format(self.reid)
raise raeting.TransactionError(msg)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
'''
devicing.py raet protocol estate classes
yarding.py raet protocol estate classes
'''
# pylint: skip-file
# pylint: disable=W0611