LoginSignup
0
0

More than 5 years have passed since last update.

Bluemix-Infra(SoftLayer)のBandwidth Pooling Groupを一覧表示するスクリプト

Posted at

内容

Bluemix Infrastructure (旧SoftLayer) において、インターネットとの帯域の量(Public Outbound)を共有できるグループを、コマンドで一覧表示できるスクリプトをつくりました。

Bandwidth Pooling について

Bluemix Infrastructure (旧SoftLayer) では インターネットとの帯域の量(Public Outbound Bandwidthをプーリングすることができます。いわゆる家族割ですね。
Poolingをするにはサーバーごとに$25必要です。
(Unlimited Bandwidthを含めることはできません。)

SoftLayerのDCごとのPublic Outbound通信料 - Qiita

前提

以下の記事が理解できていることが前提です。
Bluemix Infrastructure (旧SoftLayer) のAPIについて、詳しく解説してあります。

ShinobiLayer: SoftLayer API 次の一歩: データ型オブジェクト(1) - Qiita

スクリプト

getBandwidthPoolingGroup.py
import SoftLayer
from prettytable import PrettyTable

# account info
client = SoftLayer.create_client_from_env()

#objectmask
objectmask = """
    longName,
    name,
    vdrGroup[
        locationId,
        locationGroup[
            id,
            description,
            name
        ]
    ]
"""
bpg = client['Location'].getDatacenters(mask=objectmask)

table = PrettyTable([
    'DC Name',
    'DC Detail',
    'Pooling Group',
    'Group Detail'])

for key in range(len(bpg)):
        table.add_row([
            bpg[key]['name'],
            bpg[key]['longName'],
            bpg[key]['vdrGroup']['locationGroup']['name'],
            bpg[key]['vdrGroup']['locationGroup']['description'],
        ])

print table.get_string(sortby="Pooling Group")

実行結果の例

+---------+--------------+---------------+------------------------------+
| DC Name |  DC Detail   | Pooling Group |         Group Detail         |
+---------+--------------+---------------+------------------------------+
|  ams01  | Amsterdam 1  |    AMS/LON    | All Datacenters in Amsterdam |
|  ams03  | Amsterdam 3  |    AMS/LON    | All Datacenters in Amsterdam |
|  fra02  | Frankfurt 2  |    AMS/LON    | All Datacenters in Amsterdam |
|  lon02  |   London 2   |    AMS/LON    | All Datacenters in Amsterdam |
|  par01  |   Paris 1    |    AMS/LON    | All Datacenters in Amsterdam |
|  mel01  | Melbourne 1  |      AUS      | All Datacenters in Australia |
|  syd01  |   Sydney 1   |      AUS      | All Datacenters in Australia |
|  sao01  | Sao Paulo 1  |      BRA      |  All Datacenters in Brazil   |
|  che01  |  Chennai 1   |      IND      |   All Datacenters in India   |
|  mil01  |   Milan 1    |      ITA      |    AllDatacentersinItaly     |
|  seo01  |   Seoul 1    |      KOR      |  AllDatacentersinSouthKorea  |
|  mex01  |   Mexico 1   |      MEX      |  All Datacenters in Mexico   |
|  osl01  |    Oslo 1    |      NOR      |    AllDatacentersinNorway    |
|  hkg02  | Hong Kong 2  |    SNG/HKG    | All Datacenters in Singapore |
|  sng01  | Singapore 1  |    SNG/HKG    | All Datacenters in Singapore |
|  tok02  |   Tokyo 2    |    SNG/HKG    | All Datacenters in Singapore |
|  dal01  |   Dallas 1   |       US      |  All Datacenters in the USA  |
|  dal02  |   Dallas 2   |       US      |  All Datacenters in the USA  |
|  dal05  |   Dallas 5   |       US      |  All Datacenters in the USA  |
|  dal06  |   Dallas 6   |       US      |  All Datacenters in the USA  |
|  dal07  |   Dallas 7   |       US      |  All Datacenters in the USA  |
|  dal09  |   Dallas 9   |       US      |  All Datacenters in the USA  |
|  dal10  |  Dallas 10   |       US      |  All Datacenters in the USA  |
|  hou02  |  Houston 2   |       US      |  All Datacenters in the USA  |
|  mon01  |  Montreal 1  |       US      |  All Datacenters in the USA  |
|  sea01  |  Seattle 1   |       US      |  All Datacenters in the USA  |
|  sjc01  |  San Jose 1  |       US      |  All Datacenters in the USA  |
|  sjc03  |  San Jose 3  |       US      |  All Datacenters in the USA  |
|  tor01  |  Toronto 1   |       US      |  All Datacenters in the USA  |
|  wdc01  | Washington 1 |       US      |  All Datacenters in the USA  |
|  wdc04  | Washington 4 |       US      |  All Datacenters in the USA  |
+---------+--------------+---------------+------------------------------+
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0