Skip to content

Commit 724852e

Browse files
committed
Add location to fake network objects
Network objects returned from the SDK include a location column which has a reference to the cloud to which the object belongs. Add this column to our fake objects used for testing, so that we can make sure we don't include them in CLI output where they are useless. Change-Id: Ib09027af78e7bf2458cdc76ea9027faa3dbbfcf9 Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
1 parent 90eb0ca commit 724852e

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

  • openstackclient/tests/unit/network/v2

openstackclient/tests/unit/network/v2/fakes.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def create_one_address_group(attrs=None):
104104
'id': 'address-group-id-' + uuid.uuid4().hex,
105105
'tenant_id': 'project-id-' + uuid.uuid4().hex,
106106
'addresses': ['10.0.0.1/32'],
107+
'location': 'MUNCHMUNCHMUNCH',
107108
}
108109

109110
# Overwrite default attributes.
@@ -177,6 +178,7 @@ def create_one_address_scope(attrs=None):
177178
'tenant_id': 'project-id-' + uuid.uuid4().hex,
178179
'shared': False,
179180
'ip_version': 4,
181+
'location': 'MUNCHMUNCHMUNCH',
180182
}
181183

182184
# Overwrite default attributes.
@@ -326,6 +328,7 @@ def create_one_ip_availability(attrs=None):
326328
'subnet_ip_availability': [],
327329
'total_ips': 254,
328330
'used_ips': 6,
331+
'location': 'MUNCHMUNCHMUNCH',
329332
}
330333
network_ip_attrs.update(attrs)
331334

@@ -425,6 +428,7 @@ def create_one_network(attrs=None):
425428
'ipv4_address_scope': 'ipv4' + uuid.uuid4().hex,
426429
'ipv6_address_scope': 'ipv6' + uuid.uuid4().hex,
427430
'tags': [],
431+
'location': 'MUNCHMUNCHMUNCH',
428432
}
429433

430434
# Overwrite default attributes.
@@ -514,6 +518,7 @@ def create_one_network_flavor(attrs=None):
514518
'name': 'network-flavor-name-' + fake_uuid,
515519
'service_type': 'vpn',
516520
'tenant_id': 'project-id-' + uuid.uuid4().hex,
521+
'location': 'MUNCHMUNCHMUNCH',
517522
}
518523

519524
# Overwrite default attributes.
@@ -579,6 +584,7 @@ def create_one_network_segment(attrs=None):
579584
'network_type': 'vlan',
580585
'physical_network': 'physical-network-name-' + fake_uuid,
581586
'segmentation_id': 1024,
587+
'location': 'MUNCHMUNCHMUNCH',
582588
}
583589

584590
# Overwrite default attributes.
@@ -639,6 +645,7 @@ def create_one_network_segment_range(attrs=None):
639645
'used': {104: '3312e4ba67864b2eb53f3f41432f8efc',
640646
106: '3312e4ba67864b2eb53f3f41432f8efc'},
641647
'available': [100, 101, 102, 103, 105],
648+
'location': 'MUNCHMUNCHMUNCH',
642649
}
643650

644651
# Overwrite default attributes.
@@ -717,6 +724,7 @@ def create_one_port(attrs=None):
717724
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
718725
'tags': [],
719726
'propagate_uplink_status': False,
727+
'location': 'MUNCHMUNCHMUNCH',
720728
}
721729

722730
# Overwrite default attributes.
@@ -802,6 +810,7 @@ def create_one_network_agent(attrs=None):
802810
'admin_state_up': True,
803811
'binary': 'binary-' + uuid.uuid4().hex,
804812
'configurations': {'subnet': 2, 'networks': 1},
813+
'location': 'MUNCHMUNCHMUNCH',
805814
}
806815
agent_attrs.update(attrs)
807816
agent = fakes.FakeResource(info=copy.deepcopy(agent_attrs),
@@ -870,6 +879,7 @@ def create_one_network_rbac(attrs=None):
870879
'action': 'access_as_shared',
871880
'target_tenant': 'target-tenant-' + uuid.uuid4().hex,
872881
'tenant_id': 'tenant-id-' + uuid.uuid4().hex,
882+
'location': 'MUNCHMUNCHMUNCH',
873883
}
874884
rbac_attrs.update(attrs)
875885
rbac = fakes.FakeResource(info=copy.deepcopy(rbac_attrs),
@@ -931,7 +941,8 @@ def create_one_service_profile(attrs=None):
931941
'tenant_id': 'project-id-' + uuid.uuid4().hex,
932942
'driver': 'driver-' + uuid.uuid4().hex,
933943
'metainfo': 'metainfo-' + uuid.uuid4().hex,
934-
'enabled': True
944+
'enabled': True,
945+
'location': 'MUNCHMUNCHMUNCH',
935946
}
936947

937948
flavor_profile_attrs.update(attrs)
@@ -990,6 +1001,7 @@ def create_one_qos_policy(attrs=None):
9901001
'shared': False,
9911002
'description': 'qos-policy-description-' + uuid.uuid4().hex,
9921003
'rules': rules,
1004+
'location': 'MUNCHMUNCHMUNCH',
9931005
}
9941006

9951007
# Overwrite default attributes.
@@ -1063,7 +1075,8 @@ def create_one_security_group(attrs=None):
10631075
'name': 'security-group-name-' + uuid.uuid4().hex,
10641076
'id': sg_id,
10651077
'tenant_id': 'project-id-' + uuid.uuid4().hex,
1066-
'description': 'security-group-description-' + uuid.uuid4().hex
1078+
'description': 'security-group-description-' + uuid.uuid4().hex,
1079+
'location': 'MUNCHMUNCHMUNCH',
10671080
}
10681081

