Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _get_active_port_count(session, agent_host, network_id, model):
- query = session.query(models_v2.Port)
- query = query.join(model)
- query = query.filter(
- models_v2.Port.network_id == network_id,
- models_v2.Port.status == const.PORT_STATUS_ACTIVE,
- ml2_models.PortBinding.host == agent_host)
- return query
- def get_nondistributed_active_port_count(session, agent_host, network_id):
- query = _get_active_port_count(ml2_models.PortBinding).filter(
- ~models_v2.Port.device_owner.in_(DISTRIBUTED_INTERFACE_OWNERS))
- return query.count()
- def get_dvr_active_port_count(session, agent_host, network_id):
- query = _get_active_port_count(ml2_models.PortBinding).filter(
- models_v2.Port.device_owner == const.DEVICE_OWNER_DVR_INTERFACE)
- return query.count()
Advertisement
Add Comment
Please, Sign In to add comment