forked from softlayer/softlayer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvlan_tests.py
More file actions
78 lines (68 loc) · 2.76 KB
/
Copy pathvlan_tests.py
File metadata and controls
78 lines (68 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""
SoftLayer.tests.CLI.modules.vlan_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from SoftLayer import testing
class VlanTests(testing.TestCase):
def test_detail(self):
result = self.run_command(['vlan', 'detail', '1234'])
self.assert_no_fail(result)
def test_detail_no_vs(self):
result = self.run_command(['vlan', 'detail', '1234', '--no-vs'])
self.assert_no_fail(result)
def test_detail_no_hardware(self):
result = self.run_command(['vlan', 'detail', '1234', '--no-hardware'])
self.assert_no_fail(result)
def test_subnet_list(self):
vlan_mock = self.set_mock('SoftLayer_Network_Vlan', 'getObject')
getObject = {
'primaryRouter': {
'datacenter': {'id': 1234, 'longName': 'TestDC'},
'fullyQualifiedDomainName': 'fcr01.TestDC'
},
'id': 1234,
'vlanNumber': 4444,
'firewallInterfaces': None,
'subnets': [
{
'id': 99,
'networkIdentifier': 1111111,
'netmask': '255.255.255.0',
'gateway': '12.12.12.12',
'subnetType': 'TEST',
'usableIpAddressCount': 1
}
]
}
vlan_mock.return_value = getObject
result = self.run_command(['vlan', 'detail', '1234'])
self.assert_no_fail(result)
def test_detail_hardware_without_hostname(self):
vlan_mock = self.set_mock('SoftLayer_Network_Vlan', 'getObject')
getObject = {
'primaryRouter': {
'datacenter': {'id': 1234, 'longName': 'TestDC'},
'fullyQualifiedDomainName': 'fcr01.TestDC'
},
'id': 1234,
'vlanNumber': 4444,
'firewallInterfaces': None,
'subnets': [],
'hardware': [
{'a_hardware': 'that_has_none_of_the_expected_attributes_provided'},
{'domain': 'example.com',
'networkManagementIpAddress': '10.171.202.131',
'hardwareStatus': {'status': 'ACTIVE', 'id': 5},
'notes': '',
'hostname': 'hw1', 'hardwareStatusId': 5,
'globalIdentifier': 'f6ea716a-41d8-4c52-bb2e-48d63105f4b0',
'primaryIpAddress': '169.60.169.169',
'primaryBackendIpAddress': '10.171.202.130', 'id': 826425,
'privateIpAddress': '10.171.202.130',
'fullyQualifiedDomainName': 'hw1.example.com'}
]
}
vlan_mock.return_value = getObject
result = self.run_command(['vlan', 'detail', '1234'])
self.assert_no_fail(result)