Beispiel #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)
Beispiel #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!")
Beispiel #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!")
Beispiel #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!")
Beispiel #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!")
Beispiel #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!")
Beispiel #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!")