dave

Author Archives: dave

Python bindings for the HP VAN SDN Controller

For the last 9 months, I've been silently working on a little pet project. It's finally ready to be released in to the wild and to be used by one and all for creating Python-based SDN Applications for the HP VAN SDN Controller.

Introducing the hp-sdn-client

When I started working with the HP VAN SDN Controller (while it still had a cool code name) it became immediately apparent to me that extending the controller with Java applications is not for everyone. There's lots of heavy lifting to be done with things like Maven, OSGi and Remote Debugging. Not only that, but I am not a "Java guy" (or was not until recently to be more exact) and being able to rapidly prototype applications in Python appealed to me.

The HP VAN SDN Controller's REST API exposes a large amount of the functionality available to the Java API with the exception of handling OpenFlow Packet-In, Packet-Out events. For a large number of applications this is absolutely fine, and this is where I hope this library will be useful.

The library is licensed under the Apache 2.0 license so it's free for all to use. The source is hosted on GitHub Continue reading

Migrating from WordPress to Pelican on PaaS – Part 2

Part 2 of a this 3 part series examines how I created my Pelican blog and migrated my Wordpress content with me.

Part 2: The Wordpress to Pelican Migration

The Plan

If you haven't read Part 1 already, it will give you some background as to what I'm doing and why I'm doing it.

Starting the Pelican Project

Assuming you already have a working Python, starting a new blog is as easy as installing a few dependencies and using the pelican-quickstart

pip install pelican Markdown
mkdir blog
cd blog
pelican-quickstart
Welcome to pelican-quickstart v3.3.0.

This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.


> Where do you want to create your new web site? [.]
> What will be the title of this web site? Dave's Blog
> Who will be the author of this web site? Dave Tucker
> What will be the default language of this web site? [en]
> Do you want to specify a URL prefix? e.g., http://example.com   (Y/n) Y
> What is your URL prefix? (see  Continue reading

Migrating from WordPress to Pelican on PaaS – Part 1

I've been blogging with Wordpress for the last 5 years on and off. It has some great features and is very easy to use, but it's not for me. This series of posts documents my transition from Wordpress to Pelican.

Part 1: Motivation and Decisions

What's Wrong With Wordpress?

There are a few things about Wordpress that have been bothering me lately

  • Performance
  • Backup/Restore
  • Comment Bots
  • Portability

As with anything that relies on server-side scripting, there is performance hit when loading pages. I've been running my blog on a Linode 1024 VPS ($20 per month) and had found that I had to move from Apache to Nginx to get decent performance with Wordpress. Adding Caching to the equation with one of the many caching plugins available has also helped, but this is a rather complex solution. Another performance bottleneck is the database...

Wordpress requires a MySQL database in the back end. I am not a big MySQL fan and would prefer to run Postgres or MariaDB but this isn't officially supported in Wordpress right now. Not only is a performance bottleneck, but it is also another thing that needs to be backed up.

The Backup/Restore capabilities of Wordpress are decent, Continue reading

Remote Debugging OpenDaylight with IntelliJ

Remote Debugging OpenDaylight with IntelliJ is as easy as 1, 2, 3

​1) Go to Run > Edit Configurations

​2) Add a new Remote Configuration

​3) Configure it as follows:

  • Host = Your Controller IP
  • Port = 8000
  • Sources = Whichever project/module you want to debug

ODL Remote Debugging

Using the latest Open vSwitch with Devstack and OpenDaylight

While setting up my OpenDaylight OVSDB and Devstack following the awesome instructions from Kyle Mestery, I thought it would be fun to run the latest OVS from source on my compute nodes...

To do this, execute the following commands on one of your compute nodes before running stack.sh

sudo apt-get -y --force-yes install build-essential devscripts

gcc dkms make automake autoconf debhelper libssl-dev
pkg-config python-all python-qt4 python-zopeinterface
python-twisted-conch gdebi-core dh-autoreconf hardening-wrapper
libtool graphviz ipsec-tools module-assistant python-twisted-web
racoon git

git clone git://git.openvswitch.org/openvswitch
cd openvswitch
./boot.sh
dpkg-buildpackage -b -us -uc -nc
cd ..

Once you’ve built the .deb’s you can copy these to your other compute nodes using scp:

scp *.deb ubuntu@devstack-compute2:

Replace ubuntu with your username and devstack-compute2 with the name or IP address of your other compute nodes.

