#NEWLINE# def _validate_cidr( self , context , nets , subnets_v4 , fixed_net_v4 ) : #NEWLINE# #INDENT# used_subnets = [ net . cidr for net in nets ] #NEWLINE# def find_next( subnet ) : #NEWLINE# #INDENT# next_subnet = subnet . next ( ) #NEWLINE# while ( next_subnet in subnets_v4 ) : #NEWLINE# #INDENT# next_subnet = next_subnet . next ( ) #NEWLINE# #UNINDENT# if ( next_subnet in fixed_net_v4 ) : #NEWLINE# #INDENT# return next_subnet #NEWLINE# #UNINDENT# #UNINDENT# for subnet in list ( subnets_v4 ) : #NEWLINE# #INDENT# if ( subnet in used_subnets ) : #NEWLINE# #INDENT# next_subnet = find_next ( subnet ) #NEWLINE# if next_subnet : #NEWLINE# #INDENT# subnets_v4 . remove ( subnet ) #NEWLINE# subnets_v4 . append ( next_subnet ) #NEWLINE# subnet = next_subnet #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise exception . CidrConflict ( cidr = subnet , other = subnet ) #NEWLINE# #UNINDENT# #UNINDENT# for used_subnet in used_subnets : #NEWLINE# #INDENT# if ( subnet in used_subnet ) : #NEWLINE# #INDENT# raise exception . CidrConflict ( cidr = subnet , other = used_subnet ) #NEWLINE# #UNINDENT# if ( used_subnet in subnet ) : #NEWLINE# #INDENT# next_subnet = find_next ( subnet ) #NEWLINE# if next_subnet : #NEWLINE# #INDENT# subnets_v4 . remove ( subnet ) #NEWLINE# subnets_v4 . append ( next_subnet ) #NEWLINE# subnet = nets #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise exception . CidrConflict ( cidr = subnet , other = used_subnet )