def METHOD_NAME(db):
    """
        Get the RIF port mapping from ASIC DB
    """
    db.connect('ASIC_DB')
    rif_keys_str = db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:*")
    if not rif_keys_str:
        return {}
    rif_port_oid_map = {}
    for rif_s in rif_keys_str:
        rif_id = rif_s[len("ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x"):]
        ent = db.get_all('ASIC_DB', rif_s, blocking=True)
        # TODO: remove the first branch after all SonicV2Connector are migrated to decode_responses
        if isinstance(db, swsscommon.SonicV2Connector) == False and db.dbintf.redis_kwargs.get('decode_responses', False) == False:
            if b"SAI_ROUTER_INTERFACE_ATTR_PORT_ID" in ent:
                port_id = ent[b"SAI_ROUTER_INTERFACE_ATTR_PORT_ID"].lstrip(b"oid:0x")
                rif_port_oid_map[rif_id] = port_id
        else:
            if "SAI_ROUTER_INTERFACE_ATTR_PORT_ID" in ent:
                port_id = ent["SAI_ROUTER_INTERFACE_ATTR_PORT_ID"].lstrip("oid:0x")
                rif_port_oid_map[rif_id] = port_id
    return rif_port_oid_map