-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1579 from softlayer/issues1575
Bandwidth pool features
- Loading branch information
Showing
10 changed files
with
238 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Displays information about the accounts bandwidth pools""" | ||
# :license: MIT, see LICENSE for more details. | ||
import click | ||
|
||
from SoftLayer.CLI import environment | ||
from SoftLayer.CLI import formatting | ||
from SoftLayer.managers.account import AccountManager as AccountManager | ||
from SoftLayer import utils | ||
|
||
|
||
@click.command() | ||
@environment.pass_env | ||
def cli(env): | ||
"""Displays bandwidth pool information | ||
Similiar to https://cloud.ibm.com/classic/network/bandwidth/vdr | ||
""" | ||
|
||
manager = AccountManager(env.client) | ||
items = manager.get_bandwidth_pools() | ||
|
||
table = formatting.Table([ | ||
"Pool Name", | ||
"Region", | ||
"Servers", | ||
"Allocation", | ||
"Current Usage", | ||
"Projected Usage" | ||
], title="Bandwidth Pools") | ||
table.align = 'l' | ||
|
||
for item in items: | ||
name = item.get('name') | ||
region = utils.lookup(item, 'locationGroup', 'name') | ||
servers = manager.get_bandwidth_pool_counts(identifier=item.get('id')) | ||
allocation = "{} GB".format(item.get('totalBandwidthAllocated', 0)) | ||
current = "{} GB".format(utils.lookup(item, 'billingCyclePublicBandwidthUsage', 'amountOut')) | ||
projected = "{} GB".format(item.get('projectedPublicBandwidthUsage', 0)) | ||
|
||
table.add_row([name, region, servers, allocation, current, projected]) | ||
env.fout(table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
SoftLayer/fixtures/SoftLayer_Network_Bandwidth_Version1_Allotment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
getObject = { | ||
'id': 309961, | ||
'bareMetalInstanceCount': 0, | ||
'hardwareCount': 2, | ||
'virtualGuestCount': 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.