Merge "Add source_ip_prefix and destination_ip_prefix to metering label rules"
This commit is contained in:
commit
375fe31525
@ -46,6 +46,10 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
attrs['direction'] = 'egress'
|
attrs['direction'] = 'egress'
|
||||||
if parsed_args.remote_ip_prefix is not None:
|
if parsed_args.remote_ip_prefix is not None:
|
||||||
attrs['remote_ip_prefix'] = parsed_args.remote_ip_prefix
|
attrs['remote_ip_prefix'] = parsed_args.remote_ip_prefix
|
||||||
|
if parsed_args.source_ip_prefix is not None:
|
||||||
|
attrs['source_ip_prefix'] = parsed_args.source_ip_prefix
|
||||||
|
if parsed_args.destination_ip_prefix is not None:
|
||||||
|
attrs['destination_ip_prefix'] = parsed_args.destination_ip_prefix
|
||||||
if parsed_args.meter is not None:
|
if parsed_args.meter is not None:
|
||||||
attrs['metering_label_id'] = parsed_args.meter
|
attrs['metering_label_id'] = parsed_args.meter
|
||||||
if parsed_args.project is not None:
|
if parsed_args.project is not None:
|
||||||
@ -97,9 +101,21 @@ class CreateMeterRule(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--remote-ip-prefix',
|
'--remote-ip-prefix',
|
||||||
metavar='<remote-ip-prefix>',
|
metavar='<remote-ip-prefix>',
|
||||||
required=True,
|
required=False,
|
||||||
help=_('The remote IP prefix to associate with this rule'),
|
help=_('The remote IP prefix to associate with this rule'),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--source-ip-prefix',
|
||||||
|
metavar='<remote-ip-prefix>',
|
||||||
|
required=False,
|
||||||
|
help=_('The source IP prefix to associate with this rule'),
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--destination-ip-prefix',
|
||||||
|
metavar='<remote-ip-prefix>',
|
||||||
|
required=False,
|
||||||
|
help=_('The destination IP prefix to associate with this rule'),
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'meter',
|
'meter',
|
||||||
metavar='<meter>',
|
metavar='<meter>',
|
||||||
@ -168,12 +184,16 @@ class ListMeterRule(command.Lister):
|
|||||||
'excluded',
|
'excluded',
|
||||||
'direction',
|
'direction',
|
||||||
'remote_ip_prefix',
|
'remote_ip_prefix',
|
||||||
|
'source_ip_prefix',
|
||||||
|
'destination_ip_prefix',
|
||||||
)
|
)
|
||||||
column_headers = (
|
column_headers = (
|
||||||
'ID',
|
'ID',
|
||||||
'Excluded',
|
'Excluded',
|
||||||
'Direction',
|
'Direction',
|
||||||
'Remote IP Prefix',
|
'Remote IP Prefix',
|
||||||
|
'Source IP Prefix',
|
||||||
|
'Destination IP Prefix',
|
||||||
)
|
)
|
||||||
data = client.metering_label_rules()
|
data = client.metering_label_rules()
|
||||||
return (column_headers,
|
return (column_headers,
|
||||||
|
@ -1591,6 +1591,8 @@ class FakeNetworkMeterRule(object):
|
|||||||
'excluded': False,
|
'excluded': False,
|
||||||
'metering_label_id': 'meter-label-id-' + uuid.uuid4().hex,
|
'metering_label_id': 'meter-label-id-' + uuid.uuid4().hex,
|
||||||
'remote_ip_prefix': '10.0.0.0/24',
|
'remote_ip_prefix': '10.0.0.0/24',
|
||||||
|
'source_ip_prefix': '8.8.8.8/32',
|
||||||
|
'destination_ip_prefix': '10.0.0.0/24',
|
||||||
'tenant_id': 'project-id-' + uuid.uuid4().hex,
|
'tenant_id': 'project-id-' + uuid.uuid4().hex,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,20 +42,24 @@ class TestCreateMeterRule(TestMeterRule):
|
|||||||
)
|
)
|
||||||
|
|
||||||
columns = (
|
columns = (
|
||||||
|
'destination_ip_prefix',
|
||||||
'direction',
|
'direction',
|
||||||
'excluded',
|
'excluded',
|
||||||
'id',
|
'id',
|
||||||
'metering_label_id',
|
'metering_label_id',
|
||||||
'project_id',
|
'project_id',
|
||||||
'remote_ip_prefix',
|
'remote_ip_prefix',
|
||||||
|
'source_ip_prefix',
|
||||||
)
|
)
|
||||||
data = (
|
data = (
|
||||||
|
new_rule.destination_ip_prefix,
|
||||||
new_rule.direction,
|
new_rule.direction,
|
||||||
new_rule.excluded,
|
new_rule.excluded,
|
||||||
new_rule.id,
|
new_rule.id,
|
||||||
new_rule.metering_label_id,
|
new_rule.metering_label_id,
|
||||||
new_rule.project_id,
|
new_rule.project_id,
|
||||||
new_rule.remote_ip_prefix,
|
new_rule.remote_ip_prefix,
|
||||||
|
new_rule.source_ip_prefix,
|
||||||
)
|
)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -228,6 +232,8 @@ class TestListMeterRule(TestMeterRule):
|
|||||||
'Excluded',
|
'Excluded',
|
||||||
'Direction',
|
'Direction',
|
||||||
'Remote IP Prefix',
|
'Remote IP Prefix',
|
||||||
|
'Source IP Prefix',
|
||||||
|
'Destination IP Prefix'
|
||||||
)
|
)
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
@ -238,6 +244,8 @@ class TestListMeterRule(TestMeterRule):
|
|||||||
rule.excluded,
|
rule.excluded,
|
||||||
rule.direction,
|
rule.direction,
|
||||||
rule.remote_ip_prefix,
|
rule.remote_ip_prefix,
|
||||||
|
rule.source_ip_prefix,
|
||||||
|
rule.destination_ip_prefix
|
||||||
))
|
))
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -270,21 +278,25 @@ class TestShowMeterRule(TestMeterRule):
|
|||||||
)
|
)
|
||||||
|
|
||||||
columns = (
|
columns = (
|
||||||
|
'destination_ip_prefix',
|
||||||
'direction',
|
'direction',
|
||||||
'excluded',
|
'excluded',
|
||||||
'id',
|
'id',
|
||||||
'metering_label_id',
|
'metering_label_id',
|
||||||
'project_id',
|
'project_id',
|
||||||
'remote_ip_prefix',
|
'remote_ip_prefix',
|
||||||
|
'source_ip_prefix',
|
||||||
)
|
)
|
||||||
|
|
||||||
data = (
|
data = (
|
||||||
|
new_rule.destination_ip_prefix,
|
||||||
new_rule.direction,
|
new_rule.direction,
|
||||||
new_rule.excluded,
|
new_rule.excluded,
|
||||||
new_rule.id,
|
new_rule.id,
|
||||||
new_rule.metering_label_id,
|
new_rule.metering_label_id,
|
||||||
new_rule.project_id,
|
new_rule.project_id,
|
||||||
new_rule.remote_ip_prefix,
|
new_rule.remote_ip_prefix,
|
||||||
|
new_rule.source_ip_prefix,
|
||||||
)
|
)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user