def _delete_port_channel_resources(self, host_id, switch_ip,<EOL>intf_type, nexus_port, port_id):
<EOL>if intf_type != '<STR_LIT>':<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>vpc = nxos_db.get_switch_vpc_alloc(<EOL>switch_ip, nexus_port)<EOL><DEDENT>except excep.NexusVPCAllocNotFound:<EOL><INDENT>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, nexus_port)<EOL>return<EOL><DEDENT>if not vpc.active:<EOL><INDENT>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, nexus_port)<EOL>return<EOL><DEDENT>try:<EOL><INDENT>nxos_db.get_nexus_switchport_binding(port_id, switch_ip)<EOL>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, nexus_port)<EOL>return<EOL><DEDENT>except excep.NexusPortBindingNotFound:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>mapping = nxos_db.get_switch_and_host_mappings(<EOL>host_id, switch_ip)<EOL>eth_type, eth_port = nexus_help.split_interface_name(<EOL>mapping[<NUM_LIT:0>].if_id)<EOL><DEDENT>except excep.NexusHostMappingNotFound:<EOL><INDENT>LOG.warning("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, host_id)<EOL>return<EOL><DEDENT>if not vpc.learned:<EOL><INDENT>self.driver.delete_ch_grp_to_interface(<EOL>switch_ip, eth_type, eth_port,<EOL>nexus_port)<EOL>self.driver.delete_port_channel(switch_ip,<EOL>nexus_port)<EOL><DEDENT>try:<EOL><INDENT>nxos_db.free_vpcid_for_switch(nexus_port, switch_ip)<EOL>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>nexus_port, switch_ip)<EOL><DEDENT>except excep.NexusVPCAllocNotFound:<EOL><INDENT>LOG.warning("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>nexus_port, switch_ip)<EOL><DEDENT>
This determines if port channel id needs to be freed.