Friday, 24 April 2015

Using the MCP 2.0 commands for PowerShell

To back the launch of the NA9 MCP2.0 functionality, we have extended the PowerShell commands to have MCP 2.0 commands.
New-CaasNetworkDomain
New-CaasVlan
Get-CaasVlan
Get-CaasNetworkDomain
New-CaasServerOnNetworkDomain


https://community.opsourcecloud.net/Browse.jsp?id=5b71bb9ed81101d3222a0182b91cb986

To provision a Network Domain.

PS C:\> New-CaasNetworkDomain -Location "NA9" -Name "My test domain" -Description "the test domain" -Type Essentials


operation    : DEPLOY_NETWORK_DOMAIN
responseCode : IN_PROGRESS
message      : Request to deploy Network Domain 'My test domain' has been accepted and is being processed.
info         : {networkDomainId}
warning      :
error        :

requestId    : na/2015-04-25T01:25:21.614-04:00/ae7f0d6b-e522-425f-b744-2628885bdff8


To get the network domains in your MCP 2.0 datacenters

PS C:\> Get-CaasNetworkDomain


name            : My test domain
description     : the test domain
type            : ESSENTIALS
snatIpv4Address : 168.128.2.48
createTime      : 4/25/2015 5:25:21 AM
state           : NORMAL
progress        :
id              : 0481c6ef-d5e5-454f-a45d-096d8b59b104
datacenterId    : NA9

You can create a VLAN in your MCP 2.0 datacenters.

PS C:\> New-CaasVlan -NetworkDomainId "0481c6ef-d5e5-454f-a45d-096d8b59b104" -Name "Test VLAN" -Description "My first VLAN" -PrivateIpv4Ba
seAddress "192.168.100.0"


operation    : DEPLOY_VLAN
responseCode : IN_PROGRESS
message      : Request to deploy VLAN 'Test VLAN' has been accepted and is being processed.
info         : {vlanId}
warning      :
error        :
requestId    : na/2015-04-25T01:26:52.721-04:00/b99ddd00-8dfd-4d00-9bf5-99e235efe4af

There is a new command to see the VLANs provisioned in your MCP 2.0 datacenters.

PS C:\>Get-CaasVlan


networkDomain      : DD.CBU.Compute.Api.Contracts.Network20.VlanTypeNetworkDomain
name               : Test VLAN
description        : My first VLAN
privateIpv4Range   : DD.CBU.Compute.Api.Contracts.Network20.IpRangeCidrType
ipv4GatewayAddress : 192.168.100.1
ipv6Range          : DD.CBU.Compute.Api.Contracts.Network20.IpRangeCidrType
ipv6GatewayAddress : 2607:f480:111:1167:0:0:0:1
createTime         : 4/25/2015 5:26:52 AM
state              : PENDING_ADD
progress           : DD.CBU.Compute.Api.Contracts.Network20.ProgressType
id                 : a19c37d6-1a35-4313-810b-f0c59de73000
datacenterId       : NA9

And of course, your existing functionality will still work.

Monday, 20 April 2015

Using Apache LibCloud with the Dimension Data API

Apache have a project called 'libcloud', which is a multi-cloud library for python. Dimension Data Cloud (formerly known as OpSource cloud) has been a supported platform for many years.

Here is how you download and use libcloud with our API.

Install libcloud using PIP
>pip install apache-libcloud

Open up the Python shell
>python

import the libcloud project
>>>from pprint import pprint
>>>from libcloud.compute.types import Provider
>>>from libcloud.compute.providers import get_driver

Set the driver as OpSource (Dimension Data Cloud)
>>>cls = get_driver(Provider.OPSOURCE)

Turn off SSL validation for testing, or read https://libcloud.readthedocs.org/en/latest/other/ssl-certificate-validation.html
>>>import libcloud.security
>>>libcloud.security.VERIFY_SSL_CERT = False

Set your credentials
>>>driver = cls('myusername','mypassword')

List the servers in your account.
>>> pprint(driver.list_nodes())

[<Node: uuid=8fa6750b7829b224c6b1f252decfc80a61fae424, name=ExchN1, state=TERMINATED, public_ips=[], private_ips=10.172.
132.12, provider=Opsource ...>,
 <Node: uuid=db9505bf21d0811fc99d70c9a9ac72e0695a573d, name=ExchN2, state=TERMINATED, public_ips=[], private_ips=10.172.
132.14, provider=Opsource ...>,

Note: LibCloud only supports the NA region at present.

Further details are available on the libcloud website..
https://libcloud.readthedocs.org/en/latest/compute/index.html