Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest revision date option to output of depend. #843

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

miott7
Copy link

@miott7 miott7 commented Jan 18, 2023

Output is comma delimited with newlines which is CSV friendly. Example output file:

(pyats) /Users/miott/pyang/plugin # cat ocinst-depend.csv 
/Users/miott/ysuite/install/data/users/yangsuite-developer/repositories/ddmi-9500-2-default-repo/openconfig-network-instance@2021-01-25.yang :,2021-01-25
ietf-yang-types,2013-07-15
ietf-inet-types,2013-07-15
openconfig-network-instance-types,2021-05-21
openconfig-policy-types,2016-05-12
openconfig-routing-policy,2016-05-12
openconfig-local-routing,2016-05-11
openconfig-interfaces,2018-01-05
openconfig-extensions,2020-06-16
openconfig-network-instance-l3,2018-11-21
openconfig-types,2019-04-16
openconfig-bgp,2016-06-21
openconfig-mpls,2016-12-15
openconfig-vlan,2016-05-26
openconfig-ospfv2,2021-03-17
openconfig-policy-forwarding,2021-05-19
openconfig-segment-routing,2017-01-12
openconfig-isis,2017-01-13
openconfig-aft,2017-01-13
openconfig-pim,2021-04-21
openconfig-igmp,2019-07-09
openconfig-evpn,2020-11-24
openconfig-network-instance-l2,2021-01-25
ietf-interfaces,2018-02-20
openconfig-yang-types,2018-11-21
openconfig-bgp-common,2016-06-21
openconfig-bgp-common-multiprotocol,2016-06-21
openconfig-bgp-common-structure,2016-06-21
openconfig-bgp-peer-group,2016-06-21
openconfig-bgp-neighbor,2016-06-21
openconfig-bgp-global,2016-06-21
openconfig-bgp-types,2016-06-21
openconfig-mpls-types,2016-12-15
openconfig-mpls-rsvp,2016-12-15
openconfig-mpls-ldp,2016-12-15
openconfig-mpls-te,2016-12-15
openconfig-mpls-igp,2016-12-15
openconfig-mpls-static,2016-12-15
openconfig-mpls-sr,2016-12-15
openconfig-vlan-types,2016-05-26
openconfig-if-ethernet,2020-05-06
openconfig-if-aggregate,2018-01-05
iana-if-type,2019-02-08
openconfig-ospfv2-global,2019-11-28
openconfig-ospfv2-area,2019-11-28
openconfig-ospfv2-area-interface,2021-03-17
openconfig-ospfv2-lsdb,2019-11-28
openconfig-ospfv2-common,2019-11-28
openconfig-ospf-types,2018-11-21
openconfig-bfd,2021-03-17
openconfig-if-types,2018-11-21
openconfig-inet-types,2017-08-24
openconfig-pf-forwarding-policies,2021-05-19
openconfig-pf-path-groups,2021-05-19
openconfig-pf-interfaces,2021-05-19
openconfig-packet-match,2017-05-26
openconfig-packet-match-types,2017-05-26
openconfig-isis-types,2017-01-13
openconfig-isis-lsp,2017-01-13
openconfig-isis-routing,2017-01-13
openconfig-isis-lsdb-types,2017-01-13
openconfig-aft-types,2017-01-13
openconfig-pim-types,2018-11-21
openconfig-acl,2017-05-26
openconfig-igmp-types,2018-11-21
openconfig-evpn-types,2020-10-08
(pyats) /Users/miott/pyang/plugin #

Output is comma delimited with newlines which is CSV friendly.
Example output file:
```
(pyats) /Users/miott/pyang/plugin # cat ocinst-depend.csv 
/Users/miott/ysuite/install/data/users/yangsuite-developer/repositories/ddmi-9500-2-default-repo/openconfig-network-instance@2021-01-25.yang :,2021-01-25
ietf-yang-types,2013-07-15
ietf-inet-types,2013-07-15
openconfig-network-instance-types,2021-05-21
openconfig-policy-types,2016-05-12
openconfig-routing-policy,2016-05-12
openconfig-local-routing,2016-05-11
openconfig-interfaces,2018-01-05
openconfig-extensions,2020-06-16
openconfig-network-instance-l3,2018-11-21
openconfig-types,2019-04-16
openconfig-bgp,2016-06-21
openconfig-mpls,2016-12-15
openconfig-vlan,2016-05-26
openconfig-ospfv2,2021-03-17
openconfig-policy-forwarding,2021-05-19
openconfig-segment-routing,2017-01-12
openconfig-isis,2017-01-13
openconfig-aft,2017-01-13
openconfig-pim,2021-04-21
openconfig-igmp,2019-07-09
openconfig-evpn,2020-11-24
openconfig-network-instance-l2,2021-01-25
ietf-interfaces,2018-02-20
openconfig-yang-types,2018-11-21
openconfig-bgp-common,2016-06-21
openconfig-bgp-common-multiprotocol,2016-06-21
openconfig-bgp-common-structure,2016-06-21
openconfig-bgp-peer-group,2016-06-21
openconfig-bgp-neighbor,2016-06-21
openconfig-bgp-global,2016-06-21
openconfig-bgp-types,2016-06-21
openconfig-mpls-types,2016-12-15
openconfig-mpls-rsvp,2016-12-15
openconfig-mpls-ldp,2016-12-15
openconfig-mpls-te,2016-12-15
openconfig-mpls-igp,2016-12-15
openconfig-mpls-static,2016-12-15
openconfig-mpls-sr,2016-12-15
openconfig-vlan-types,2016-05-26
openconfig-if-ethernet,2020-05-06
openconfig-if-aggregate,2018-01-05
iana-if-type,2019-02-08
openconfig-ospfv2-global,2019-11-28
openconfig-ospfv2-area,2019-11-28
openconfig-ospfv2-area-interface,2021-03-17
openconfig-ospfv2-lsdb,2019-11-28
openconfig-ospfv2-common,2019-11-28
openconfig-ospf-types,2018-11-21
openconfig-bfd,2021-03-17
openconfig-if-types,2018-11-21
openconfig-inet-types,2017-08-24
openconfig-pf-forwarding-policies,2021-05-19
openconfig-pf-path-groups,2021-05-19
openconfig-pf-interfaces,2021-05-19
openconfig-packet-match,2017-05-26
openconfig-packet-match-types,2017-05-26
openconfig-isis-types,2017-01-13
openconfig-isis-lsp,2017-01-13
openconfig-isis-routing,2017-01-13
openconfig-isis-lsdb-types,2017-01-13
openconfig-aft-types,2017-01-13
openconfig-pim-types,2018-11-21
openconfig-acl,2017-05-26
openconfig-igmp-types,2018-11-21
openconfig-evpn-types,2020-10-08
(pyats) /Users/miott/pyang/plugin #
```
@miott7 miott7 changed the title Add latest revision date to output of depend. Add latest revision date option to output of depend. Jan 18, 2023
@mbj4668
Copy link
Owner

