<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[RouteSwitch]]></title><description><![CDATA[Concise, Real-world Networking]]></description><link>https://routeswitch.in/</link><image><url>https://routeswitch.in/favicon.png</url><title>RouteSwitch</title><link>https://routeswitch.in/</link></image><generator>Ghost 5.82</generator><lastBuildDate>Sat, 01 Jun 2024 17:46:42 GMT</lastBuildDate><atom:link href="https://routeswitch.in/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Cisco Model Driven Telemetry - Part 1]]></title><description><![CDATA[<p>Hey Folks !</p><p>Do checkout this introductory video on Cisco Model Driven Telemetry on my new YouTube channel.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/NgohSalGzNk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen title="Cisco Model Driven Telemetry - Basics and Theory - Part 1"></iframe></figure><p>This video aims to present an overview . Do give your suggestion through comments! Thanks</p>]]></description><link>https://routeswitch.in/cisco-model-driven-telemetry-part-1/</link><guid isPermaLink="false">63065dd1306e7a0001fd45e1</guid><category><![CDATA[Cisco]]></category><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Wed, 24 Aug 2022 17:28:28 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2022/08/20220805_222404.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2022/08/20220805_222404.jpg" alt="Cisco Model Driven Telemetry - Part 1"><p>Hey Folks !</p><p>Do checkout this introductory video on Cisco Model Driven Telemetry on my new YouTube channel.</p><figure class="kg-card kg-embed-card"><iframe width="200" height="113" src="https://www.youtube.com/embed/NgohSalGzNk?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen title="Cisco Model Driven Telemetry - Basics and Theory - Part 1"></iframe></figure><p>This video aims to present an overview . Do give your suggestion through comments! Thanks</p>]]></content:encoded></item><item><title><![CDATA[Introduction to JSON XML & YAML]]></title><description><![CDATA[This article discusses semantics of XML, JSON & YAML.]]></description><link>https://routeswitch.in/json-xml-yaml/</link><guid isPermaLink="false">60a7445dbd5bfe000183729a</guid><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Mon, 24 May 2021 15:18:05 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/09/a.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://routeswitch.in/content/images/2021/09/a.png" alt="Introduction to JSON XML &amp; YAML"><p>In a previous article we saw that Computers/machines communicating with each other might use different encoding/data formats.</p>
<blockquote>
<p>The three formats that are heavily used in the networking world for the exchange of data are JSON, XML  and YAML.</p>
</blockquote>
<h2 id="objects">Objects</h2>
<p>So all the languages described above are used in denoting what is called <em>objects</em>. Let&apos;s deep dive a bit. An object is a container for information. It is how we pass information between machines through API. So we need a way to describe the object, don&apos;t we? A way to describe the characteristics of the object.</p>
<blockquote>
<p>The multiple characteristics can always be denoted by key-value pairs.</p>
</blockquote>
<p>Say for example let&apos;s take an object which denotes an employee. An employee might have the following attributes. An ID number, a name, a department etc. All these characteristics can be described as a key and value pair.</p>
<p>Let us look into the details of the object language one by one:-</p>
<h2 id="xml-extensible-markup-language">XML ( eXtensible Markup Language )</h2>
<p><img src="https://bl6pap003files.storage.live.com/y4mSxvWGsw4nOk2xp1Mw5vvwB1aSaOVWX1NxxtX2QpnHjQFPZRsWbX1GBCQzHm5En0qsoX9gie-QNSWjHNOSDlUIvZYzTVFANYUx4bnh-jgUNbuAB3ymL7HFoSymRFXDWYGZ44KmDZepTWm1v78GMJzAY0AiriIzsbNKZmmkvtEMAuTcDpgq2buI3dJE_W3Mllo?width=1000&amp;height=600&amp;cropmode=none" alt="Introduction to JSON XML &amp; YAML" loading="lazy"></p>
<p>Amongst the discussed formats, XML is the heaviest data type; very difficult to comprehend by humans. It is often used when lots of data is exchanged between machines. If the XML data is very small then we can attempt to understand it with some effort.</p>
<blockquote>
<p>But as the structure grows heavier, it becomes highly difficult to comprehend and interpret.</p>
</blockquote>
<h4 id="semantics"><a href="https://www.w3.org/XML/?ref=routeswitch.in">Semantics</a></h4>
<p>XML has been the language for the machine to machine communications for a very long time. It is very similar to HTML. Some of the key features of XML are:-</p>
<ul>
<li>It&apos;s a markup language.</li>
<li>XML uses a system of tags to denote key-value pairs</li>
<li>Tags are used in the format <code>&lt;tags&gt;&lt;/tags&gt;</code></li>
<li>The value is contained inside a tag pair <code>&lt;key&gt;value&lt;/key&gt;</code></li>
<li>XML is case sensitive in the tag usage.</li>
</ul>
<p>Let us look at a sample XML file to understand the semantics described above.</p>
<pre><code>&lt;employee&gt;
  &lt;name&gt;Arjuna&lt;/name&gt;
  &lt;location&gt;
    &lt;city&gt;Delhi&lt;/city&gt;
    &lt;state&gt;Delhi&lt;/state&gt;
  &lt;/location&gt;
  &lt;roles&gt;Network Engineer&lt;/roles&gt;
  &lt;roles&gt;Blogger&lt;/roles&gt;
&lt;/employee&gt;
</code></pre>
<hr>
<h2 id="json-javascript-object-notation">JSON ( JavaScript Object Notation)</h2>
<p><img src="https://bl6pap003files.storage.live.com/y4moZgTRXiUbHO5QhUog20bUnWp_PI0Rjr-_MjC1mhVSm9pzSauqZOW8j938w4B_ceqENqybr3U4-cdWAdqSi2g6QoeAMAOHoLhTCHAjA-5ykG4kZK3RoNOpjGZrB740Y5-o9f-SVgpGHAdnjU9q3pEf4tdA5pl5sG_eb2_jrCmkut7siJZKOcKuT0GCIT0Y5Z4?width=997&amp;height=501&amp;cropmode=none" alt="Introduction to JSON XML &amp; YAML" loading="lazy"></p>
<p>If we compare the painfully heavy nature of XML with JSON, JSON is very light and more human-readable. But why was JSON needed in the first place? Imagine you are running an application on your phone. The application might fetch data from the server. Now, what format will you choose for the data exchange? Will you send HTML? Will you send plain text?  Now the plain text will increase complications at the client side. How would the client know about the data it has received? So in this object-oriented world, we need a structured data exchange between the client-server architecture. In this case, JSON comes to the rescue. It is a notation that will help applications running Javascript easily parse and get the value of objects.</p>
<blockquote>
<p>Will it help only Javascript users?</p>
</blockquote>
<p>No, it has become a common object notation language that is now being used by multiple languages. Many come with built-in or custom libraries to parse and use JSON objects.</p>
<h4 id="semantics">Semantics</h4>
<p>Some key points to keep in mind while constructing a JSON file.</p>
<ul>
<li>The syntax makes use of {} (curly braces) , [] (square braces and) , comma.</li>
<li>Whitespaces don&apos;t matter.</li>
<li>The Tag concept is not used here.</li>
</ul>
<p>We can open a JSON object by using {} and go on to list the key-value pairs. Both the key and value are to be surrounded by quotes &quot; if there is a need to denote the value as a string. Multiple attributes of an object are separated from each other using &apos;,&apos;.</p>
<p>Let us look at the same data we represented using the YAML file above through JSON constructs:-</p>
<pre><code>{
    &quot;employee&quot;: {
        &quot;name&quot;: &quot;Arjuna&quot;, 
        &quot;location&quot;: {
            &quot;city&quot;: &quot;Delhi&quot;, 
            &quot;state&quot;: &quot;Delhi&quot;
        },
        &quot;roles&quot;: [
            &quot;network engineer&quot;,
            &quot;blogger&quot;
        ]
    }
}
</code></pre>
<blockquote>
<p>Notice how the square braces are used to denote an array in JSON ( Compared to the hyphens we used in YAML)</p>
</blockquote>
<hr>
<h2 id="yaml-yaml-aint-markup-language"><a href="https://yaml.org/?ref=routeswitch.in">YAML ( YAML Aint Markup Language)</a></h2>
<p><img src="https://bl6pap003files.storage.live.com/y4mzx_DACUjA79FuIwwhWUA05HTa4hjMWftJOvynqjTY_MonkMUvGwzfhjY8C9SWCAKQAWAocfuNYfI3hnQMVv9t8MlTDeXGBbeE620mQzBUj2FSnqYkegWncqwe4WCW5bHKIQ5qNI86VlOMxaGXgzCJ8HLEGQCf3PlOF3dT84gjaNJ3Ic6o29X4CZdXxz_U6GA?width=1024&amp;height=353&amp;cropmode=none" alt="Introduction to JSON XML &amp; YAML" loading="lazy"></p>
<p>YAML language was designed with one and the only thing in mind.</p>
<blockquote>
<p>Human readability</p>
</blockquote>
<p>It is designed to be a very clean language. As a developer, you can use two extensions for YAML files. They are yml and yaml. Both are acceptable.  We see YAML being converted to XML and JSON to make it mode machine-readable in a few use cases. YAML is mostly used to define configurations. It uses indentation to structure or define the objects. So people who are familiar with Python can understand YAML structure very easily.</p>
<h4 id="semantics">Semantics</h4>
<p>Some key points to keep in mind while constructing a YAML file.</p>
<ul>
<li>YAML is not a markup language.</li>
<li>There is no concept of tags.</li>
<li>Whitespaces matter in YAML. Let us look at a sample YAML file.</li>
</ul>
<pre><code>---
employee:
  name: Arjuna
  location:
    city: Delhi
    state: Delhi
  roles:
    - network engineer
    - blogger

