Python classes are very useful when you need to create objects with the same characteristics. This is often referred to as Object Oriented Programming (OOP). Not having much of a programming background, I found classes to be a bit confusing, and I wasn’t fully understanding the use of __init__ and self. Thanks to the Twitter community, my friend Peter Palúch , and the videos of Cory Schafer, I know feel I have a better understanding, and wanted to share my findings, from a networking person’s perspective.
First, let’s look at why classes are needed in the first case. Let’s say that we want to keep track of our network devices. The attributes we are interested in are:
We can of course create this information manually, without classes, like this:
daniel@devasc:~/DevAsc$ python3 Python 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> device1_hostname = "r1" >>> device1_vendor = "Cisco" >>> device1_type = "router" >>> device1_model = "ISR4331" >>> device1_loopback = "192.0.2.1" >>> device2_hostname = "sw1" >>> device2_vendor = "Cisco" >>> device2_type = "switch" >>> device2_model = Continue reading
Time for another Python challenge. This time it’s the palindrome challenge. What is a palindrome? A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward. Some examples are level, radar, stats.
The goal is to take a string the user inputs, reverse the string and see if it’s identical backward as forward. I will divide my code into two functions:
The first function simply takes the string that is input. The second function checks if it’s a palindrome and prints the result.
As always, let’s first start with a docstring:
"""Program to check if string is a palindrome"""
Then we create a function to get the string from the user. This code should look familiar if you went through the divisors challenge.
def get_string():
"""Get a string from user to be used in function to check for palindrome"""
# Get string from user with input() and return result
user_string = input("Please enter a string to check if it's a palindrome: ")
return user_string
Now for the more interesting part, to check if a string is a palindrome. To do that, we need to reverse the string. How can we Continue reading
As part of Nick Russo’s DevAsc study plan, he recommends doing a few Python challenges to check your existing knowledge of Python. One of these is the Divisors challenge. The goal of of this exercise is to take a number, such as 12, and then find all the divisors, that is the numbers that you can divide 12 with and have no remainder. This would 1, 2, 3, 4, 6, and finally 12 itself.
Now, solving this doesn’t take a lot of code. However, I decided that gold plating is allowed in my studies of code. That is, I would rather practice writing functions from the get go rather than just quickly moving from exercises.
To find divisors, we need a little basic math. We can use the Modulo operation to find the reminder of a division. For example, if you divide 5 by 2, the remainder is 1. We call this 5 modulo 2. Because there is a remainder of 1, this means that 2 is not a divisor for 5. If we however use 9 and 3 instead, with 9 modulo 3, the remainder is 0. This means that 3 is a divisor for 9. We then Continue reading
For those that follow me on Twitter, you probably know that I’m an avid runner and post some of my experiences there. My current goal is to become a sub 20 minute 5km runner, which is turning out to be an aggressive goal. I’m probably at around 22 minutes right now. As I always do, I try to learn from different areas of life and cross apply that, to also what I do in IT. When you think about it, it’s not that different! Things I’ve learned from trying to become a better runner, that you can apply in your IT training.
Plan – The saying “failing to plan is planning to fail” is quite accurate. Many runners don’t have a plan and end up just running around the same pace every training session. That leads to mediocre results. The same is true when trying to become better at something in IT. You don’t always need a super detailed plan, but you need a plan. A certification is one of the tools to help you build that plan.
Discipline – A plan is no good if you don’t materialize it. Sometimes it’s tough, and you don’t feel like living Continue reading
Linux is becoming more and more prominent in the networking industry. Many of us come from a mixed background and have varying levels of knowledge of Linux. I’ve been around Linux for a long time but really never got beyond the very most basic stuff. Looking back, I wish I had spent some more time learning Sed, Awk, regex, and Bash etc. I was doing some labs over at NRE Labs (great labs), and wanted to highlight some of the things I learned.
Sometimes you want to append something quickly to a file or send several lines of text to a Linux command. That can be done using “here documents“.
First, look at this small configuration:
daniel@devasc:~/DevAsc$ cat config.txt interface GigabitEthernet0/1 switchport mode access switchport access vlan 10 ! interface GigabitEthernet0/2 switchport mode access switchport access vlan 10 ! interface GigabitEthernet0/3 switchport mode access switchport access vlan 10 !
Now we want to append another interface to the end of this file. We can do that using cat:
daniel@devasc:~/DevAsc$ cat <<EOT >> config.txt > interface GigabitEthernet0/4 > switchport mode access > switchport access vlan 10 > ! > EOT
After the cat command, Continue reading
XML, or Extensible Markup Language, rounds out the usual suspects of YAML, JSON, and XML. It’s probably my least favorite of the three, but knowledge of XML is needed when working with code.
XML is, of course, related to HTML. So why didn’t we just settle for HTML? Turns out machines don’t understand HTML very well. They can parse it perfectly fine, yes, but in HTML you put information in, such an address, and you understand it’s an address because you are a human. A machine doesn’t know that Baker Street is an address, unless you tell it.
XML consists of tags, elements, and attributes. Let’s take a basic example and then go through these in more detail:
<?xml version="1.0" encoding="UTF-8"?>
<address>
<name>
<title>Mr</title>
<first-name>Sherlock</first-name>
<last-name>Holmes</last-name>
</name>
<street>221B Baker Street</street>
<city state="NA">London</city>
</address>
First, we declare that this is an XML document and the encoding used. This is called a prolog. It’s optional, but if included, should always be the first line.
The tag <address> is the root of the document. We must always have a root. The tag <address> has three children:
<name><street><city>The tag <name> has three children as well:
JSON, JavaScript Object Notation, is one of the usual suspects when it comes to network automation. YAML and XML being the other two. It’s easy for machines to parse and generate and the readability is good, better than XML, although YAML is easier for humans to read.
JSON is based on a subset of the JavaScript programming language, as the name implies.
JSON, just like YAML, supports single values, lists, and key/value pairs.
JSON is commonly used to interchange between different formats.
JSON has no requirement for indentation or white space, which YAML has. That said, to make it human readable, it still makes sense to use white space and spaces, most likely either two or four.
JSON supports the following data types:
We’ll Continue reading
YAML, previously known as Yet Another Markup Language, but now YAML Ain’t Markup Language, is a human friendly data serialization standard for programming languages.
YAML and JSON, JavaScript Object Notation, are related to each other, where YAML, according to YAML 1.2 specification, is a superset of JSON.
YAML supports using scalars, sequences, and mappings. A scalar is a string, a number, or boolean, a sequence is a list, and a mapping is a key/value pair.
YAML is commonly used by configuration files in open source tools and Ansible, a network automation tool, uses YAML to run its playbooks.
When it comes to YAML syntax, be aware of the following:
Scalars are single values. It can be a string, number, or a boolean value. Strings don’t need to be quoted, except for some special cases:
People that know me know that I like to be open on sharing thoughts, insights, things I’ve learned, and my struggles. Many people have put their trust in me and I consider it important to show that perceived leaders of the networking industry have the same thoughts and struggles as everyone else.
I wrote this tweet which gained a lot of response and positive comments (thank you).
I’ve dabbled with Python a couple of times the last couple of years. I know the very basics but I haven’t done much more beyond that. Why haven’t I done more automation? There are some different clues as to why, including the fear of not being very good at it.
Job role – I’m a Network Architect. What I enjoy the most, my passion if you will, is to engage in discussions with customers and create Continue reading
I got into some interesting discussions about IPv6 on Twitter. Then someone asked if Android is getting DHCPv6 support in version 11 of the OS.
When IPv6 was developed, initially with RFC 2460, there was this idea that:
Forget all you've learned about IPv4, and design IPv6 from the ground up
This sounds good in theory but ignores completely the lessons we’ve learned from IPv4. Not to mention, there is no such thing as greenfield. Almost all networks, are existing ones, you don’t get to start all over again. There was this very shiny view of end to end connectivity, /64 everywhere and only SLAAC allowed. I get all of that, it’s like saying “I wish there were no wars”, but unfortunately, people are stupid, so there will be wars. There’s this naivety, similar to a teenager that is growing up. You want to change the world, then you realize the world is run by money, mega corps, and dirty politicians.
This whole mess led to the holy wars of SLAAC + RDNSS vs DHCPv6. Please note that SLAAC Continue reading
Yesterday I posted a tweet on company culture that received a lot of positive feedback:
People thought this should be saved in a blog post, so this is it.
Do you want to attract and retain talent and high performers? Of course you do. Do you understand how to do that and are you willing to change your company culture?
Everything starts with culture. You may have heard the quote “Culture eats strategy for breakfast”, meaning that even the best stratety can’t compete with a company that has a great culture. Strategy without culture does not create success.
Most companies, such as the web scalers, often confuse gimmicks with culture. We have great company culture! We have ping pong tables, flipper games and even artists who play music for us! While these things can be entertaining, don’t mistake them for culture. Continue reading
People that know me know that I like to stay up to date on what’s going on in the industry, new technologies, and so on. Mostly this is because I have a passion for technology and for learning. However, there is almost certainly a part of me that also, as many people do, has the fear of missing out (FOMO). That is, you are afraid to get left behind so you keep sipping from the fire hose constantly, because you believe everyone else is doing the same.
There are many many fine podcasts out there. I used to listen to Packet Pushers, Software Gone Wild, Talk Python to Me, Clear to Send, and many more. These shows are extremely good at producing content consistently. Unfortunately, that means that you have maybe 4-5h of content to consume each week. That’s too much for me.
I’m a very analytical person. Both by nature, and in my job role as an Architect. My brain is constantly analyzing, thinking, trying to solve problems. This makes me very efficient, but it also adds stress, and can make it difficult to wind down. As Continue reading
Cisco recently announced that they are releasing CML-P, which is version two of the product formerly known as VIRL. First of all, I’ve seen the product demoed and helped with feedback on it, it looks stunning! The architecture looks great, it’s fully leveraging APIs and it’s an entirely different beast than VIRL. This is a great product and I want to see it succeed. Unfortunately, this product is never going to be as successful as it could be. Why?
CML-P, where P stands for Private, supports a maximum of 20 nodes. This is supposed to be a differentiator to the the -E version, which is for enterprises that wish to run this product at larger scale, including support. First of all, I don’t agree that a node limit is the proper way to differentiate -P from -E. That can be done through support, training and other means.
CML-P’s competition is going to be GNS3 and EVE-NG. These are freely available, but also offer paid versions with a more advanced feature set. There is no node limit with these products. You can run as much as your server can handle. If CML-P is going to compete Continue reading
I received a question on Twitter from my friend Fernando on feedback on when to give up on certifications:
First of all, not everyone will agree that you even need certifications. That’s another discussion and I think there are not many reasons to avoid them entirely, but let’s assume that you already have certifications, when do you give up on them?
That is going to be a choice each person has to make, and it will depend on a number of factors, I think. Here are some that immediately come to mind:
What’s your method for learning a new skill? People use certifications differently but for me it’s about a guided learning path. I know roughly what to study to become decently skilled at a topic. For example, when I wanted to learn more about AWS and their networking, I decided to study for the AWS Solutions Architect Associate. For me, it’s motivating to Continue reading
Other vendors such as Juniper and AWS have already started doing it, now it’s Cisco’s turn to offer online testing. This is especially welcome in Covid times where it’s difficult to go visit an on-premises Pearson/Vue test center. Starting April 15, Cisco will offer remote testing and this means you can take your test any time, any day, around the year. Almost all of the written tests will be offered, including the DevNet ones! The CCDE is one of the excluded tests.
What is required to take the test online? There are some prerequisites:
Your test will be proctored by an online proctor. Before the test starts, you will need to show your room, that there are no books or notes, that you are alone in the room and that you can close the room etc. As well that you are not wearing a watch or have access to a mobile phone. You will also need to provide a valid ID before starting the test. If you break any rules, you will of course not receive a passing score. You can find more information in Susie Wee’s Continue reading
On 27 February 2020, I took and passed the Automating Cisco Enterprise Solutions (ENAUTO) exam on my first attempt. This was the last exam I took that day, having taken DEVASC and DEVCOR in earlier. This exam was a bit different for a few reasons, which I’ll discuss shortly. Passing both DEVCOR and ENAUTO has earned me the Cisco Certified DevNet Professional certification. Like the other DevNet exams, it was fair and reasonably well-written.
I’ve been working with Cisco products for more than 10 years and earning Cisco certifications for about 8 years, and this was my first specialist exam. You can learn more about the ENAUTO exam here. About 40% of the exam is based on general programming principles and network automation techniques, most of which overlap nicely with DEVASC and DEVCOR. The remaining 60% is divided evenly between Cisco’s biggest three enterprise solutions: DNA Center, SD-WAN, and Meraki at 20% each.
Before attempting this exam, you should already have a DevNet Associate certification (not required) or comparable knowledge, plus at least 3 years of network automation experience. Those skills alone cover probably 30% of the blueprint. If you already passed the DEVCOR exam (or have comparable Continue reading
On 27 February 2020, I took and passed the Cisco Certified DevNet Professional Core (DEVCOR) exam on my first attempt. For those who like to memorize dates, yes, I did pass DEVASC and DEVCOR on the same day to cut down on trips to the test center. Like DEVASC, this exam was fair and all blueprint topics were appropriately represented. You can read about my DEVASC blog here (provide link to other blog).
I want to focus on what I did to succeed and less about the exam structure itself. You can learn more about the official certification here. This blog is focused primarily on the DEVCOR exam. Before talking about the exam, just know that you need to pass the core exam plus one concentration exam to earn the Cisco Certified DevNet Professional certification. I also passed the ENAUTO exam, which focuses on enterprise network automation. I’ll write about it in “part 2” later.
Before attempting this certification, you should already have a DevNet Associate certification (not required) or comparable knowledge, plus at least 3 years of software development/automation experience. The DEVCOR exam was no joke. It was harder than the CCIE RS and SP written exams, and about Continue reading
As COVID-19 (Corona) has spread around the world, and while we can argue how serious that is, a lot of tech conferences have been cancelled, and rightfully so. Safety always comes first.
People have suggested that virtual conferences could be a replacement, but as I’ll explain in this blog, they can never really replace a standard conference, rather just be a complement.
First, let me just clear a couple of things:
The first challenge is that we are all in different time zones. When I go to Cisco Live in the US, I adjust to the US time. If I’m staying here in Sweden, I’m not going to stay up late to watch a stream coming from the US.
When you travel to a conference, you are away from work and family, you have dedicated that time to make the Continue reading
On 27 February 2020, I took and passed the Cisco Certified DevNet Associate (DEVASC) exam on my first attempt. TLDR; it was a well-structured and fair exam. I think it was my favorite Cisco exam of all time. It had clear questions, good depth, no off-blueprint curveballs, and a great measure of candidate skill. The distribution of questions was also in accordance with the blueprint topic weights.
I’m known for being a concise and high signal-to-noise blogger, so I won’t turn this into a blueprint exploration article. You can learn more about the official certification here. Instead, I’ll focus on how I prepared for this exam.
Above all else, you need to sign up for an account at Cisco DevNet. It’s 100% free and contains many excellent resources to help you learn software-related topics. This is more than just “network automation” as you’ll be exposed to software development techniques and strategies, too. While everything on DevNet is useful, I believe the following three resources are the most important for this exam. Learning the content and passing any DevNet exam would be almost impossible without them:
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!