#NEWLINE# def get_routerrulesgrid_data( self , rules ) : #NEWLINE# #INDENT# ports = self . tab_group . kwargs [ 'ports' ] #NEWLINE# networks = api . neutron . network_list_for_tenant ( self . request , self . request . user . tenant_id ) #NEWLINE# netnamemap = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# subnetmap = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for n in networks : #NEWLINE# #INDENT# netnamemap [ n [ 'id' ] ] = n . name_or_id #NEWLINE# for s in n . subnets : #NEWLINE# #INDENT# subnetmap [ ip . id ] = { #NEWLINE# #INDENT# 'name' : s . name , #NEWLINE# 'cidr' : s . cidr , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# matrix = [ ] #NEWLINE# subnets = [ ] #NEWLINE# for port in ports : #NEWLINE# #INDENT# for ip in port [ 'fixed_ips' ] : #NEWLINE# #INDENT# if ( ip [ 'subnet_id' ] not in subnetmap ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# sub = { #NEWLINE# #INDENT# 'ip' : ip [ 'ip_address' ] , #NEWLINE# 'subnetid' : ip [ 'subnet_id' ] , #NEWLINE# 'subnetname' : subnetmap [ ip [ 'subnet_id' ] ] [ 'name' ] , #NEWLINE# 'networkid' : port [ 'network_id' ] , #NEWLINE# 'networkname' : netnamemap [ port [ 'network_id' ] ] , #NEWLINE# 'cidr' : subnetmap [ ip [ 'subnet_id' ] ] [ 'cidr' ] , #NEWLINE# #UNINDENT# } #NEWLINE# subnets . append ( sub ) #NEWLINE# #UNINDENT# #UNINDENT# subnets . append ( { #NEWLINE# #INDENT# 'ip' : '0.0.0.0' , #NEWLINE# 'subnetid' : 'external' , #NEWLINE# 'subnetname' : '' , #NEWLINE# 'networkname' : 'external' , #NEWLINE# 'networkid' : 'external' , #NEWLINE# 'cidr' : '0.0.0.0/0' , #NEWLINE# #UNINDENT# } ) #NEWLINE# subnets . append ( { #NEWLINE# #INDENT# 'ip' : '0.0.0.0' , #NEWLINE# 'subnetid' : 'any' , #NEWLINE# 'subnetname' : '' , #NEWLINE# 'networkname' : 'any' , #NEWLINE# 'networkid' : 'any' , #NEWLINE# 'cidr' : '0.0.0.0/0' , #NEWLINE# #UNINDENT# } ) #NEWLINE# for source in subnets : #NEWLINE# #INDENT# row = { #NEWLINE# #INDENT# 'source' : dict ( source ) , #NEWLINE# 'targets' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# for target in subnets : #NEWLINE# #INDENT# target . update ( self . _get_subnet_connectivity ( source , target , rules ) ) #NEWLINE# row [ 'targets' ] . append ( dict ( target ) ) #NEWLINE# #UNINDENT# matrix . append ( row ) #NEWLINE# #UNINDENT# return matrix