</code></pre>
<p>All data of a particular object uses the same indentation level. Key-value pairs are separated by the use of colon &quot;:&quot;. &quot;_ _ _&quot; mentions the start of a YAML file.</p>
<p>In YAML, typically two spaces are used for indentation, but we can use any form of indentation we are comfortable with.</p>
<blockquote>
<p>Remember indentation using TABS is not supported in YAML. Use 2 space / 4 space indentations.</p>
</blockquote>
<p>YAML assumes the data type of the attributes based on the content. This applies to numbers strings etc. So there is no explicit need to append &quot; to strings. Also note that there is no comma &quot;,&quot; at the end of the value of a key-value pair. To denote the values forming part of a list use the dash/ hyphen &quot;-&quot; symbol.</p>
<hr>
<p>Hope this article gave an introduction to various encoding languages used in API communication. Bye.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Interacting with Softwares]]></title><description><![CDATA[Interacting with Software - API]]></description><link>https://routeswitch.in/interacting-with-softwares/</link><guid isPermaLink="false">60a3e43abd5bfe00018371ee</guid><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Tue, 18 May 2021 17:49:42 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2022/08/istockphoto-1058262630-612x612.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h2 id="introduction">Introduction</h2>
<img src="https://routeswitch.in/content/images/2022/08/istockphoto-1058262630-612x612.jpg" alt="Interacting with Softwares"><p><img src="https://bl6pap003files.storage.live.com/y4m8fphBuIyHoyKLYCduGCfATaqHI7w6iidcrJum3ok9GpDpRX5HqJIvz6kcsdI-06GbmQ3NMqPLMax6blMxOIFH5y1eGFSsijnJAA34CwDOLIO0s19P6g_kK6HqASKZLi9IVXoy9s9yzB2Jmot6zoKJHxUH2T5uOdYfFBtf2cPX8gOU8QO41edz6fhC5RC9bt-?width=955&amp;height=500&amp;cropmode=none" alt="Interacting with Softwares" loading="lazy"></p>
<hr>
<h2 id="evolution-of-software">Evolution of Software</h2>
<p>We all are encountering different types of Software in our day to day lives. The development process for each of this software is different and unique.  Every software solves a separate purpose. Earlier we used to have big fat applications which used to serve a single purpose, but nowadays we see everything migrating towards Web apps or Mobile Apps. We see most of them integrated with Social media. We see many apps making use of SSO of popular social media apps like Facebook Linkedin etc. It is only fair to say there is heavy reuse of code everywhere and no one wants to re-invent the wheel</p>
<hr>
<h2 id="why-the-hype-behind-api">Why the hype behind API?</h2>
<p><img src="https://bl6pap003files.storage.live.com/y4mOm_r3KEaSM2A6xiWKKH5J5tVN0fqh61GKiDF5zvDLNQ8uBhKg2PSLn-1PWxbZdB_qHC3WhxnJhGIpUZOG8Pi2s-OVhwCT2sLbO79-_UFDj4iE5QiH5uV515yGHkHte-4UdrkthdWGKnoSDaXe0XlhKQbO7boLW7ywgS_kwka1vHewXyaavOWX9H-JKJs-bma?width=680&amp;height=383&amp;cropmode=none" alt="Interacting with Softwares" loading="lazy"></p>
<blockquote>
<p>APIs help separate the modules by the functionality.</p>
</blockquote>
<p>You interface with an API because it solves a particular problem for you. Take for example the Google Maps API. You interface with it if you want geolocation functionality.</p>
<p>Imagine the several new web applications that are being developed day in day out. Now there are several modules implemented in the backend to give that nice user interface to you. At the backend, a module might take care of authentication, another might take care of database etc. Now all the interaction between the modules is possible because of API. It allows programmers to develop their own module and expose the functionality through an API and not be concerned about what other programmers have developed.</p>
<blockquote>
<p>You can develop and test your implemented function through API.</p>
</blockquote>
<hr>
<h2 id="distributed-computing">Distributed Computing</h2>
<p><img src="https://bl6pap003files.storage.live.com/y4m5lufR6_A9dCgWeKZI__twOq56V0T1tAYThrP3-OngPSUWJvvyfU-V6_t3R8KykItoqX1p6r0jKVwyHZ2fx2WNeZSkHzVMNQGyQ8ehqc4-Hybwb_O9WBxMatwgSFrh9VBKfmxB_uflU8IhFdIoRbGERb2HKAJxUi1yrqhYbjTtK0xQ3zFauYfhwdrT2KxEmEX?width=1280&amp;height=720&amp;cropmode=none" alt="Interacting with Softwares" loading="lazy"></p>
<p>Typically all these modules might be implemented in a single system/server or they might even be distributed. Take the example of google maps API. Your application might reside on a server in India. The maps API could point to a server in California. So the app implemented by you in your server has to extend an API call to the California server, fetch the response and then present it to your clients in a nice GUI. Can we say this to be a distributed system? we sure can. We need to take care of the networking requirements we implement such distributed systems.</p>
<hr>
<h2 id="documentation-of-apis">Documentation of APIs</h2>
<p><img src="https://bl6pap003files.storage.live.com/y4mMXaejLqtg2N90XqI8USkvkcMSdYAjJb8PuwoAHdEduK3-FTN1W5vidR1IlmC1Fd6JPp2syu23Qooe8hPySWCv7uY-Ty2KWoVgfH7usVkR-IN52AyPRN7Pvp3xW3VTz62CTvkJsaZHyXGbEq7ku6oyuJnYtPw3iz3QtWKNCwpPpzx0sGLWL3QYrNsTiqXCkAZ?width=1200&amp;height=763&amp;cropmode=none" alt="Interacting with Softwares" loading="lazy"></p>
<p>The documentation for API forms key for people to efficiently use and implement the API in their code. The doc should mention clearly how you are expecting the data input, what is the output format etc. Also, the language you expect the API server and client to speak is very important. Shall we call it encoding? Most of the API design uses a standard encoding schema.</p>
<p>We shall see more about the encoding schemas in upcoming articles</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Python - Using PIP]]></title><description><![CDATA[Using Python PIP package manager]]></description><link>https://routeswitch.in/python-pip/</link><guid isPermaLink="false">60a31ffcbd5bfe000183715e</guid><category><![CDATA[Python]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Tue, 18 May 2021 02:38:43 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2022/08/articleocw-5c6632dd1fe9f-1.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2022/08/articleocw-5c6632dd1fe9f-1.jpg" alt="Python - Using PIP"><p>Let us zoom through some of the commands and use cases for PIP the python package manager.</p><pre><code>pip install &quot;xyz&quot;</code></pre><p>Use the install command to install any of the modules that you need. Earlier you could search for the packages using the search command. It has now been discontinued. So you might get an error when you try to use their API for searching packages.</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/image-4.png" class="kg-image" alt="Python - Using PIP" loading="lazy" width="850" height="241" srcset="https://routeswitch.in/content/images/size/w600/2021/05/image-4.png 600w, https://routeswitch.in/content/images/2021/05/image-4.png 850w" sizes="(min-width: 720px) 720px"></figure><pre><code>pip list</code></pre><p>You can use the pip list command to list all the packages that you currently have installed.</p><pre><code>pip uninstall &quot;xyz&quot;</code></pre><p>You can use the uninstall command to uninstall any of the modules that you wish to remove.</p><pre><code>pip list --outdated</code></pre><p>You can use the list command with the outdated option to get a list of all outdated packages. You will get to know what version you have installed versus the latest one.</p><p>So how do you update the outdated packages?</p><pre><code>pip install -U &quot;xyz&quot;</code></pre><p>The install command with the -U option will let you upgrade the module to the latest version.</p><p>What&apos;s the use of the freeze command?</p><pre><code>pip freeze</code></pre><p>The freeze command will output all the modules installed in a format that is easier for the user to compile and make a requirements file. Suppose you need to ship the code to somebody. You need to tell them that these are the requirements that you need to have before you run my code. In that case, you will do a pip freeze; copy the contents and send him the requirements txt file.</p><pre><code>pip freeze &gt; requirements.txt</code></pre><p>The above command will get the output from pip freeze and put the contents into the requirements text file.</p><p>Suppose you have sent Mr X this text file. How will he install all the requirements on his computer? Will he do it one by one? </p><pre><code>pip install -r requirements.txt</code></pre><p>The -r modifier will instruct the pip to install all the modules mentioned in the requirements text file.</p><p>How to download modules through pip?</p><p>There might be a use-case where you need to download the package from one computer and install it on another. We can use pip to download the files and save the files on a directory of choice using the following command.</p><pre><code>pip download &quot;xyz&quot; --dest &quot;C:/path..&quot;</code></pre><p>This will download all the necessary files in this folder. This folder can be zipped and shipped to the remote destination and there it can be installed using the requirements.txt file method that was discussed previously.</p><p>Hope you found this snippet useful for working with pip the python package manager.</p>]]></content:encoded></item><item><title><![CDATA[Python - Use of "__name__" variable]]></title><description><![CDATA[A snippet detailing the use of the "__name__" variable in Python]]></description><link>https://routeswitch.in/python-name-variable/</link><guid isPermaLink="false">60a287013a57f30001446b33</guid><category><![CDATA[Python]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Mon, 17 May 2021 16:23:22 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2022/08/articleocw-5c6632dd1fe9f.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2022/08/articleocw-5c6632dd1fe9f.jpg" alt="Python - Use of &quot;__name__&quot; variable"><p>Hey, folks let&apos;s look at the usage of &quot;__name__&quot; in this snippet. Let us try to print the variable from a python program called code1.py</p><pre><code>print(__name__)</code></pre><p>On running this we get,</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/image-2.png" class="kg-image" alt="Python - Use of &quot;__name__&quot; variable" loading="lazy" width="287" height="76"></figure><p>Python loads a few Environment variables before it starts executing the code that you have given it to execute. &#xA0;The &quot;__name__&quot; variable is one such special variable. Here we ran the code directly by executing code1.py and therefore python has set the &quot;__name__&quot; &#xA0;variable to main.</p><p>Let us now import the code1.py python module into another python program called code2.py. Now we all know that python runs the complete code when we import a module into another module. Now let&apos;s test how the &quot;__name__&quot; variable behaves when the code1.py is imported in code2.py</p><pre><code>import code1</code></pre><p>code2.py has only the above-mentioned piece of code. So, let us run this and compare it with what we got when we execute code1.py</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/image-3.png" class="kg-image" alt="Python - Use of &quot;__name__&quot; variable" loading="lazy" width="725" height="94" srcset="https://routeswitch.in/content/images/size/w600/2021/05/image-3.png 600w, https://routeswitch.in/content/images/2021/05/image-3.png 725w" sizes="(min-width: 720px) 720px"></figure><p>Look at that!. We now have code1 as the output when we ran code2.py.</p><h3 id="inference">INFERENCE </h3><p> The &quot;__name__&quot; variable is initialised with main if the code is directly run by python. On the contrary when the code is imported and internally run by python; the &quot;__name__&quot; is initialised with the name of the imported module. That is why we got code1 as the output of the print function when it was imported by code2.py.</p><h3 id="usecase">USECASE</h3><pre><code>if __name__ == &quot;__main__&quot;:
	{
    &quot;Place the code that you want to run if this module is executed directly&quot;
    }
