Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify operational SRIOV model #1

Open
wants to merge 10 commits into
base: stable/queens
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions nuage_neutronclient/net_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,31 @@ def add_known_arguments(self, parser):
dest='switch_info',
help=_('Name of the switch device'))
parser.add_argument(
'--port-id',
dest='port_id',
help=_('Port mnemonic of phys port of the switch'))
'--port-name',
dest='port_name',
help=_('Physical port name of port on the switch'))
parser.add_argument(
'--port-desc',
dest='port_desc',
help=_('Port description to put in VSD'))
parser.add_argument(
'--host-id',
help=_('Nova compute host id. hypervisor_hostname'))
parser.add_argument(
'--pci-slot',
dest='pci_slot',
help=_('PCI id of the VF device.'))
help=_('Optional PCI id of a VF device on the given host'))
parser.add_argument(
'--physnet',
dest='physnet',
help=_('Physical network to which the NIC is connected'))

return parser

def args2body(self, args):
body = {}
attributes = ['switch_id', 'switch_info', 'port_id',
'host_id', 'pci_slot']
attributes = ['switch_id', 'switch_info', 'port_name', 'port_desc',
'host_id', 'pci_slot', 'physnet']
gw_mappingV20.update_dict(args, body, attributes)

return {'switchport_mapping': body}
Expand All @@ -67,7 +75,7 @@ class SwitchportMappingList(extension.ClientExtensionList, SwitchportMapping):
"""List switchport mappings."""

shell_command = 'nuage-switchport-mapping-list'
list_columns = ['id', 'switch_id', 'port_id', 'host_id', 'pci_slot']
list_columns = ['id', 'switch_id', 'port_uuid', 'host_id', 'physnet']
pagination_support = True
sorting_support = True

Expand Down Expand Up @@ -101,21 +109,28 @@ def add_known_arguments(self, parser):
dest='switch_info',
help=_('Name of the gateway device'))
parser.add_argument(
'--port_id',
dest='port_id',
help=_('Port mnemoniq of phys port of gateway'))
'--port-name',
dest='port_name',
help=_('Physical port name of gateway port'))
parser.add_argument(
'--port-desc',
dest='port_desc',
help=_('Port description to put in VSD'))
parser.add_argument(
'--host-id',
help=_('Nova compute host id. hypervisor_hostname'))
parser.add_argument(
'--pci-slot',
dest='pci_slot',
help=_('PCI id of the device.'))
help=_('Optional PCI slot of a VF on the given host'))
parser.add_argument(
'--physnet',
dest='physnet',
help=_('Physical network to which the NIC is connected.'))

def args2body(self, args):
body = {}
attributes = ['switch_id', 'switch_info', 'port_id',
'host_id', 'pci_slot']
attributes = ['switch_id', 'switch_info', 'port_name', 'port_desc',
'host_id', 'pci_slot', 'physnet']
gw_mappingV20.update_dict(args, body, attributes)

return {'switchport_mapping': body}
Expand Down
31 changes: 19 additions & 12 deletions nuage_neutronclient/osc/v2/nuage_switchport_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
RESOURCE_NAME = 'switchport_mapping'
RESOURCE_NAME_PLURAL = 'switchport_mappings'


_attr_map = (('id', 'ID', column_util.LIST_BOTH),
('switch_id', 'Switch ID', column_util.LIST_BOTH),
('switch_info', 'Switch Info', column_util.LIST_BOTH),
('port_id', 'Port ID', column_util.LIST_BOTH),
('host_id', 'Host ID', column_util.LIST_BOTH),
('pci_slot', 'PCI slot', column_util.LIST_BOTH),
# ('port_name', 'Port Name', column_util.LIST_BOTH),
('physnet', 'Physical Network', column_util.LIST_BOTH),
('host_id', 'Host ID[:PCI slot]', column_util.LIST_BOTH),
('port_uuid', 'Port UUID', column_util.LIST_BOTH))


def add_arguments_for_create_update(parser, is_create):
parser.add_argument(
'--switch-id',
Expand All @@ -49,26 +47,35 @@ def add_arguments_for_create_update(parser, is_create):
help=_('Name of the switch device'),
required=False)
parser.add_argument(
'--port-id',
dest='port_id',
help=_('Name of the port of the switch'),
'--port-name',
dest='port_name',
help=_('Physical port name of the switch port'),
required=is_create)
parser.add_argument(
'--port-desc',
dest='port_desc',
help=_('Port description to put in VSD'),
required=False)
parser.add_argument(
'--host-id',
help=_('Nova compute host id, hypervisor_hostname'),
required=is_create)
parser.add_argument(
'--pci-slot',
dest='pci_slot',
help=_('PCI id of the VF device.'),
help=_('Optional PCI slot of a VF on given host'),
required=False)
parser.add_argument(
'--physnet',
dest='physnet',
help=_('Physical network for the given NIC.'),
required=is_create)


def get_body_update_create(parsed_args):
body = {RESOURCE_NAME: {}}
update_dict(parsed_args, body[RESOURCE_NAME],
('switch_id', 'switch_info', 'port_id',
'host_id', 'pci_slot'))
('switch_id', 'switch_info', 'port_name', 'port_desc',
'host_id', 'pci_slot', 'physnet'))
return body


Expand Down