in blueprints/cloud-operations/network-quota-monitoring/src/plugins/series-subnets.py [0:0]
def _subnet_forwarding_rules(resources, subnet_nets):
'Returns counts of forwarding rules per subnetwork.'
for v in resources['forwarding_rules'].values():
if v['load_balancing_scheme'].startswith('INTERNAL'):
yield v['subnetwork'], 1
continue
if v['psc_accepted']:
network = resources['networks'].get(v['network'])
if not network:
LOGGER.warn(f'PSC address for missing network {v["network"]}')
continue
address = ipaddress.ip_address(v['address'])
for subnet_self_link in network['subnetworks']:
if address in subnet_nets[subnet_self_link]:
yield subnet_self_link, 1
break
continue