1 #
2 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3 # Use is subject to license terms.
4 #
5
6 #
7 # BSD 3 Clause License
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 # - Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 #
15 # - Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in
17 # the documentation and/or other materials provided with the
18 # distribution.
19 #
20 # - Neither the name of Sun Microsystems, Inc. nor the
21 # names of its contributors may be used to endorse or promote products
22 # derived from this software without specific prior written permission.
23 #
24 # THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. "AS IS" AND ANY
25 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 # DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY
28 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES
30 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #
35
36 #
37 # This file contains all the sub routines for the
38 # SCSI interface methods. Each Method tests different
39 # error conditions depending on the input file
40 #
41 #
42 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
43 #
44
45 use strict;
46 use warnings;
47
48 our $log_flag = 1;
49 our $option = "cli";
50 sub scsi_close_dnoe {
51 my $interface = "scsi_close";
52 my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
53 my %args = ('option',$option,'inf',$interface,'err',$error);
54 ndmp_execute::ndmp_execute_cli(\%args);
55 }
56 sub scsi_close_nae {
57 my $interface = "scsi_close";
58 my $error = "NDMP_NOT_AUTHORIZED_ERR";
59 my %args = ('option',$option,'inf',$interface,'err',$error);
60 ndmp_execute::ndmp_execute_cli(\%args);
61 }
62 sub scsi_close_nne {
63 my $interface = "scsi_close";
64 my $error = "NDMP_DEV_NOT_OPEN_ERR";
65 my %args = ('option',$option,'inf',$interface,'err',$error);
66 ndmp_execute::ndmp_execute_cli(\%args);
67 }
68 sub scsi_exec_nae {
69 my $interface = "scsi_execute_cdb";
70 my $error = "NDMP_NOT_AUTHORIZED_ERR";
71 my $cdb = "INQUIRY";
72 my %args = ('option',$option,'inf',$interface,'err',$error,'cdb',$cdb);
73 ndmp_execute::ndmp_execute_cli(\%args);
74 }
75 sub scsi_exec_iae {
76 my $interface = "scsi_execute_cdb";
77 my $error = "NDMP_ILLEGAL_ARGS_ERR";
78 my $cdb = "INQUIRY";
79 my %args = ('option',$option,'inf',$interface,'err',$error,'cdb',$cdb);
80 ndmp_execute::ndmp_execute_cli(\%args);
81 }
82
83 sub scsi_exec_nne {
84 my $interface = "scsi_execute_cdb";
85 my $error = "NDMP_NO_ERR";
86 my $cdb = "INQUIRY";
87 my %args = ('option',$option,'inf',$interface,'err',$error,'cdb',$cdb);
88 ndmp_execute::ndmp_execute_cli(\%args);
89 }
90
91 sub scsi_exec_dnoe {
92 my $interface = "scsi_execute_cdb";
93 my $error = "NDMP_DEV_NOT_OPEN_ERR";
94 my $cdb = "INQUIRY";
95 my %args = ('option',$option,'inf',$interface,'err',$error,'cdb',$cdb);
96 ndmp_execute::ndmp_execute_cli(\%args);
97 }
98
99 sub scsi_get_state_dnoe {
100 my $interface = "scsi_get_state";
101 my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
102 my %args = ('option',$option,'inf',$interface,'err',$error);
103 ndmp_execute::ndmp_execute_cli(\%args);
104 }
105 sub scsi_get_state_nae {
106 my $interface = "scsi_get_state";
107 my $error = "NDMP_NOT_AUTHORIZED_ERR";
108 my %args = ('option',$option,'inf',$interface,'err',$error);
109 ndmp_execute::ndmp_execute_cli(\%args);
110 }
111 sub scsi_get_state_nne {
112 my $interface = "scsi_get_state";
113 my $error = "NDMP_NO_ERR";
114 my %args = ('option',$option,'inf',$interface,'err',$error);
115 ndmp_execute::ndmp_execute_cli(\%args);
116 }
117 sub scsi_open_doe {
118 my $interface = "scsi_open";
119 my $error = "NDMP_DEVICE_OPENED_ERR";
120 my %args = ('option',$option,'inf',$interface,'err',$error);
121 ndmp_execute::ndmp_execute_cli(\%args);
122 }
123 sub scsi_open_nae {
124 my $interface = "scsi_open";
125 my $error = "NDMP_NOT_AUTHORIZED_ERR";
126 my %args = ('option',$option,'inf',$interface,'err',$error);
127 ndmp_execute::ndmp_execute_cli(\%args);
128 }
129 sub scsi_open_nne {
130 my $interface = "scsi_open";
131 my $error = "NDMP_NO_ERR";
132 my %args = ('option',$option,'inf',$interface,'err',$error);
133 ndmp_execute::ndmp_execute_cli(\%args);
134 }
135 sub scsi_open_nde {
136 my $interface = "scsi_open";
137 my $error = "NDMP_NO_DEVICE_ERR";
138 my %args = ('option',$option,'inf',$interface,'err',$error);
139 ndmp_execute::ndmp_execute_cli(\%args);
140 }
141 sub scsi_reset_device_dnoe {
142 my $interface = "scsi_reset_device";
143 my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
144 my %args = ('option',$option,'inf',$interface,'err',$error);
145 ndmp_execute::ndmp_execute_cli(\%args);
146 }
147 sub scsi_reset_device_nae {
148 my $interface = "scsi_reset_device";
149 my $error = "NDMP_NOT_AUTHORIZED_ERR";
150 my %args = ('option',$option,'inf',$interface,'err',$error);
151 ndmp_execute::ndmp_execute_cli(\%args);
152 }
153 sub scsi_reset_device_nne {
154 my $interface = "scsi_reset_device";
155 my $error = "NDMP_NO_ERR";
156 my %args = ('option',$option,'inf',$interface,'err',$error);
157 ndmp_execute::ndmp_execute_cli(\%args);
158 }
159 1;