code: def _get_baremetal_switch_info(self, link_info):
          
  
          try:
              switch_info = link_info['switch_info']
              if not isinstance(switch_info, dict):
                  switch_info = jsonutils.loads(switch_info)
          except Exception as e:
              LOG.error("switch_info can't be decoded: %(exp)s",
                        {"exp": e})
              switch_info = {}
  
          return switch_info
docs: Get switch_info dictionary from context.