10691082
security_group = fakes.FakeResource(
@@ -1097,6 +1110,7 @@ def create_one_qos_rule(attrs=None):
10971110
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
10981111
'tenant_id': 'project-id-' + uuid.uuid4().hex,
10991112
'type': type,
1113+
'location': 'MUNCHMUNCHMUNCH',
11001114
}
11011115
if type == RULE_TYPE_BANDWIDTH_LIMIT:
11021116
qos_rule_attrs['max_kbps'] = randint(1, 10000)
@@ -1172,6 +1186,7 @@ def create_one_qos_rule_type(attrs=None):
11721186
# Set default attributes.
11731187
qos_rule_type_attrs = {
11741188
'type': 'rule-type-' + uuid.uuid4().hex,
1189+
'location': 'MUNCHMUNCHMUNCH',
11751190
}
11761191

11771192
# Overwrite default attributes.
@@ -1230,6 +1245,7 @@ def create_one_router(attrs=None):
12301245
'availability_zone_hints': [],
12311246
'availability_zones': [],
12321247
'tags': [],
1248+
'location': 'MUNCHMUNCHMUNCH',
12331249
}
12341250

12351251
# Overwrite default attributes.
@@ -1305,7 +1321,8 @@ def create_one_security_group(attrs=None):
13051321
'stateful': True,
13061322
'project_id': 'project-id-' + uuid.uuid4().hex,
13071323
'security_group_rules': [],
1308-
'tags': []
1324+
'tags': [],
1325+
'location': 'MUNCHMUNCHMUNCH',
13091326
}
13101327

13111328
# Overwrite default attributes.
@@ -1387,6 +1404,7 @@ def create_one_security_group_rule(attrs=None):
13871404
'remote_ip_prefix': '0.0.0.0/0',
13881405
'security_group_id': 'security-group-id-' + uuid.uuid4().hex,
13891406
'tenant_id': 'project-id-' + uuid.uuid4().hex,
1407+
'location': 'MUNCHMUNCHMUNCH',
13901408
}
13911409

13921410
# Overwrite default attributes.
@@ -1475,6 +1493,7 @@ def create_one_subnet(attrs=None):
14751493
'subnetpool_id': None,
14761494
'description': 'subnet-description-' + uuid.uuid4().hex,
14771495
'tags': [],
1496+
'location': 'MUNCHMUNCHMUNCH',
14781497
}
14791498

14801499
# Overwrite default attributes.
@@ -1556,6 +1575,7 @@ def create_one_floating_ip(attrs=None):
15561575
'description': 'floating-ip-description-' + uuid.uuid4().hex,
15571576
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
15581577
'tags': [],
1578+
'location': 'MUNCHMUNCHMUNCH',
15591579
}
15601580

15611581
# Overwrite default attributes.
@@ -1620,7 +1640,8 @@ def create_one_meter(attrs=None):
16201640
'name': 'meter-name-' + uuid.uuid4().hex,
16211641
'description': 'meter-description-' + uuid.uuid4().hex,
16221642
'tenant_id': 'project-id-' + uuid.uuid4().hex,
1623-
'shared': False
1643+
'shared': False,
1644+
'location': 'MUNCHMUNCHMUNCH',
16241645
}
16251646

16261647
meter_attrs.update(attrs)
@@ -1669,6 +1690,7 @@ def create_one_rule(attrs=None):
16691690
'source_ip_prefix': '8.8.8.8/32',
16701691
'destination_ip_prefix': '10.0.0.0/24',
16711692
'tenant_id': 'project-id-' + uuid.uuid4().hex,
1693+
'location': 'MUNCHMUNCHMUNCH',
16721694
}
16731695

16741696
meter_rule_attrs.update(attrs)
@@ -1730,6 +1752,7 @@ def create_one_subnet_pool(attrs=None):
17301752
'ip_version': '4',
17311753
'description': 'subnet-pool-description-' + uuid.uuid4().hex,
17321754
'tags': [],
1755+
'location': 'MUNCHMUNCHMUNCH',
17331756
}
17341757

17351758
# Overwrite default attributes.
@@ -1801,6 +1824,7 @@ def create_one_network_service_provider(attrs=None):
18011824
'name': 'provider-name-' + uuid.uuid4().hex,
18021825
'service_type': 'service-type-' + uuid.uuid4().hex,
18031826
'default': False,
1827+
'location': 'MUNCHMUNCHMUNCH',
18041828
}
18051829

18061830
service_provider.update(attrs)
@@ -1923,6 +1947,7 @@ def create_one_port_forwarding(attrs=None):
19231947
'external_port': randint(1, 65535),
19241948
'protocol': 'tcp',
19251949
'description': 'some description',
1950+
'location': 'MUNCHMUNCHMUNCH',
19261951
}
19271952

19281953
# Overwrite default attributes.
@@ -1998,6 +2023,7 @@ def create_one_l3_conntrack_helper(attrs=None):
19982023
'helper': 'tftp',
19992024
'protocol': 'tcp',
20002025
'port': randint(1, 65535),
2026+
'location': 'MUNCHMUNCHMUNCH',
20012027
}
20022028

20032029
# Overwrite default attributes.

0 commit comments

Comments
 (0)