Using fog-softlayer for Managing Global IP AddressesIn [part six]( http://sldn.softlayer.com/blog/matteldridge/Using-fog-softlayer-Managing-Networks-VLANs) of this series w

You can follow this link for details on what SoftLayer global IP addresses are and how they work.

In short, with SoftLayer global IP addresses you can route a public IPv4 or IPv6 address to any server, on any (public) VLAN, in any SoftLayer data center.

They’re similar to “Elastic IPs” offered by some other public clouds. The only difference is that global IPs are more flexible, powerful, and useful.

This post will cover basic management of global IP addresses with fog-softlayer. Before we get into that, there’s one IMPORTANT ITEM TO NOTE: before a global IP will work properly certain minor configuration changes must be made on the target host. Please read this article for information on the configuration changes.

Network Examples

These examples all assume you have ~/.fog, which contains the following:

Create a Connection to the SoftLayer Network

require ‘fog/softlayer’
@sl = Fog::Network[:softlayer]

The Same, But Different

Part six of this series covered using the Network service to manage your VLANs. The service comprises a handful of models including Fog::Network::Softlayer::Network, Fog::Network::Softlayer::Subnet, and Fog::Network::Softlayer::Ip.

Global IP addresses are accessed through the Fog::Network::Softlayer::Ip model. Unlike “normal” IP addresses, they can be specifically created and destroyed, while non-global IP addresses are created and destroyed via a subnet.

This example lists all IPs on the SoftLayer account and selects those that are global. The response shows us two global IP addresses belonging to the account. The first one is unrouted, and the second one is routed.

For IPv6 I simply do this:

Try Before You Buy

One of the excellent features included in fog-softlayer (and for all of the supported providers), is fantastic mocking.

Even if you don’t have a SoftLayer account, you can download fog-softlayer and start testing this code.

Just call Fog.mock! immediately after requiring the gem, so you can run all of the above code examples and see how easy they are to work with.

We’re working hard to get full coverage of Mock classes and methods. You may run across a MockNotImplemented exception here or there. If you do, the best course is probably to fork the repo, implement the mock, and open a pull request.