Add source_ip_prefix and destination_ip_prefix to metering label rules
As proposed in the RFE and then approved in the spec, we are adding to the neutron metering rules two new parameters. The source IP prefix, and destination IP prefix. Partially-Implements: https://bugs.launchpad.net/neutron/+bug/1889431 RFE: https://bugs.launchpad.net/neutron/+bug/1889431 Depends-On: https://review.opendev.org/#/c/746203/ Depends-On: https://review.opendev.org/#/c/744702/ Depends-On: https://review.opendev.org/#/c/743828/ Depends-On: https://review.opendev.org/#/c/746142/ Depends-On: https://review.opendev.org/#/c/746347/ Change-Id: Ib288e276fbe5337e2dfc92a8f0f11dfcb425322b
This commit is contained in:
parent
d4022f62a0
commit
878a8d944d
@ -27,7 +27,7 @@ class MeteringLabelRule(resource.Resource):
|
||||
|
||||
_query_mapping = resource.QueryParameters(
|
||||
'direction', 'metering_label_id', 'remote_ip_prefix',
|
||||
project_id='tenant_id',
|
||||
'source_ip_prefix', 'destination_ip_prefix', project_id='tenant_id',
|
||||
)
|
||||
|
||||
# Properties
|
||||
@ -52,3 +52,8 @@ class MeteringLabelRule(resource.Resource):
|
||||
"'source_ip_prefix' and/or 'destination_ip_prefix' "
|
||||
"parameters. For more details, you can check the "
|
||||
"spec: https://review.opendev.org/#/c/744702/.")
|
||||
|
||||
#: The source IP prefix to be associated with this metering label rule.
|
||||
source_ip_prefix = resource.Body('source_ip_prefix')
|
||||
#: The destination IP prefix to be associated with this metering label rule
|
||||
destination_ip_prefix = resource.Body('destination_ip_prefix')
|
||||
|
@ -46,3 +46,23 @@ class TestMeteringLabelRule(base.TestCase):
|
||||
self.assertEqual(EXAMPLE['metering_label_id'], sot.metering_label_id)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['remote_ip_prefix'], sot.remote_ip_prefix)
|
||||
|
||||
def test_make_it_source_and_destination(self):
|
||||
custom_example = EXAMPLE.copy()
|
||||
custom_example["source_ip_prefix"] = "192.168.0.11/32"
|
||||
custom_example["destination_ip_prefix"] = "0.0.0.0/0"
|
||||
|
||||
sot = metering_label_rule.MeteringLabelRule(**custom_example)
|
||||
self.assertEqual(custom_example['direction'], sot.direction)
|
||||
self.assertFalse(sot.is_excluded)
|
||||
self.assertEqual(custom_example['id'], sot.id)
|
||||
self.assertEqual(
|
||||
custom_example['metering_label_id'], sot.metering_label_id)
|
||||
self.assertEqual(custom_example['tenant_id'], sot.project_id)
|
||||
self.assertEqual(
|
||||
custom_example['remote_ip_prefix'], sot.remote_ip_prefix)
|
||||
|
||||
self.assertEqual(
|
||||
custom_example['source_ip_prefix'], sot.source_ip_prefix)
|
||||
self.assertEqual(
|
||||
custom_example['destination_ip_prefix'], sot.destination_ip_prefix)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add ``source_ip_prefix`` and ``destination_ip_prefix`` to Neutron metering
|
||||
label rules.
|
Loading…
Reference in New Issue
Block a user