Finally we can install the packages as follows:

sudo dpkg -i *.deb

At the time of writing this will build Open vSwitch 2.1.90. You can check the version as follows:

sudo ovs-vsctl --version

Which will give the following output

ovs-vsctl (Open vSwitch) 2.1.90
Compiled Jan 16 2014 15:18:45

Huge thanks to @FlorianOtel for his help with Devstack!

@dave_tucker

Installing Pyenv on Mac OSX

When I’m writing code, I’m usually in OSX. When I want to try things out, or check for compatibility between certain versions of Python, it’s handy to have them all accessible… enter Pyenv. Pyenv is based on Rbenv, which for you non-Rubyists is a tools that allows you to set up Ruby environments that are scoped either globally, per-shell or per-folder!

If you aren’t using Homebrew already, which I highly recommend you should, then install it.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

Before you start brewing you should run “brew doctor”. This will check that everything is ok with your installation.

brew doctor

Hopefully you will get a message “Your system is ready to brew”, otherwise doctor brew will oftentimes tell you what to do.

brew install python
brew install pyenv

The above commands will, install homebrew’s Python 2.7 (to replace the system pyhton) and install pyenv. Replacing the system Pyhton fixes issues with needing “sudo” for easy_install and others documented here

Now Pyenv is installed, you should edit your “~/.bash_profile” and add the following:

export PYENV_ROOT=/usr/local/opt/pyenv  
eval "$(pyenv init -)"

This changes the Pyenv root path and makes sure pyenv is initialized.

$SHELL -l

Continue reading

Bypassing the memory check on a VMware ESXi 5

When my new HP ML10 arrived I was ready to install ESXi… until I realised that my 32GB of RAM wouldn’t be on its way for a week! To get around the memory check in ESXi 5.5, I found the awesome instructions here and with a few tweaks was able to get this working. Here are the 20 steps that I followed…

  1. Boot the system from USB Stick with ESXi installer on it.
  2. Once the installer welcome screen shows up, press ALT+F1
  3. Login as “root”, no password.
  4. cd /usr/lib/vmware/weasel/util
  5. Delete upgrade_precheck .pyc (compiled version)
  6. Move precheck.py to precheck.py.old
  7. cp upgrade_precheck.py.old upgrade_precheck.py
  8. chmod 666 upgrade_precheck.py
  9. vi upgrade_precheck.py
  10. Type “/MEM_MIN” and press ENTER
  11. Press “i” for insert
  12. Edit the line to read “MEM_MIN_SIZE= (1*1024–32)”
  13. Press ESC and then type “:w” and ENTER
  14. Press ESC and then type “:q!” and ENTER
  15. ps -c | grep weasel
  16. Note the process id for “python”
  17. kill –9 /<process_id/>
  18. This put me back at the main screen, but you can jump back pressing ALT+F2 if necessary
  19. Continue the install process
  20. Fin

The definitve guide to setting up a USB Serial adapter and iTerm2 on OSX

Using a few guides on the web and a little bit of ingenuity I was able to get my FTDI-based, USB to 2x Serial adapter working in Mac OSX 10.9 Mavericks with iTerm 2. This post documents the process and resources used in the hope of becoming the definitive guide to setting up a USB serial adapter in OSX and using iTerm2 as the terminal emulator. Even if it isn’t quite definitive, it should at least be useful to others - I hope!

Choose your weapon

My Weapon of Choice

The dual serial adapter above is my weapon of choice. You can pick one up for about £20 on Amazon(not an affiliate link). Generally speaking, I’ve had better experience with FTDI chipsets so if you are in the market for an adapter, I’d recommend checking the chipset first…

Driver Installation

For FTDI

  1. Download the FTDI VCP driver for OSX
  2. Install the drivers

For Prolific

  1. Download the drivers from here
  2. Install the drivers

A quick note on terminal emulation in OSX

Most likely you have used a USB-serial adapter in Windows. When installed It appears as a COM port, you point TeraTerm or HyperTerminal to that COM port and everything automagically works. In Continue reading

Stahp it with the Network programmer FUD already

Every week I see somebody ask “will all Network Engineers be programmers” on Twitter, LinkedIn, at a trade show or just to be antagonistic and for no other reason than to start an argument.

The anger inside has been brewing for over 12 months until the pressure valve finally released in the form of this blog post. Expect snark.

What is a programmer anyway?