else:
	{
    &quot;Place the code that you want to run if this module is imported&quot;
    }</code></pre><p>A check condition using an if statement such as the one mentioned in the above example can be incorporated whenever we want certain things to be done only when the module is executed directly. Whatever code we put inside this check statement will not be executed when this module is imported into another module.</p><p>Drop-in your comments if you find this snippet useful. Bye!.</p>]]></content:encoded></item><item><title><![CDATA[Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 2]]></title><description><![CDATA[Setting up HTTPS and mail for self-hosted GHOST blog on GCP free-tier.]]></description><link>https://routeswitch.in/hosting-your-blog-on-gcp-with-ghost-nginx-lets-encrypt-mail-gun-and-cloudflare-part-2/</link><guid isPermaLink="false">60a0b5903a57f30001446a58</guid><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Sun, 16 May 2021 13:59:32 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/download.png" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/download.png" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 2"><p>In <a href="https://routeswitch.in/hosting-your-blog-on-gcp-with-ghost-lets-encrypt-and-mail-gun/">Part 1</a> of this article, we took a look at how to set up your base VM and get the shell script ready for your docker container. In this article let&apos;s look quickly at how to install Nginx, set up the HTTPS certificates with Certbot and LetsEncrypt and check our mail settings for our newly created blog. </p><p>Installing Nginx is straightforward. Nginx will act as a frontend intercepting requests forwarded to our server and forwarding it inturn to our docker container which is listening on a custom port. </p><pre><code>sudo apt-get install nginx</code></pre><p>Once installed let us create a file inside the sites-enabled folder of Nginx.</p><h3 id="etcnginxsites-enabledyourdomainxyz">/etc/nginx/sites-enabled/yourdomain.xyz</h3><pre><code>server {

	server_name &lt;YOUR DOMAIN&gt;.com www.&lt;YOUR DOMAIN&gt;.com;

	location ~ /.well-known {
		allow all;
		break;
	}

	location / {
		proxy_pass http://127.0.0.1:2368;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header HOST $http_host;
		proxy_set_header X-Forwarded-Proto https;	
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}</code></pre><p>Set up the directories that will be used by LetsEncrypt for server validation.</p><pre><code>mkdir /var/www/.well-known
chmod 755 /var/www/.well-known</code></pre><p>Install Certbot and the plugin for Nginx.</p><pre><code>sudo apt install certbot python3-certbot-nginx
</code></pre><p>Let Certbot do its job. Remember in the previous article we had looked into setting up Cloudflare for our domain. You would want to temporarily pause Cloudfare in this domain so that the proxy features or disabled. You can also do this by enabling maintenance mode. This would help Certbot during the checks and allow it to complete the process. Take care of this proxy thing during renewals also.</p><pre><code>sudo certbot --nginx -d example.com -d www.example.com
</code></pre><p>Replace your domain in the above command.</p><p>MAIL GUN API credentials</p><p>Once the Ghost settings interface is up and running you can key in your Mailgun API credentials </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/-1.JPG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 2" loading="lazy" width="999" height="442" srcset="https://routeswitch.in/content/images/size/w600/2021/05/-1.JPG 600w, https://routeswitch.in/content/images/2021/05/-1.JPG 999w" sizes="(min-width: 720px) 720px"><figcaption>Key in your mailgun API credentials here.</figcaption></figure><p>Note this is in addition to the SMTP credentials that we had configured in Part 1.</p><p><strong>ZOHO setup</strong>. Now we have configured the mail dispatch settings that will help us send emails from our domain ( newsletters etc). But it will not let us receive any emails. That&apos;s why it is recommended to configure a separate sub-domain for Mailgun that will take care of our sending requirements. To have a mail server setup for our root domain we can take help from Zohos always free tier. Their website offers complete instructions on setting up your DNS records and other settings. Check it out <a href="https://mail.zoho.in/orgsignup.do?ref=routeswitch.in">here</a>.</p><p>I think by now you would have given the docker container we built in the previous article a spin. It would be listening on the custom port we configured. Configure your firewall settings accordingly.</p><p>Yay!. We now have HTTPS configured, set up proxying through Cloudflare, our bulk email setting should work now (now that we have configured mail gun), we have an email service for us through ZOHO and that&apos;s pretty much it. I think we pretty much have everything to get a basic domain and a website up and running. There is one thing left. Backups. You can use your own means to back up the ghost_blog folder that we created to back up the content in total including images and stuff. </p><p>Ghost also gives you an option to backup the contents by downloading a JSON file. You can choose to do that also. But it doesn&apos;t include images and other contents. Should you bump into any issue setting up the blog after following the instructions let me know in the comments. &#xA0;</p>]]></content:encoded></item><item><title><![CDATA[Cisco Network Services Orchestrator (NSO)  - YANG - Part 2]]></title><description><![CDATA[An in-depth dissection of a yang data model.]]></description><link>https://routeswitch.in/nso-yang-2/</link><guid isPermaLink="false">609d1e0310a8c400019b0ca9</guid><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Sat, 15 May 2021 08:58:03 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/cisco-nso-2.png" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/cisco-nso-2.png" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2"><p>In this post, let us try to further concepts introduced earlier. We started looking at the way a yang data model is structured. In this article let&apos;s take a sample yang model and try to understand it part by part.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/pic-1.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="336" height="209"><figcaption>Snippet - 1 IETF interfaces yang model</figcaption></figure><h3 id="modules-prefixes">MODULES, PREFIXES</h3><p>We first start with the modules. A module can comprise multiple sub-modules. Every module needs to be uniquely identified by a <strong>namespace</strong>. This will help to differentiate this yang model from many other models that may reside in the system/device. The prefix is sort of a <strong>shorthand</strong> notation we would use to reference this namespace subsequently in this module.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/admin.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="399" height="346"><figcaption>Snippet - 2- Administrative details in a yang data model</figcaption></figure><h3 id="administrative-content-in-yang-header">ADMINISTRATIVE CONTENT IN YANG HEADER</h3><p>The module header can include administrative content like organisation, contact information etc. The <strong>revision field</strong> can help us uniquely identify the revision of the module. Including revision- fields can help prevent any mismatch between the devices that are talking NETCONF protocol. How? During the initial hello exchange the devices involved in NETCONF exchange their data models and capabilities and any mismatch in revision in the yang header can be easily identified by the devices.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/revision.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="395" height="202"><figcaption>Snippet 3 - Revision details included in a sample yang file</figcaption></figure><h3 id="import-includes">IMPORT / INCLUDES</h3><p>Then there is the concept of imports and includes. <strong>Import</strong> statements are used when we want to reference definitions from another yang file. It is used to just reference; so the entire body of the referenced file is not pulled into the referencing yang module. &#xA0;This is especially useful when we write a module that supposedly contains a common theme and we can reference it in multiple other modules for clarity.</p><p>On the other hand,<strong> include </strong>statements are used to pull in the parts of the yang file spread over multiple files. The included sub-modules are stiched and pulled together into the referencing module when an include statement is used.</p><p>What&apos;s the need for a <strong>sub-module</strong>?</p><p>Sub-modules allow the writer to split a big complex model design into several small sub-modules. All such sub-modules combine and contribute to the module that calls the sub-modules using the previously introduced &quot;<em><strong>include</strong></em>&quot; statement.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/module-snippet.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="360" height="234"><figcaption>An example of a module containing sub-modules</figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/sub-module-snippet.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="268" height="102"><figcaption>A sub-module file using the &quot;belongs-to&quot; statement to reference back to the parent module</figcaption></figure><p>Notice how the sub-module does not have the <strong>name-space</strong> declaration, instead has a <strong>belongs-to</strong> statement. A sub-module can belong to only a single module.</p><h3 id="data-types-supported-in-yang">DATA TYPES SUPPORTED IN YANG</h3><p>Yang supports most of the common data types integer, unsigned integer etc. All supported base types have been defined in RFC 6020. &#xA0;Some of the supported data types are:-</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/data-types.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="429" height="386"><figcaption>Some of the supported YANG data types. Source - tail-f presentation</figcaption></figure><p> The final element of yang that stores the data (ex leaf) can store a base type or a derived type. A derived type can be defined by a typedef or grouping. We will not be looking into groupings at this point in time.</p><h3 id="typedef">TYPEDEF</h3><p>Typedefs are used to define a new derived data type using the base type with some restrictions. Let us see this example to understand better:-</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/typedef.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="330" height="234"><figcaption>Example of typedef- Source - tail-f presentation.</figcaption></figure><p>In this typedef, the author has tried to impose a restriction on the values the defines datatype &quot;per cent&quot; could take using the <strong>range</strong> keyword. Later we see the leaf &quot;completed&quot; taking the type of the newly defined &quot;per cent&quot; using the <strong>type</strong> keyword. Several modifiers can be used to play around with the restrictions. If we come across a yang file we can always google to find out the meaning of that modifier or keyword to understand the restrictions it brings to the table. When one derived data type references another derived datatype previously defined, the restrictions of the new derived type are applied <strong>on top of the restrictions posed by the mother derived data type</strong>. &#xA0; </p><h3 id="union-statement">UNION STATEMENT</h3><p>If we require our derived data types to be either of two base data types then we can mark such restrictions using a union statement. Let&apos;s take a look at this example:-</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/union-statement.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="514" height="300"></figure><p>In the above example, we try to define a new datatype called &quot;threshold&quot; which can hold values that either belongs to the unsigned integer base type with restriction of (0 to 100) or it can be of type &quot;enumeration&quot; which can hold one of the enum type called &quot;disabled&quot;.</p><p>Apart from the base types defined in RFC 6020, &#xA0;the working group thought they should build a module for the commonly used objects of the networking world. This module is named &quot;ietf-yang-types&quot;. So anybody who wishes to use these definitions in their modules can go ahead and <strong>import</strong> them. Remember the &quot;ietf-interfaces&quot; module that we took a look at in the initial part of this article. Notice how it imports the ietf-yang-types module and assigns a prefix &quot;yang&quot; to it. This the convention mostly followed when one imports the &quot;ietf-yang-types&quot; module:-</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/ietfinterface.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG - Part 2" loading="lazy" width="319" height="166"></figure><p>You can take a look at the &quot;ietf-yang-types&quot; module <a href="http://www.netconfcentral.org/modules/ietf-yang-types?ref=routeswitch.in">here</a> and go through the derived datatypes the writers have created.</p><p>When we want to utilise one of the derived types from the imported module we should append the prefix for that module followed by a colon &quot;:&quot; to uniquely reference the definition from that module. Example:-</p><pre><code>type yang:counter64</code></pre><p>What are leaves?</p><p>A leaf node contains simple data like an integer or a string. &#xA0;It has exactly one value of a particular type and <strong>no child nodes</strong>.</p><p>The YANG language provides two constructs that can hold data namely the leaves and leaf lists. First, we see an example of a leaf definition and an XML instance of the leaf called &quot;enabled&quot;. </p><pre><code>leaf enabled {
	type boolean;
	default true;
}</code></pre><pre><code>&lt;enabled&gt;false&lt;/enabled&gt;</code></pre><p>A leaf node can have atmost only one instance but a leaf-list can have multiple instances. Here we see an example of leaf-list definition followed by an example XML instance:-</p><pre><code>leaf-list cipher {
	type string;
}</code></pre><pre><code>&lt;cipher&gt;blowfish-cbc&lt;/cipher&gt;
&lt;cipher&gt;3des-cbc&lt;/cipher&gt;</code></pre><p>Then what are non-leaf constructs?</p><p><strong>Non-leaf type</strong> constructs are those that can have references to child nodes but cannot take in a value. Only leaves can take in value. So what are the non-leaf constructs? They are <strong>containers and lists</strong>. </p><p>Let us see about <strong>containers</strong>. A container mode is used to only group some other nodes (child nodes). So what are all the options for child nodes? A container can contain leaves, leaf lists, the container itself or lists(we haven&apos;t seen lists yet). Remember, a container can only have child nodes but cannot take a value on its own. Let us take a look at a definition of container followed by a sample instance.</p><pre><code>container system {
         container login {
             leaf message {
                 type string;
                 description
                     &quot;Message given at start of login session&quot;;
             }
         }
     }</code></pre><p>See how the container named &quot;system&quot; references another container named &quot;login&quot;. This is a valid definition. Further, the container &quot;login&quot; references a leaf child node that will contain the value. Let us see a sample XML instance of the container defined above:-</p><pre><code>&lt;system&gt;
       &lt;login&gt;
         &lt;message&gt;Good morning&lt;/message&gt;
       &lt;/login&gt;
