Update the server to nominally support KMIP 2.0

This commit is contained in:
Peter Hamilton 2019-06-17 12:18:54 -04:00 committed by Peter Hamilton
parent ffe5d7a86c
commit 9fac723b2e
2 changed files with 13 additions and 8 deletions

View File

@ -107,6 +107,7 @@ class KmipEngine(object):
self._id_placeholder = None
self._protocol_versions = [
contents.ProtocolVersion(2, 0),
contents.ProtocolVersion(1, 4),
contents.ProtocolVersion(1, 3),
contents.ProtocolVersion(1, 2),
@ -114,8 +115,8 @@ class KmipEngine(object):
contents.ProtocolVersion(1, 0)
]
self.default_protocol_version = self._protocol_versions[2]
self._protocol_version = self._protocol_versions[2]
self.default_protocol_version = self._protocol_versions[3]
self._protocol_version = self._protocol_versions[3]
self._object_map = {
enums.ObjectType.CERTIFICATE: objects.X509Certificate,

View File

@ -6713,27 +6713,31 @@ class TestKmipEngine(testtools.TestCase):
payloads.DiscoverVersionsResponsePayload
)
self.assertIsNotNone(result.protocol_versions)
self.assertEqual(5, len(result.protocol_versions))
self.assertEqual(6, len(result.protocol_versions))
self.assertEqual(
contents.ProtocolVersion(1, 4),
contents.ProtocolVersion(2, 0),
result.protocol_versions[0]
)
self.assertEqual(
contents.ProtocolVersion(1, 3),
contents.ProtocolVersion(1, 4),
result.protocol_versions[1]
)
self.assertEqual(
contents.ProtocolVersion(1, 2),
contents.ProtocolVersion(1, 3),
result.protocol_versions[2]
)
self.assertEqual(
contents.ProtocolVersion(1, 1),
contents.ProtocolVersion(1, 2),
result.protocol_versions[3]
)
self.assertEqual(
contents.ProtocolVersion(1, 0),
contents.ProtocolVersion(1, 1),
result.protocol_versions[4]
)
self.assertEqual(
contents.ProtocolVersion(1, 0),
result.protocol_versions[5]
)
# Test detailed request.
e._logger = mock.MagicMock()