#NEWLINE# def test_allocate_tenant_segment( self ) : #NEWLINE# #INDENT# tunnel_ids = set ( ) #NEWLINE# for x in moves . range ( TUN_MIN , ( TUN_MAX + 1 ) ) : #NEWLINE# #INDENT# segment = self . driver . allocate_tenant_segment ( self . session ) #NEWLINE# self . assertThat ( segment [ api . SEGMENTATION_ID ] , matchers . GreaterThan ( ( TUN_MIN - 1 ) ) ) #NEWLINE# self . assertThat ( segment [ api . SEGMENTATION_ID ] , matchers . LessThan ( ( TUN_MAX + 1 ) ) ) #NEWLINE# tunnel_ids . add ( segment [ api . SEGMENTATION_ID ] ) #NEWLINE# #UNINDENT# segment = self . driver . allocate_tenant_segment ( self . session ) #NEWLINE# self . assertIsNone ( segment ) #NEWLINE# segment = { #NEWLINE# #INDENT# api . NETWORK_TYPE : self . TYPE , #NEWLINE# api . PHYSICAL_NETWORK : 'None' , #NEWLINE# api . SEGMENTATION_ID : tunnel_ids . pop ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . driver . release_segment ( self . session , segment ) #NEWLINE# segment = self . driver . allocate_tenant_segment ( self . session ) #NEWLINE# self . assertThat ( segment [ api . SEGMENTATION_ID ] , matchers . GreaterThan ( ( TUN_MIN - 1 ) ) ) #NEWLINE# self . assertThat ( segment [ api . SEGMENTATION_ID ] , matchers . LessThan ( ( TUN_MAX + 1 ) ) ) #NEWLINE# tunnel_ids . add ( segment [ api . SEGMENTATION_ID ] ) #NEWLINE# for tunnel_id in tunnel_ids : #NEWLINE# #INDENT# segment [ api . SEGMENTATION_ID ] = tunnel_id #NEWLINE# self . driver . release_segment ( self . session , segment )