bm_nw_provision_db.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:networking-hpe 作者: openstack 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号