void nas_acl_counter_t::set_type(uint_t type, bool reset)
{
    auto t = static_cast <BASE_ACL_COUNTER_TYPE_t> (type);

    if (!is_attr_dirty (BASE_ACL_COUNTER_TYPES)) {
        mark_attr_dirty (BASE_ACL_COUNTER_TYPES);
        _types_to_be_pushed.clear();

        if (reset) {
            _enable_byte_count = false;
            _enable_pkt_count = false;
        }
    }

    switch (t) {
        case BASE_ACL_COUNTER_TYPE_PACKET:
            _enable_pkt_count = true;
            break;
        case BASE_ACL_COUNTER_TYPE_BYTE:
            _enable_byte_count = true;
            break;
        default:
            throw nas::base_exception {NAS_ACL_E_ATTR_VAL, __PRETTY_FUNCTION__,
                  std::string {"Unknown Counter type "}
                  + std::to_string (t)};
            break;
    }
}
void derived_obj_t::set_attr2 (uint_t attr2)
{
    if (attr2 > MAX_ATTR2_RANGE) {
        throw nas::base_exception {NAS_BASE_E_PARAM, __PRETTY_FUNCTION__,
                              "Invalid value for attr2"};
    }

    _obj.attr2 = attr2;
    mark_attr_dirty (BASE_UT_ATTR2);
}
void nas_acl_table::set_priority (uint_t p)
{
    if (is_created_in_ndi()) {
        // Create-Only attribute
        throw nas::base_exception {NAS_ACL_E_CREATE_ONLY, __PRETTY_FUNCTION__,
                                "Cannot modify Priority for Table"};
    }

    if (p != _priority) {
        _priority = p;
        mark_attr_dirty (BASE_ACL_TABLE_PRIORITY);
    }
}
void nas_acl_table::set_stage (uint_t stage)
{
    if (is_created_in_ndi()) {
        // Create-Only attribute
        throw nas::base_exception {NAS_ACL_E_CREATE_ONLY, __PRETTY_FUNCTION__,
                                "Cannot modify Stage for Table"};
    }

    _stage = static_cast<BASE_ACL_STAGE_t> (stage);
    switch (_stage) {
        case BASE_ACL_STAGE_INGRESS:
        case BASE_ACL_STAGE_EGRESS:
            break;
        default:
            throw nas::base_exception {NAS_ACL_E_ATTR_VAL, __PRETTY_FUNCTION__,
                                     "Bad value for Stage"};
    }

    mark_attr_dirty (BASE_ACL_TABLE_STAGE);
}
void nas_acl_table::set_allowed_filter (uint_t filter_id)
{
    if (is_created_in_ndi()) {
        // Create-Only attribute
        throw nas::base_exception {NAS_ACL_E_CREATE_ONLY, __PRETTY_FUNCTION__,
                                "Cannot modify Filter-Set for Table"};
    }

    BASE_ACL_MATCH_TYPE_t f = static_cast <BASE_ACL_MATCH_TYPE_t> (filter_id);

    if (!nas_acl_filter_t::is_type_valid (f)) {
        throw nas::base_exception {NAS_ACL_E_ATTR_VAL, __PRETTY_FUNCTION__,
            std::string {"Unknown Table Match Field type "}
            + std::to_string (f)};
    }

    if (!is_attr_dirty (BASE_ACL_TABLE_ALLOWED_MATCH_FIELDS)) {
        mark_attr_dirty (BASE_ACL_TABLE_ALLOWED_MATCH_FIELDS);
        _allowed_filters.clear ();
    }

    _allowed_filters.insert(f);
}