code: def _get_baremetal_connections(self, port,
                                     only_active_switch=False,
                                     from_segment=False):
          
  
          connections = []
  
          is_native = False if self.trunk.is_trunk_subport(port) else True
  
          all_link_info = port[bc.portbindings.PROFILE]['local_link_information']
  
          for link_info in all_link_info:
  
              # Extract port info
              intf_type, port = nexus_help.split_interface_name(
                                    link_info['port_id'])
  
              # Determine if this switch is to be skipped
              switch_info = self._get_baremetal_switch_info(
                                link_info)
              if not switch_info:
                  continue
              switch_ip = switch_info['switch_ip']
  
              # If not for Nexus
              if not self._switch_defined(switch_ip):
                  continue
  
              # Requested connections for only active switches
              if (only_active_switch and
                  not self.is_switch_active(switch_ip)):
                  continue
  
              ch_grp = 0
              if not from_segment:
                  try:
                      reserved = nxos_db.get_switch_if_host_mappings(
                          switch_ip,
                          nexus_help.format_interface_name(
                              intf_type, port))
                      if reserved[0].ch_grp > 0:
                          ch_grp = reserved[0].ch_grp
                          intf_type, port = nexus_help.split_interface_name(
                              '', ch_grp)
                  except excep.NexusHostMappingNotFound:
                      pass
  
              connections.append((switch_ip, intf_type, port,
                                  is_native, ch_grp))
  
          return connections
docs: Get switch ips and interfaces from baremetal transaction.
  
          This method is used to extract switch/interface
          information from transactions where VNIC_TYPE is
          baremetal.
  
          :param port: Received port transaction
          :param only_active_switch: Indicator for selecting
                       connections with switches that are active
          :param from_segment: only return interfaces from the
                     segment/transaction as opposed to
                     say port channels which are learned.
          :Returns: list of switch_ip, intf_type, port_id, is_native