#NEWLINE# def check_public_floating_ranges_intersection( self ) : #NEWLINE# #INDENT# 'Check public floating ranges intersection\n\n        1. Check intersection of networks address spaces inside\n        Public and Floating network\n        2. Check that Public Gateway is in Public CIDR\n        3. Check that Public IP ranges are in Public CIDR\n        (nova-net)\n        ' #NEWLINE# pub = [ ng for ng in self . networks if ( ng [ 'name' ] == consts . NETWORKS . public ) ] [ 0 ] #NEWLINE# pub_ranges_err = False #NEWLINE# nets = { #NEWLINE# #INDENT# consts . NETWORKS . public : [ netaddr . IPRange ( v [ 0 ] , v [ 1 ] ) for v in pub [ 'ip_ranges' ] ] , #NEWLINE# 'floating' : [ netaddr . IPRange ( v [ 0 ] , v [ 1 ] ) for v in self . network_config [ 'floating_ranges' ] ] , #NEWLINE# #UNINDENT# } #NEWLINE# for ( name , ranges ) in six . iteritems ( nets ) : #NEWLINE# #INDENT# ids = ( [ pub [ 'id' ] ] if ( name == consts . NETWORKS . public ) else [ ] ) #NEWLINE# for npair in combinations ( ranges , 2 ) : #NEWLINE# #INDENT# if self . net_man . is_range_intersection ( npair [ 0 ] , npair [ 1 ] ) : #NEWLINE# #INDENT# self . err_msgs . append ( 'Address space intersection between ranges of {0} network.' . format ( name ) ) #NEWLINE# self . result . append ( { #NEWLINE# #INDENT# 'ids' : ids , #NEWLINE# 'errors' : [ 'ip_ranges' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# for net in pub : #NEWLINE# #INDENT# if ( netaddr . IPAddress ( pub [ 'gateway' ] ) in net ) : #NEWLINE# #INDENT# self . err_msgs . append ( 'Address intersection between public gateway and IP range of {0} network.' . format ( name ) ) #NEWLINE# self . result . append ( { #NEWLINE# #INDENT# 'ids' : ids , #NEWLINE# 'errors' : [ 'gateway' , 'ip_ranges' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( name == consts . NETWORKS . public ) : #NEWLINE# #INDENT# if ( ( net not in netaddr . IPNetwork ( pub [ 'cidr' ] ) ) and ( not pub_ranges_err ) ) : #NEWLINE# #INDENT# pub_ranges_err = True #NEWLINE# self . err_msgs . append ( 'Public gateway and public ranges are not in one CIDR.' ) #NEWLINE# self . result . append ( { #NEWLINE# #INDENT# 'ids' : ids , #NEWLINE# 'errors' : [ 'gateway' , 'ip_ranges' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . expose_error_messages ( ) #NEWLINE# for npair in combinations ( ( nets [ consts . NETWORKS . public ] + nets [ 'floating' ] ) , 2 ) : #NEWLINE# #INDENT# if self . net_man . is_range_intersection ( npair [ 0 ] , npair [ 1 ] ) : #NEWLINE# #INDENT# self . err_msgs . append ( 'Address space intersection between range of public network and floating range.' ) #NEWLINE# self . result . append ( { #NEWLINE# #INDENT# 'ids' : [ pub [ 'id' ] ] , #NEWLINE# 'errors' : [ 'ip_ranges' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# self . expose_error_messages ( )