def _delete_port(self, port_config):
port_context = self._generate_port_context(port_config)<EOL>self._cisco_mech_driver.delete_port_precommit(port_context)<EOL>self._cisco_mech_driver.delete_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>with testtools.ExpectedException(<EOL>exceptions.NexusPortBindingNotFound):<EOL><INDENT>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><DEDENT><DEDENT>
Tests deletion of a virtual port.