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>
This commit is contained in:
Dr. Jens Harbott 2021-12-16 16:21:58 +01:00 committed by Dr. Jens Harbott
parent 90eb0ca4bb
commit 724852e66e

View File

@ -104,6 +104,7 @@ class FakeAddressGroup(object):
'id': 'address-group-id-' + uuid.uuid4().hex, 'id': 'address-group-id-' + uuid.uuid4().hex,
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'addresses': ['10.0.0.1/32'], 'addresses': ['10.0.0.1/32'],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -177,6 +178,7 @@ class FakeAddressScope(object):
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'shared': False, 'shared': False,
'ip_version': 4, 'ip_version': 4,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -326,6 +328,7 @@ class FakeIPAvailability(object):
'subnet_ip_availability': [], 'subnet_ip_availability': [],
'total_ips': 254, 'total_ips': 254,
'used_ips': 6, 'used_ips': 6,
'location': 'MUNCHMUNCHMUNCH',
} }
network_ip_attrs.update(attrs) network_ip_attrs.update(attrs)
@ -425,6 +428,7 @@ class FakeNetwork(object):
'ipv4_address_scope': 'ipv4' + uuid.uuid4().hex, 'ipv4_address_scope': 'ipv4' + uuid.uuid4().hex,
'ipv6_address_scope': 'ipv6' + uuid.uuid4().hex, 'ipv6_address_scope': 'ipv6' + uuid.uuid4().hex,
'tags': [], 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -514,6 +518,7 @@ class FakeNetworkFlavor(object):
'name': 'network-flavor-name-' + fake_uuid, 'name': 'network-flavor-name-' + fake_uuid,
'service_type': 'vpn', 'service_type': 'vpn',
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -579,6 +584,7 @@ class FakeNetworkSegment(object):
'network_type': 'vlan', 'network_type': 'vlan',
'physical_network': 'physical-network-name-' + fake_uuid, 'physical_network': 'physical-network-name-' + fake_uuid,
'segmentation_id': 1024, 'segmentation_id': 1024,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -639,6 +645,7 @@ class FakeNetworkSegmentRange(object):
'used': {104: '3312e4ba67864b2eb53f3f41432f8efc', 'used': {104: '3312e4ba67864b2eb53f3f41432f8efc',
106: '3312e4ba67864b2eb53f3f41432f8efc'}, 106: '3312e4ba67864b2eb53f3f41432f8efc'},
'available': [100, 101, 102, 103, 105], 'available': [100, 101, 102, 103, 105],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -717,6 +724,7 @@ class FakePort(object):
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex, 'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'tags': [], 'tags': [],
'propagate_uplink_status': False, 'propagate_uplink_status': False,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -802,6 +810,7 @@ class FakeNetworkAgent(object):
'admin_state_up': True, 'admin_state_up': True,
'binary': 'binary-' + uuid.uuid4().hex, 'binary': 'binary-' + uuid.uuid4().hex,
'configurations': {'subnet': 2, 'networks': 1}, 'configurations': {'subnet': 2, 'networks': 1},
'location': 'MUNCHMUNCHMUNCH',
} }
agent_attrs.update(attrs) agent_attrs.update(attrs)
agent = fakes.FakeResource(info=copy.deepcopy(agent_attrs), agent = fakes.FakeResource(info=copy.deepcopy(agent_attrs),
@ -870,6 +879,7 @@ class FakeNetworkRBAC(object):
'action': 'access_as_shared', 'action': 'access_as_shared',
'target_tenant': 'target-tenant-' + uuid.uuid4().hex, 'target_tenant': 'target-tenant-' + uuid.uuid4().hex,
'tenant_id': 'tenant-id-' + uuid.uuid4().hex, 'tenant_id': 'tenant-id-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
rbac_attrs.update(attrs) rbac_attrs.update(attrs)
rbac = fakes.FakeResource(info=copy.deepcopy(rbac_attrs), rbac = fakes.FakeResource(info=copy.deepcopy(rbac_attrs),
@ -931,7 +941,8 @@ class FakeNetworkFlavorProfile(object):
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'driver': 'driver-' + uuid.uuid4().hex, 'driver': 'driver-' + uuid.uuid4().hex,
'metainfo': 'metainfo-' + uuid.uuid4().hex, 'metainfo': 'metainfo-' + uuid.uuid4().hex,
'enabled': True 'enabled': True,
'location': 'MUNCHMUNCHMUNCH',
} }
flavor_profile_attrs.update(attrs) flavor_profile_attrs.update(attrs)
@ -990,6 +1001,7 @@ class FakeNetworkQosPolicy(object):
'shared': False, 'shared': False,
'description': 'qos-policy-description-' + uuid.uuid4().hex, 'description': 'qos-policy-description-' + uuid.uuid4().hex,
'rules': rules, 'rules': rules,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1063,7 +1075,8 @@ class FakeNetworkSecGroup(object):
'name': 'security-group-name-' + uuid.uuid4().hex, 'name': 'security-group-name-' + uuid.uuid4().hex,
'id': sg_id, 'id': sg_id,
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'description': 'security-group-description-' + uuid.uuid4().hex 'description': 'security-group-description-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
security_group = fakes.FakeResource( security_group = fakes.FakeResource(
@ -1097,6 +1110,7 @@ class FakeNetworkQosRule(object):
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex, 'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'type': type, 'type': type,
'location': 'MUNCHMUNCHMUNCH',
} }
if type == RULE_TYPE_BANDWIDTH_LIMIT: if type == RULE_TYPE_BANDWIDTH_LIMIT:
qos_rule_attrs['max_kbps'] = randint(1, 10000) qos_rule_attrs['max_kbps'] = randint(1, 10000)
@ -1172,6 +1186,7 @@ class FakeNetworkQosRuleType(object):
# Set default attributes. # Set default attributes.
qos_rule_type_attrs = { qos_rule_type_attrs = {
'type': 'rule-type-' + uuid.uuid4().hex, 'type': 'rule-type-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1230,6 +1245,7 @@ class FakeRouter(object):
'availability_zone_hints': [], 'availability_zone_hints': [],
'availability_zones': [], 'availability_zones': [],
'tags': [], 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1305,7 +1321,8 @@ class FakeSecurityGroup(object):
'stateful': True, 'stateful': True,
'project_id': 'project-id-' + uuid.uuid4().hex, 'project_id': 'project-id-' + uuid.uuid4().hex,
'security_group_rules': [], 'security_group_rules': [],
'tags': [] 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1387,6 +1404,7 @@ class FakeSecurityGroupRule(object):
'remote_ip_prefix': '0.0.0.0/0', 'remote_ip_prefix': '0.0.0.0/0',
'security_group_id': 'security-group-id-' + uuid.uuid4().hex, 'security_group_id': 'security-group-id-' + uuid.uuid4().hex,
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1475,6 +1493,7 @@ class FakeSubnet(object):
'subnetpool_id': None, 'subnetpool_id': None,
'description': 'subnet-description-' + uuid.uuid4().hex, 'description': 'subnet-description-' + uuid.uuid4().hex,
'tags': [], 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1556,6 +1575,7 @@ class FakeFloatingIP(object):
'description': 'floating-ip-description-' + uuid.uuid4().hex, 'description': 'floating-ip-description-' + uuid.uuid4().hex,
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex, 'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'tags': [], 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1620,7 +1640,8 @@ class FakeNetworkMeter(object):
'name': 'meter-name-' + uuid.uuid4().hex, 'name': 'meter-name-' + uuid.uuid4().hex,
'description': 'meter-description-' + uuid.uuid4().hex, 'description': 'meter-description-' + uuid.uuid4().hex,
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'shared': False 'shared': False,
'location': 'MUNCHMUNCHMUNCH',
} }
meter_attrs.update(attrs) meter_attrs.update(attrs)
@ -1669,6 +1690,7 @@ class FakeNetworkMeterRule(object):
'source_ip_prefix': '8.8.8.8/32', 'source_ip_prefix': '8.8.8.8/32',
'destination_ip_prefix': '10.0.0.0/24', 'destination_ip_prefix': '10.0.0.0/24',
'tenant_id': 'project-id-' + uuid.uuid4().hex, 'tenant_id': 'project-id-' + uuid.uuid4().hex,
'location': 'MUNCHMUNCHMUNCH',
} }
meter_rule_attrs.update(attrs) meter_rule_attrs.update(attrs)
@ -1730,6 +1752,7 @@ class FakeSubnetPool(object):
'ip_version': '4', 'ip_version': '4',
'description': 'subnet-pool-description-' + uuid.uuid4().hex, 'description': 'subnet-pool-description-' + uuid.uuid4().hex,
'tags': [], 'tags': [],
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1801,6 +1824,7 @@ class FakeNetworkServiceProvider(object):
'name': 'provider-name-' + uuid.uuid4().hex, 'name': 'provider-name-' + uuid.uuid4().hex,
'service_type': 'service-type-' + uuid.uuid4().hex, 'service_type': 'service-type-' + uuid.uuid4().hex,
'default': False, 'default': False,
'location': 'MUNCHMUNCHMUNCH',
} }
service_provider.update(attrs) service_provider.update(attrs)
@ -1923,6 +1947,7 @@ class FakeFloatingIPPortForwarding(object):
'external_port': randint(1, 65535), 'external_port': randint(1, 65535),
'protocol': 'tcp', 'protocol': 'tcp',
'description': 'some description', 'description': 'some description',
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.
@ -1998,6 +2023,7 @@ class FakeL3ConntrackHelper(object):
'helper': 'tftp', 'helper': 'tftp',
'protocol': 'tcp', 'protocol': 'tcp',
'port': randint(1, 65535), 'port': randint(1, 65535),
'location': 'MUNCHMUNCHMUNCH',
} }
# Overwrite default attributes. # Overwrite default attributes.