Commit bf34ba4b authored by Anmol Vatsa's avatar Anmol Vatsa

some changes to wfas. don't know what state the wfas are in. made random...

some changes to wfas. don't know what state the wfas are in. made random changes while trying to get some numbers for eval
parent 6084a86a
......@@ -21,7 +21,7 @@ def allpairs(nodes1, nodes2):
traceback.print_exc()
pass
def allpairscrosscloud(protocol, ctrlid, RECVNODES_TIMEOUT = 2):
def allpairscrosscloud(protocol, ctrlid, count=50, RECVNODES_TIMEOUT = 2):
rpkey = "RP_ALL_PAIRS"
rp0, me_props, broker = util.recv_preamble(protocol)
local_nodes = util.recv_nodes(protocol, rp0.recv_iter_timeout(RECVNODES_TIMEOUT))
......@@ -31,8 +31,22 @@ def allpairscrosscloud(protocol, ctrlid, RECVNODES_TIMEOUT = 2):
print("Got remote RP from broker")
print("Recv nodes")
remote_nodes = util.recv_nodes(protocol, rp.recv_iter())
allpairs(local, remote_nodes)
remote_nodes ={}
for i in range(199):
node = rp.recv()
grant = node.reset()
flow = grant.flow()
info = node.info()
remote_nodes[info.name] = util.NodeProperties(node, grant, info, None, flow)
passNodeslocal = local_nodes
passNodesremote = remote_nodes
if(count):
keys = local_nodes.keys()
rkeys = remote_nodes.keys()
for i in range(count):
passNodeslocal[keys[i]] = local_nodes[keys[i]]
passNodesremote[rkeys[i]] = remote_nodes[rkeys[i]]
allpairs(passNodeslocal, passNodesremote)
if __name__ == '__main__':
import sys
......
import traceback
import capnet as cp
import capnet.util as util
import time
def sendcap(protocol, RECVNODES_TIMEOUT = 2):
rpkey = "RP_ALL_PAIRS"
rp0, me_props, broker = util.recv_preamble(protocol)
local_nodes = util.recv_nodes(protocol, rp0.recv_iter_timeout(RECVNODES_TIMEOUT))
rp = protocol.create(cp.RP)
print("Register rp to broker with key="+rpkey)
broker.register(rpkey, rp)
print("registered")
print("Send all local nodes on rp")
for name, node in local_nodes.iteritems():
rp.send(node.node)
print("sent")
print("now just wait around so the wfa does not terminate and lose the rp cap")
while True:
time.sleep(10)
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
print("Usage: python allpairscrosscloud_b <interface>")
exit()
p = cp.Protocol(sys.argv[1])
sendcap(p)
......@@ -22,15 +22,23 @@ def allpairs(nodes):
traceback.print_exc()
pass
def allpairslocal(protocol, RECVNODES_TIMEOUT = 1):
def allpairslocal(protocol, count=None, RECVNODES_TIMEOUT = 1):
rp0, me_props, broker = util.recv_preamble(protocol)
nodes = util.recv_nodes(protocol, rp0.recv_iter_timeout(RECVNODES_TIMEOUT))
allpairs(nodes)
passNodes = nodes
if(count):
keys = nodes.keys()
for i in range(count):
passNodes[keys[i]] = nodes[keys[i]]
allpairs(passNodes)
if __name__ == '__main__':
import sys
if len(sys.argv) != 2:
print("Usage: python allpairslocal <interface>")
if len(sys.argv) < 2:
print("Usage: python allpairslocal <interface> [<count>]")
exit()
p = cp.Protocol(sys.argv[1])
allpairslocal(p)
if(len(sys.argv) == 3):
allpairslocal(p,sys.argv[2])
else:
allpairslocal(p)
import traceback
import capnet as cp
import capnet.util as util
def grant2all(cap, nodes, count):
for name,node in nodes.iteritems():
if count==0:
return
node.grant.grant(cap)
count -= 1
def localrevokes(protocol, RECVNODES_TIMEOUT = 2):
rp0, me_props, broker = util.recv_preamble(protocol)
local_nodes = util.recv_nodes(protocol, rp0.recv_iter_timeout(RECVNODES_TIMEOUT))
rp = protocol.create(cp.RP)
for i in range(200,2,-1):
print("Grant to all "+str(i)+"local nodes")
grant2all(rp, local_nodes, i)
print("now revoke")
rp.revoke()
print("revoke done")
if __name__ == '__main__':
import sys
if len(sys.argv) < 2:
print("Usage: python localrevokes <interface>")
exit()
p = cp.Protocol(sys.argv[1])
localrevokes(p)
......@@ -2,9 +2,12 @@ import traceback
import capnet as cp
import capnet.util as util
def grant2all(cap, nodes):
def grant2all(cap, nodes, count):
for name,node in nodes.iteritems():
if count==0:
return
node.grant.grant(cap)
count -= 1
def remoterevoke(protocol, ctrlid, RECVNODES_TIMEOUT = 2):
rpkey = "RP_REMOTEREVOKE"
......@@ -19,12 +22,12 @@ def remoterevoke(protocol, ctrlid, RECVNODES_TIMEOUT = 2):
remotecap = rp.recv()
print("Got remote cap")
print("Grant to all local")
grant2all(remotecap, local_nodes)
print("now revoke")
remotecap.revoke()
print("revoke done")
for i in range(200,2,-1):
print("Grant to all "+str(i)+"local nodes")
grant2all(remotecap, local_nodes, i)
print("now revoke")
remotecap.revoke()
print("revoke done")
if __name__ == '__main__':
import sys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment