Esempio n. 1
0
def main():

    channel1 = start_grpc('localhost:10240')
    stub1 = nfa_msg_pb2_grpc.Runtime_RPCStub(channel1)

    packet_out, packet_dropped, duration_time = test(stub1)
    print str(packet_out) + ' ' + str(packet_dropped) + ' ' + str(
        duration_time)
Esempio n. 2
0
def LivenessCheck(runtime_info):
    channel = grpc.insecure_channel(runtime_info["rpc_ip"] + ":" +
                                    str(runtime_info["rpc_port"]))

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    response = stub.LivenessCheck(nfa_msg_pb2.LivenessRequest())

    print("LivenessCheck OK!")
Esempio n. 3
0
def Recover(source_runtime, target_runtime):
    channel = grpc.insecure_channel( \
    source_runtime["rpc_ip"]+":"+str(source_runtime["rpc_port"]) )

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    request = nfa_msg_pb2.RecoverReq()
    request.addr.rpc_ip = target_runtime["rpc_ip"]
    request.addr.rpc_port = target_runtime["rpc_port"]

    response = stub.Recover(request)

    print("Recover OK!")
Esempio n. 4
0
def AddOutputMac(source_runtime, target_runtime):
    channel = grpc.insecure_channel( \
    source_runtime["rpc_ip"]+":"+str(source_runtime["rpc_port"]) )

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    request = nfa_msg_pb2.AddOutputMacReq()
    request.addrs.rpc_ip = target_runtime["rpc_ip"]
    request.addrs.rpc_port = target_runtime["rpc_port"]

    response = stub.AddOutputMac(request)

    print("AddOutputMac OK!")
Esempio n. 5
0
def AddReplicas(source_runtime, target_runtime):
    channel = grpc.insecure_channel( \
    source_runtime["rpc_ip"]+":"+str(source_runtime["rpc_port"]) )

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    request = nfa_msg_pb2.AddReplicasReq()
    address = request.addrs.add()
    address.rpc_ip = target_runtime["rpc_ip"]
    address.rpc_port = target_runtime["rpc_port"]

    response = stub.AddReplicas(request)

    print("AddReplicas OK!")
Esempio n. 6
0
def MigrateTo(source_runtime, target_runtime, qouta):
    channel = grpc.insecure_channel( \
    source_runtime["rpc_ip"]+":"+str(source_runtime["rpc_port"]) )

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    request = nfa_msg_pb2.MigrateToReq()
    request.addr.rpc_ip = target_runtime["rpc_ip"]
    request.addr.rpc_port = target_runtime["rpc_port"]
    request.quota = qouta

    response = stub.MigrateTo(request)

    print("MigrateTo OK!")
Esempio n. 7
0
def SetMigrationTarget(source_runtime, target_runtime):
    channel = grpc.insecure_channel( \
    source_runtime["rpc_ip"]+":"+str(source_runtime["rpc_port"]) )

    stub = nfa_msg_pb2_grpc.Runtime_RPCStub(channel)

    request = nfa_msg_pb2.SetMigrationTargetReq()
    address = request.addrs.add()
    address.rpc_ip = target_runtime["rpc_ip"]
    address.rpc_port = target_runtime["rpc_port"]

    response = stub.SetMigrationTarget(request)

    print("SetMigrationTarget OK!")