Lets clear something up. IF YOU CAN WRITE ONE LINE OF RUBY YOU ARE NOT A PROGRAMMER. The Programmers of myth and legend are these days referred to as “Software Engineers”, “Software Architects” and sometimes even “Hackers”, “Coders” or “Code Monkeys”. What they “do” - is build software for a living.

So what about Networking Engineers?

The networking industry can be broken in to four main segments:

Network Operations - These folk keep networks running. They eat support tickets and are seldom let out of their cages.

Network Architects - These folk run around data centers with whiteboards and sharpies and draw clouds. Consultants fall under this designation too. Occasionally these guys get their hands dirty and pick up a console cable but most times they are cooking up the most complicated solution to a simple Continue reading

Configuring the HP MSR930 for BT Infinity

After trying in vain to make my BT Home Hub 3 work as a Proper Router™ for my home lab I decided to take the plunge and get something better. Seeing as I work at HP, I thought I’d try the HP MSR 930

First step is to get your Fundamentals configured. The config below is a snippet from my configuration. This will enable SSH, SFTP, and HTTPS access from local IP addresses only.

sysname <Your Hostname>
#
# Change some web timeouts
#
web https-authorization mode auto
web idle-timeout 3
#
# ACL for Local Access
#
acl number 2000
 description *** Local Only ***
 rule 0 permit source 192.168.1.0 0.0.0.255
 rule 5 permit source 10.0.0.0 0.255.255.255
#
# Secure Web Interface
#
undo ip http enable
ip https enable
ip https port 443
ip https acl 2000
#
# SSH Setup
#
ssh server enable
ssh server authentication-timeout 10
sftp server enable
#
# Restrict VTY to SSH from Local IP's
#
user-interface vty 0 4
 acl 2000 in
 authentication-mode scheme
 protocol inbound ssh

Once we have our fundamentals done, we can get our firewall ready. Continue reading

Learning though experimentation and breaking things

Lifehacker suggested“Learning to Code by Breaking Someone Else’s Code” and I wanted to share my personal experiences with this method….

The DOS era

When I was young, 7ish, my parents bought a Packard Bell 486 machine (a DX with goofy speakers that hook on the side of the monitor IIRC). It was supposed to be for school, but as far as I was concerned it was for playing games! While the PC ran Windows 3.11, all of my games ran on DOS. DOS, as many of you probably know, has no UI, so in order to install or run a game you were at the mercy of the manual. Typically, the manual would instruct you to “cd” to a removable disk drive and run an “.exe”. This taught me some basic DOS and that an “exe” was an application that I could run.

Sound, Joysticks, IRQ and DMA

Upon running the “exe” in DOS you would be lucky if the game would run correctly first time. Sometimes you would have graphics issues, other times no sound and sometimes your joystick wouldn’t work. To get a game to work you had to select the correct drivers for graphics Continue reading

Making JSON more Readable with Sublime Text

I saw Scott Lowe’s post on how he is making JSON more readable in BBEdit and I thought I’d share how I’m doing this in Sublime Text.

If you aren’t using Package Control, you should be, so install it using the instructions here.

Open the prompt with ^⌘P then type Install and press Enter Then type Pretty JSON and press enter on more time.

Then to make your JSON pretty, you can simply ^⌘J or ^⌘P and type pretty

Adding Markdown support to your WordPress Blog

Continuning on this week's theme of Markdown, I'll be explaining how to add Markdown to your blog in 3 easy steps.

Step 1 - Install the WP-Markdown plugin

From your Wordpress dashboard, head over to the Plugins tab and click Add New. Search for "WP-Markdown" and install

Step 2 - Enable Markdown for specific pages

Once your plugin has been installed, head on down to Settings > Writing and scroll to the Markdown section pictured below.

Enable Markdown

Enable Markdown wherever you like, but I'd recommend pages and posts

WARNING: Enabling Markdown will affect your existing posts/pages. I noticed that while my posts didn't look any different on the outside, behind the scenes they were a mess and required a little trying up.

Step 3 - Try it out

Create a new post or page and practice your Markdown-Fu. Not sure where to start? Here's an example

# This is a first level heading

Here is some body text

## Second level of heading here
### And a Third
#### And so on and so forth

- Now some bullets
- Hopefully you are getting the hang of this now
- It's pretty easy

> Blockquotes are easy with Markdown  Continue reading

Why I switched from MultiMarkdown to Pandoc

