def send_abort_session(client, args):
    abort_session_chan = ServiceRegistry.get_rpc_channel("abort_session_service", ServiceRegistry.LOCAL)
    abort_session_client = AbortSessionResponderStub(abort_session_chan)

    asr = AbortSessionRequest(
        session_id=args.session_id,
        user_name=args.user_name,
    )

    asa = abort_session_client.AbortSession(asr)
    print(asa)
Beispiel #2
0
    def create_AbortSessionRequest(self, imsi: str) -> AbortSessionResult:
        # Get SessionID
        req = GetDirectoryFieldRequest(id=imsi, field_key="session_id")
        try:
            res = self._directorydstub.GetDirectoryField(
                req, DEFAULT_GRPC_TIMEOUT)
        except grpc.RpcError as err:
            print("Error: GetDirectoryFieldRequest error for id: %s! [%s] %s" %
                  (imsi, err.code(), err.details()))
            self._print_directoryd_content()

        return self._abort_session_stub.AbortSession(
            AbortSessionRequest(
                session_id=res.value,
                user_name=imsi,
            ))