&lt;/system&gt;</code></pre><p>See how the string &quot;Good morning&quot; is contained within the leaf named message.</p><p>So then what is the other non-leaf type? It&apos;s the list. If you are familiar with python you can think of a dictionary object at the back of your mind to augment the understanding of this yang construct. In the likes of a container a list cannot have value but can have child objects. &#xA0;The child objects can be a leaf or list or a container (any number of them) . In a python dictionary, how do you uniquely identify an object inside the dict object? We use a key to reference an object and get its value. Similarly, the list construct also allows us to define the key attribute. </p><p>Let&apos;s quickly look at an example to understand better:-</p><pre><code> list user {
         key &quot;name&quot;;
         leaf name {
             type string;
         }
         leaf full-name {
             type string;
         }
         leaf class {
             type string;
         }
     }</code></pre><p>In this list called user, we have defined multiple child objects (In this case three leaves have been defined). But out of those, the leaf called &quot;name&quot; has been defined to be the <strong>key</strong> attribute for this list. Let&apos;s take a look at a sample XML instance:-</p><pre><code>&lt;user&gt;
       &lt;name&gt;glocks&lt;/name&gt;
       &lt;full-name&gt;Goldie Locks&lt;/full-name&gt;
       &lt;class&gt;intruder&lt;/class&gt;
