Skip to content

Commit

Permalink
Merge pull request #384 from timopollmeier/next-gmp-version
Browse files Browse the repository at this point in the history
Add protocol version "next" and GMP 21.04 doc
  • Loading branch information
bjoernricks authored Jan 27, 2021
2 parents 3024576 + 5ee3ab1 commit b50fd9a
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
* Added protocol version "next" and GMP 21.04 doc [#384](https://github.com/greenbone/python-gvm/pull/384)

### Changed
### Deprecated
### Removed
Expand Down
92 changes: 92 additions & 0 deletions docs/api/gmpv214.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
.. _gmpv214:

GMP v21.4
^^^^^^^^^

.. automodule:: gvm.protocols.gmpv214

Enums
-----

.. autoclass:: AlertCondition
:members:
:undoc-members:

.. autoclass:: AlertEvent
:members:
:undoc-members:

.. autoclass:: AlertMethod
:members:
:undoc-members:

.. autoclass:: AliveTest
:members:
:undoc-members:

.. autoclass:: AssetType
:members:
:undoc-members:

.. autoclass:: CredentialFormat
:members:
:undoc-members:

.. autoclass:: CredentialType
:members:
:undoc-members:

.. autoclass:: EntityType
:members:
:undoc-members:

.. autoclass:: FeedType
:members:
:undoc-members:

.. autoclass:: FilterType
:members:
:undoc-members:

.. autoclass:: HostsOrdering
:members:
:undoc-members:

.. autoclass:: InfoType
:members:
:undoc-members:

.. autoclass:: PermissionSubjectType
:members:
:undoc-members:

.. autoclass:: ScannerType
:members:
:undoc-members:

.. autoclass:: PortRangeType
:members:
:undoc-members:

.. autoclass:: SeverityLevel
:members:
:undoc-members:

.. autoclass:: SnmpAuthAlgorithm
:members:
:undoc-members:

.. autoclass:: SnmpPrivacyAlgorithm
:members:
:undoc-members:

.. autoclass:: TicketStatus
:members:
:undoc-members:

Protocol
--------

.. autoclass:: Gmp
:members:
:inherited-members:
11 changes: 9 additions & 2 deletions docs/api/protocols.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Protocols
gmpv8
gmpv9
gmpv208
gmpv214
ospv1

Dynamic
Expand All @@ -20,7 +21,13 @@ Dynamic
To dynamically use the supported GMP version of the manager daemon see
:mod:`gvm.protocols.gmp` for details.

Latest
^^^^^^
"latest" protocols
^^^^^^^^^^^^^^^^^^

.. automodule:: gvm.protocols.latest


"next" protocols
^^^^^^^^^^^^^^^^

.. automodule:: gvm.protocols.next
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -24,7 +24,7 @@
# -- Project information -----------------------------------------------------

project = 'python-gvm'
copyright = '2018 - 2019, Greenbone Networks GmbH'
copyright = '2018 - 2021, Greenbone Networks GmbH'
author = 'Greenbone Networks GmbH'

# The short X.Y version
Expand Down
4 changes: 3 additions & 1 deletion gvm/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Package for supported Greenbone Protocol versions.
Currently `GMP version 7`_, `GMP version 8`_, `GMP version 9`_ ,
`GMP version 20.08`_ and `OSP version 1`_ are supported.
`GMP version 20.08`_, `GMP version 21.04`_ and `OSP version 1`_ are supported.
.. _GMP version 7:
https://docs.greenbone.net/API/GMP/gmp-7.0.html
Expand All @@ -29,6 +29,8 @@
https://docs.greenbone.net/API/GMP/gmp-9.0.html
.. _GMP version 20.08:
https://docs.greenbone.net/API/GMP/gmp-20.08.html
.. _GMP version 21.04:
https://docs.greenbone.net/API/GMP/gmp-21.04.html
.. _OSP version 1:
https://docs.greenbone.net/API/OSP/osp-1.2.html
"""
9 changes: 5 additions & 4 deletions gvm/protocols/latest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 - 2019 Greenbone Networks GmbH
# Copyright (C) 2018 - 2021 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
Expand All @@ -15,9 +15,10 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Latest supported protocols.
"""Latest supported stable protocols.
This module exposes the latest supported protocols of gvm.
This module exposes the latest supported protocols for the newest stable
release branch of GVM.
The provided Gmp class implements the latest `Greenbone Management
Protocol`_.
Expand All @@ -27,7 +28,7 @@
:py:mod:`gvm.protocols`.
Exports:
- :py:class:`gvm.protocols.gmpv20.08Gmp`
- :py:class:`gvm.protocols.gmpv208.Gmp`
- :py:class:`gvm.protocols.ospv1.Osp`
.. _Greenbone Management Protocol:
Expand Down
138 changes: 138 additions & 0 deletions gvm/protocols/next.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 - 2021 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Latest supported protocols, including unstable ones.
This module exposes the latest supported protocols of GVM including versions
not yet released as stable.
The provided Gmp class implements the latest `Greenbone Management
Protocol`_.
The provided Osp class implements the latest Open Scanner Protocol.
For details about the possible supported protocol versions please take a look at
:py:mod:`gvm.protocols`.
Exports:
- :py:class:`gvm.protocols.gmpv214.Gmp`
- :py:class:`gvm.protocols.ospv1.Osp`
.. _Greenbone Management Protocol:
https://docs.greenbone.net/API/GMP/gmp.html
"""

from .gmpv214 import (
Gmp,
AggregateStatistic,
AlertCondition,
AlertEvent,
AlertMethod,
AliveTest,
AssetType,
CredentialFormat,
CredentialType,
EntityType,
FeedType,
FilterType,
HostsOrdering,
InfoType,
PermissionSubjectType,
PortRangeType,
ScannerType,
SeverityLevel,
SnmpAuthAlgorithm,
SnmpPrivacyAlgorithm,
SortOrder,
TicketStatus,
TimeUnit,
UserAuthType,
get_aggregate_statistic_from_string,
get_alert_condition_from_string,
get_alert_event_from_string,
get_alert_method_from_string,
get_alive_test_from_string,
get_asset_type_from_string,
get_credential_format_from_string,
get_credential_type_from_string,
get_entity_type_from_string,
get_feed_type_from_string,
get_filter_type_from_string,
get_hosts_ordering_from_string,
get_info_type_from_string,
get_permission_subject_type_from_string,
get_port_range_type_from_string,
get_scanner_type_from_string,
get_severity_level_from_string,
get_snmp_auth_algorithm_from_string,
get_snmp_privacy_algorithm_from_string,
get_sort_order_from_string,
get_ticket_status_from_string,
get_time_unit_from_string,
get_user_auth_type_from_string,
)
from .ospv1 import Osp

__all__ = [
"Gmp",
"Osp",
"AggregateStatistic",
"AlertCondition",
"AlertEvent",
"AlertMethod",
"AliveTest",
"AssetType",
"CredentialType",
"CredentialFormat",
"EntityType",
"FeedType",
"FilterType",
"HostsOrdering",
"InfoType",
"PermissionSubjectType",
"PortRangeType",
"ScannerType",
"SeverityLevel",
"SnmpAuthAlgorithm",
"SnmpPrivacyAlgorithm",
"SortOrder",
"TicketStatus",
"TimeUnit",
"UserAuthType",
"get_aggregate_statistic_from_string",
"get_alert_condition_from_string",
"get_alert_event_from_string",
"get_alert_method_from_string",
"get_alive_test_from_string",
"get_asset_type_from_string",
"get_credential_format_from_string",
"get_credential_type_from_string",
"get_entity_type_from_string",
"get_feed_type_from_string",
"get_filter_type_from_string",
"get_hosts_ordering_from_string",
"get_info_type_from_string",
"get_permission_subject_type_from_string",
"get_port_range_type_from_string",
"get_scanner_type_from_string",
"get_severity_level_from_string",
"get_snmp_auth_algorithm_from_string",
"get_snmp_privacy_algorithm_from_string",
"get_sort_order_from_string",
"get_ticket_status_from_string",
"get_time_unit_from_string",
"get_user_auth_type_from_string",
]
33 changes: 33 additions & 0 deletions tests/protocols/test_next.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Greenbone Networks GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest

from gvm.protocols.next import Gmp, Osp


class LatestProtocolsTestCase(unittest.TestCase):
def test_gmp_version(self):
self.assertEqual(Gmp.get_protocol_version(), (21, 4))

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


if __name__ == '__main__':
unittest.main()

0 comments on commit b50fd9a

Please sign in to comment.