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 # TAPE 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 tape_close_dnoe {
  51         my $interface = "tape_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 tape_close_nae {
  57         my $interface = "tape_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 tape_close_nne {
  63         my $interface = "tape_close";
  64         my $error = "NDMP_NO_ERR";
  65         my %args = ('option',$option,'inf',$interface,'err',$error);
  66         ndmp_execute::ndmp_execute_cli(\%args);
  67 }
  68 sub tape_exec_dnoe {
  69         my $interface = "tape_execute_cdb";
  70         my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
  71         my %args = ('option',$option,'inf',$interface,'err',$error);
  72         ndmp_execute::ndmp_execute_cli(\%args);
  73 }
  74 sub tape_exec_nae {
  75         my $interface = "tape_execute_cdb";
  76         my $error = "NDMP_NOT_AUTHORIZED_ERR";
  77         my %args = ('option',$option,'inf',$interface,'err',$error);
  78         ndmp_execute::ndmp_execute_cli(\%args);
  79 }
  80 sub tape_exec_nne {
  81         my $interface = "tape_execute_cdb";
  82         my $error = "NDMP_NO_ERR";
  83         my %args = ('option',$option,'inf',$interface,'err',$error);
  84         ndmp_execute::ndmp_execute_cli(\%args);
  85 }
  86 sub tape_getstate_dnoe {
  87         my $interface = "tape_get_state";
  88         my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
  89         my %args = ('option',$option,'inf',$interface,'err',$error);
  90         ndmp_execute::ndmp_execute_cli(\%args);
  91 }
  92 sub tape_getstate_nne {
  93         my $interface = "tape_get_state";
  94         my $error = "NDMP_NO_ERR";
  95         my %args = ('option',$option,'inf',$interface,'err',$error);
  96         ndmp_execute::ndmp_execute_cli(\%args);
  97 }
  98 sub tape_mtio_dnoe {
  99         my $interface = "tape_mtio";
 100         my $error = "NDMP_DEVICE_NOT_OPEN_ERR";
 101         my %args = ('option',$option,'inf',$interface,'err',$error);
 102         ndmp_execute::ndmp_execute_cli(\%args);
 103 }
 104 sub tape_mtio_iae {
 105         my $interface = "tape_mtio";
 106         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 107         my %args = ('option',$option,'inf',$interface,'err',$error);
 108         ndmp_execute::ndmp_execute_cli(\%args);
 109 }
 110 sub tape_mtio_nae {
 111         my $interface = "tape_mtio";
 112         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 113         my %args = ('option',$option,'inf',$interface,'err',$error);
 114         ndmp_execute::ndmp_execute_cli(\%args);
 115 }
 116 sub tape_mtio_nne {
 117         my $interface = "tape_mtio";
 118         my $error = "NDMP_NO_ERR";
 119         my %args = ('option',$option,'inf',$interface,'err',$error);
 120         ndmp_execute::ndmp_execute_cli(\%args);
 121 }
 122 sub tape_open_doe {
 123         my $interface = "tape_open";
 124         my $error = "NDMP_DEVICE_OPENED_ERR";
 125         my %args = ('option',$option,'inf',$interface,'err',$error);
 126         ndmp_execute::ndmp_execute_cli(\%args);
 127 }
 128 sub tape_open_nae {
 129         my $interface = "tape_open";
 130         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 131         my %args = ('option',$option,'inf',$interface,'err',$error);
 132         ndmp_execute::ndmp_execute_cli(\%args);
 133 }
 134 sub tape_open_nde {
 135         my $interface = "tape_open";
 136         my $error = "NDMP_NO_DEVICE_ERR";
 137         my %args = ('option',$option,'inf',$interface,'err',$error);
 138         ndmp_execute::ndmp_execute_cli(\%args);
 139 }
 140 sub tape_open_nne {
 141         my $interface = "tape_open";
 142         my $error = "NDMP_NO_ERR";
 143         my %args = ('option',$option,'inf',$interface,'err',$error);
 144         ndmp_execute::ndmp_execute_cli(\%args);
 145 }
 146 sub tape_open_nte {
 147         my $interface = "tape_open";
 148         my $error = "NDMP_NO_TAPE_LOADED_ERR";
 149         my %args = ('option',$option,'inf',$interface,'err',$error);
 150         ndmp_execute::ndmp_execute_cli(\%args);
 151 }
 152 sub tape_open_wpe {
 153         my $interface = "tape_open";
 154         my $error = "NDMP_WRITE_PROTECT_ERR";
 155         my %args = ('option',$option,'inf',$interface,'err',$error);
 156         ndmp_execute::ndmp_execute_cli(\%args);
 157 }
 158 sub tape_read_dnoe {
 159         my $interface = "tape_read";
 160         my $error = "NDMP_DEV_NOT_OPEN_ERR";
 161         my %args = ('option',$option,'inf',$interface,'err',$error);
 162         ndmp_execute::ndmp_execute_cli(\%args);
 163 }
 164 sub tape_read_nae {
 165         my $interface = "tape_read";
 166         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 167         my %args = ('option',$option,'inf',$interface,'err',$error);
 168         ndmp_execute::ndmp_execute_cli(\%args);
 169 }
 170 sub tape_read_nne {
 171         my $interface = "tape_read";
 172         my $error = "NDMP_NO_ERR";
 173         my %args = ('option',$option,'inf',$interface,'err',$error);
 174         ndmp_execute::ndmp_execute_cli(\%args);
 175 }
 176 sub tape_write_dnoe {
 177         my $interface = "tape_write";
 178         my $error = "NDMP_DEV_NOT_OPEN_ERR";
 179         my %args = ('option',$option,'inf',$interface,'err',$error);
 180         ndmp_execute::ndmp_execute_cli(\%args);
 181 }
 182 sub tape_write_nae {
 183         my $interface = "tape_write";
 184         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 185         my %args = ('option',$option,'inf',$interface,'err',$error);
 186         ndmp_execute::ndmp_execute_cli(\%args);
 187 }
 188 sub tape_write_nne {
 189         my $interface = "tape_read";
 190         my $error = "NDMP_NO_ERR";
 191         my %args = ('option',$option,'inf',$interface,'err',$error);
 192         ndmp_execute::ndmp_execute_cli(\%args);
 193 }
 194 1;