&lt;/user&gt;
&lt;user&gt;
       &lt;name&gt;snowey&lt;/name&gt;
       &lt;full-name&gt;Snow White&lt;/full-name&gt;
       &lt;class&gt;free-loader&lt;/class&gt;
&lt;/user&gt;</code></pre><p>In this case, multiple entries of this list can be uniquely identified by the &quot;name&quot; attribute.</p><p>We have come a long way in understanding the basic constructs, data types and parts of the yang modelling language. It is always tough to learn theory, isn&apos;t it ? The last two parts of this series have been heavily theoretical but I am sure it will help us in understanding the working aspects of Cisco NSO. We have not dwelled into the complete intricacies of yang modelling language; we will look into it further in future if there is a need.</p><p>In the next article, we will look into some practical aspects of NSO, start getting our hands dirty. Do let me know your suggestions and comments. If you come across any technical inaccuracies please point them out, I will do my best to correct them as soon as possible. It will help many others in the community. Thanks. &#xA0;</p>]]></content:encoded></item><item><title><![CDATA[Cisco Network Services Orchestrator (NSO)  - YANG]]></title><description><![CDATA[An explainer on NETCONF, YANG data model. Cisco Network Services Orchestrator (NSO)  - Familiarization Series - Part 2]]></description><link>https://routeswitch.in/nso-yang/</link><guid isPermaLink="false">609a806110a8c400019b0a31</guid><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Wed, 12 May 2021 17:51:48 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/yang.JPG" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/yang.JPG" alt="Cisco Network Services Orchestrator (NSO)  - YANG"><p>In the previous article, we saw, in brief, the parts that made up the NSO. It looked something like this:-</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/nsoarch.PNG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG" loading="lazy" width="651" height="408" srcset="https://routeswitch.in/content/images/size/w600/2021/05/nsoarch.PNG 600w, https://routeswitch.in/content/images/2021/05/nsoarch.PNG 651w"><figcaption>Pic from Cisco Live Presentation</figcaption></figure><p>We have the northbound interfaces with which the operator could interact (small blue boxes at the top). We have the core components of NSO like the Service and Device managers which sort of helped us in abstracting the different services and devices we use in day to day life. And finally, we have the NED which helps us in processing the southbound interaction with the network devices. If the Network device did not natively support NETCONF then NED helps in modelling the interaction with the device either through native CLI or SNMP etc.</p><h3 id="how-do-we-intend-to-consume-these-northbound-interfaces">How do we intend to consume these NorthBound Interfaces?</h3><p>The NSO CLI (Yeah NSO has its own CLI) and the WEB UI is primarily meant for us Network Engineers. It is more human-oriented.</p><p>The NETCONF and RESTCONF are used primarily for interaction with other platforms, think of machine to machine interaction. (OSS/BSS). Example:-NSO receiving instructions from Ansible to configure a bunch of devices.</p><p>SNMP might be used for monitoring the NSO system itself. Again these are possible use cases, but everyone uses the Northbound Interfaces differently. If you have a use case that differs do comment.</p><h3 id="its-time-to-get-into-yang-netconf">It&apos;s time to get into YANG &amp; NETCONF</h3><p>The RFC 3535 insisted on developing a programmatic interface for device configuration. We need to be able to differentiate between data involved in <strong>configuring</strong> devices (Think config statements) vs data involving the <strong>state</strong> (Think show commands) of the network devices. The RFC also insisted on the ability to configure services (say for example L2VPN) &#xA0;without being all concerned about the devices involved (say the PE devices or the CE devices. Given the fact that the config that goes into these devices for successfully configuring the L2VPN service might be different ). And most importantly if there is a problem when committing the config changes to devices I need to be able to revert those changes in an appropriate order to restore the state.</p><h3 id="the-netconf-protocol-and-yangmodel-driven-programmability">THE NETCONF PROTOCOL and YANG - MODEL DRIVEN PROGRAMMABILITY</h3><p>Simply put, NETCONF is the <strong>transport protocol</strong> for interacting programmatically with our network devices. The protocol and its intricacies figured in RFC 4741 &amp; RFC 6241. A slight google search would reveal that there is a gap of 5 years between the RFCs. Also, the RFC for YANG RFC 6020 was released somewhere in 2010 which was out there because the community felt there was a need to streamline the data that is carried by the transport protocol (NETCONF) when interacting with devices. So, after the initial RFC for NETCONF in 2006, some changes were incorporated to NETCONF to include the modalities of YANG. The modified version of NETCONF RFC was out in 2011. </p><p>That begs the question &quot; Is NETCONF the only protocol that could carry/transport YANG data to and out of devices ?&quot; Protocols like RESTCONF and gRPC (It is again an open-source project from Google) could also be used to transport YANG data, but it depends upon the use case. Like gRPC is now heavily being used in the network community to transport Streaming telemetry data. The latest versions of IOS XR do support telemetry with gRPC to transport live statistics of the device(through YANG data models of course). </p><p>It helps to picture mentally picture the stack of what all can interact with YANG data. Here is a picture that helps us understand:-</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/stack.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG" loading="lazy" width="382" height="415"><figcaption>YANG models. Where do they fit in? Source - NetDevOps live</figcaption></figure><p>So NETCONF is the protocol that carries YANG data. Drawing parallels to SNMP, NETCONF can be compared with the SNMP (the protocol itself) and YANG can be compared to the MIBs. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/nc-vs-YANG.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG" loading="lazy" width="968" height="319" srcset="https://routeswitch.in/content/images/size/w600/2021/05/nc-vs-YANG.JPG 600w, https://routeswitch.in/content/images/2021/05/nc-vs-YANG.JPG 968w" sizes="(min-width: 720px) 720px"><figcaption>What goes where ? NETCONF vs YANG</figcaption></figure><p>YANG - Yet Another Next Generation (Data/Data Model/Modelling language)</p><p>Let us ask ourselves a few questions to understand the YANG.</p><p>Why do I need a data model? </p><p>Data models typically describe our objects of interest called Entities. Suppose we own a Grocery store. We might have several products. So products are entities. There are so many ways to describe a product. They are the attributes of the product. Suppose I wish to standardise how I want to describe a product. Why do I need to standardise in the first place? Say I am procuring stuff from a wholesale dealer. He might describe his products in a different manner. When conveying to him there can be a misunderstanding. So between the grocery store and the wholesale dealer when data is exchanged for procurement wouldn&apos;t it be beneficial if they agree on the attributes about their entities of interest (products). Does it make sense?</p><p>So if we are talking about an interface of a network device (that is our entity) we need to make sure the attributes are agreed upon. How do we describe those attributes? How do we say &quot; okay, an interface has the following attributes - It has speed in Mbps, bandwidth in Mbps, Input error count etc&quot; - the <em><strong>YANG modelling language </strong></em>in this case helps us describe the attributes. Once we pen down the attributes it becomes a <strong><em>YANG data model. </em></strong>The actual value of the attributes we described earlier becomes the <strong><em>YANG data. </em></strong> </p><p>As a network engineer, what can we use YANG for?</p><p>To model device data and to model service data. An example of device data would be modelling interface data. An example of service data modelling would the one that describes a VRF or say a Layer 3 VPN.</p><p>Where do the models come from?</p><p>YANG models can be of two types. The industry-standard ones that are written by bodies such as the IETF( <a href="https://github.com/YangModels/yang?ref=routeswitch.in">Github repo for yang models</a>), ITU etc and the vendor-specific ones that are written by the vendors specific to their devices or Operating systems. </p><p>How do we represent a YANG data model?</p><p>A yang model can be described in the YANG language but most commonly it is described in an XML or JSON format. When we are looking from a NETCONF point of view the encoding supported is just the XML.</p><p>How to look into the tree structure of a yang file?</p><p>Pyang module helps us visualise the tree structure. Lots of tutorials available for Pyang visualisation. <a href="https://www.youtube.com/watch?v=kESU4Y8DJ2A&amp;ref=routeswitch.in">This brief video by Knox on YANG includes looking up tree structure using pyang</a>.</p><p>How is a YANG model structured?</p><p>It is a hierarchical model of nodes. We can have a container to group the nodes. If I need to sequentially identify a set of nodes I put them in what&apos;s called a list. A node might have multiple attributes. So, each individual attribute is denoted by a leaf. A leaf has to have an associated data type. &#xA0;Whoa. Let&apos;s take a pause and analyse this picture to understand the components of the hierarchical model. We will take a deeper dive into the YANG model in the next article, now that we have understood the need. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/illus.JPG" class="kg-image" alt="Cisco Network Services Orchestrator (NSO)  - YANG" loading="lazy" width="602" height="481" srcset="https://routeswitch.in/content/images/size/w600/2021/05/illus.JPG 600w, https://routeswitch.in/content/images/2021/05/illus.JPG 602w"><figcaption>Image from Cisco NetDevOps live presentation</figcaption></figure><p>Again this has just been an introduction to NETCONF and YANG and there are more pieces in understanding the structure and the protocol itself. There might also be a question in our mind; &quot;Is this series about NSO or YANG?&quot;; why do we need so much of NETCONF and YANG for NSO. I think a clear understanding of NETCONF and YANG will help in understanding various concepts of modelling used in NSO. </p><p>Please do drop in your comments and suggestions. &#xA0;</p><p> </p><p></p>]]></content:encoded></item><item><title><![CDATA[Cisco Network Services Orchestrator (NSO) - Glimpses]]></title><description><![CDATA[Cisco Network Services Orchestrator (NSO)  - Familiarization Series - Part 1]]></description><link>https://routeswitch.in/nso-glimpses/</link><guid isPermaLink="false">6098baaa10a8c400019b07d1</guid><category><![CDATA[NetDevOps]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Mon, 10 May 2021 16:38:57 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/cisco-nso-1.png" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/cisco-nso-1.png" alt="Cisco Network Services Orchestrator (NSO) - Glimpses"><p>You will find a lot of literature everywhere on what is Cisco&apos;s NSO tool. Briefly, NSO aims to provide an orchestration layer; which can help ease our interaction with both traditional and SDN enabled devices. It has support for multiple vendors and can interact with network devices in multiple ways. We will learn about the features that NSO brings along gradually. The series follows no definite pattern. We will try to understand the need for NSO and then dive into the practical aspects. Let us go over some fundamental topics that we need to know before we jump to NSO.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/image-1.png" class="kg-image" alt="Cisco Network Services Orchestrator (NSO) - Glimpses" loading="lazy" width="628" height="353" srcset="https://routeswitch.in/content/images/size/w600/2021/05/image-1.png 600w, https://routeswitch.in/content/images/2021/05/image-1.png 628w"><figcaption>Courtesy - Cisco.com</figcaption></figure><h3 id="network-management-standardisation">NETWORK MANAGEMENT STANDARDISATION</h3><p>We have heard about NETCONF, RESTCONF, and YANG in many presentations. We usually brush them aside thinking now is not the time. The usual thought is &quot;My organization will take time in implementing such changes; my devices don&apos;t support them&quot; etc. We give all sorts of excuses to learn them because we network engineers have been heavily comfortable with CLI. But smart people were focused on standardizing the way we manage networks. </p><h3 id="rfc-3535">RFC 3535 </h3><p>This <a href="https://www.tail-f.com/netconf-yang-onwards-upwards/?ref=routeswitch.in">blog pos</a>t by the tail-f team gives a very brief read on how the RFC by the standards body IETF became the catalyst for developing the robust NETCONF protocol and how YANG became the popular data modelling language. This mention is just to take you through history; there is no need to know too much of NETCONF and YANG stuff. </p><p>Also, we need to understand the drawbacks of our existing tools (CLI, SNMP). CLI has always been proprietary stuff. You spend years and tears (when typing I wanted to write years and years, but later I thought tears are more appropriate) learning the CLI of one vendor; you are tied to it. Say you are a Cisco expert. A company that acquires you to manage their devices can have you on their payroll only to manage Cisco devices. What if later their purchase team says there are more features in Juniper devices (just an example) and deploys Juniper devices as part of an upgrade. They will have to spend more cost on acquiring resources, network engineers to manage Junos devices. Bottom-line - CLI is expensive. </p><p>SNMP has been very successful in allowing us to poll statistics from devices but honestly, it has not been successful in letting us do config changes. I may be wrong but the farthest &#xA0;I have seen do are ACL changes on interfaces. So no CLI and no SNMP. What next?</p><h3 id="cli-scripting">CLI Scripting</h3><p>I think we all by now would have tried our hands in CLI scripting. &#xA0;Elementary python knowledge would arm us with the firepower to burst some show commands to our devices, wait for a timer to expire, parse the reply from devices using the very many string functions that come with python and get some usable output. Or even more, we tried our best to enter into the config terminal and push some config changes. We then had questions like was it implemented successfully? How do I push to multiple devices at the same time; should I use concepts of multi-threading etc. It is plagued with problems. But for anyone to understand the problems of Adhoc scripting you should get your hands dirty in it. Try using libraries such as paramiko to help jumpstart your ssh sessions and try building some use cases.</p><h3 id="nsonetconf-yang">NSO - NETCONF &amp; YANG </h3><p>We spoke about the drawbacks of CLI and SNMP briefly to understand why NSO uses NETCONF and YANG to interact with devices southbound to get onboard in the standardization train. It doesn&apos;t mean NSO will not use CLI. We will discuss the multiple ways NSO interacts with devices in future. NSO can interact with both physical and virtual devices; can interact with multiple vendor implementations; act as sort of an SDN controller for multiple technologies like Service Provider, Data Centers etc. Standardizing the interaction between a controller and a network device which we saw earlier --&gt; delivers, aids in the platform-vendor-agnostic features of NSO. </p><h3 id="need-for-config-database">NEED FOR CONFIG DATABASE</h3><p>We all have felt the need for a config database. Haven&apos;t we? When we see our software counterparts using git in and out we have felt why network implementations have not ingested such concepts. We saw some of these concepts come up in the latest routers &#xA0;where we are asked &quot;Do you want to commit?&quot; Take for example IOS XR. We can guess where this concept comes from now I guess. Still, it was the responsibility of the individual devices to maintain the database and roll back ids. You could go back in the config state based on the IDs. But what about a central database in sync with the device configurations. We didn&apos;t get that. The closest we could get was Network Config Management tools that scraped the config from the devices at fixed intervals of time (say a day) and did the job of storing it in a database as a backup.</p><p> The problems with such config backups are many. Imagine you want to go back to a state say the 05th of May. You open the config tool and it gives you the config that was available on the 05th of May. There could be multiple changes done after the 05th of May on that device. How do you as a network administrator approach this problem of reverting the state to that of 05th May? We open our notepads copy the config, compare it line by line and apply our mind to negate the config and restore the config as it was on 05th of May. Keep this in the back of your mind as we progress along.</p><p>Cisco NSO has something called the CDB (Configuration Database) which is an in-memory database (If you want to know more about in-memory check this link<a href="https://medium.com/@denisanikin/what-an-in-memory-database-is-and-how-it-persists-data-efficiently-f43868cff4c1?ref=routeswitch.in"> here</a>) and uses the YANG model for transactions. This will serve as our single Source of Truth (SoT). NSO will try to query our devices periodically; try to fetch the config and maintain an in-sync config state in the CDB. Whoa! When it queries the devices it can use multiple means; it can use CLI, it can use NETCONF but NSO does its dutiful job of maintaining the CDB; most importantly an in-sync CDB. </p><p><strong>NORTHBOUND VS SOUTHBOUND</strong></p><p>Northbound interactions comprise all interactions between the user and NSO. NSO supports multiple technologies for this northbound interaction. Some include REST , NETCONF , CLI (NSO has its own CLI), Web UI etc.</p><p>Southbound takes care of all interaction between our NSO and network devices. <strong>NED(Network element drivers)</strong> are written for multiple vendors and multiple OSs. For example, there is NED for Cisco ios and another for Cisco ASA.</p><p><strong>CORE COMPONENTS </strong></p><p>NSO consists of the following core components:-</p><p>A service manager, a device manager and a Configuration Database.</p><p>The device manager has the role of simplifying device interactions; so obviously talks to devices via previously discussed NEDs. CDB is the database where all the latest and greatest config lies. It is like an amplified git repo for network config. The service manager is the one we have to wrap our brains on. It has the task of applying service changes. Think of service as a Layer 3 VPN config. The service layer would handle it for you. Between the service layer and the device layer, we have a mapping mechanism that sorts of tells the device layer what to apply to the end devices.</p><p>This is the end of part 1. We will gradually build our NSO concepts in upcoming posts. </p>]]></content:encoded></item><item><title><![CDATA[Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1]]></title><description><![CDATA[Setting up a self-hosted ghost blog with GCP, nginx, Let's Encrypt , MailGun and Cloudflare]]></description><link>https://routeswitch.in/hosting-your-blog-on-gcp-with-ghost-lets-encrypt-and-mail-gun/</link><guid isPermaLink="false">60957008884fdb0001df94d1</guid><category><![CDATA[Tutorials]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Sun, 09 May 2021 05:58:17 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/4.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/4.jpg" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1"><p>We all have longed a website for ourselves, haven&apos;t we? In this post, we look at how do we set things up to have a Ghost blog up and running on an Ubuntu server hosted on GCP free tier in no time. I have consolidated information from various articles of similar nature. All such sources have been given due credits in the reference section</p><h3 id="google-cloud-free-tier">GOOGLE CLOUD FREE TIER</h3><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/google-free.PNG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1" loading="lazy" width="821" height="251" srcset="https://routeswitch.in/content/images/size/w600/2021/05/google-free.PNG 600w, https://routeswitch.in/content/images/2021/05/google-free.PNG 821w" sizes="(min-width: 720px) 720px"><figcaption>Free Trial vs Free Tier</figcaption></figure><p>Step 1 - Set up a fully functional GCP account; with all payment info. If you are just starting with GCP the differences between free credit and always free tier can confuse you. Free credits give you the initial boost whereas always free tier allows you to run specific resources for free for a fixed number of hours in a month. In our case, we are interested in the Compute Engine resource. We should be choosing the resource from the region and zone entitled to always free tier.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/gcp-2.PNG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1" loading="lazy" width="465" height="200"><figcaption>Iowa - us-central1 is one of the supported regions. Check GCP documentation</figcaption></figure><p>GCP free tier allows us to run an f1-micro instance for free. Under &apos;General Purpose&apos; category select N1 Series and then select f1-micro.</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/gcp-1.PNG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1" loading="lazy" width="442" height="287"></figure><p>Select the desired OS; In my case, I have opted for Ubuntu 21.04 OS. Be careful when selecting the type of disk. The default option might be the balanced type ; but it doesn&apos;t come under the free tier criteria. We need to select the standard persistent disk and we can go up to 30GB. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/gcp-3.PNG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1" loading="lazy" width="469" height="244"><figcaption>Refer GCP documentation for different boot disk types.</figcaption></figure><p>Once the VM is up and running we should do the following basic steps to prepare our VM</p><!--kg-card-begin: markdown--><ul>
<li>Note down the Public IP of the VM that you have spun up.</li>
<li>Generate your key pair using putty gen. Add your public key data to GCP meta data.</li>
<li>SSH into your VM using your private key.</li>
<li>Perform apt-get update and apt-get upgrade</li>
</ul>
<!--kg-card-end: markdown--><p><strong>CREATE SWAP FILE FOR BETTER PERFORMANCE</strong></p><p>As you might reckon, we have chosen an f1-micro for our blog which has limited RAM available. It is recommended to create a swap file for better performance.</p><p>Courtesy: <a href="http://www.appliedarchitect.com/?ref=routeswitch.in">http://www.theappliedarchitect.com/</a></p><!--kg-card-begin: html--><script src="https://gist.github.com/g-arjuna/49542120a24450bb099aa4349e528471.js"></script><!--kg-card-end: html--><p>You would want to make the changes to the swap file permanent. </p><pre><code>sudo nano /etc/fstab</code></pre><p>Edit the file and append <code>/swapfile swap swap defaults 0 0</code> at the end of the file.</p><p><strong>INSTALL DOCKER </strong></p><p>Step 2. The easiest way to get docker for your VM is to utilize the convenience script prepared by the docker team.</p><!--kg-card-begin: html--><script src="https://gist.github.com/g-arjuna/29a8b9904c6ada8637708a90a65e591f.js"></script><!--kg-card-end: html--><p>You can also choose to do the installation manually by following the steps mentioned on this <a href="https://docs.docker.com/engine/install/ubuntu/?ref=routeswitch.in">page</a>.</p><p>PREPARING YOUR DOMAIN</p><p>Step 3. You most probably have a registered domain with you. Quickly head to the area where you can key in the DNS servers or nameservers for the domain. Many domain registrars might charge an additional cost for letting you key in TXT /MX records, so it would be beneficial to change the name servers entirely to some free service like Cloudflare. If you are comfortable changing the records from the DNS server of the registrar; you can choose to do so. </p><p>In my case, I have opted to create a free account in Cloudflare and pointed my domains name servers to that of Cloudflare&apos;s. This will take some time to propagate. Cloudflare will let you know through an email when your domain is ready. During setup, you can choose caching options i.e if you want to proxy your sites traffic through Cloudflare&apos;s CDN or just opt for its DNS services. I have opted for the proxy as this would reduce the latency drastically. You can check that for yourself once you have done this configuration. &#xA0;If everything is okay you should have your landing page in Cloudflare looking like this:-</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://routeswitch.in/content/images/2021/05/cf-1.PNG" class="kg-image" alt="Hosting your blog on GCP with GHOST, Nginx, Lets Encrypt, Mail Gun and Cloudflare - Part 1" loading="lazy" width="693" height="218" srcset="https://routeswitch.in/content/images/size/w600/2021/05/cf-1.PNG 600w, https://routeswitch.in/content/images/2021/05/cf-1.PNG 693w"><figcaption>Your domain should be in Active status</figcaption></figure><p>CREATE A MAILGUN FREE ACCOUNT</p><p>Step 3. After hosting a blog, you might want to send bulk emails; dispatching your well-written articles to everyone. The integration with Mailgun is the easiest. but should you chose to go with any other provider you are welcome to modify the code. After creating a free account you need to add appropriate records to your DNS server. Detailed documentation on the DNS records required for Mailgun can be accessed here. The document is self-explanatory. You will be required to add TXT records to be able to send mails from your domain. MX records are required to receive mail. ( We will not be using Mailgun to receive emails for our root domain) . I will explain how I had ZOHO always free tier set up for sending and receiving emails for our root domain. Once you key in all the relevant records and allow them to propagate; you will receive an email from Mailgun stating that you are now ready to start sending emails. &#xA0;</p><p>PREPARE CONFIG FILES FOR GHOST</p><p>Step 4. Make a new folder for Ghost. This would contain all the resources relating to our blog, making it easy for us to back up. </p><pre><code>mkdir ghost_blog</code></pre><p>Step 5. Prepare config files. I should give credit to <a href="http://www.theappliedarchitect.com/?ref=routeswitch.in">http://www.theappliedarchitect.com/</a> from where I got the template for this config file. I have done some modifications to the template to also include the SMTP setting for our Mailgun account. You can get your SMTP credentials under domain settings in the Mailgun dashboard.</p><!--kg-card-begin: html--><script src="https://gist.github.com/g-arjuna/d1b2cc7534b6dd041bc706e49343923a.js"></script><!--kg-card-end: html--><p>This config file should be inside the ghost_blog folder that we have created already. The port settings can be modified according to your needs. I have opted to leave it at 2368 as I will be using a Nginx front end before the docker container.</p><p>I will reference a shell script prepared by <a href="http://www.theappliedarchitect.com/?ref=routeswitch.in">http://www.theappliedarchitect.com/</a> that will help us do basic docker command functions from the shell. This will be useful to restart the container after reloads etc.</p><!--kg-card-begin: html--><script src="https://gist.github.com/g-arjuna/4fbfa1cc4151a2736b79591647fd89d4.js"></script><!--kg-card-end: html--><p>This script can be placed outside the ghost_blog folder. If you read through the shell script you will understand why. &#xA0;Note how I have used HTTPS everywhere. This would come in handy when you complete the HTTPS setup with Nginx, Let&apos;s Encrypt and Certbot. Before you run this script and kick start your docker container we need few more things installed and set up. &#xA0; In part 2 of this article, we will look into setting up Nginx, dispatching our mails through mail gun (through API &amp; SMTP); setting up the member option in GHOST which will enable your visitors to sign up as members and receive your newsletters. </p><p>Hope it was a good read. Please let me know through comments if it helped setting up your blog. Bye.</p>]]></content:encoded></item><item><title><![CDATA[Welcome!]]></title><description><![CDATA[<p>Let us be real. We net-workers refer lots of documentation on the Internet to do our day-to-day jobs. We try to browse and peruse through tons and tons of PDFs, OEM documentation and research about our use cases. Often, we do not find clear illustrations, that jumps straight to the</p>]]></description><link>https://routeswitch.in/welcome/</link><guid isPermaLink="false">6094d8ea884fdb0001df94b2</guid><category><![CDATA[Blog]]></category><dc:creator><![CDATA[Arjuna Ganesan]]></dc:creator><pubDate>Fri, 07 May 2021 06:09:50 GMT</pubDate><media:content url="https://routeswitch.in/content/images/2021/05/360_F_176984023_8I82qQPmKn8TqNAZXIYMCSiwccoUiPBg.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://routeswitch.in/content/images/2021/05/360_F_176984023_8I82qQPmKn8TqNAZXIYMCSiwccoUiPBg.jpg" alt="Welcome!"><p>Let us be real. We net-workers refer lots of documentation on the Internet to do our day-to-day jobs. We try to browse and peruse through tons and tons of PDFs, OEM documentation and research about our use cases. Often, we do not find clear illustrations, that jumps straight to the point; but when we find them out it offers a very cool experience to every implementer/technologist.</p><figure class="kg-card kg-image-card"><img src="https://routeswitch.in/content/images/2021/05/gq-happiness-project-february-2021.jpg" class="kg-image" alt="Welcome!" loading="lazy" width="2000" height="1125" srcset="https://routeswitch.in/content/images/size/w600/2021/05/gq-happiness-project-february-2021.jpg 600w, https://routeswitch.in/content/images/size/w1000/2021/05/gq-happiness-project-february-2021.jpg 1000w, https://routeswitch.in/content/images/size/w1600/2021/05/gq-happiness-project-february-2021.jpg 1600w, https://routeswitch.in/content/images/size/w2400/2021/05/gq-happiness-project-february-2021.jpg 2400w" sizes="(min-width: 720px) 720px"></figure><p>The joy of finding a blog / article where the author had thought just like we did is surreal. This blog aims to (at-least attempt to) give articles that are precise, concise and real-world implementation oriented.</p><p>While the traditional networking constructs in various domains is transitioning to Software-Defined bandwagon; many forget that in-spite of the fancy GUI and automation codes&amp; scripts our final endeavor is to route and switch. Let us route and switch them packets! Happy reading!</p>]]></content:encoded></item></channel></rss>