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 # CONNECT 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 connect_open_nne {
  51         my $interface = "NDMP_CONNECT_OPEN";
  52         my $error = "NDMP_NO_ERR";
  53         my $version = "4";
  54         my %args = ('option',$option,'inf',$interface,'err',$error,'ndmp_ver',$version);
  55         ndmp_execute::ndmp_execute_cli(\%args);
  56 }
  57 sub connect_open_iae {
  58         my $interface = "NDMP_CONNECT_OPEN";
  59         my $error = "NDMP_ILLEGAL_ARGS_ERR";
  60         my $version = "5";
  61         my %args = ('option',$option,'inf',$interface,'err',$error,'ndmp_ver',$version);
  62         ndmp_execute::ndmp_execute_cli(\%args);
  63 }
  64 sub connect_open_ise {
  65         my $interface = "NDMP_CONNECT_OPEN";
  66         my $error = "NDMP_ILLEGAL_STATE_ERR";
  67         my $version = "4";
  68         my %args = ('option',$option,'inf',$interface,'err',$error,'ndmp_ver',$version);
  69         ndmp_execute::ndmp_execute_cli(\%args);
  70 }
  71 sub connect_open_nse {
  72         my $interface = "NDMP_CONNECT_OPEN";
  73         my $error = "NDMP_NOT_SUPPORTED_ERR";
  74         my $version = "4";
  75         my %args = ('option',$option,'inf',$interface,'err',$error,'ndmp_ver',$version);
  76         ndmp_execute::ndmp_execute_cli(\%args);
  77 }
  78 sub connect_client_auth_nne {
  79         my $interface = "NDMP_CONNECT_CLIENT_AUTH";
  80         my $error = "NDMP_NO_ERR";
  81         my $auth_type = "NDMP_AUTH_TEXT";
  82         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
  83         ndmp_execute::ndmp_execute_cli(\%args);
  84 }
  85 sub connect_client_auth_nae {
  86         my $interface = "NDMP_CONNECT_CLIENT_AUTH";
  87         my $error = "NDMP_NOT_AUTHORIZED_ERR";
  88         my $auth_type = "NDMP_AUTH_TEXT";
  89         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
  90         ndmp_execute::ndmp_execute_cli(\%args);
  91 }
  92 sub connect_client_auth_nse {
  93         my $interface = "NDMP_CONNECT_CLIENT_AUTH";
  94         my $error = "NDMP_NOT_SUPPORTED_ERR";
  95         my $auth_type = "NDMP_AUTH_NONE";
  96         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
  97         ndmp_execute::ndmp_execute_cli(\%args);
  98 }
  99 sub connect_client_auth_iae {
 100         my $interface = "NDMP_CONNECT_CLIENT_AUTH";
 101         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 102         my $auth_type = "NDMP_AUTH_NONE";
 103         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
 104         ndmp_execute::ndmp_execute_cli(\%args);
 105 }
 106 sub connect_close_nne {
 107         my $interface = "NDMP_CONNECT_CLOSE";
 108         my $error = "NDMP_NO_ERR";
 109         my %args = ('option',$option,'inf',$interface,'err',$error);
 110         ndmp_execute::ndmp_execute_cli(\%args);
 111 }
 112 sub connect_server_auth_nne {
 113         my $interface = "NDMP_CONNECT_SERVER_AUTH";
 114         my $error = "NDMP_NO_ERR";
 115         my $auth_type = "NDMP_AUTH_TEXT";
 116         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
 117         ndmp_execute::ndmp_execute_cli(\%args);
 118 }
 119 sub connect_server_auth_nae {
 120         my $interface = "NDMP_CONNECT_SERVER_AUTH";
 121         my $error = "NDMP_NOT_AUTHORIZED_ERR";
 122         my $auth_type = "NDMP_AUTH_TEXT";
 123         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
 124         ndmp_execute::ndmp_execute_cli(\%args);
 125 }
 126 sub connect_server_auth_iae {
 127         my $interface = "NDMP_CONNECT_SERVER_AUTH";
 128         my $error = "NDMP_ILLEGAL_ARGS_ERR";
 129         my $auth_type = "NDMP_AUTH_NONE";
 130         my %args = ('option',$option,'inf',$interface,'err',$error,'auth_type',$auth_type);
 131         ndmp_execute::ndmp_execute_cli(\%args);
 132 }
 133 1;
 134