-
Notifications
You must be signed in to change notification settings - Fork 50
/
tests.py
594 lines (518 loc) · 21.6 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
import json
import random
import unittest
from nsnitro import *
nsnitro_test_netscaler_ipaddress = '172.16.214.200'
nsnitro_test_netscaler_uname = 'nsroot'
nsnitro_test_netscaler_pword = 'nsroot'
nsnitro_test_ip_ipaddress = '10.32.100.' + str(random.randrange(1, 256))
nsnitro_test_ip_netmask = '255.255.255.224'
nsnitro_test_lbvserver_ipaddress = '10.32.110.' + str(random.randrange(1, 256))
nsnitro_test_lbvserver_port = random.randrange(1025, 65536)
nsnitro_test_server_ipaddress = '10.32.120.' + str(random.randrange(1, 256))
nsnitro_test_service_port = random.randrange(1025, 65536)
nsnitro_test_interface_ifnum = '1/1'
nsnitro_test_vlan_id = str(random.randrange(1025, 4096))
class TestNitroFunctions(unittest.TestCase):
nitro = NSNitro(
nsnitro_test_netscaler_ipaddress,
nsnitro_test_netscaler_uname,
nsnitro_test_netscaler_pword,
useSSL=False)
@classmethod
def setUpClass(cls):
cls.nitro.login()
@classmethod
def tearDownClass(cls):
cls.nitro.logout()
def test_00_add_ip(self):
# Add IP address
ip = NSIP()
ip.set_ipaddress(nsnitro_test_ip_ipaddress)
ip.set_netmask(nsnitro_test_ip_netmask)
ip.set_vserver('disabled')
r = NSIP.add(self.nitro, ip)
self.assertEqual(r.errorcode, 0)
def test_00_add_lbmonitor(self):
# Add load-balancing monitor
lbmonitor = NSLBMonitor()
lbmonitor.set_monitorname('nsnitro_test_lbmonitor')
lbmonitor.set_type('HTTP')
lbmonitor.set_httprequest('HEAD /')
lbmonitor.set_rtsprequest('HEAD /')
lbmonitor.set_respcode(['200'])
lbmonitor.set_interval(5)
lbmonitor.set_resptimeout(2)
lbmonitor.set_resptimeoutthresh(0)
r = NSLBMonitor.add(self.nitro, lbmonitor)
self.assertEqual(r.errorcode, 0)
def test_00_add_server(self):
# Add server
server = NSServer()
server.set_name('nsnitro_test_server')
server.set_ipaddress(nsnitro_test_server_ipaddress)
r = NSServer.add(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_00_add_vlan(self):
# Add VLAN
vlan = NSVLAN()
vlan.set_id(nsnitro_test_vlan_id)
r = NSVLAN.add(self.nitro, vlan)
self.assertEqual(r.errorcode, 0)
def test_01_add_cmdpol(self):
# Add command policy
cmdpol = NSSystemCMDPolicy()
cmdpol.set_action('ALLOW')
cmdpol.set_policyname('nsnitro_test_cmdpol')
cmdpol.set_cmdspec('show hardware')
r = NSSystemCMDPolicy.add(self.nitro, cmdpol)
self.assertEqual(r.errorcode, 0)
# def test_01_add_cspolicy(self):
# # Add content-switching policy
# cspol = NSCSPolicy()
# cspol.set_rule('CLIENT.IP.SRC.SUBNET(24).EQ(10.10.42.0)')
# cspol.set_policyname('test_policyname')
# r = NSCSPolicy.add(self.nitro, cspol)
# self.assertEqual(r.errorcode, 0)
def test_01_add_lbvserver(self):
# Add load-balancing virtual server
lbvserver = NSLBVServer()
lbvserver.set_name('nsnitro_test_lbvserver')
lbvserver.set_ipv46(nsnitro_test_lbvserver_ipaddress)
lbvserver.set_port(nsnitro_test_lbvserver_port)
lbvserver.set_clttimeout(180)
lbvserver.set_persistencetype('NONE')
lbvserver.set_servicetype('HTTP')
r = NSLBVServer.add(self.nitro, lbvserver)
self.assertEqual(r.errorcode, 0)
def test_01_add_acl(self):
#Add extended acl
acl = NSAcl()
acl.set_aclaction('ALLOW')
acl.set_aclname('TEST_acl')
acl.set_srcipop('=')
acl.set_destportop('=')
acl.set_srcipval('192.168.0.2')
acl.set_srcip('1')
acl.set_destport('1')
acl.set_protocolnumber(6)
acl.set_destportval('8080')
r = NSAcl.add(self.nitro, acl)
self.assertEqual(r.errorcode, 0)
def test_01_add_simple_acl(self):
#Add simple acl
simpleacl = NSSimpleacl()
simpleacl.set_aclaction('DENY')
simpleacl.set_aclname('TEST_simple_acl')
simpleacl.set_srcip('192.168.0.5')
simpleacl.set_destport('9090')
simpleacl.set_protocol('TCP')
r = NSSimpleacl.add(self.nitro, simpleacl)
self.assertEqual(r.errorcode, 0)
def test_01_add_simple_acl_ttl(self):
#Add simple acl with a TTL
simpleacl = NSSimpleacl()
simpleacl.set_aclaction('DENY')
simpleacl.set_aclname('TEST_simple_acl_ttl')
simpleacl.set_srcip('192.168.0.10')
simpleacl.set_destport('10000')
simpleacl.set_protocol('TCP')
simpleacl.set_ttl('4')
r = NSSimpleacl.add(self.nitro, simpleacl)
self.assertEqual(r.errorcode, 0)
# def test_01_add_rewriteaction(self):
# # Add rewrite action
# rewriteaction = NSRewriteAction()
# rewriteaction.set_name('nsnitro_test_rewriteaction')
# rewriteaction.set_type('insert_http_header')
# rewriteaction.set_target('ble')
# rewriteaction.set_stringbuilderexpr('CLIENT.IP.SRC')
# r = NSRewriteAction.add(self.nitro, rewriteaction)
# self.assertEqual(r.errorcode, 0)
def test_01_add_service(self):
# Add service
service = NSService()
service.set_name('nsnitro_test_service')
service.set_servername('nsnitro_test_server')
service.set_servicetype('HTTP')
service.set_port(nsnitro_test_service_port)
r = NSService.add(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_01_add_servicegroup(self):
# Add servicegroup
servicegroup = NSServiceGroup()
servicegroup.set_servicegroupname('nsnitro_test_servicegroup')
servicegroup.set_servicetype('http')
r = NSServiceGroup.add(self.nitro, servicegroup)
self.assertEqual(r.errorcode, 0)
def test_02_bind_lbmonitorservice(self):
# Bind load-balancing monitor to a service
lbmonbind = NSLBMonitorServiceBinding()
lbmonbind.set_servicename('nsnitro_test_service')
lbmonbind.set_monitorname('nsnitro_test_lbmonitor')
r = NSLBMonitorServiceBinding.add(self.nitro, lbmonbind)
self.assertEqual(r.errorcode, 0)
def test_02_bind_lbvserverservice(self):
# Bind service to load-balancing virtual server
lbvserverservice = NSLBVServerServiceBinding()
lbvserverservice.set_name('nsnitro_test_lbvserver')
lbvserverservice.set_servicename('nsnitro_test_service')
lbvserverservice.set_weight(40)
r = NSLBVServerServiceBinding.add(self.nitro, lbvserverservice)
self.assertEqual(r.errorcode, 0)
def test_02_bind_vlan_to_if(self):
# Bind VLAN to interface
vifb = NSVLANInterfaceBinding()
vifb.set_id(nsnitro_test_vlan_id)
vifb.set_ifnum(nsnitro_test_interface_ifnum)
vifb.set_tagged(True)
r = NSVLANInterfaceBinding.add(self.nitro, vifb)
self.assertEqual(r.errorcode, 0)
def test_02_bind_vlan_to_ip(self):
# Bind VLAN to IP address
vipb = NSVLANNSIPBinding()
vipb.set_id(nsnitro_test_vlan_id)
vipb.set_ipaddress(nsnitro_test_ip_ipaddress)
vipb.set_netmask(nsnitro_test_ip_netmask)
r = NSVLANNSIPBinding.add(self.nitro, vipb)
self.assertEqual(r.errorcode, 0)
def test_03_disable_feature(self):
# Disable Netscaler features
feature = NSFeature()
feature.set_feature(['ssl'])
r = NSFeature.disable(self.nitro, feature)
self.assertEqual(r.errorcode, 0)
def test_03_disable_server(self):
# Disable server
server = NSServer()
server.set_name('nsnitro_test_server')
r = NSServer.disable(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_03_disable_service(self):
# Disable service
service = NSService()
service.set_name('nsnitro_test_service')
r = NSService.disable(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_04_enable_feature(self):
# Enable Netscaler features
feature = NSFeature()
feature.set_feature(['ssl'])
r = NSFeature.enable(self.nitro, feature)
self.assertEqual(r.errorcode, 0)
def test_04_enable_server(self):
# Enable server
server = NSServer()
server.set_name('nsnitro_test_server')
r = NSServer.enable(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_04_enable_service(self):
# Enable service
service = NSService()
service.set_name('nsnitro_test_service')
r = NSService.enable(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_05_get_hanodes(self):
# Get HA node info
hanodes = NSHANode.get_all(self.nitro)
hanode_list = []
for hanode in hanodes:
hanode_list.append(hanode.get_id())
self.assertIn('0', hanode_list)
def test_05_get_ips(self):
# List all IPs
ips = NSIP.get_all(self.nitro)
ip_list = []
for ip in ips:
ip_list.append(ip.get_ipaddress())
self.assertIn(nsnitro_test_netscaler_ipaddress, ip_list)
self.assertIn(nsnitro_test_ip_ipaddress, ip_list)
def test_05_get_lbmonitor(self):
# Get load-balancing monitor info
lbmonitor = NSLBMonitor()
lbmonitor.set_monitorname('nsnitro_test_lbmonitor')
r = NSLBMonitor.get(self.nitro, lbmonitor).__dict__['options']
self.assertIn('nsnitro_test_lbmonitor', r['monitorname'])
self.assertIn('HEAD /', r['httprequest'])
self.assertEqual(5, r['interval'])
def test_05_get_lbvserver(self):
# Get load-balanced virtual server info
lbvserver = NSLBVServer()
lbvserver.set_name('nsnitro_test_lbvserver')
r = NSLBVServer.get(self.nitro, lbvserver).__dict__['options']
self.assertIn('nsnitro_test_lbvserver', r['name'])
self.assertEqual('180', r['clttimeout'])
self.assertEqual(nsnitro_test_lbvserver_port, r['port'])
def test_05_get_lbvserverservice_bindings(self):
# Get load-balanced virtual server/service binding
lbvserverservicebinding = NSLBVServerServiceBinding()
lbvserverservicebinding.set_name('nsnitro_test_lbvserver')
#This returned as a list with a single dict in it
r = NSLBVServerServiceBinding.get(self.nitro, lbvserverservicebinding)[0].__dict__['options']
self.assertIn('nsnitro_test_service', r['servicename'])
self.assertIn('nsnitro_test_lbvserver', r['name'])
self.assertIn(nsnitro_test_server_ipaddress, r['ipv46'])
#self.assertIn(nsnitro_test_server_ipaddress, r['vsvrbindsvcip']) #key is not returned
self.assertEqual(nsnitro_test_service_port, r['port'])
def test_05_get_nsconfig(self):
# Get system configuration
r = NSConfig.get_all(self.nitro).__dict__['options']
self.assertIn(nsnitro_test_netscaler_ipaddress, r['ipaddress'])
def test_05_get_server(self):
# Get info on a specific server
server = NSService()
server.set_name('nsnitro_test_server')
r = NSServer.get(self.nitro, server).__dict__['options']
self.assertIn('nsnitro_test_server', r['name'])
self.assertIn(nsnitro_test_server_ipaddress, r['ipaddress'])
def test_05_get_service(self):
# Get info on a specific service
service = NSService()
service.set_name('nsnitro_test_service')
r = NSService.get(self.nitro, service).__dict__['options']
self.assertIn('nsnitro_test_service', r['name'])
self.assertIn('HTTP', r['servicetype'])
self.assertEqual(nsnitro_test_service_port, r['port'])
def test_05_get_vlan_if_bindings(self):
# Get all VLAN/interface bindings
vlans = NSVLAN.get_all(self.nitro)
vifb_list = []
for vlan in vlans:
vifbs = NSVLANInterfaceBinding.get(self.nitro, vlan)
vifb = vifbs.__dict__['options']
vifb_list.append(vifb['id'])
self.assertIn('1', vifb_list)
self.assertIn(nsnitro_test_vlan_id, vifb_list)
def test_05_get_vlan_ip_bindings(self):
# Get VLAN/IP address bindings
vlans = NSVLAN.get_all(self.nitro)
vipb_list = []
for vlan in vlans:
vipbs = NSVLANNSIPBinding.get(self.nitro, vlan)
vipb = vipbs.__dict__['options']
vipb_list.append(vipb['id'])
self.assertIn('1', vipb_list)
self.assertIn(nsnitro_test_vlan_id, vipb_list)
def test_05_get_vlans(self):
# Get VLANs
vlans = NSVLAN.get_all(self.nitro)
vlan_list = []
for vlan in vlans:
vlan_list.append(vlan.get_id())
self.assertIn('1', vlan_list)
self.assertIn(nsnitro_test_vlan_id, vlan_list)
def test_05_get_simple_acl(self):
#Get simple acl
simpleacl = NSSimpleacl()
simpleacl.set_aclname('TEST_simple_acl')
r = NSSimpleacl.get(self.nitro, simpleacl)
self.assertEqual(r.__dict__['options']['aclname'],'TEST_simple_acl')
def test_05_get_simple_acl_ttl(self):
#Get simple acl with TTL
simpleacl = NSSimpleacl()
simpleacl.set_aclname('TEST_simple_acl_ttl')
r = NSSimpleacl.get(self.nitro, simpleacl)
self.assertEqual(r.__dict__['options']['aclname'],'TEST_simple_acl_ttl')
def test_05_get_acl(self):
#Get extended acl
acl = NSAcl()
acl.set_aclname('TEST_acl')
r = NSAcl.get(self.nitro, acl)
self.assertEqual(r.__dict__['options']['aclname'],'TEST_acl')
self.assertEqual(r.__dict__['options']['destportval'],'8080')
def test_06_rename_server_01(self):
# Rename service
server = NSServer()
server.set_name('nsnitro_test_server')
server.set_newname('nsnitro_test_server_rename')
r = NSServer.rename(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_06_rename_server_02(self):
# Rename service
server = NSServer()
server.set_name('nsnitro_test_server_rename')
server.set_newname('nsnitro_test_server')
r = NSServer.rename(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_06_rename_service_01(self):
# Rename service
service = NSService()
service.set_name('nsnitro_test_service')
service.set_newname('nsnitro_test_service_rename')
r = NSService.rename(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_06_rename_service_02(self):
# Rename service back to original
service = NSService()
service.set_name('nsnitro_test_service_rename')
service.set_newname('nsnitro_test_service')
r = NSService.rename(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_06_update_server(self):
# Update server
server = NSServer()
server.set_name('nsnitro_test_server')
server.set_comment('test comment')
r = NSServer.update(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_06_update_service(self):
# Update service
service = NSService()
service.set_name('nsnitro_test_service')
service.set_comment('test comment')
service.set_useproxyport('NO')
r = NSService.update(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_06_update_cmdpol(self):
# Update command policy
cmdpol = NSSystemCMDPolicy()
cmdpol.set_action('DENY')
cmdpol.set_policyname('nsnitro_test_cmdpol')
cmdpol.set_cmdspec('show lb vserver')
r = NSSystemCMDPolicy.update(self.nitro, cmdpol)
self.assertEqual(r.errorcode, 0)
def test_06_update_lbmonitor(self):
# Update load-balancing monitor
lbmon = NSLBMonitor()
lbmon.set_monitorname('nsnitro_test_lbmonitor')
lbmon.set_type('HTTP')
lbmon.set_interval('60')
lbmon.set_resptimeout('24')
r = NSLBMonitor.update(self.nitro, lbmon)
self.assertEqual(r.errorcode, 0)
def test_06_update_acl(self):
# #Update extended acl
acl = NSAcl()
acl.set_aclname('TEST_acl')
acl.set_destportval('8081')
acl.set_destport('1')
acl.set_aclaction("DENY")
r = NSAcl.update(self.nitro, acl)
self.assertEqual(r.errorcode, 0)
r = NSAcl.get(self.nitro, acl)
self.assertEqual(r.__dict__['options']['destportval'],'8081')
self.assertEqual(r.__dict__['options']['aclaction'],'DENY')
def test_07_unbind_lbmonitorservice(self):
# Unbind load-balancing monitor from a service
lbmonbind = NSLBMonitorServiceBinding()
lbmonbind.set_servicename('nsnitro_test_service')
lbmonbind.set_monitorname('nsnitro_test_lbmonitor')
r = NSLBMonitorServiceBinding.delete(self.nitro, lbmonbind)
self.assertEqual(r.errorcode, 0)
def test_07_unbind_lbvserverservice(self):
# Unbind service from load-balancing virtual server
lbvserverservice = NSLBVServerServiceBinding()
lbvserverservice.set_name('nsnitro_test_lbvserver')
lbvserverservice.set_servicename('nsnitro_test_service')
r = NSLBVServerServiceBinding.delete(self.nitro, lbvserverservice)
self.assertEqual(r.errorcode, 0)
def test_07_unbind_vifb(self):
# Unbind VLAN from interface
ip = NSVLANInterfaceBinding()
ip.set_id(nsnitro_test_vlan_id)
ip.set_ifnum(nsnitro_test_interface_ifnum)
r = NSVLANInterfaceBinding.delete(self.nitro, ip)
self.assertEqual(r.errorcode, 0)
def test_07_unbind_vipb(self):
# Unbind VLAN from IP address
ip = NSVLANNSIPBinding()
ip.set_id(nsnitro_test_vlan_id)
ip.set_ipaddress(nsnitro_test_ip_ipaddress)
ip.set_netmask(nsnitro_test_ip_netmask)
r = NSVLANNSIPBinding.delete(self.nitro, ip)
self.assertEqual(r.errorcode, 0)
def test_08_delete_cmdpol(self):
# Delete command policy
cmdpol = NSSystemCMDPolicy()
cmdpol.set_policyname('nsnitro_test_cmdpol')
r = NSSystemCMDPolicy.delete(self.nitro, cmdpol)
self.assertEqual(r.errorcode, 0)
# def test_08_delete_cspolicy(self):
# # Delete content-switching policy
# cspol = NSCSPolicy()
# cspol.set_rule('CLIENT.IP.SRC.SUBNET(24).EQ(10.10.42.0)')
# cspol.set_policyname('test_policyname')
# r = NSCSPolicy.delete(self.nitro, cspol)
# self.assertEqual(r.errorcode, 0)
def test_08_delete_lbvserver(self):
# Delete load-balancing virtual server
lbvserver = NSLBVServer()
lbvserver.set_name('nsnitro_test_lbvserver')
r = NSLBVServer.delete(self.nitro, lbvserver)
self.assertEqual(r.errorcode, 0)
# def test_08_delete_rewriteaction(self):
# # Delete rewrite action
# rewriteaction = NSRewriteAction()
# rewriteaction.set_name('nsnitro_test_rewriteaction')
# r = NSRewriteAction.delete(self.nitro, rewriteaction)
# self.assertEqual(r.errorcode, 0)
def test_08_delete_service(self):
# Delete service
service = NSService()
service.set_name('nsnitro_test_service')
r = NSService.delete(self.nitro, service)
self.assertEqual(r.errorcode, 0)
def test_08_delete_servicegroup(self):
# Delete servicegroup
servicegroup = NSServiceGroup()
servicegroup.set_servicegroupname('nsnitro_test_servicegroup')
r = NSServiceGroup.delete(self.nitro, servicegroup)
self.assertEqual(r.errorcode, 0)
def test_09_delete_ip(self):
# Delete IP address
ip = NSIP()
ip.set_ipaddress(nsnitro_test_ip_ipaddress)
r = NSIP.delete(self.nitro, ip)
self.assertEqual(r.errorcode, 0)
def test_09_delete_lbmonitor(self):
# Delete load-balancing monitor
lbmon = NSLBMonitor()
lbmon.set_monitorname('nsnitro_test_lbmonitor')
lbmon.set_type('HTTP')
r = NSLBMonitor.delete(self.nitro, lbmon)
self.assertEqual(r.errorcode, 0)
def test_09_delete_server(self):
# Delete server
server = NSServer()
server.set_name('nsnitro_test_server')
r = NSServer.delete(self.nitro, server)
self.assertEqual(r.errorcode, 0)
def test_09_delete_vlan(self):
# Delete VLAN
vlan = NSVLAN()
vlan.set_id(nsnitro_test_vlan_id)
r = NSVLAN.delete(self.nitro, vlan)
self.assertEqual(r.errorcode, 0)
def test_10_save_config(self):
config = NSConfig()
r = config.save(self.nitro)
self.assertEqual(r.errorcode, 0)
def test_10_del_simple_acl(self):
#Delete simple acl
simpleacl = NSSimpleacl()
simpleacl.set_aclname('TEST_simple_acl')
r = NSSimpleacl.delete(self.nitro, simpleacl)
self.assertEqual(r.errorcode,0)
def test_10_del_simple_acl_ttl(self):
#Delete simple acl with ttl
simpleacl = NSSimpleacl()
simpleacl.set_aclname('TEST_simple_acl_ttl')
r = NSSimpleacl.delete(self.nitro, simpleacl)
self.assertEqual(r.errorcode,0)
def test_10_del_acl(self):
#Delete extended acl
acl = NSAcl()
acl.set_aclname('TEST_acl')
r = NSAcl.delete(self.nitro, acl)
self.assertEqual(r.errorcode,0)
#This will clear all simple acl on the device
#def test_11_zclear_all_simple_acl(self):
# simpleacl = NSSimpleacl()
# r = NSSimpleacl.clear(self.nitro)
# self.assertEqual(r.errorcode, 0)
def test_11_flush_simple_acl(self):
simpleacl = NSSimpleacl()
r = NSSimpleacl.flush(self.nitro)
self.assertEqual(r.errorcode, 0)
if __name__ == '__main__':
unittest.main()