Add multi-segment and trunk support to N1KV Neutron client
Change-Id: I7e1f8ffb0c5aadfbfd1b808e49495f27aae4ef12 Implements: blueprint neutron-client-n1000v-multisegment-trunk
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#
|
||||
#@author Abhishek Raut, Cisco Systems
|
||||
#@author Sergey Sudakovich, Cisco Systems
|
||||
#@author Rudrajit Tapadar, Cisco Systems
|
||||
|
||||
import logging
|
||||
|
||||
@@ -22,7 +23,8 @@ from neutronclient.neutron.v2_0 import parse_args_to_dict
|
||||
from neutronclient.openstack.common.gettextutils import _
|
||||
|
||||
RESOURCE = 'network_profile'
|
||||
SEGMENT_TYPE_CHOICES = ['vlan', 'vxlan']
|
||||
SEGMENT_TYPE_CHOICES = ['vlan', 'vxlan', 'multi-segment', 'trunk']
|
||||
SEGMENT_SUBTYPE_CHOICES = ['vlan', 'vxlan']
|
||||
|
||||
|
||||
class ListNetworkProfile(neutronV20.ListCommand):
|
||||
@@ -31,7 +33,7 @@ class ListNetworkProfile(neutronV20.ListCommand):
|
||||
resource = RESOURCE
|
||||
log = logging.getLogger(__name__ + '.ListNetworkProfile')
|
||||
_formatters = {}
|
||||
list_columns = ['id', 'name', 'segment_type', 'segment_range',
|
||||
list_columns = ['id', 'name', 'segment_type', 'sub_type', 'segment_range',
|
||||
'physical_network', 'multicast_ip_index',
|
||||
'multicast_ip_range']
|
||||
|
||||
@@ -56,6 +58,9 @@ class CreateNetworkProfile(neutronV20.CreateCommand):
|
||||
parser.add_argument('segment_type',
|
||||
choices=SEGMENT_TYPE_CHOICES,
|
||||
help='Segment type')
|
||||
parser.add_argument('--sub_type',
|
||||
choices=SEGMENT_SUBTYPE_CHOICES,
|
||||
help='Sub-type for the Segment')
|
||||
parser.add_argument('--segment_range',
|
||||
help='Range for the Segment')
|
||||
parser.add_argument('--physical_network',
|
||||
@@ -70,6 +75,9 @@ class CreateNetworkProfile(neutronV20.CreateCommand):
|
||||
if parsed_args.segment_type:
|
||||
body['network_profile'].update({'segment_type':
|
||||
parsed_args.segment_type})
|
||||
if parsed_args.sub_type:
|
||||
body['network_profile'].update({'sub_type':
|
||||
parsed_args.sub_type})
|
||||
if parsed_args.segment_range:
|
||||
body['network_profile'].update({'segment_range':
|
||||
parsed_args.segment_range})
|
||||
|
||||
@@ -84,3 +84,28 @@ class CLITestV20NetworkProfile(test_cli20.CLITestV20Base):
|
||||
myid = 'myid'
|
||||
args = [myid]
|
||||
self._test_delete_resource(resource, cmd, myid, args)
|
||||
|
||||
def test_create_networkprofile_trunk(self):
|
||||
"""Create networkprofile: myid."""
|
||||
resource = 'network_profile'
|
||||
cmd = networkprofile.CreateNetworkProfile(test_cli20.
|
||||
MyApp(sys.stdout), None)
|
||||
name = 'myname'
|
||||
myid = 'myid'
|
||||
segment_type = 'trunk'
|
||||
args = [name, segment_type, '--sub_type', 'vlan']
|
||||
position_names = ['name', 'segment_type', ]
|
||||
position_values = [name, segment_type, ]
|
||||
self._test_create_resource(resource, cmd, name, myid, args,
|
||||
position_names, position_values,
|
||||
sub_type='vlan')
|
||||
|
||||
def test_list_networkprofile_trunk_detail(self):
|
||||
"""List networkprofile: -D."""
|
||||
resources = 'network_profiles'
|
||||
cmd = networkprofile.ListNetworkProfile(test_cli20.MyApp(sys.stdout),
|
||||
None)
|
||||
contents = [{'name': 'myname', 'segment_type': 'trunk',
|
||||
'--sub_type': 'vlan'}]
|
||||
self._test_list_resources(resources, cmd, True,
|
||||
response_contents=contents)
|
||||
|
||||
Reference in New Issue
Block a user