Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/api/gmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ gmpv224
gmpv225
gmpv226
gmpv227
gmpv228
gmpnext
```
48 changes: 24 additions & 24 deletions docs/api/gmpv228.md → docs/api/gmpnext.md
Original file line number Diff line number Diff line change
@@ -1,156 +1,156 @@
(gmpv228)=
(gmpnext)=

# GMP v22.8
# GMP Next

```{eval-rst}
.. automodule:: gvm.protocols.gmp._gmp228
.. automodule:: gvm.protocols.gmp._gmpnext
```

## Protocol

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.GMPv228
.. autoclass:: gvm.protocols.gmp.GMPNext
:members:
:inherited-members:
```

## Enums

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.AlertCondition
.. autoclass:: gvm.protocols.gmp.requests.next.AlertCondition
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.AlertEvent
.. autoclass:: gvm.protocols.gmp.requests.next.AlertEvent
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.AlertMethod
.. autoclass:: gvm.protocols.gmp.requests.next.AlertMethod
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.AliveTest
.. autoclass:: gvm.protocols.gmp.requests.next.AliveTest
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.CredentialFormat
.. autoclass:: gvm.protocols.gmp.requests.next.CredentialFormat
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.CredentialType
.. autoclass:: gvm.protocols.gmp.requests.next.CredentialType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.EntityType
.. autoclass:: gvm.protocols.gmp.requests.next.EntityType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.FeedType
.. autoclass:: gvm.protocols.gmp.requests.next.FeedType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.FilterType
.. autoclass:: gvm.protocols.gmp.requests.next.FilterType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.HostsOrdering
.. autoclass:: gvm.protocols.gmp.requests.next.HostsOrdering
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.HelpFormat
.. autoclass:: gvm.protocols.gmp.requests.next.HelpFormat
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.InfoType
.. autoclass:: gvm.protocols.gmp.requests.next.InfoType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.PermissionSubjectType
.. autoclass:: gvm.protocols.gmp.requests.next.PermissionSubjectType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.PortRangeType
.. autoclass:: gvm.protocols.gmp.requests.next.PortRangeType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.ReportFormatType
.. autoclass:: gvm.protocols.gmp.requests.next.ReportFormatType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.ResourceType
.. autoclass:: gvm.protocols.gmp.requests.next.ResourceType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.ScannerType
.. autoclass:: gvm.protocols.gmp.requests.next.ScannerType
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.SnmpAuthAlgorithm
.. autoclass:: gvm.protocols.gmp.requests.next.SnmpAuthAlgorithm
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.SnmpPrivacyAlgorithm
.. autoclass:: gvm.protocols.gmp.requests.next.SnmpPrivacyAlgorithm
:members:
:undoc-members:
:no-index:
```

```{eval-rst}
.. autoclass:: gvm.protocols.gmp.requests.v228.TicketStatus
.. autoclass:: gvm.protocols.gmp.requests.next.TicketStatus
:members:
:undoc-members:
:no-index:
Expand Down
8 changes: 4 additions & 4 deletions gvm/protocols/gmp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
dynamically selects the supported GMP protocol of the remote manager daemon.
If you need to use a specific GMP version, you can use the :class:`GMPv224`,
:class:`GMPv225`, :class:`GMPv226`, :class:`GMPv227` or :class:`GMPv228` classes.
:class:`GMPv225`, :class:`GMPv226`, :class:`GMPv227` or :class:`GMPNext` classes.
* :class:`GMP` - Dynamically select supported GMP protocol of the remote manager daemon.
* :class:`GMPv224` - GMP version 22.4
* :class:`GMPv225` - GMP version 22.5
* :class:`GMPv226` - GMP version 22.6
* :class:`GMPv227` - GMP version 22.7
* :class:`GMPv228` - GMP version 22.8
* :class:`GMPNext` - "next" GMP version, containing unstable features
"""

from ._gmp import GMP
from ._gmp224 import GMPv224
from ._gmp225 import GMPv225
from ._gmp226 import GMPv226
from ._gmp227 import GMPv227
from ._gmp228 import GMPv228
from ._gmpnext import GMPNext

Gmp = GMP # for backwards compatibility

Expand All @@ -35,5 +35,5 @@
"GMPv225",
"GMPv226",
"GMPv227",
"GMPv228",
"GMPNext",
)
8 changes: 4 additions & 4 deletions gvm/protocols/gmp/_gmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from ._gmp225 import GMPv225
from ._gmp226 import GMPv226
from ._gmp227 import GMPv227
from ._gmp228 import GMPv228
from ._gmpnext import GMPNext
from .requests import Version

SUPPORTED_GMP_VERSIONS = Union[
GMPv224[T], GMPv225[T], GMPv226[T], GMPv227[T], GMPv228[T]
GMPv224[T], GMPv225[T], GMPv226[T], GMPv227[T], GMPNext[T]
]
_SUPPORTED_GMP_VERSION_STRINGS = ["22.4", "22.5", "22.6", "22.7", "22.8"]

Expand All @@ -42,7 +42,7 @@ class GMP(GvmProtocol[T]):
# gvm.protocols.gmp.GMPv225,
# gvm.protocols.gmp.GMPv226,
# gvm.protocols.gmp.GMPv227,
# or gvm.protocols.gmp.GMPv228
# or gvm.protocols.gmp.GMPNext
# depending on the supported GMP version of the remote manager daemon
resp = gmp.get_tasks()
"""
Expand Down Expand Up @@ -100,7 +100,7 @@ def determine_supported_gmp(self) -> SUPPORTED_GMP_VERSIONS:
elif major_version == 22 and minor_version == 7:
gmp_class = GMPv227
elif major_version == 22 and minor_version >= 8:
gmp_class = GMPv228
gmp_class = GMPNext
if minor_version > 8:
warnings.warn(
"Remote manager daemon uses a newer GMP version than "
Expand Down
12 changes: 8 additions & 4 deletions gvm/protocols/gmp/_gmp228.py → gvm/protocols/gmp/_gmpnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@

from .._protocol import T
from ._gmp227 import GMPv227
from .requests.v228 import AgentInstallers
from .requests.next import AgentInstallers


class GMPv228(GMPv227[T]):
class GMPNext(GMPv227[T]):
"""
A class implementing the Greenbone Management Protocol (GMP) version 22.8
A class implementing the "Next" version of Greenbone Management Protocol (GMP)
containing features that are not part of the stable release yet.

These features may change at any time and may not be available in all builds
of the gvmd back-end.

Example:

.. code-block:: python

from gvm.protocols.gmp import GMPv228 as GMP
from gvm.protocols.gmp.next import GMP

with GMP(connection) as gmp:
resp = gmp.get_tasks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

from gvm.protocols.gmp.requests.v228._agent_installers import AgentInstallers
from gvm.protocols.gmp.requests.next._agent_installers import AgentInstallers

from .._entity_id import EntityID
from .._version import Version
Expand Down
7 changes: 4 additions & 3 deletions gvm/protocols/next.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"""Latest supported protocols, including unstable ones.
This module exposes the latest supported protocols of GVM including versions
not yet released as stable.
not yet released as stable, which may contain features that can change at any time
and may not be available in all builds of the gvmd back-end.
The provided Gmp class implements the latest Greenbone Management Protocol.
The provided Osp class implements the latest Open Scanner Protocol.
Expand All @@ -14,12 +15,12 @@
:py:mod:`gvm.protocols`.
Exports:
- :py:class:`gvm.protocols.gmp.GMPv227`
- :py:class:`gvm.protocols.gmp.GMPNext`
- :py:class:`gvm.protocols.ospv1.Osp`
"""

from .gmp import (
GMPv227 as Gmp,
GMPNext as Gmp,
)
from .ospv1 import Osp

Expand Down
4 changes: 2 additions & 2 deletions tests/protocols/gmp/test_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from unittest.mock import MagicMock, patch

from gvm.errors import GvmError
from gvm.protocols.gmp import Gmp, GMPv228
from gvm.protocols.gmp import Gmp, GMPNext
from gvm.protocols.gmp._gmp224 import GMPv224
from gvm.protocols.gmp._gmp225 import GMPv225
from gvm.protocols.gmp._gmp226 import GMPv226
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_select_gmpv228(self):

with self.gmp as gmp:
self.assertEqual(gmp.get_protocol_version(), (22, 8))
self.assertIsInstance(gmp, GMPv228)
self.assertIsInstance(gmp, GMPNext)

self.connection.read.return_value(
b'<get_version_response status="200" status_text="OK">'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#

from gvm.protocols.gmp import GMPv228
from gvm.protocols.gmp import GMPNext

from .. import GmpTestCase as BaseGMPTestCase


class GMPTestCase(BaseGMPTestCase):
gmp_class = GMPv228
gmp_class = GMPNext
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
#

from ...gmpv228 import GMPTestCase
from ...gmpnext import GMPTestCase
from .agent_installers.test_get_agent_installer import (
GmpGetAgentInstallerTestMixin,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/test_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class LatestProtocolsTestCase(unittest.TestCase):
def test_gmp_version(self):
self.assertEqual(Gmp.get_protocol_version(), (22, 7))
self.assertEqual(Gmp.get_protocol_version(), (22, 8))

def test_osp_version(self):
self.assertEqual(Osp.get_protocol_version(), (1, 2))
Expand Down