For the last 6 months I've been using Markdown where I can. Since embarking on the path towards a more Agile approach to writing, it has been necessary to use Markdown more and more. This has led me towards using Pandoc Markdown rather than MultMarkdown as my dialect of choice and I hope to explain why.

So what's so good about Markdown?

If you haven't used Markdown already, you might be wondering what the fuss is about. Basically it is a way of writing markup in an easy-to-read, easy-to-write fashion. It decouples the act of writing from formatting/layout so the same source text can be used to produce multiple formats.

Barriers to Markdown adoption

So what are the barriers to Markdown adoption? Personally I have found only two.

While I use Markdown, the rest of the company uses Microsoft Word - All of our corporate templates are in MS Word format - Neither Markdown or MultiMarkdown reliably export to MS Word format (yes MMD does ODF, but it doesn't handle images well)

The next issue is that Markdown to PDF conversion uses LaTeX. Unfortunately I neither have the time nor inclination to learn LaTeX. While it can be a powerful Continue reading

Using Pandoc with Marked app

I recently changed from MultiMarkdown to Pandoc. But I still wanted to use Marked app to preview my work…

Thankfully the author of Marked allowed for such an eventuality with the "Custom Processor" option.

Pandoc in Marked

To use this tick the box, put in your fully qualified path to pandoc and add your arguments and bob is your proverbial uncle. The quickest way to find out where pandoc is installed on your Mac is to type the following from the terminal.

which pandoc

@dave_tucker

Agile Writing – Week 1 – Getting Started with JIRA, GreenHopper and Markdown

I finished reading The Phoenix Project at the beginning of May and it has had a profound affect on my outlook towards work. Not only was this a great read, but while I was reading I kept getting ideas on how I could implement the three ways at work. This diary documents the transition to an Agile Writing workflow.

Why bother?

Before I start covering the how, I thought I would spend a little time on the why. Agile is something that is usually associated with Software Development and you might be thinking "What has this got to do with writing?". I write technical documentation for a living, but I've been a long time have-a-go programmer and I recently had the pleasure of working on a professional software project. One of the things that amazed me was how Agile mad them so much more efficient.

  • Scope creep was eliminated through issue and requirements management
  • Many application releases gets product in the customer's hands sooner
  • Team maintains a constant velocity and is always striving to be more efficient
  • Everything that can be automated, is.

It is actually quite easy to draw parallels between application development and writing technical documentation. A Continue reading

Arduino: Using my MelodyUtils library for R2-D2 style chirps

As part of a small robotics project I've been working on this weekend (affectionately called CoBe1, there will be a follow up blog on that soon) I decided to give by robot some personality in the form a a voice, and uploaded some of my code to GitHub.

While Arduino is capable of playing music and sounds from an SD Card I wanted something a little more authentic… something similar to R2-D2's chirps from Star Wars. I had a mini 8Ohm speaker lying around and following the tutorials here it was easy to get it hooked up to my Arduino Uno and start making sounds. By adjusting the default melody and timings I got part way to achieving my R2-D2 style attitude, but notes on their own just didn't cut it. What I needed was some articulations. I got coding and whipped up a library that makes it easy to use glissando and tremolo. Want to give it a try? Grab the code on GitHub Here's a simple example sketch:

#include <pitches.h>;

void setup()
{
MelodyUtils mel(8);
mel.Glis(NOTE_C3, NOTE_C4, 5);
delay(1000);
mel.Trem(NOTE_C3,  Continue reading

Install Raspbmc without a Keyboard or Mouse

Once I had got my iTunes library downgraded to 10.7 and liberated some of my DRM'd media I thought it would be awesome to use my Raspberry Pi as an Airplay Receiver...

Head over to http://www.raspbmc.com/download/ and follow the instructions to download and install Raspbmc. Once you've prepped your SD card, popped it in your Pi hole and got it booted it should start the installation… at this point you can grab a coffee

In older versions of Raspbmc you had to SSH in and enable the web server in /home/pi/.xbmc/userdata/guisettings.xml

In the latest version this was already enabled, so I just picked up my phone, downloaded the official XBMC remote app from the Android marketplace (or iTunes store if you are that way inclined).

A couple of points of note when adding your host in the XBMC remote app. If you don't know your IP address and your Pi is not automatically found you can find this from your local router. The HTTP port is 80 by default in Raspbmc (not 8080) and the password is blank, although I configured username xbmc and password xbmc and this works just fine!

Once set up it Continue reading