def _create_port(self, port_config, override_netid=None):
port_context = self._generate_port_context(<EOL>port_config, override_netid=override_netid)<EOL>self._cisco_mech_driver.create_port_postcommit(port_context)<EOL>self._cisco_mech_driver.bind_port(port_context)<EOL>self._cisco_mech_driver.update_port_precommit(port_context)<EOL>self._cisco_mech_driver.update_port_postcommit(port_context)<EOL>if nexus_help.is_baremetal(port_context.current):<EOL><INDENT>connections = self._cisco_mech_driver._get_port_connections(<EOL>port_context.current, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>connections = self._cisco_mech_driver._get_port_connections(<EOL>port_context.current, port_config.host_name)<EOL><DEDENT>for switch_ip, intf_type, port, is_p_vlan, _ in connections:<EOL><INDENT>if switch_ip is not port_config.nexus_ip_addr:<EOL><INDENT>continue<EOL><DEDENT>port_id = intf_type + '<STR_LIT::>' + port<EOL>bindings = nexus_db_v2.get_nexusport_binding(<EOL>port_id,<EOL>port_config.vlan_id,<EOL>port_config.nexus_ip_addr,<EOL>port_config.instance_id)<EOL>self.assertEqual(<NUM_LIT:1>, len(bindings))<EOL><DEDENT>
Tests creation of a virtual port.