1
+ $Nsip = " 172.16.124.10"
2
+ $Username = " nsroot"
3
+ $Password = " nsroot"
4
+
5
+ Import-Module Pester
6
+
7
+ $here = Split-Path - Parent $MyInvocation.MyCommand.Path
8
+ Import-Module - Force $here \..\Netscaler
9
+ . $here \TestSupport.ps1
10
+
11
+ Describe " Netscaler Get-*" {
12
+ $Session = Connect-Netscaler - Hostname $Nsip - Credential $Credential - PassThru
13
+
14
+ It " should list VPN policies" {
15
+ $Policy = Get-NSVPNSessionPolicy
16
+
17
+ $Policy | Should Not BeNullOrEmpty
18
+ $Policy.name | Should Be " SETVPNPARAMS_POL"
19
+ }
20
+
21
+ It " should get VPN policy" {
22
+ $Policy = Get-NSVPNSessionPolicy - Name " SETVPNPARAMS_POL"
23
+
24
+ $Policy | Should Not BeNullOrEmpty
25
+ $Policy.name | Should Be " SETVPNPARAMS_POL"
26
+ }
27
+
28
+ It " should list VPN profiles" {
29
+ $Policy = Get-NSVPNSessionProfile
30
+
31
+ $Policy | Should Not BeNullOrEmpty
32
+ $Policy.name | Should Be " SETVPNPARAMS_ACT"
33
+ }
34
+
35
+ It " should get VPN profiles" {
36
+ $Policy = Get-NSVPNSessionProfile - Name " SETVPNPARAMS_ACT"
37
+
38
+ $Policy | Should Not BeNullOrEmpty
39
+ $Policy.name | Should Be " SETVPNPARAMS_ACT"
40
+ }
41
+
42
+ It " should get a certificate" {
43
+ $Cert = Get-NSSSLCertificate - Name " ns-server-certificate"
44
+
45
+ $Cert | Should Not BeNullOrEmpty
46
+ $Cert.certkey | Should Be " ns-server-certificate"
47
+ }
48
+
49
+ It " should list certificates" {
50
+ $Cert = Get-NSSSLCertificate
51
+
52
+ $Cert | Should Not BeNullOrEmpty
53
+ $Cert.certkey | Should Be " ns-server-certificate"
54
+ }
55
+ }
56
+
57
+ Describe " Netscaler" {
58
+ $Session = Connect-Netscaler - Hostname $Nsip - Credential $Credential - PassThru
59
+
60
+
61
+ It " should add a server" {
62
+ New-NSLBServer - Name ' srv-test' - IPAddress 1.2 .3.4
63
+
64
+ Compare-NSConfig $OldConf | Should Match " => add server srv-test 1.2.3.4"
65
+ }
66
+
67
+ BeforeEach { $OldConf = Get-NSConfig }
68
+ AfterEach { Clear-NSConfig - Force }
69
+ }
0 commit comments