VNI support in BGPVPN CLI
Changes to support VNI attribute through BGPVPN CLIs Change-Id: I1f828ef965d5b117539b88a290e2b9b966016336 Partial-Bug: #1590908 Depends-On: I3d47000bb0ad8434f88d016acb5b05fb7142e47a
This commit is contained in:
parent
d7b4a40166
commit
5fddd71452
neutronclient
releasenotes/notes
@ -40,6 +40,7 @@ _attr_map = (
|
||||
nc_osc_utils.LIST_LONG_ONLY),
|
||||
('networks', 'Associated Networks', nc_osc_utils.LIST_LONG_ONLY),
|
||||
('routers', 'Associated Routers', nc_osc_utils.LIST_LONG_ONLY),
|
||||
('vni', 'VNI', nc_osc_utils.LIST_LONG_ONLY),
|
||||
)
|
||||
_formatters = {
|
||||
'route_targets': format_columns.ListColumn,
|
||||
@ -144,6 +145,10 @@ def _get_common_parser(parser, update=None):
|
||||
action='store_true',
|
||||
help=_('Empty route distinguisher list'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--vni', type=int,
|
||||
help=_('VXLAN Network Identifier to be used for this BGPVPN '
|
||||
'when a VXLAN encapsulation is used'))
|
||||
|
||||
|
||||
def _args2body(client_manager, id, action, args):
|
||||
@ -159,6 +164,9 @@ def _args2body(client_manager, id, action, args):
|
||||
if 'name' in args and args.name is not None:
|
||||
attrs['name'] = str(args.name)
|
||||
|
||||
if 'vni' in args and args.vni is not None:
|
||||
attrs['vni'] = args.vni
|
||||
|
||||
if args.purge_route_target:
|
||||
attrs['route_targets'] = []
|
||||
elif args.route_targets:
|
||||
@ -235,6 +243,8 @@ class CreateBgpvpn(command.ShowOne):
|
||||
attrs['export_targets'] = parsed_args.export_targets
|
||||
if parsed_args.route_distinguishers is not None:
|
||||
attrs['route_distinguishers'] = parsed_args.route_distinguishers
|
||||
if parsed_args.vni is not None:
|
||||
attrs['vni'] = parsed_args.vni
|
||||
if 'project' in parsed_args and parsed_args.project is not None:
|
||||
project_id = nc_osc_utils.find_project(
|
||||
self.app.client_manager.identity,
|
||||
|
@ -68,6 +68,7 @@ class FakeBgpvpn(object):
|
||||
'route_distinguishers': [],
|
||||
'networks': [],
|
||||
'routers': [],
|
||||
'vni': 100,
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
|
@ -63,6 +63,7 @@ class TestCreateBgpvpn(fakes.TestNeutronClientBgpvpn):
|
||||
('project', None),
|
||||
('name', None),
|
||||
('type', 'l3'),
|
||||
('vni', None),
|
||||
('route_targets', None),
|
||||
('import_targets', None),
|
||||
('export_targets', None),
|
||||
@ -83,6 +84,7 @@ class TestCreateBgpvpn(fakes.TestNeutronClientBgpvpn):
|
||||
'tenant_id': 'new_fake_project_id',
|
||||
'name': 'fake_name',
|
||||
'type': 'l2',
|
||||
'vni': 100,
|
||||
'route_targets': ['fake_rt1', 'fake_rt2', 'fake_rt3'],
|
||||
'import_targets': ['fake_irt1', 'fake_irt2', 'fake_irt3'],
|
||||
'export_targets': ['fake_ert1', 'fake_ert2', 'fake_ert3'],
|
||||
@ -95,6 +97,7 @@ class TestCreateBgpvpn(fakes.TestNeutronClientBgpvpn):
|
||||
'--project', fake_bgpvpn['tenant_id'],
|
||||
'--name', fake_bgpvpn['name'],
|
||||
'--type', fake_bgpvpn['type'],
|
||||
'--vni', str(fake_bgpvpn['vni']),
|
||||
]
|
||||
for rt in fake_bgpvpn['route_targets']:
|
||||
arglist.extend(['--route-target', rt])
|
||||
@ -108,6 +111,7 @@ class TestCreateBgpvpn(fakes.TestNeutronClientBgpvpn):
|
||||
('project', fake_bgpvpn['tenant_id']),
|
||||
('name', fake_bgpvpn['name']),
|
||||
('type', fake_bgpvpn['type']),
|
||||
('vni', fake_bgpvpn['vni']),
|
||||
('route_targets', fake_bgpvpn['route_targets']),
|
||||
('import_targets', fake_bgpvpn['import_targets']),
|
||||
('export_targets', fake_bgpvpn['export_targets']),
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
CLI support for VXLAN VNI ID attribute in bgpvpn.
|
||||
An optional argument ``--vni`` is added to ``openstack bgpvpn``
|
||||
commands to configure VXLAN Network Identifier when VXLAN
|
||||
encapsulation is used for the bgpvpn.
|
Loading…
x
Reference in New Issue
Block a user