/// <summary>
        /// Reset all member variables before running next test case
        /// </summary>
        public override void Reset()
        {
            if (oplockClient != null)
            {
                oplockClient.Disconnect();
                oplockClient = null;
            }

            if (leaseClient != null)
            {
                leaseClient.Disconnect();
                leaseClient = null;
            }

            fileName           = null;
            breakType          = ModelBreakType.NoBreak;
            treeIdOplock       = 0;
            treeIdLease        = 0;
            alreadyRequested   = false;
            grantedLeaseState  = LeaseStateValues.SMB2_LEASE_NONE;
            grantedOplockLevel = OplockLevel_Values.OPLOCK_LEVEL_NONE;

            base.Reset();
        }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, OPLOCK_BREAK_Notification_Packet notification)
 {
     breakType = ModelBreakType.OplockBreak;
     oplockClient.OplockAcknowledgement(treeIdOplock, notification.FileId, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)notification.OplockLevel);
 }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, LEASE_BREAK_Notification_Packet notification)
 {
     // Set Lease break state
     breakType = ModelBreakType.LeaseBreak;
     leaseClient.LeaseBreakAcknowledgment(treeIdLease, notification.LeaseKey, notification.NewLeaseState);
 }
        /// <summary>
        /// Reset all member variables before running next test case
        /// </summary>
        public override void Reset()
        {
            if (oplockClient != null)
            {
                oplockClient.Disconnect();
                oplockClient = null;
            }

            if (leaseClient != null)
            {
                leaseClient.Disconnect();
                leaseClient = null;
            }

            fileName = null;
            breakType = ModelBreakType.NoBreak;
            treeIdOplock = 0;
            treeIdLease = 0;
            alreadyRequested = false;
            grantedLeaseState = LeaseStateValues.SMB2_LEASE_NONE;
            grantedOplockLevel = OplockLevel_Values.OPLOCK_LEVEL_NONE;

            base.Reset();
        }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, OPLOCK_BREAK_Notification_Packet notification)
 {
     breakType = ModelBreakType.OplockBreak;
     oplockClient.OplockAcknowledgement(treeIdOplock, notification.FileId, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)notification.OplockLevel);
 }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, LEASE_BREAK_Notification_Packet notification)
 {
     // Set Lease break state
     breakType = ModelBreakType.LeaseBreak;
     leaseClient.LeaseBreakAcknowledgment(treeIdLease, notification.LeaseKey, notification.NewLeaseState);
 }
        public static void Verification(ModelBreakType breakType, OplockLevel_Values grantedOplockType, ModelLeaseStateType grantedLeaseType)
        {
            PrintMatrixAndState();
            // 1st Client(Oplock)      2nd Client(Lease)   OplockBreakExist   GrantedLeaseState
            // ================================================================================
            // OPLOCK_LEVEL_II         Any Lease           No                 Lease_R
            // OPLOCK_LEVEL_EXCLUSIVE  Any Lease           Yes                Lease_R
            // OPLOCK_LEVEL_BATCH      Any Lease           Yes                Lease_R
            switch (OplockState)
            {
                // The first request is not for Oplock
                case OplockLevel_Values.OPLOCK_LEVEL_NONE:
                    break;
                case OplockLevel_Values.OPLOCK_LEVEL_II:
                    Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                    Condition.IsTrue(grantedLeaseType == ModelLeaseStateType.Lease_R);
                    break;
                case OplockLevel_Values.OPLOCK_LEVEL_EXCLUSIVE:
                case OplockLevel_Values.OPLOCK_LEVEL_BATCH:
                    Condition.IsTrue(breakType == ModelBreakType.OplockBreak);
                    Condition.IsTrue(grantedLeaseType == ModelLeaseStateType.Lease_R);
                    break;
                default:
                    break;
            }

            // 1st Client(Lease)      2nd Client(Oplock)   LeaseBreakExist   GrantedOplockLevel
            // ================================================================================
            // Lease_R                Any Oplock           No                OPLOCK_LEVEL_II
            // Lease_RH               Any Oplock           No                OPLOCK_LEVEL_NONE
            // Lease_RW               Any Oplock           Yes               OPLOCK_LEVEL_II
            // Lease_RWH              Any Oplock           Yes               OPLOCK_LEVEL_NONE
            switch (LeaseState)
            {
                // The first request is not for Lease
                case ModelLeaseStateType.Lease_None:
                    break;
                case ModelLeaseStateType.Lease_R:
                    Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                    Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_II);
                    break;
                case ModelLeaseStateType.Lease_RH:
                    Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                    Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_NONE);
                    break;
                case ModelLeaseStateType.Lease_RW:
                    Condition.IsTrue(breakType == ModelBreakType.LeaseBreak);
                    Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_II);
                    break;
                case ModelLeaseStateType.Lease_RWH:
                    Condition.IsTrue(breakType == ModelBreakType.LeaseBreak);
                    Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_NONE);
                    break;
                default:
                    break;
            }
        }
        public static void Verification(ModelBreakType breakType, OplockLevel_Values grantedOplockType, ModelLeaseStateType grantedLeaseType)
        {
            PrintMatrixAndState();
            // 1st Client(Oplock)      2nd Client(Lease)   OplockBreakExist   GrantedLeaseState
            // ================================================================================
            // OPLOCK_LEVEL_II         Any Lease           No                 Lease_R
            // OPLOCK_LEVEL_EXCLUSIVE  Any Lease           Yes                Lease_R
            // OPLOCK_LEVEL_BATCH      Any Lease           Yes                Lease_R
            switch (OplockState)
            {
            // The first request is not for Oplock
            case OplockLevel_Values.OPLOCK_LEVEL_NONE:
                break;

            case OplockLevel_Values.OPLOCK_LEVEL_II:
                Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                Condition.IsTrue(grantedLeaseType == ModelLeaseStateType.Lease_R);
                break;

            case OplockLevel_Values.OPLOCK_LEVEL_EXCLUSIVE:
            case OplockLevel_Values.OPLOCK_LEVEL_BATCH:
                Condition.IsTrue(breakType == ModelBreakType.OplockBreak);
                Condition.IsTrue(grantedLeaseType == ModelLeaseStateType.Lease_R);
                break;

            default:
                break;
            }

            // 1st Client(Lease)      2nd Client(Oplock)   LeaseBreakExist   GrantedOplockLevel
            // ================================================================================
            // Lease_R                Any Oplock           No                OPLOCK_LEVEL_II
            // Lease_RH               Any Oplock           No                OPLOCK_LEVEL_NONE
            // Lease_RW               Any Oplock           Yes               OPLOCK_LEVEL_II
            // Lease_RWH              Any Oplock           Yes               OPLOCK_LEVEL_NONE
            switch (LeaseState)
            {
            // The first request is not for Lease
            case ModelLeaseStateType.Lease_None:
                break;

            case ModelLeaseStateType.Lease_R:
                Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_II);
                break;

            case ModelLeaseStateType.Lease_RH:
                Condition.IsTrue(breakType == ModelBreakType.NoBreak);
                Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_NONE);
                break;

            case ModelLeaseStateType.Lease_RW:
                Condition.IsTrue(breakType == ModelBreakType.LeaseBreak);
                Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_II);
                break;

            case ModelLeaseStateType.Lease_RWH:
                Condition.IsTrue(breakType == ModelBreakType.LeaseBreak);
                Condition.IsTrue(grantedOplockType == OplockLevel_Values.OPLOCK_LEVEL_NONE);
                break;

            default:
                break;
            }
        }