pyang icon indicating copy to clipboard operation
pyang copied to clipboard

CheckUpdatePlugin does not check leaf order change for groupings

Open rangao2 opened this issue 5 years ago • 3 comments

The order of leafs could change for a grouping and CheckUpdatePlugin does not flag it.

Say I have an old model

module test-rpc {
  yang-version 1;
  namespace "http://example.com/test-rpc";
  prefix test-rpc;

  revision 2018-11-01 {
    description
      "Initial revision";
    reference "1.0.0";
  }

  grouping test-rpc-grouping {
    leaf uint32-value {
        type uint32;
    }
    leaf string-value {
      type string;
    }
    leaf bool-value {
      type boolean;
    }
  }
  rpc test-rpc-input {
    input {
      uses test-rpc:test-rpc-grouping;
    }
  }
}

and a new model

module test-rpc {
  yang-version 1;
  namespace "http://example.com/test-rpc";
  prefix test-rpc;

  revision 2018-11-01 {
    description "Initial revision";
  }

  grouping test-rpc-grouping {
    leaf string-value {
      type string;
    }
    leaf bool-value {
      type boolean;
    }
    leaf uint32-value {
      type uint32;
    }
  }
  rpc test-rpc-input {
    input {
      uses test-rpc:test-rpc-grouping;
    }
  }
}

Notice that the leafs in test-rpc-grouping does not align. Yet if I run the following command

> pyang --check-update-from old_dir/test-rpc.yang new_dir/test-rpc.yang
> new_dir/test-rpc.yang:1: error: new revision 2018-11-01 is not newer than old revision 2018-11-01 (RFC 6020: 10, p2)

Once I added a new revision to new model, I no longer get an error. I believe the order do matters in some cases and would appreciate if such condition could be caught.

rangao2 avatar Sep 03 '20 20:09 rangao2

Hi rangao @rangao2

Can you explain more? I don't really catch your point.

As is described in Chapter10 in RFC6020 or Chapter11 in RFC7950,

For any published change, a new "revision" statement (Section 7.1.9) MUST be included in front of the existing "revision" statements. If there are no existing "revision" statements, then one MUST be added to identify the new revision.

Any set of data definition nodes may be replaced with another set of syntactically and semantically equivalent nodes. For example, a set of leafs may be replaced by a "uses" statement of a grouping with the same leafs.

fredgan avatar Sep 09 '20 06:09 fredgan

Hello Fred,

Thanks for responding. The question is whether the ordering of leafs in a grouping matters or not, and whether checkUpdate plugin shall be able to detect such.

Thank you.

rangao2 avatar Sep 14 '20 17:09 rangao2

Hi rangao, From the description of RFC7950 as i understood, the answers are No

Best regards Fred

Sent by my iPhone.

------------------ Original ------------------ From: rangao2 <[email protected]> Date: Tue,Sep 15,2020 1:12 AM To: mbj4668/pyang <[email protected]> Cc: Fred Gan <[email protected]>, Comment <[email protected]> Subject: Re: [mbj4668/pyang] CheckUpdatePlugin does not check leaf order change for groupings (#672)

Hello Fred,

Thanks for responding. The question is whether the ordering of leafs in a grouping matters or not, and whether checkUpdate plugin shall be able to detect such.

Thank you.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fredgan avatar Sep 15 '20 00:09 fredgan