def bind_port(self, context):
vnic_type = context.current.get(bc.portbindings.VNIC_TYPE,<EOL>bc.portbindings.VNIC_NORMAL)<EOL>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT:port>': context.current['<STR_LIT:id>'],<EOL>'<STR_LIT>': vnic_type,<EOL>'<STR_LIT>': context.network.current['<STR_LIT:id>']})<EOL>profile = context.current.get(bc.portbindings.PROFILE, {})<EOL>if not self.driver.check_vnic_type_and_vendor_info(vnic_type,<EOL>profile):<EOL><INDENT>return<EOL><DEDENT>for segment in context.network.network_segments:<EOL><INDENT>if self.check_segment(segment):<EOL><INDENT>vlan_id = segment[api.SEGMENTATION_ID]<EOL>if not vlan_id:<EOL><INDENT>LOG.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>LOG.debug("<STR_LIT>", str(vlan_id))<EOL>if self.driver.is_vmfex_port(profile):<EOL><INDENT>profile_name = self.make_profile_name(vlan_id)<EOL>self.vif_details[<EOL>const.VIF_DETAILS_PROFILEID] = profile_name<EOL><DEDENT>else:<EOL><INDENT>self.vif_details[<EOL>bc.portbindings.VIF_DETAILS_VLAN] = str(vlan_id)<EOL><DEDENT>context.set_binding(segment[api.ID],<EOL>self.vif_type,<EOL>self.vif_details,<EOL>bc.constants.PORT_STATUS_ACTIVE)<EOL>return<EOL><DEDENT><DEDENT>LOG.error('<STR_LIT>'<EOL>'<STR_LIT>',<EOL>{'<STR_LIT:id>': context.current['<STR_LIT:id>'],<EOL>'<STR_LIT>': context.network.current['<STR_LIT:id>']})<EOL>
Binds port to current network segment.

        Binds port only if the vnic_type is direct or macvtap and
        the port is from a supported vendor. While binding port set it
        in ACTIVE state and provide the Port Profile or Vlan Id as part
        vif_details.