%global _empty_manifest_terminate_build 0 Name: python-ttp Version: 0.9.4 Release: 1 Summary: Template Text Parser License: MIT URL: https://github.com/dmulyalin/ttp Source0: https://mirrors.nju.edu.cn/pypi/web/packages/62/16/2e1aeb095e090969751546d5eb45deb307e6c24cd4cd9710e10d006988ce/ttp-0.9.4.tar.gz BuildArch: noarch Requires: python3-cerberus Requires: python3-jinja2 Requires: python3-pyyaml Requires: python3-deepdiff Requires: python3-openpyxl Requires: python3-tabulate Requires: python3-ttp_templates Requires: python3-yangson Requires: python3-n2g Requires: python3-readthedocs-sphinx-search Requires: python3-Sphinx Requires: python3-sphinx_rtd_theme Requires: python3-sphinxcontrib-applehelp Requires: python3-sphinxcontrib-devhelp Requires: python3-sphinxcontrib-htmlhelp Requires: python3-sphinxcontrib-jsmath Requires: python3-sphinxcontrib-napoleon Requires: python3-sphinxcontrib-qthelp Requires: python3-sphinxcontrib-serializinghtml Requires: python3-sphinxcontrib-spelling %description ucs-core-switch-1 65100 CUST-1 192.0.2.1 65101 00:12:33 300 peer-1 ipv4 RPL-1-IMPORT-v4 RPL-1-EXPORT-V4 ucs-core-switch-1 65100 CUST-1 192.0.2.2 65102 03:55:01 idle peer-2 ipv4 RPL-2-IMPORT-V6 RPL-2-EXPORT-V6 Run this script with "python filename.py" hostname="gethostname" chain_1 = [ "set('vrf_name')", "lookup('peer_ip', group='bgp_state', update=True)" ] {{ peer }} 4 65101 20 21 43 0 0 {{ uptime }} {{ state }} router bgp {{ asn | record(asn) }} vrf {{ vrf_name }} neighbor {{ peer_ip }} {{ local_asn | set(asn) }} {{ hostname | set(hostname) }} remote-as {{ peer_asn }} description {{ description }} address-family {{ afi }} unicast route-map {{ rpl_in }} in route-map {{ rpl_out }} out """ data_bgp_state = """ ucs-core-switch-1#show bgp vrf CUST-1 vpnv4 unicast summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.0.2.1 4 65101 32 54 42 0 0 00:12:33 300 192.0.2.2 4 65101 11 45 99 0 0 03:55:01 idle """ data_bgp_config = """ ucs-core-switch-1#show run | section bgp router bgp 65100 vrf CUST-1 neighbor 192.0.2.1 remote-as 65101 description peer-1 address-family ipv4 unicast route-map RPL-1-IMPORT-v4 in route-map RPL-1-EXPORT-V4 out neighbor 192.0.2.2 remote-as 65102 description peer-2 address-family ipv4 unicast route-map RPL-2-IMPORT-V6 in route-map RPL-2-EXPORT-V6 out """ from ttp import ttp parser = ttp() parser.add_template(template) parser.add_input(data=data_bgp_state, input_name="bgp_state") parser.add_input(data=data_bgp_config, input_name="bgp_config") parser.parse() ``` # Contributions Feel free to submit an issue, report a bug or ask a question, feature requests are welcomed. Or [buy](https://paypal.me/dmulyalin) Author a coffee # Additional resources List of additional resources: - Sandbox to test TTP templates - http://textfsm.nornir.tech/ by [tbotnz](https://github.com/tbotnz) - Videos on TTP - https://pynet.twb-tech.com/videos/ttp/ttp.html by [Kirk Byers](https://github.com/ktbyers) %package -n python3-ttp Summary: Template Text Parser Provides: python-ttp BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-ttp ucs-core-switch-1 65100 CUST-1 192.0.2.1 65101 00:12:33 300 peer-1 ipv4 RPL-1-IMPORT-v4 RPL-1-EXPORT-V4 ucs-core-switch-1 65100 CUST-1 192.0.2.2 65102 03:55:01 idle peer-2 ipv4 RPL-2-IMPORT-V6 RPL-2-EXPORT-V6 Run this script with "python filename.py" hostname="gethostname" chain_1 = [ "set('vrf_name')", "lookup('peer_ip', group='bgp_state', update=True)" ] {{ peer }} 4 65101 20 21 43 0 0 {{ uptime }} {{ state }} router bgp {{ asn | record(asn) }} vrf {{ vrf_name }} neighbor {{ peer_ip }} {{ local_asn | set(asn) }} {{ hostname | set(hostname) }} remote-as {{ peer_asn }} description {{ description }} address-family {{ afi }} unicast route-map {{ rpl_in }} in route-map {{ rpl_out }} out """ data_bgp_state = """ ucs-core-switch-1#show bgp vrf CUST-1 vpnv4 unicast summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.0.2.1 4 65101 32 54 42 0 0 00:12:33 300 192.0.2.2 4 65101 11 45 99 0 0 03:55:01 idle """ data_bgp_config = """ ucs-core-switch-1#show run | section bgp router bgp 65100 vrf CUST-1 neighbor 192.0.2.1 remote-as 65101 description peer-1 address-family ipv4 unicast route-map RPL-1-IMPORT-v4 in route-map RPL-1-EXPORT-V4 out neighbor 192.0.2.2 remote-as 65102 description peer-2 address-family ipv4 unicast route-map RPL-2-IMPORT-V6 in route-map RPL-2-EXPORT-V6 out """ from ttp import ttp parser = ttp() parser.add_template(template) parser.add_input(data=data_bgp_state, input_name="bgp_state") parser.add_input(data=data_bgp_config, input_name="bgp_config") parser.parse() ``` # Contributions Feel free to submit an issue, report a bug or ask a question, feature requests are welcomed. Or [buy](https://paypal.me/dmulyalin) Author a coffee # Additional resources List of additional resources: - Sandbox to test TTP templates - http://textfsm.nornir.tech/ by [tbotnz](https://github.com/tbotnz) - Videos on TTP - https://pynet.twb-tech.com/videos/ttp/ttp.html by [Kirk Byers](https://github.com/ktbyers) %package help Summary: Development documents and examples for ttp Provides: python3-ttp-doc %description help ucs-core-switch-1 65100 CUST-1 192.0.2.1 65101 00:12:33 300 peer-1 ipv4 RPL-1-IMPORT-v4 RPL-1-EXPORT-V4 ucs-core-switch-1 65100 CUST-1 192.0.2.2 65102 03:55:01 idle peer-2 ipv4 RPL-2-IMPORT-V6 RPL-2-EXPORT-V6 Run this script with "python filename.py" hostname="gethostname" chain_1 = [ "set('vrf_name')", "lookup('peer_ip', group='bgp_state', update=True)" ] {{ peer }} 4 65101 20 21 43 0 0 {{ uptime }} {{ state }} router bgp {{ asn | record(asn) }} vrf {{ vrf_name }} neighbor {{ peer_ip }} {{ local_asn | set(asn) }} {{ hostname | set(hostname) }} remote-as {{ peer_asn }} description {{ description }} address-family {{ afi }} unicast route-map {{ rpl_in }} in route-map {{ rpl_out }} out """ data_bgp_state = """ ucs-core-switch-1#show bgp vrf CUST-1 vpnv4 unicast summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.0.2.1 4 65101 32 54 42 0 0 00:12:33 300 192.0.2.2 4 65101 11 45 99 0 0 03:55:01 idle """ data_bgp_config = """ ucs-core-switch-1#show run | section bgp router bgp 65100 vrf CUST-1 neighbor 192.0.2.1 remote-as 65101 description peer-1 address-family ipv4 unicast route-map RPL-1-IMPORT-v4 in route-map RPL-1-EXPORT-V4 out neighbor 192.0.2.2 remote-as 65102 description peer-2 address-family ipv4 unicast route-map RPL-2-IMPORT-V6 in route-map RPL-2-EXPORT-V6 out """ from ttp import ttp parser = ttp() parser.add_template(template) parser.add_input(data=data_bgp_state, input_name="bgp_state") parser.add_input(data=data_bgp_config, input_name="bgp_config") parser.parse() ``` # Contributions Feel free to submit an issue, report a bug or ask a question, feature requests are welcomed. Or [buy](https://paypal.me/dmulyalin) Author a coffee # Additional resources List of additional resources: - Sandbox to test TTP templates - http://textfsm.nornir.tech/ by [tbotnz](https://github.com/tbotnz) - Videos on TTP - https://pynet.twb-tech.com/videos/ttp/ttp.html by [Kirk Byers](https://github.com/ktbyers) %prep %autosetup -n ttp-0.9.4 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-ttp -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 25 2023 Python_Bot - 0.9.4-1 - Package Spec generated