本文整理汇总了Python中SoftLayer.CCIManager.change_port_speed方法的典型用法代码示例。如果您正苦于以下问题:Python CCIManager.change_port_speed方法的具体用法?Python CCIManager.change_port_speed怎么用?Python CCIManager.change_port_speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoftLayer.CCIManager
的用法示例。
在下文中一共展示了CCIManager.change_port_speed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from SoftLayer import CCIManager [as 别名]
# 或者: from SoftLayer.CCIManager import change_port_speed [as 别名]
def execute(self, args):
public = args['public']
cci = CCIManager(self.client)
cci_id = resolve_id(cci.resolve_ids, args.get('<identifier>'), 'CCI')
cci.change_port_speed(cci_id, public, args['--speed'])
示例2: CCITests
# 需要导入模块: from SoftLayer import CCIManager [as 别名]
# 或者: from SoftLayer.CCIManager import change_port_speed [as 别名]
#.........这里部分代码省略.........
assert_data = {
'startCpus': 1,
'maxMemory': 1,
'hostname': 'test',
'domain': 'example.com',
'localDiskFlag': True,
'operatingSystemReferenceCode': "STRING",
'hourlyBillingFlag': True,
'sshKeys': [{'id': 543}],
}
self.assertEqual(data, assert_data)
def test_generate_no_disks(self):
data = self.cci._generate_create_dict(
cpus=1,
memory=1,
hostname='test',
domain='example.com',
os_code="STRING"
)
self.assertEqual(data.get('blockDevices'), None)
def test_generate_single_disk(self):
data = self.cci._generate_create_dict(
cpus=1,
memory=1,
hostname='test',
domain='example.com',
os_code="STRING",
disks=[50]
)
assert_data = {
'blockDevices': [
{"device": "0", "diskImage": {"capacity": 50}}]
}
self.assertTrue(data.get('blockDevices'))
self.assertEqual(data['blockDevices'], assert_data['blockDevices'])
def test_generate_multi_disk(self):
data = self.cci._generate_create_dict(
cpus=1,
memory=1,
hostname='test',
domain='example.com',
os_code="STRING",
disks=[50, 70, 100]
)
assert_data = {
'blockDevices': [
{"device": "0", "diskImage": {"capacity": 50}},
{"device": "2", "diskImage": {"capacity": 70}},
{"device": "3", "diskImage": {"capacity": 100}}]
}
self.assertTrue(data.get('blockDevices'))
self.assertEqual(data['blockDevices'], assert_data['blockDevices'])
def test_change_port_speed_public(self):
cci_id = 1
speed = 100
self.cci.change_port_speed(cci_id, True, speed)
service = self.client['Virtual_Guest']
f = service.setPublicNetworkInterfaceSpeed
f.assert_called_once_with(speed, id=cci_id)
def test_change_port_speed_private(self):
cci_id = 2
speed = 10
self.cci.change_port_speed(cci_id, False, speed)
service = self.client['Virtual_Guest']
f = service.setPrivateNetworkInterfaceSpeed
f.assert_called_once_with(speed, id=cci_id)
def test_edit(self):
# Test editing user data
service = self.client['Virtual_Guest']
self.cci.edit(100, userdata='my data')
service.setUserMetadata.assert_called_once_with(['my data'], id=100)
# Now test a blank edit
self.assertTrue(self.cci.edit, 100)
# Finally, test a full edit
args = {
'hostname': 'new-host',
'domain': 'new.sftlyr.ws',
'notes': 'random notes',
}
self.cci.edit(100, **args)
service.editObject.assert_called_once_with(args, id=100)