Network module conditional

Let's take a look at another network device conditional example by using the comparison keyword we saw at the beginning of this chapter. We can take advantage of the fact that both IOSv and Arista EOS provide the outputs in JSON format for the show commands. For example, we can check the status of the interface:

    arista1#sh interfaces ethernet 1/3 | json    {     "interfaces": {     "Ethernet1/3": {     "interfaceStatistics": {    <skip>     "outPktsRate": 0.0     },     "name": "Ethernet1/3",     "interfaceStatus": "disabled",     "autoNegotiate": "off",     <skip>    }    arista1#

If we have an operation that we want to perform and it depends on Ethernet1/3 being disabled in order to have no user impact, such as to ensure no users are actively connected to ...

Get Mastering Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.