Port Group's letfovers

* Fix some docstrings
* Add a pg_get() command to make the interface more complete
* Fix may_exist for pg_add()

Change-Id: I596e0674a860d2dd9738799a09b66e1712953728
This commit is contained in:
Lucas Alvares Gomes 2018-05-31 14:06:33 +01:00
parent 7e980f1ae5
commit 62a619024a
3 changed files with 23 additions and 5 deletions

View File

@ -893,7 +893,8 @@ class API(api.API):
:param name: The name of the port group
:type name: string
:param if_exists: If True, don't fail if the router doesn't exist
:param if_exists: If True, don't fail if the port group
doesn't exist
:type if_exists: boolean
:returns: :class:`Command` with no result
"""
@ -904,9 +905,9 @@ class API(api.API):
:param pg_id: The name or uuid of the port group
:type pg_id: string or uuid.UUID
:param lsp: A list of :class:`Command` with a Logical_Switch_Port
:param lsp: A list of :class:`Command` Logical_Switch_Port
instance result or UUID
:type lsp: A list of :class:`Command` with a Logical_Switch_Port
:type lsp: A list of :class:`Command` Logical_Switch_Port
or string or uuid.UUID
A Logical_Switch_Port instance or string
or uuid.UUID
@ -919,12 +920,21 @@ class API(api.API):
:param pg_id: The name or uuid of the port group
:type pg_id: string or uuid.UUID
:param lsp: A list of :class:`Command` with a Logical_Switch_Port
:param lsp: A list of :class:`Command` Logical_Switch_Port
instance result or UUID
:type lsp: A list of :class:`Command` with a Logical_Switch_Port
:type lsp: A list of :class:`Command` Logical_Switch_Port
or string or uuid.UUID
:type if_exists: If True, don't fail if the logical port(s) doesn't
exist
:type if_exists: boolean
:returns: :class:`Command` with no result
"""
@abc.abstractmethod
def pg_get(self, pg_id):
"""Get port group
:param pg_id: The name or uuid of the port group
:type pg_id: string or uuid.UUID
:returns: :class:`Command` with RowView result
"""

View File

@ -1214,6 +1214,7 @@ class PgAddCommand(cmd.AddCommand):
try:
pg = self.api.lookup(self.table_name, self.name)
self.result = rowview.RowView(pg)
return
except idlutils.RowNotFound:
pass
@ -1287,3 +1288,7 @@ class PgAddPortCommand(_PgUpdatePortsHelper):
class PgDelPortCommand(_PgUpdatePortsHelper):
method = 'delvalue'
class PgGetCommand(cmd.BaseGetRowCommand):
table = 'Port_Group'

View File

@ -286,3 +286,6 @@ class OvnNbApiIdlImpl(ovs_idl.Backend, api.API):
def pg_del_ports(self, pg_id, lsp, if_exists=False):
return cmd.PgDelPortCommand(self, pg_id, lsp=lsp, if_exists=if_exists)
def pg_get(self, pg):
return cmd.PgGetCommand(self, pg)