def get_all_bnp_switch_port_maps(context, filter_dict):
"""Get all switch port maps."""
try:
switchportmap = models.BNPSwitchPortMapping
neutronport = models.BNPNeutronPort
physwitch = models.BNPPhysicalSwitch
query = context.session.query(switchportmap.neutron_port_id,
switchportmap.switch_port_name,
neutronport.lag_id,
neutronport.segmentation_id,
neutronport.access_type,
neutronport.bind_status, physwitch.name)
query = query.join(neutronport,
neutronport.neutron_port_id ==
switchportmap.neutron_port_id)
query = query.join(physwitch, switchportmap.switch_id == physwitch.id)
for key, value in filter_dict.items():
query = query.filter(key == value)
port_maps = query.all()
except exc.NoResultFound:
LOG.error(_LE("no switch port mappings found"))
return
return port_maps
评论列表
文章目录