public void SmbdCreditMgmt_NegativeParameter_CreditRequested()
        {
            // define data for test case
            const ushort RECEIVE_CREDIT_MAX = 10;
            const ushort SEND_CREDIT_TARGET = 10;

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Connect to server over RDMA");
            NtStatus status = smbdAdapter.ConnectToServerOverRDMA();

            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD connection is {0}", status);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "SMBD Negotiate");
            SmbdNegotiateResponse response;

            status = smbdAdapter.SmbdNegotiate(
                SEND_CREDIT_TARGET,
                RECEIVE_CREDIT_MAX,
                out response);
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD negotiate is {0}", status);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Send SMBD Data Transfer Message request with 0 credit.");
            status = smbdAdapter.SmbdSendDataTransferMessage(
                0,
                0,
                SmbdDataTransfer_Flags.NONE,
                0,
                0,
                0,
                new byte[0]);
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of send SMBD Data Transfer message is {0}", status);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Verify server connection will be terminated.");
            smbdAdapter.WaitRdmaDisconnect();
            BaseTestSite.Assert.IsFalse(smbdAdapter.ClientConnection.Endpoint.IsConnected, "Connection should be terminated");
        }
예제 #2
0
        public void SmbdNegotiate_NegotiationTimer()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Connect to server over RDMA");
            NtStatus ret = smbdAdapter.ConnectToServerOverRDMA();

            BaseTestSite.Assert.AreEqual <NtStatus>(ret, NtStatus.STATUS_SUCCESS, "Status of SMBD connection is {0}", ret);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Wait 4 seconds (less than the connection timeout of 5 seconds).");
            Thread.Sleep(TimeSpan.FromSeconds(SmbdConnection.PASSIVE_NEGOTIATION_TIMEOUT - 1));

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Send Negotiate request and receive the response.");
            NtStatus status = smbdAdapter.SmbdNegotiate();

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Verify server does not terminate the connection.");
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD negotiate", status);
        }
        /// <summary>
        /// Establish SMB2 connection over RDMA and open file
        /// 1. Connect to server over RDMA
        /// 2. SMBD Negotiation over RDMA
        /// 3. Establish SMB2 session and open file with specific dialect
        /// </summary>
        /// <param name="fileName">File name to open</param>
        /// <param name="negotiatedDialect">Optional to set the SMB2 dialect used for SMB2 connection</param>
        protected virtual void EstablishConnectionAndOpenFile(string fileName, DialectRevision negotiatedDialect = DialectRevision.Smb30)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Establish SMB2 connection over RDMA and open file " + fileName);

            // Connect to server over RDMA
            NtStatus status = smbdAdapter.ConnectToServerOverRDMA();

            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD connection is {0}", status);

            // SMBD Negotiate
            status = smbdAdapter.SmbdNegotiate();
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD negotiate is {0}", status);

            status = smbdAdapter.Smb2EstablishSessionAndOpenFile(fileName, negotiatedDialect);
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMB2 establish session and open file is {0}", status);
        }
        public void InitSmbdConnectionForTestCases(string fileName)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Initial SMBD connection and open file " + fileName);

            uint size = smbdAdapter.TestConfig.LargeFileSizeInByte;
            // Connect to server over RDMA
            NtStatus status = smbdAdapter.ConnectToServerOverRDMA();

            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD connection is {0}", status);

            // SMBD Negotiate
            status = smbdAdapter.SmbdNegotiate();
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD negotiate is {0}", status);


            status = smbdAdapter.Smb2EstablishSessionAndOpenFile(fileName);
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMB2 establish session and open file is {0}", status);
        }
예제 #5
0
        /// <summary>
        /// Establish SMB2 connection over RDMA and open file
        /// 1. Connect to server over RDMA
        /// 2. SMBD Negotiation over RDMA
        /// 3. Establish SMB2 session and open file with specific dialect
        /// </summary>
        /// <param name="fileName">File name to open</param>
        /// <param name="negotiatedDialects">Optional to set the SMB2 dialects used for SMB2 connection</param>
        protected virtual void EstablishConnectionAndOpenFile(string fileName, DialectRevision[] negotiatedDialects = null)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Establish SMB2 connection over RDMA and open file " + fileName);

            // Connect to server over RDMA
            NtStatus status = smbdAdapter.ConnectToServerOverRDMA();

            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD connection is {0}", status);

            // SMBD Negotiate
            status = smbdAdapter.SmbdNegotiate();
            if (status == NtStatus.STATUS_NOT_SUPPORTED)
            {
                BaseTestSite.Assert.Inconclusive("Requested SMB dialects are not supported.");
            }
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMBD negotiate is {0}", status);

            status = smbdAdapter.Smb2EstablishSessionAndOpenFile(fileName, negotiatedDialects);
            BaseTestSite.Assert.AreEqual <NtStatus>(NtStatus.STATUS_SUCCESS, status, "Status of SMB2 establish session and open file is {0}", status);
        }