#NEWLINE# def _get_active_network_ports( session , network_id ) : #NEWLINE# #INDENT# with session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# query = session . query ( ml2_models . PortBinding , agents_db . Agent ) #NEWLINE# query = query . join ( agents_db . Agent , ( agents_db . Agent . host == ml2_models . PortBinding . host ) ) #NEWLINE# query = query . join ( models_v2 . Port ) #NEWLINE# query = query . filter ( ( models_v2 . Port . network_id == network_id ) , ( models_v2 . Port . status == const . PORT_STATUS_ACTIVE ) ) #NEWLINE# return query