{"id":1643,"date":"2023-04-10T20:22:03","date_gmt":"2023-04-10T19:22:03","guid":{"rendered":"http:\/\/192.168.1.213:8088\/?p=1643"},"modified":"2023-10-13T05:40:09","modified_gmt":"2023-10-13T04:40:09","slug":"unleashing-the-power-of-network-digital-twins-within-ci-cd-environments-part-2","status":"publish","type":"post","link":"http:\/\/192.168.1.213:8088\/unleashing-the-power-of-network-digital-twins-within-ci-cd-environments-part-2\/","title":{"rendered":"Unleashing the Power of Network Digital Twins within CI\/CD Environments – Part 2"},"content":{"rendered":"\t\t
Alright, let’s get down to business \ud83d\ude80 ! In this part, I will show you how an end-to-end pipeline can be built using the digital-twin approach.\u00a0<\/p>
I will use the following scenario as an example:<\/strong><\/p> A network administrator by the name of Pawel finds himself entrusted with the responsibility of expanding the configuration on a VPC back-to-back<\/a> environment in the data center. Awaiting their network configurations, new servers stand ready to be integrated into the environment.<\/p> Pawel’s mission is threefold: to create a new VLAN specifically tailored for these servers, configure the ports with this VLAN, and establish SVIs on each Nexus switch.<\/strong><\/p> While these tasks may appear to be a walk in the park for seasoned network administrators, Pawel, being a recent addition to the company, is determined to prove his mettle and ensure his first assignment is a resounding success.<\/p> In pursuit of this goal, Pawel meticulously approaches each step, embracing the challenges and opportunities that come with being the company’s newest network administrator. With a keen eye for detail and an unwavering commitment to excellence, Pawel sets out to make a lasting impression on his colleagues and demonstrate that he has what it takes to succeed in his new role.<\/p> To give a better idea, the network diagram looks like this:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t When working with automation, it’s important to separate data from the code that processes it. This makes everything easier to manage and maintain in the future.<\/p> One way to help with this separation is by using a data model, like OpenConfig<\/a>. OpenConfig is a standard that makes it simpler to manage network devices from different vendors using the same set of rules.<\/p> By using OpenConfig, you can manage and automate your network more easily, no matter what devices you’re working with. This makes your automation tasks more organized, efficient, and multi-vendor friendly.<\/p> In my particular use case, I have opted to craft a custom data model tailored specifically for this scenario, ensuring a seamless fit with my requirements and offering a personalized touch to address the challenges at hand.<\/strong><\/p> The following example shows the data model for one Nexus device:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t Finding the right tools for automation can be tough when you’re new to it. Focus on your goal and what you want to achieve. Your first solution might not be perfect, but it’s better to start and learn from it than to do nothing at all. Keep trying, and you’ll improve your automation skills over time.<\/p> My advice to you:<\/strong><\/p> In this use case, I am going to use the following toolset:<\/strong><\/p> To successfully execute the desired use case, the following steps are needed:<\/p> Docker file construction and registry upload<\/strong>: Create a Docker file that encapsulates all dependencies and configurations required for your project. Once built, upload it to the Docker registry to ensure easy deployment and consistency across environments.<\/p><\/li> Ansible file linting<\/strong>: Review and check all Ansible files for syntax, best practices, and potential errors. Linting will help maintain high code quality and reduce the possibility of unforeseen issues during execution.<\/p><\/li> Digital twin creation in CML<\/strong>: Utilize Ansible to create a digital twin within Cisco Modeling Labs (CML), providing a virtual replica of your production environment. This allows for testing and validation of configurations without affecting the live system.<\/p><\/li> Nexus device configuration<\/strong>: Apply the necessary configurations to the Nexus devices in the digital twin environment using Ansible. This process will ensure that the devices are set up correctly and ready for testing.<\/p><\/li> VLAN and VLAN interface validation<\/strong>: Implement the Robot framework to test whether the VLAN and VLAN interface have been created correctly. This step helps confirm that your configurations are functional and error-free.<\/p><\/li> Production Nexus device configuration<\/strong>: Once the digital twin environment has been thoroughly tested and validated, apply the same configurations to the production Nexus devices. This step ensures that the live environment is aligned with the successful digital twin setup.<\/p><\/li> Production environment testing<\/strong>: Run the same test cases used in the digital twin environment on the production setup. This process validates that the configurations work as intended in the live environment, further ensuring system stability and reliability.<\/p><\/li> Digital twin removal in CML<\/strong>: After successfully implementing and validating the configurations in both the digital twin and production environments, delete the digital twin in CML. This action keeps your workspace clean and efficient, minimizing resource usage.<\/p><\/li><\/ul>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t Given the extensive collection of files involved in this project, I will highlight just a few key examples with their content.<\/p> \u2b50 To explore the complete set of files, please visit my GitHub repository at: beye.blog\/brkops-2317 <\/a><\/strong>\u2b50<\/a><\/strong><\/p> The list of files are the following:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t As usual, I am creating my own Docker image which hosts all the tools that are needed for the project.\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t First, you need to create the CML digital twin this is done by loading the lab file YAML file into the CML controller. The devices will boot with a basic configuration which includes the user and password as well as the IP address for the management interface to access the devices.\u00a0<\/p> This takes some time make sure to set the command_timeout<\/strong> parameter with a higher value for example 1800.\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\tThe importance of separating data from code<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Choosing the right toolset<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
The steps that are involved<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
Build the pipeline<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Dockerfile<\/h6>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Ansible<\/h6>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t