Python: Working with Jinja2 templates

In this post we’ll see how to work with Jinja2 in your Python projects, to easily create and modify templates.

Jinja2 is widely used and you probably already noticed it if you used projects such as Flask and Ansible or even if you simply searched for a robust templating engine.I can describe its greatness for a couple of minutes if not hours, but the

I can describe its greatness for a couple of minutes if not hours, but the official doc does it much better, so I recommend to go over them to get an idea on what you can achieve by using it. This post is mainly for those who are looking for a quickstart guide.

Continue reading “Python: Working with Jinja2 templates”

TripleO: Debugging Overcloud Deployment Failure

You run ‘openstack overcloud deploy’ and after a couple of minutes you find out it failed and if that’s not enough, then you open the deployment log just to find a very (very!) long output that doesn’t give you an clue as to why the deployment failed. In the following sections we’ll see how can we get to the root of the problem.

Continue reading “TripleO: Debugging Overcloud Deployment Failure”

Python: check if two strings are permutations of each other

Another question I cover in a presentation I’m preparing for “Open University meets Open Source” meetups.

What is a Permutation?

Permutation is the action of rearranging objects, characters or symbols into different, unique sequences.

Each sequence is called ‘permutation’.

It’s common to see people mix permutation with combination, but those are two different things. Remember, combination doesn’t care about the order, while permutation does.

Continue reading “Python: check if two strings are permutations of each other”

Python: check if one string is a rotation of another string

Another question I cover in a presentation I’m preparing for “Open University meets Open Source” meetups.

The question

You have two strings, str1 and str2 and you need to return True if the first string is a rotation of the second string. Otherwise, return False.

Examples

“hello”,    “llohe” -> True. If we’ll rotate the second string twice, you’ll get ‘hello’.

Continue reading “Python: check if one string is a rotation of another string”

OpenFlow: Introduction

What is OpenFlow?

If we tried to explain what OpenFlow is, a possible definition would be: OpenFlow is a protocol for controlling and interacting with forwarding behaviors of switches. It allows us to dynamically control  the behavior of the switches in our network. Many SDN (software defined network) and Open Source projects use OpenFlow or support it as a plugin, such as OpenStack Neutron and OpenDaylight.

But It’s hard to grasp what it is, what it solves and how it works only using this brief description. In order to truly understand what is OpenFlow, we need to start from the beginning, before SDN era.

Continue reading “OpenFlow: Introduction”

Open vSwitch: Introduction – Part 1

This post turned out to be much longer than I planned. So I decided to split it into two posts.

This part covers:

  • Overview
  • Installation
  • Simple scenario walkthrough (connecting a virtual machine through ovs bridge to the internet)
  • Basic commands ( add/delete bridge, add/delete ports, show configuration, etc)

The second part covers:

  • Components (ovsdb-server, ovs-vswitch, ovs kernel module)
  • Utilities (ovs-vsctl, ovs-ofctl, ovs-appctl, etc)
  • Modes (normal & flow)

What is Open vSwitch?

Open vSwitch is a multilayer software/virtual switch used to interconnect virtual machines in the same host and between different hosts.

Continue reading “Open vSwitch: Introduction – Part 1”