def bind_port(self, context):
        LOG.debug("Attempting to bind port %(port)s on "
                  "network %(network)s",
                  {'port': context.current['id'],
                   'network': context.network.current['id']})
        vnic_type = context.current.get(portbindings.VNIC_TYPE,
                                        portbindings.VNIC_NORMAL)
        if vnic_type not in self.supported_vnic_types:
            LOG.debug("Refusing to bind due to unsupported vnic_type: %s",
                      vnic_type)
            return

        vif_type = self.vnic_type_for_vif_type.get(vnic_type,
                                                   VIF_TYPE_HW_VEB)

        if not self._check_supported_pci_vendor_device(context):
            LOG.debug("Refusing to bind due to unsupported pci_vendor device")
            return

        if vnic_type == portbindings.VNIC_DIRECT_PHYSICAL:
            # Physical functions don't support things like QoS properties,
            # spoof checking, etc. so we might as well side-step the agent
            # for now. The agent also doesn't currently recognize non-VF
            # PCI devices so we won't get port status change updates
            # either. This should be changed in the future so physical
            # functions can use device mapping checks and the plugin can
            # get port status updates.
            self.try_to_bind(context, None, vif_type)
            return

        for agent in context.host_agents(self.agent_type):
            LOG.debug("Checking agent: %s", agent)
            if agent['alive']:
                if self.try_to_bind(context, agent, vif_type):
                    return
            else:
                LOG.warning(_LW("Attempting to bind with dead agent: %s"),
                            agent)
dataset/ETHPy150Open openstack/neutron/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py/SriovNicSwitchMechanismDriver.bind_port/original