|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -# Copyright (C) 2013-2016 Mag. Christian Tanzer All rights reserved |
| 2 | +# Copyright (C) 2013-2018 Mag. Christian Tanzer All rights reserved |
3 | 3 | # Glasauergasse 32, A--1130 Wien, Austria. tanzer@swing.co.at
|
4 | 4 | # #*** <License> ************************************************************#
|
5 | 5 | # This module is part of the package CNDB.OMP.__test__.
|
|
53 | 53 | # have an associated `Net_Interface`.
|
54 | 54 | # 12-Mar-2015 (CT) Adapt to sqlalchemy 0.9.8
|
55 | 55 | # 12-Mar-2015 (CT) Fix backend dependent tests
|
| 56 | +# 19-Mar-2018 (CT) Use `expect_except` (Python-3 compatibility) |
56 | 57 | # ««revision-date»»···
|
57 | 58 | #--
|
58 | 59 |
|
|
152 | 153 | 10.0.64.0/18 Open Source Consulting : electric = T, children = F
|
153 | 154 | 10.0.128.0/17 Open Source Consulting : electric = T, children = F
|
154 | 155 |
|
155 |
| - >>> ct_addr = osc_pool.reserve ('10.0.0.1/32', owner = ct) |
156 |
| - Traceback (most recent call last): |
157 |
| - ... |
| 156 | + >>> with expect_except (CNDB.OMP.Error.Address_Already_Used) : |
| 157 | + ... ct_addr = osc_pool.reserve ('10.0.0.1/32', owner = ct) |
158 | 158 | Address_Already_Used: Address 10.0.0.1 already in use by 'Schlatterbeck Ralf'
|
159 | 159 |
|
160 | 160 | >>> show_networks (scope, ETM, pool = rs_pool) ### 10.0.0.0/28
|
|
171 | 171 | 10.0.0.4/30 Schlatterbeck Ralf : electric = T, children = F
|
172 | 172 | 10.0.0.8/29 Schlatterbeck Ralf : electric = T, children = F
|
173 | 173 |
|
174 |
| - >>> ak_pool = rs_pool.allocate (28, ak) |
175 |
| - Traceback (most recent call last): |
176 |
| - ... |
| 174 | + >>> with expect_except (CNDB.OMP.Error.No_Free_Address_Range) : |
| 175 | + ... ak_pool = rs_pool.allocate (28, ak) |
177 | 176 | No_Free_Address_Range: Address range [10.0.0.0/28] of this IP4_Network doesn't contain a free subrange for mask length 28
|
178 | 177 |
|
179 | 178 | >>> show_networks (scope, ETM, pool = rs_pool) ### 10.0.0.0/30 ct after alloc error
|
|
210 | 209 | 10.0.0.8/29 Glueck Martin : electric = F, children = F
|
211 | 210 | 10.0.0.0/29 Schlatterbeck Ralf : electric = T, children = T
|
212 | 211 |
|
213 |
| - >>> xx_pool = rs_pool.allocate (30, mg) |
214 |
| - Traceback (most recent call last): |
215 |
| - ... |
| 212 | + >>> with expect_except (CNDB.OMP.Error.No_Free_Address_Range) : |
| 213 | + ... xx_pool = rs_pool.allocate (30, mg) |
216 | 214 | No_Free_Address_Range: Address range [10.0.0.0/28] of this IP4_Network doesn't contain a free subrange for mask length 30
|
217 | 215 |
|
218 |
| - >>> yy_pool = mg_pool.allocate (29, mg) |
219 |
| - Traceback (most recent call last): |
220 |
| - ... |
| 216 | + >>> with expect_except (CNDB.OMP.Error.No_Free_Address_Range) : |
| 217 | + ... yy_pool = mg_pool.allocate (29, mg) |
221 | 218 | No_Free_Address_Range: Address range [10.0.0.8/29] of this IP4_Network doesn't contain a free subrange for mask length 29
|
222 | 219 |
|
223 | 220 | >>> show_network_count (scope, ETM)
|
|
398 | 395 | >>> q (Q.net_address.CONTAINS (n), sort_key = s).first ()
|
399 | 396 | CNDB.IP4_Network ("10.42.137.0/28")
|
400 | 397 |
|
401 |
| - >>> ff_pool.free () |
402 |
| - Traceback (most recent call last): |
403 |
| - ... |
| 398 | + >>> with expect_except (CNDB.OMP.Error.Cannot_Free_Network) : |
| 399 | + ... ff_pool.free () |
404 | 400 | Cannot_Free_Network: Cannot free toplevel network 10.0.0.0/8
|
405 |
| - >>> rs_pool.free () |
406 |
| - Traceback (most recent call last): |
407 |
| - ... |
| 401 | + >>> with expect_except (CNDB.OMP.Error.Cannot_Free_Network) : |
| 402 | + ... rs_pool.free () |
408 | 403 | Cannot_Free_Network: Cannot free network with allocations: 10.0.0.0/28
|
409 | 404 |
|
410 | 405 | >>> p1 = CNDB.IP4_Pool \\
|
|
799 | 794 | >>> xpool = CNDB.IP4_Network ('192.168.0.0/16', owner = ff, raw = True)
|
800 | 795 | >>> mgpool = xpool.allocate (17, mg)
|
801 | 796 | >>> ctpool = xpool.allocate (17, ct)
|
802 |
| - >>> rspool = xpool.allocate (32, rs) |
803 |
| - Traceback (most recent call last): |
804 |
| - ... |
| 797 | + >>> with expect_except (CNDB.OMP.Error.No_Free_Address_Range) : |
| 798 | + ... rspool = xpool.allocate (32, rs) |
805 | 799 | No_Free_Address_Range: Address range [192.168.0.0/16] of this IP4_Network doesn't contain a free subrange for mask length 32
|
806 | 800 | >>> ffpool = mgpool.allocate (22, ff)
|
807 | 801 |
|
808 |
| - >>> rspool = xpool.allocate (32, rs) |
809 |
| - Traceback (most recent call last): |
810 |
| - ... |
| 802 | + >>> with expect_except (CNDB.OMP.Error.No_Free_Address_Range) : |
| 803 | + ... rspool = xpool.allocate (32, rs) |
811 | 804 | No_Free_Address_Range: Address range [192.168.0.0/16] of this IP4_Network doesn't contain a free subrange for mask length 32
|
812 | 805 | """
|
813 | 806 |
|
|
0 commit comments