ConfD User Community

Individual commit for few commands


#1

Hi ,we have below requirement …

for the below yang model .
we have handler using policy-hook to store and update our system params with some conditions. if conditions are not met we errorout.

let us suppose user tried configuring 3 policies and tried for a commit .
out of which first policy is valid and because of first policy 2nd policy is not valid.
cdb error out and wont configure all three .

instead as first policy is valid we should allow first policy to get configured by updating cdb , but from second policy it should error out.

please let us know a way to do the same.

  list policy{
    key "name";
    tailf:info "set policy";
    tailf:callpoint policy-hook{
      tailf:transaction-hook subtree;
    }
    leaf name {
      tailf:info "Enter name of policy";
      type string;
    }
    list group{
      key "id";
      tailf:info "set access-group";
      leaf id {
        tailf:info "Enter id of group";
        type uint32; 
      }
      container feature
      {
        choice work_choice{
          case yes{
            leaf-list what_work{
              tailf:cli-drop-node-name;
              type work_type;
            }
          }
          case no{
            leaf nowork{
              type boolean;
              default true;
              tailf:cli-boolean-no;
              tailf:cli-show-with-default;
            }
          }
        }
      }
      leaf t_group{
        type uint32;
      }
      leaf t_down{
        type pass_type;
      }
    }
  }

#2

Have the user commit between each entered policy list entry. You do not want to change a commit behaviour just because you want to be “nice”.

If you, as I read in your YANG model, are validating from a tailf:transaction-hook, don’t. You will not be able to return a descriptive error message. Hooks are not intended for validation.

Use the validation phase and “tailf:validate” validation points instead to allow descriptive text in your error message when your validation fail to make it easy for the manager to identify which list entry failed and how to correct it.

See ConfD UG and examples for tailf:validate details


#3

thanks cohult.
will look into it