We then setup our pyATS framework and connect ( nnect) to our topology I tell Python where to find the Jinja2 templates and setup a variable I can use later to load said templates Then for this example I will do 2 learn functions, platform and routing and see if I can transform real network state data into meaningful WebEx messages The general_functionalities are important these are object oriented code that gets reused per pyATS learn or parse library call. We setup our WebEx room and token (12 hour or bot) as variables we can call later Update – I’ve also come to discover we need 1 more import and pip install requests_toolbelt in order to attach files to WebEx messages.We don’t need a lot to make this happen either here is everything I import I want the message to be in Markdown so I am going to use a Jinja2 template to craft the JSON we can POST with Python requests after pyATS has parsed or learned the function With the above foundational WebEx integration with pyATS and WebEx’s simplicity I thought I would integrate a few sample commands into a Merlin pyATS job for the community to see how you can send Network State data to WebEx! Thats it you are ready to connect your pyATS jobs for a job summary as a WebEx message! Adding Network State Data This will give you the JSON list – here is the Merlin Room ID The easiest way to get one of these is to go to the Documentationīut how do I get the Room / Channel / Space ID? Or, right from the browser, grab one of the 12 hour tokens This in itself is pretty handy! And all you need to do is go to the Cisco WebEx for Developers portal and either make a Bot under My Apps This looks something like this inside of WebEx: If you create the nf file as Takashi suggests and add the information it will enable the pyATS job to report the job summary into the WebEx space you provide the config file. With all the big WebEx news – including a new logo – I wanted to revisit the basic #chatbots I have working using pyATS, Python requests, and the WebEx API after the conversation came up in the #pyATS WebEx Community space today:įirst, let’s take a look at what this does, and this is not limited to Merlin any pyATS job has this capability
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |