CINXE.COM
bsingh23/nornir_crc_errors - Cisco Code Exchange
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>bsingh23/nornir_crc_errors - Cisco Code Exchange</title> <link rel="shortcut icon" href="https://static.production.devnetcloud.com/images/favicon.ico"> <link rel="canonical" href="https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors/"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="bsingh23/nornir_crc_errors - Script will collect CRC error from Cisco Device. Output will be generated on screen in table format and stored in a CSV file."> <meta name="name" content="codeexchange"> <meta name="commitid" content="v4.0.2"> <meta name="env" content="production"> <meta name="keywords" content="gitHub,repo,repos,repositories,discover,cisco,learn,build,sdk,api"> <link href="https://static.production.devnetcloud.com/platformsdk/sdk.css?v4.0.2" rel="stylesheet"> <link href="https://static.production.devnetcloud.com/dwc-header-and-footer/style.css?v4.0.2" rel="stylesheet"> <script src="https://static.production.devnetcloud.com/analyticSDK/sdk.js?v4.0.2" defer></script> <script src="https://static.production.devnetcloud.com/platformsdk/sdk.js?v4.0.2" defer></script> <script src="https://static.production.devnetcloud.com/dwc-header-and-footer/index.js?v4.0.2" defer></script> <script src="https://static.production.devnetcloud.com/form/sdk.js?v4.0.2" defer></script> <script type="module" crossorigin src="https://static.production.devnetcloud.com/codeexchange/assets/template-Cn9-u231.js"></script> <link rel="stylesheet" crossorigin href="https://static.production.devnetcloud.com/codeexchange/assets/template-mms6uZAA.css"> <meta name="lambda_time" content="1740153130431"> <meta property="og:type" name="og:type" content="website"> <meta property="og:site_name" name="og:site_name" content="Cisco DevNet Code Exchange"> <meta property="og:title" name="og:title" content="bsingh23/nornir_crc_errors - Cisco Code Exchange"> <meta property="og:description" name="og:description" content="bsingh23/nornir_crc_errors - Script will collect CRC error from Cisco Device. Output will be generated on screen in table format and stored in a CSV file."> <meta property="og:image" name="og:image" content="https://static.production.devnetcloud.com/images/codeexchange.png"> <meta property="og:url" name="og:url" content="https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors/"> <meta property="og:updated_time" name="og:updated_time" content="2023-05-25T13:02:05Z"> <meta property="twitter:card" name="twitter:card" content="summary"> <meta property="twitter:site" name="twitter:site" content="@CiscoDevNet"> <meta property="twitter:title" name="twitter:title" content="bsingh23/nornir_crc_errors - Cisco Code Exchange"> <meta property="twitter:description" name="twitter:description" content="bsingh23/nornir_crc_errors - Script will collect CRC error from Cisco Device. Output will be generated on screen in table format and stored in a CSV file."> <meta property="twitter:image" name="twitter:image" content="https://static.production.devnetcloud.com/images/codeexchange.png"> <meta property="twitter:url" name="twitter:url" content="https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors/"> </head> <body> <div id="root"><dwc-header thin="true"></dwc-header><div class="detail"><div class="breadcrumb breadcrumb--block"><div class="container"><a class="bci-link" href="/codeexchange">Code Exchange</a><i class="chevron chevron--right breadcrumb__chevron"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M10.9998 8L5.9998 13L5.2998 12.3L9.5998 8L5.2998 3.7L5.9998 3L10.9998 8Z" fill="currentColor"></path></svg></i><a class="bci-link" href="/codeexchange/search/">Search</a><i class="chevron chevron--right breadcrumb__chevron"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M10.9998 8L5.9998 13L5.2998 12.3L9.5998 8L5.2998 3.7L5.9998 3L10.9998 8Z" fill="currentColor"></path></svg></i>Repository</div></div><header style="background:linear-gradient(180deg, #252D2E 0%, #0A0B0C 100%)" class="banner banner--left banner--bg"><video class="banner__video" autoplay="" playsinline="" loop="" muted="" id="bg-video" src="https://static.production.devnetcloud.com/codeexchange/assets/background-E6Q1Zfzk.mp4"></video><div class="container"><h1 class="banner__title">nornir_crc_errors</h1><div class="banner__meta"><svg style="margin-top:-1px" width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.375 4.50781C12.5625 4.55469 12.7266 4.64844 12.8438 4.78906C12.9609 4.95312 13.0078 5.11719 13.0078 5.30469C13.0078 5.49219 12.9375 5.65625 12.7969 5.79688L10.3125 8.21094L10.8984 11.6328C10.9219 11.8203 10.875 12.0078 10.7812 12.1719C10.6875 12.3359 10.5469 12.4297 10.3594 12.4766C10.1719 12.5234 9.98438 12.5 9.82031 12.4062L6.75 10.8125L3.67969 12.4062C3.49219 12.5 3.32812 12.5234 3.14062 12.4766C2.95312 12.4297 2.78906 12.3359 2.69531 12.1719C2.60156 12.0078 2.55469 11.8203 2.60156 11.6328L3.1875 8.21094L0.703125 5.79688C0.5625 5.65625 0.46875 5.49219 0.46875 5.30469C0.46875 5.11719 0.515625 4.95312 0.632812 4.78906C0.75 4.64844 0.914062 4.55469 1.125 4.50781L4.54688 4.01562L6.07031 0.921875C6.16406 0.734375 6.28125 0.617188 6.46875 0.546875C6.65625 0.5 6.82031 0.5 7.00781 0.546875C7.19531 0.617188 7.33594 0.734375 7.42969 0.921875L8.95312 4.01562L12.375 4.50781ZM9.11719 7.8125L11.4609 5.51562L8.20312 5.04688L6.75 2.09375L5.29688 5.04688L2.03906 5.51562L4.38281 7.8125L3.84375 11.0703L6.75 9.52344L9.65625 11.0703L9.11719 7.8125Z" fill="currentColor"></path></svg>1<svg width="14" height="9" viewBox="0 0 14 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.3359 3.9375C13.4297 4.125 13.5 4.3125 13.5 4.5C13.5 4.71094 13.4297 4.89844 13.3359 5.0625C12.6562 6.21094 11.7422 7.125 10.5938 7.78125C9.42188 8.48438 8.13281 8.8125 6.75 8.8125C5.34375 8.8125 4.07812 8.48438 2.90625 7.78125C1.73438 7.125 0.820312 6.21094 0.164062 5.0625C0.046875 4.89844 0 4.71094 0 4.5C0 4.3125 0.046875 4.125 0.164062 3.9375C0.820312 2.8125 1.73438 1.89844 2.90625 1.21875C4.07812 0.539062 5.34375 0.1875 6.75 0.1875C8.13281 0.1875 9.42188 0.539062 10.5938 1.21875C11.7422 1.89844 12.6562 2.8125 13.3359 3.9375ZM6.75 7.6875C7.92188 7.6875 9.02344 7.40625 10.0078 6.82031C10.9922 6.25781 11.7891 5.48438 12.375 4.5C12 3.91406 11.5547 3.39844 11.0391 2.92969C10.5234 2.46094 9.9375 2.08594 9.28125 1.80469C9.70312 2.39062 9.9375 3.04688 9.9375 3.75C9.9375 4.33594 9.77344 4.875 9.49219 5.34375C9.21094 5.83594 8.8125 6.23438 8.34375 6.51562C7.85156 6.79688 7.3125 6.9375 6.75 6.9375C6.16406 6.9375 5.625 6.79688 5.15625 6.51562C4.66406 6.23438 4.26562 5.83594 3.98438 5.34375C3.70312 4.875 3.5625 4.33594 3.5625 3.75C3.5625 3.23438 3.67969 2.71875 3.9375 2.25C3.9375 2.625 4.05469 2.92969 4.3125 3.1875C4.57031 3.44531 4.875 3.5625 5.25 3.5625C5.60156 3.5625 5.90625 3.44531 6.16406 3.1875C6.42188 2.92969 6.5625 2.625 6.5625 2.25C6.5625 1.89844 6.42188 1.59375 6.1875 1.33594C5.10938 1.42969 4.14844 1.75781 3.25781 2.32031C2.36719 2.88281 1.64062 3.60938 1.125 4.5C1.6875 5.48438 2.48438 6.25781 3.46875 6.82031C4.45312 7.40625 5.55469 7.6875 6.75 7.6875Z" fill="currentColor"></path></svg>1<svg width="9" height="10" viewBox="0 0 9 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.21429 1.5625C3.21429 1.93838 3.07804 2.27728 2.85059 2.54527C2.55277 2.89617 2.25 3.28975 2.25 3.75C2.25 4.0957 2.53728 4.375 2.89286 4.375H6.10714C6.46272 4.375 6.75 4.0957 6.75 3.75C6.75 3.28975 6.44723 2.89617 6.14941 2.54527C5.92196 2.27728 5.78571 1.93838 5.78571 1.5625C5.78571 0.699609 6.50491 0 7.39286 0C8.2808 0 9 0.699609 9 1.5625C9 1.93838 8.86375 2.27728 8.6363 2.54527C8.33848 2.89617 8.03571 3.28975 8.03571 3.75C8.03571 4.78516 7.17188 5.625 6.10714 5.625H5.97317C5.5146 5.625 5.14286 5.99674 5.14286 6.45531C5.14286 6.789 5.35805 7.07624 5.60392 7.30184C5.91408 7.58643 6.10714 7.99005 6.10714 8.4375C6.10714 9.30078 5.38795 10 4.5 10C3.61205 10 2.89286 9.30078 2.89286 8.4375C2.89286 7.99005 3.08592 7.58643 3.39608 7.30184C3.64195 7.07624 3.85714 6.789 3.85714 6.45531C3.85714 5.99674 3.4854 5.625 3.02683 5.625H2.89286C1.82772 5.625 0.964286 4.78516 0.964286 3.75C0.964286 3.2897 0.661721 2.89594 0.363885 2.54499C0.136496 2.27704 0 1.93825 0 1.5625C0 0.699609 0.719598 0 1.60714 0C2.49509 0 3.21429 0.699609 3.21429 1.5625ZM1.60714 2.03125C1.87333 2.03125 2.08929 1.82129 2.08929 1.5625C2.08929 1.30371 1.87333 1.09375 1.60714 1.09375C1.34096 1.09375 1.125 1.30371 1.125 1.5625C1.125 1.82129 1.34096 2.03125 1.60714 2.03125ZM7.39286 2.03125C7.66004 2.03125 7.875 1.82129 7.875 1.5625C7.875 1.30371 7.66004 1.09375 7.39286 1.09375C7.12567 1.09375 6.91071 1.30371 6.91071 1.5625C6.91071 1.82129 7.12567 2.03125 7.39286 2.03125ZM4.5 7.96875C4.23281 7.96875 4.01786 8.17773 4.01786 8.4375C4.01786 8.69727 4.23281 8.90625 4.5 8.90625C4.76719 8.90625 4.98214 8.69727 4.98214 8.4375C4.98214 8.17773 4.76719 7.96875 4.5 7.96875Z" fill="currentColor"></path></svg>0</div><p class="banner__description"></p><div class="detail__nav"><nav class="nav"></nav></div></div></header><nav class="sticky-nav"><div class="sticky-nav__sticky"><div class="sticky-nav__container container"><div class="sticky-nav__navs"></div><div class="sticky-nav__buttons"></div></div></div></nav><section class="container detail__body"><div class="detail__left"><div id="readme" class="detail__content"><div class="markdown-viewer-root"><div class="widget markdown-viewer theme-light"><div class="html-viewer markdown-body"><p dir="auto"><a href="https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors" rel="nofollow"><img src="https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-published.svg" alt="published" style="max-width:100%" /></a> <a href="https://developer.cisco.com/devenv/?id=devenv-vscode-base&GITHUB_SOURCE_REPO=https://github.com/bsingh23/nornir_crc_errors" rel="nofollow"><img src="https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-runable-icon.svg" alt="Run in Cisco Cloud IDE" style="max-width:100%" /></a> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/723530d950ad33dbac30bac267a80043cbc66f07605537e22cdf8eb3801452f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f507974686f6e2d332e392d3337373641422e7376673f7374796c653d666c6174266c6f676f3d707974686f6e266c6f676f436f6c6f723d7768697465"><img src="https://camo.githubusercontent.com/723530d950ad33dbac30bac267a80043cbc66f07605537e22cdf8eb3801452f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f507974686f6e2d332e392d3337373641422e7376673f7374796c653d666c6174266c6f676f3d707974686f6e266c6f676f436f6c6f723d7768697465" alt="Python3.6" style="max-width:100%" /></a></p> <h1 dir="auto">Nornir Script: Find Interfaces with CRC Errors</h1> <p dir="auto">This Nornir script collects CRC errors from Cisco network devices and writes the data to a CSV file and provide output on screen using RICH table.</p> <p dir="auto">Script will prompt the user to enter the minimum number of CRC errors.</p> <p dir="auto">The RICH table and CSV file contains the hostname, interface, and the number of CRC errors for each interface.</p> <h2 dir="auto">Requirements</h2> <ul dir="auto"> <li>Python 3.9+</li> <li>Nornir 3.x</li> <li>Nornir-scrapli plugin</li> <li>Nornir-utils plugin</li> <li>Scrapli library</li> <li>Genie library</li> <li>Devices configured for SSH access</li> </ul> <p dir="auto">Note: Code tested on Python 3.9.6</p> <h2 dir="auto">Configuration</h2> <p dir="auto">Configure your network devices in the <code class="notranslate">hosts.yaml</code> file using the following format:</p> <div class="highlight highlight-source-yaml" dir="auto"><div class="dwcin-code-block"><pre class="notranslate"><span class="pl-ent">host_name</span>: <span class="pl-ent">hostname</span>: <span class="pl-s">ip_address</span> <span class="pl-ent">platform</span>: <span class="pl-s">ios</span> <span class="pl-ent">username</span>: <span class="pl-s">username</span> <span class="pl-ent">password</span>: <span class="pl-s">password</span> <span class="pl-ent">groups</span>: <span class="pl-s">(Optional)</span> - <span class="pl-s"><group_name></span></pre><span class="dwcin-code-copy-btn"></span></div></div> <p dir="auto">You can also specify SSH port and any other connection options in the inventory file. Refer to the Nornir documentation for more information.</p> <h2 dir="auto">Usage</h2> <ol dir="auto"> <li> <p dir="auto">Clone the repository:</p> <div class="highlight highlight-source-shell" dir="auto"><div class="dwcin-code-block"><pre class="notranslate">git clone https://github.com/bsingh23/nornir_crc_errors.git</pre><span class="dwcin-code-copy-btn"></span></div></div> </li> <li> <p dir="auto">Install the dependencies:</p> <div class="highlight highlight-source-shell" dir="auto"><div class="dwcin-code-block"><pre class="notranslate">pip3 install -r requirements.txt</pre><span class="dwcin-code-copy-btn"></span></div></div> </li> <li> <p dir="auto">Modify the <code class="notranslate">config_test.yaml</code> file in the <code class="notranslate">nornir</code> directory with your specific settings.</p> </li> <li> <p dir="auto">Run the script:</p> <div class="highlight highlight-source-shell" dir="auto"><div class="dwcin-code-block"><pre class="notranslate">python3 crc_error_v1.0.py</pre><span class="dwcin-code-copy-btn"></span></div></div> </li> <li> <p dir="auto">The script will create a CSV file in the same directory as the script with the following name format: <code class="notranslate">crcerror_<current_datetime>.csv</code>.</p> </li> </ol> <h2 dir="auto">Sample Output</h2> <table role="table"> <thead> <tr> <th>Hostname</th> <th>Interface</th> <th>CRC Error</th> </tr> </thead> <tbody> <tr> <td>switch1</td> <td>GigabitEthernet1/0/1</td> <td>1214</td> </tr> <tr> <td>switch2</td> <td>GigabitEthernet0/0/1</td> <td>57</td> </tr> <tr> <td>switch3</td> <td>GigabitEthernet2/0</td> <td>150</td> </tr> </tbody> </table> <h2 dir="auto">Notes</h2> <ul dir="auto"> <li> <p dir="auto">The script uses the Genie library to parse the output of the <code class="notranslate">show interfaces</code> command. Make sure your network devices support the show interfaces command output in a format that can be parsed by Genie.</p> </li> <li> <p dir="auto">Testing done on IOS and IOS-XE</p> </li> </ul></div></div></div></div><div style="display:none" role="presentation" class="detail__form"><div role="presentation" class="repo-form"></div></div></div><div class="detail__right"><div class="repo"><a href="https://github.com/bsingh23/nornir_crc_errors" class="btn btn-primary" target="_blank">View code on GitHub</a><ul><li class="repo__item"><p class="repo__info">Owner</p><div class="repo__user"><span class="repo__user-icon">b</span><a class="link" href="/codeexchange/search?q=bsingh23">bsingh23</a></div></li><li class="repo__item"><p class="repo__info">Contributors</p><div class="repo__user"><span class="repo__user-icon repo__user-icon--multi">+<!-- -->1</span>Github contributor</div></li><li class="repo__item"><p class="repo__info">Categories</p></li><li class="repo__item"><p class="repo__info">Programming Languages</p><a class="repo__lang link" href="/codeexchange/search/?languages=Python">Python</a></li><li class="repo__item"><p class="repo__info">License</p><div>MIT License</div></li></ul></div><div class="related"><div class="related__head">Related code repos</div><div class="spin"><i class="spin__icon spin__icon--medium"></i></div><ul class="related__list"></ul></div><div class="detail__community"><i class="detail__community-icon"></i><p class="detail__community-title">Code Exchange Community</p>Get help, share code, and collaborate with other developers in the Code Exchange community.<a class="btn btn-secondary" href="https://community.cisco.com/t5/code-exchange/bd-p/dev-code-exchange" target="_blank">View Community<i aria-hidden="true" role="button" tabindex="-1" style="height:16px;width:16px" class="icon icon--external-link"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M5 3V4H11.295L3 12.295L3.705 13L12 4.705V11H13V3H5Z" fill="currentColor"></path></svg></i></a></div></div></section><div class="back-to-top"><div class="back-to-top__wrapper back-to-top__wrapper--none"><div class="container"><i class="back-to-top__icon"></i></div></div></div><section class="detail__disclaimer"><div class="container">Disclaimer:<br/>Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco. </div></section></div><dwc-footer></dwc-footer><script nonce="the-nonce">window.__staticRouterHydrationData = JSON.parse("{\"loaderData\":{\"0\":null,\"0-6\":{\"cache\":300,\"data\":{\"id\":\"bsingh23__nornir_crc_errors\",\"name\":\"bsingh23/nornir_crc_errors\",\"published_catalog\":{\"id\":\"bsingh23__nornir_crc_errors\",\"name\":\"bsingh23/nornir_crc_errors\",\"description\":\"Script will collect CRC error from Cisco Device. Output will be generated on screen in table format and stored in a CSV file.\",\"url\":\"https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors\",\"type\":\"Code\",\"contentSubtype\":\"COMMUNITY\",\"status\":\"PUBLISHED\",\"meta\":{\"CodeExchangeScore\":\"1\",\"CodeExchangeScoreReason\":\"|GitScore 2 |Valid License type mit |Valid readme with len 3644 |Last udated before 243 days \",\"deprecated\":\"0\",\"disclaimer\":\"0\",\"forksCounts\":\"0\",\"githubURL\":\"https://github.com/bsingh23/nornir_crc_errors\",\"stargazersCount\":\"1\",\"subscribersCount\":\"1\",\"watchersCount\":\"1\"},\"complexity\":\"\",\"categories\":[\"Networking\"],\"programmingLanguages\":[\"Python\"],\"additionalTags\":[\"nornir\",\"python3\",\"owner:bsingh23\",\"contributor:bsingh23\"],\"importance\":0.1,\"contentOwners\":[\"bsingh23\"],\"contentContributors\":[\"bsingh23\"],\"contentFullText\":\"published Run in Cisco Cloud IDE Python3.6\\n\\nNornir Script: Find Interfaces with CRC Errors\\n\\nThis Nornir script collects CRC errors from Cisco network devices and writes the data to a CSV file and provide output on screen using RICH table.\\n\\nScript will prompt the user to enter the minimum number of CRC errors.\\n\\nThe RICH table and CSV file contains the hostname, interface, and the number of CRC errors for each interface.\\n\\nRequirements\\n\\nPython 3.9+\\nNornir 3.x\\nNornir-scrapli plugin\\nNornir-utils plugin\\nScrapli library\\nGenie library\\nDevices configured for SSH access\\n\\nNote: Code tested on Python 3.9.6\\n\\nConfiguration\\n\\nConfigure your network devices in the hosts.yaml file using the following format:\\n\\nhostname:\\n hostname: ipaddress\\n platform: ios\\n username: username\\n password: password\\n groups: (Optional)\\n \\nYou can also specify SSH port and any other connection options in the inventory file. Refer to the Nornir documentation for more information.\\n\\nUsage\\n\\nClone the repository:\\n\\n git clone https://github.com/bsingh23/nornircrcerrors.git\\n \\nInstall the dependencies:\\n\\n pip3 install -r requirements.txt\\n \\nModify the configtest.yaml file in the nornir directory with your specific settings.\\n\\nRun the script:\\n\\n python3 crcerrorv1.0.py\\n \\nThe script will create a CSV file in the same directory as the script with the following name format: crcerror.csv.\\n\\nSample Output\\n\\n| Hostname | Interface | CRC Error |\\n| --------- | ----------------- | --------- |\\n| switch1 | GigabitEthernet1/0/1 | 1214 |\\n| switch2 | GigabitEthernet0/0/1 | 57 |\\n| switch3 | GigabitEthernet2/0 | 150 |\\n\\nNotes\\n\\nThe script uses the Genie library to parse the output of the show interfaces command. Make sure your network devices support the show interfaces command output in a format that can be parsed by Genie.\\n\\nTesting done on IOS and IOS-XE\\n\",\"contentCreationTime\":\"2023-04-24T20:28:12Z\",\"contentLastUpdateTime\":\"2024-09-12T03:21:59.418940219Z\"},\"published_contributors\":[{\"username\":\"bsingh23\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/55885130?v=4\",\"user_url\":\"https://github.com/bsingh23\"}],\"published_readme\":{\"auto_valid\":true,\"html_url\":\"https://github.com/bsingh23/nornir_crc_errors/blob/main/README.md\",\"md_url\":\"https://raw.githubusercontent.com/bsingh23/nornir_crc_errors/main/README.md\",\"raw_base_url\":\"https://raw.githubusercontent.com/bsingh23/nornir_crc_errors/main/\",\"commit_sha\":\"464f554e3806fc4f66640186a306fe228b2c023e\",\"base64_content\":\"WyFbcHVibGlzaGVkXShodHRwczovL3N0YXRpYy5wcm9kdWN0aW9uLmRldm5ldGNsb3VkLmNvbS9jb2RlZXhjaGFuZ2UvYXNzZXRzL2ltYWdlcy9kZXZuZXQtcHVibGlzaGVkLnN2ZyldKGh0dHBzOi8vZGV2ZWxvcGVyLmNpc2NvLmNvbS9jb2RlZXhjaGFuZ2UvZ2l0aHVi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ZSB0aGUgb3V0cHV0IG9mIHRoZSBgc2hvdyBpbnRlcmZhY2VzYCBjb21tYW5kLiBNYWtlIHN1cmUgeW91ciBuZXR3b3JrIGRldmljZXMgc3VwcG9ydCB0aGUgc2hvdyBpbnRlcmZhY2VzIGNvbW1hbmQgb3V0cHV0IGluIGEgZm9ybWF0IHRoYXQgY2FuIGJlIHBhcnNlZCBieSBHZW5pZS4KCiogVGVzdGluZyBkb25lIG9uIElPUyBhbmQgSU9TLVhFCg==\",\"html_content\":\"\u003cp dir=\\\"auto\\\"\u003e\u003ca href=\\\"https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors\\\" rel=\\\"nofollow\\\"\u003e\u003cimg src=\\\"https://camo.githubusercontent.com/6246fbfe22dbe8ab5d0a4e25e8796d3702452e10e04bf83bece7e72a96acc680/68747470733a2f2f7374617469632e70726f64756374696f6e2e6465766e6574636c6f75642e636f6d2f636f646565786368616e67652f6173736574732f696d616765732f6465766e65742d7075626c69736865642e737667\\\" alt=\\\"published\\\" data-canonical-src=\\\"https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-published.svg\\\" style=\\\"max-width: 100%;\\\"\u003e\u003c/a\u003e \u003ca href=\\\"https://developer.cisco.com/devenv/?id=devenv-vscode-base\u0026amp;GITHUB_SOURCE_REPO=https://github.com/bsingh23/nornir_crc_errors\\\" rel=\\\"nofollow\\\"\u003e\u003cimg src=\\\"https://camo.githubusercontent.com/de21eda95ca1e83fd7ae2d7d0454d55cd16964a9c92684d73e2bf6e8cf7dc520/68747470733a2f2f7374617469632e70726f64756374696f6e2e6465766e6574636c6f75642e636f6d2f636f646565786368616e67652f6173736574732f696d616765732f6465766e65742d72756e61626c652d69636f6e2e737667\\\" alt=\\\"Run in Cisco Cloud IDE\\\" data-canonical-src=\\\"https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-runable-icon.svg\\\" style=\\\"max-width: 100%;\\\"\u003e\u003c/a\u003e \u003ca target=\\\"_blank\\\" rel=\\\"noopener noreferrer nofollow\\\" href=\\\"https://camo.githubusercontent.com/723530d950ad33dbac30bac267a80043cbc66f07605537e22cdf8eb3801452f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f507974686f6e2d332e392d3337373641422e7376673f7374796c653d666c6174266c6f676f3d707974686f6e266c6f676f436f6c6f723d7768697465\\\"\u003e\u003cimg src=\\\"https://camo.githubusercontent.com/723530d950ad33dbac30bac267a80043cbc66f07605537e22cdf8eb3801452f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f507974686f6e2d332e392d3337373641422e7376673f7374796c653d666c6174266c6f676f3d707974686f6e266c6f676f436f6c6f723d7768697465\\\" alt=\\\"Python3.6\\\" style=\\\"max-width: 100%;\\\"\u003e\u003c/a\u003e\u003c/p\u003e\\n\u003ch1 dir=\\\"auto\\\"\u003eNornir Script: Find Interfaces with CRC Errors\u003c/h1\u003e\\n\u003cp dir=\\\"auto\\\"\u003eThis Nornir script collects CRC errors from Cisco network devices and writes the data to a CSV file and provide output on screen using RICH table.\u003c/p\u003e\\n\u003cp dir=\\\"auto\\\"\u003eScript will prompt the user to enter the minimum number of CRC errors.\u003c/p\u003e\\n\u003cp dir=\\\"auto\\\"\u003eThe RICH table and CSV file contains the hostname, interface, and the number of CRC errors for each interface.\u003c/p\u003e\\n\u003ch2 dir=\\\"auto\\\"\u003eRequirements\u003c/h2\u003e\\n\u003cul dir=\\\"auto\\\"\u003e\\n\u003cli\u003ePython 3.9+\u003c/li\u003e\\n\u003cli\u003eNornir 3.x\u003c/li\u003e\\n\u003cli\u003eNornir-scrapli plugin\u003c/li\u003e\\n\u003cli\u003eNornir-utils plugin\u003c/li\u003e\\n\u003cli\u003eScrapli library\u003c/li\u003e\\n\u003cli\u003eGenie library\u003c/li\u003e\\n\u003cli\u003eDevices configured for SSH access\u003c/li\u003e\\n\u003c/ul\u003e\\n\u003cp dir=\\\"auto\\\"\u003eNote: Code tested on Python 3.9.6\u003c/p\u003e\\n\u003ch2 dir=\\\"auto\\\"\u003eConfiguration\u003c/h2\u003e\\n\u003cp dir=\\\"auto\\\"\u003eConfigure your network devices in the \u003ccode class=\\\"notranslate\\\"\u003ehosts.yaml\u003c/code\u003e file using the following format:\u003c/p\u003e\\n\u003cdiv class=\\\"highlight highlight-source-yaml\\\" dir=\\\"auto\\\"\u003e\u003cpre class=\\\"notranslate\\\"\u003e\u003cspan class=\\\"pl-ent\\\"\u003ehost_name\u003c/span\u003e:\\n \u003cspan class=\\\"pl-ent\\\"\u003ehostname\u003c/span\u003e: \u003cspan class=\\\"pl-s\\\"\u003eip_address\u003c/span\u003e\\n \u003cspan class=\\\"pl-ent\\\"\u003eplatform\u003c/span\u003e: \u003cspan class=\\\"pl-s\\\"\u003eios\u003c/span\u003e\\n \u003cspan class=\\\"pl-ent\\\"\u003eusername\u003c/span\u003e: \u003cspan class=\\\"pl-s\\\"\u003eusername\u003c/span\u003e\\n \u003cspan class=\\\"pl-ent\\\"\u003epassword\u003c/span\u003e: \u003cspan class=\\\"pl-s\\\"\u003epassword\u003c/span\u003e\\n \u003cspan class=\\\"pl-ent\\\"\u003egroups\u003c/span\u003e: \u003cspan class=\\\"pl-s\\\"\u003e(Optional)\u003c/span\u003e\\n - \u003cspan class=\\\"pl-s\\\"\u003e\u0026lt;group_name\u0026gt;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\\n\u003cp dir=\\\"auto\\\"\u003eYou can also specify SSH port and any other connection options in the inventory file. Refer to the Nornir documentation for more information.\u003c/p\u003e\\n\u003ch2 dir=\\\"auto\\\"\u003eUsage\u003c/h2\u003e\\n\u003col dir=\\\"auto\\\"\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eClone the repository:\u003c/p\u003e\\n\u003cdiv class=\\\"highlight highlight-source-shell\\\" dir=\\\"auto\\\"\u003e\u003cpre class=\\\"notranslate\\\"\u003egit clone https://github.com/bsingh23/nornir_crc_errors.git\u003c/pre\u003e\u003c/div\u003e\\n\u003c/li\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eInstall the dependencies:\u003c/p\u003e\\n\u003cdiv class=\\\"highlight highlight-source-shell\\\" dir=\\\"auto\\\"\u003e\u003cpre class=\\\"notranslate\\\"\u003epip3 install -r requirements.txt\u003c/pre\u003e\u003c/div\u003e\\n\u003c/li\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eModify the \u003ccode class=\\\"notranslate\\\"\u003econfig_test.yaml\u003c/code\u003e file in the \u003ccode class=\\\"notranslate\\\"\u003enornir\u003c/code\u003e directory with your specific settings.\u003c/p\u003e\\n\u003c/li\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eRun the script:\u003c/p\u003e\\n\u003cdiv class=\\\"highlight highlight-source-shell\\\" dir=\\\"auto\\\"\u003e\u003cpre class=\\\"notranslate\\\"\u003epython3 crc_error_v1.0.py\u003c/pre\u003e\u003c/div\u003e\\n\u003c/li\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eThe script will create a CSV file in the same directory as the script with the following name format: \u003ccode class=\\\"notranslate\\\"\u003ecrcerror_\u0026lt;current_datetime\u0026gt;.csv\u003c/code\u003e.\u003c/p\u003e\\n\u003c/li\u003e\\n\u003c/ol\u003e\\n\u003ch2 dir=\\\"auto\\\"\u003eSample Output\u003c/h2\u003e\\n\u003ctable role=\\\"table\\\"\u003e\\n\u003cthead\u003e\\n\u003ctr\u003e\\n\u003cth\u003eHostname\u003c/th\u003e\\n\u003cth\u003eInterface\u003c/th\u003e\\n\u003cth\u003eCRC Error\u003c/th\u003e\\n\u003c/tr\u003e\\n\u003c/thead\u003e\\n\u003ctbody\u003e\\n\u003ctr\u003e\\n\u003ctd\u003eswitch1\u003c/td\u003e\\n\u003ctd\u003eGigabitEthernet1/0/1\u003c/td\u003e\\n\u003ctd\u003e1214\u003c/td\u003e\\n\u003c/tr\u003e\\n\u003ctr\u003e\\n\u003ctd\u003eswitch2\u003c/td\u003e\\n\u003ctd\u003eGigabitEthernet0/0/1\u003c/td\u003e\\n\u003ctd\u003e57\u003c/td\u003e\\n\u003c/tr\u003e\\n\u003ctr\u003e\\n\u003ctd\u003eswitch3\u003c/td\u003e\\n\u003ctd\u003eGigabitEthernet2/0\u003c/td\u003e\\n\u003ctd\u003e150\u003c/td\u003e\\n\u003c/tr\u003e\\n\u003c/tbody\u003e\\n\u003c/table\u003e\\n\u003ch2 dir=\\\"auto\\\"\u003eNotes\u003c/h2\u003e\\n\u003cul dir=\\\"auto\\\"\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eThe script uses the Genie library to parse the output of the \u003ccode class=\\\"notranslate\\\"\u003eshow interfaces\u003c/code\u003e command. Make sure your network devices support the show interfaces command output in a format that can be parsed by Genie.\u003c/p\u003e\\n\u003c/li\u003e\\n\u003cli\u003e\\n\u003cp dir=\\\"auto\\\"\u003eTesting done on IOS and IOS-XE\u003c/p\u003e\\n\u003c/li\u003e\\n\u003c/ul\u003e\"},\"published_license\":{\"auto_valid\":true,\"filename\":\"LICENSE\",\"file_url\":\"https://raw.githubusercontent.com/bsingh23/nornir_crc_errors/main/LICENSE\",\"license_key\":\"mit\",\"license_name\":\"MIT License\",\"commit_sha\":\"6732917a80f3cd09f21b87e0c487083207d99769\",\"base64_content\":\"\"},\"use_cases\":[],\"sandboxes\":[],\"learning_labs\":[],\"white_papers\":[],\"legacy\":false}}},\"actionData\":null,\"errors\":null}");</script></div> <script> window['CONFIG'] = {"BASENAME":"codeexchange","USER_BASE":"https://users.production.devnetcloud.com","CONTENT_BASE":"https://static.production.devnetcloud.com","API_BASE":"https://devnet.cisco.com","REPO_FORM_ID":"clo0t4vo2tiamqrgsq20","REQUEST_FORM_ID":"clvugggkn21qdq08re4g","CLOUD_IDE_ID":"devenv-base-vscode"}; </script> <script src="https://static.production.devnetcloud.com/dwc/dwc-exception-pages/v0.0.8/index.js" defer></script> <script src="https://static.production.devnetcloud.com/dwc/dwc-countdown/v1.0.3/index.js" defer></script> <script type="application/ld+json"> [ { "@context": "https://schema.org", "@type": "TechArticle", "mainEntityOfPage": { "@id": "https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors/", "@type": "WebPage" }, "author": { "@type": "Person", "name": "bsingh23" }, "contributor": { "@type": "Person", "name": "bsingh23" }, "headline": "bsingh23/nornir_crc_errors - Cisco Code Exchange", "description": "bsingh23/nornir_crc_errors - Script will collect CRC error from Cisco Device. Output will be generated on screen in table format and stored in a CSV file.", "dateModified": "2023-05-25T13:02:05Z", "datePublished": "2023-04-24T20:28:12Z", "publisher": { "@type": "Organization", "name": "Cisco DevNet", "parentOrganization": "Cisco", "url": "https://developer.cisco.com", "logo": { "@type": "ImageObject", "url": "https://static.production.devnetcloud.com/images/cisco-devnet.jpg", "width": "400", "height": "400" } } }, { "@context": "https://schema.org", "@type": "SoftwareSourceCode", "codeRepository": "https://github.com/bsingh23/nornir_crc_errors", "codeSampleType": "scripts", "programmingLanguage": { "@type": "ComputerLanguage", "name": "Python" } }, { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "Cisco DevNet", "item": "https://developer.cisco.com" }, { "@type": "ListItem", "position": 2, "name": "Cisco DevNet Code Exchange", "item": "https://developer.cisco.com/codeexchange/" }, { "@type": "ListItem", "position": 3, "name": "bsingh23/nornir_crc_errors - Cisco Code Exchange", "item": "https://developer.cisco.com/codeexchange/github/repo/bsingh23/nornir_crc_errors/" } ] } ] </script> </body> </html>