mbj4668 commented Jan 19, 2023

This is probably useful, but I don't think it belongs in the depend output, since depend is designed to generate Makefile dependency rules.

@miott
Copy link

miott commented Jan 19, 2023

This is probably useful, but I don't think it belongs in the depend output, since depend is designed to generate Makefile dependency rules.

Makefile dependency rules point to filenames. It is within the specification that a yang file can be named using its latest revision number as shown in the example above (openconfig-network-instance@2021-01-25.yang). I can make a change to the output so the revision number can be added to the Makefile rule.

@mbj4668
Copy link
Owner

mbj4668 commented Jan 20, 2023

Good idea!

@miott7
Copy link
Author

miott7 commented Jan 20, 2023

Tested all output options: --depend-recurse --depend-target ALL --depend-extension .txt --depend-include-path --depend-include-revision.

Note: Option --depend-include-path will ignore --depend-include-revision just like --depend-extension does because in that case the actual file path and file names are used as prerequisites.

Command:
pyang -f depend --depend-recurse --depend-target ALL --depend-include-revision -o ~/pyang/depend-target-rev.txt openconfig-network-instance@2021-01-25.yang

Result:
ALL : ietf-yang-types@2013-07-15 ietf-inet-types@2013-07-15 openconfig-network-instance-types@2021-05-21 openconfig-policy-types@2016-05-12 openconfig-routing-policy@2016-05-12 openconfig-local-routing@2016-05-11 openconfig-interfaces@2018-01-05 openconfig-extensions@2020-06-16 openconfig-network-instance-l3@2018-11-21 openconfig-types@2019-04-16 openconfig-bgp@2016-06-21 openconfig-mpls@2016-12-15 openconfig-vlan@2016-05-26 openconfig-ospfv2@2021-03-17 openconfig-policy-forwarding@2021-05-19 openconfig-segment-routing@2017-01-12 openconfig-isis@2017-01-13 openconfig-aft@2017-01-13 openconfig-pim@2021-04-21 openconfig-igmp@2019-07-09 openconfig-evpn@2020-11-24 openconfig-network-instance-l2@2021-01-25 ietf-interfaces@2018-02-20 openconfig-yang-types@2018-11-21 openconfig-bgp-common@2016-06-21 openconfig-bgp-common-multiprotocol@2016-06-21 openconfig-bgp-common-structure@2016-06-21 openconfig-bgp-peer-group@2016-06-21 openconfig-bgp-neighbor@2016-06-21 openconfig-bgp-global@2016-06-21 openconfig-bgp-types@2016-06-21 openconfig-mpls-types@2016-12-15 openconfig-mpls-rsvp@2016-12-15 openconfig-mpls-ldp@2016-12-15 openconfig-mpls-te@2016-12-15 openconfig-mpls-igp@2016-12-15 openconfig-mpls-static@2016-12-15 openconfig-mpls-sr@2016-12-15 openconfig-vlan-types@2016-05-26 openconfig-if-ethernet@2020-05-06 openconfig-if-aggregate@2018-01-05 iana-if-type@2019-02-08 openconfig-ospfv2-global@2019-11-28 openconfig-ospfv2-area@2019-11-28 openconfig-ospfv2-area-interface@2021-03-17 openconfig-ospfv2-lsdb@2019-11-28 openconfig-ospfv2-common@2019-11-28 openconfig-ospf-types@2018-11-21 openconfig-bfd@2021-03-17 openconfig-if-types@2018-11-21 openconfig-inet-types@2017-08-24 openconfig-pf-forwarding-policies@2021-05-19 openconfig-pf-path-groups@2021-05-19 openconfig-pf-interfaces@2021-05-19 openconfig-packet-match@2017-05-26 openconfig-packet-match-types@2017-05-26 openconfig-isis-types@2017-01-13 openconfig-isis-lsp@2017-01-13 openconfig-isis-routing@2017-01-13 openconfig-isis-lsdb-types@2017-01-13 openconfig-aft-types@2017-01-13 openconfig-pim-types@2018-11-21 openconfig-acl@2017-05-26 openconfig-igmp-types@2018-11-21 openconfig-evpn-types@2020-10-08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants