diff --git a/bddtests/api_pb2.py b/bddtests/api_pb2.py new file mode 100644 index 00000000000..72c4e0511c5 --- /dev/null +++ b/bddtests/api_pb2.py @@ -0,0 +1,229 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: api.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +import fabric_pb2 as fabric__pb2 +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='api.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\tapi.proto\x12\x06protos\x1a\x0c\x66\x61\x62ric.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x1d\n\x0b\x42lockNumber\x12\x0e\n\x06number\x18\x01 \x01(\x04\"\x1b\n\nBlockCount\x12\r\n\x05\x63ount\x18\x01 \x01(\x04\x32\x87\x02\n\tOpenchain\x12\x45\n\x11GetBlockchainInfo\x12\x16.google.protobuf.Empty\x1a\x16.protos.BlockchainInfo\"\x00\x12\x38\n\x10GetBlockByNumber\x12\x13.protos.BlockNumber\x1a\r.protos.Block\"\x00\x12=\n\rGetBlockCount\x12\x16.google.protobuf.Empty\x1a\x12.protos.BlockCount\"\x00\x12:\n\x08GetPeers\x12\x16.google.protobuf.Empty\x1a\x14.protos.PeersMessage\"\x00\x62\x06proto3') + , + dependencies=[fabric__pb2.DESCRIPTOR,google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_BLOCKNUMBER = _descriptor.Descriptor( + name='BlockNumber', + full_name='protos.BlockNumber', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='number', full_name='protos.BlockNumber.number', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=64, + serialized_end=93, +) + + +_BLOCKCOUNT = _descriptor.Descriptor( + name='BlockCount', + full_name='protos.BlockCount', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='count', full_name='protos.BlockCount.count', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=95, + serialized_end=122, +) + +DESCRIPTOR.message_types_by_name['BlockNumber'] = _BLOCKNUMBER +DESCRIPTOR.message_types_by_name['BlockCount'] = _BLOCKCOUNT + +BlockNumber = _reflection.GeneratedProtocolMessageType('BlockNumber', (_message.Message,), dict( + DESCRIPTOR = _BLOCKNUMBER, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:protos.BlockNumber) + )) +_sym_db.RegisterMessage(BlockNumber) + +BlockCount = _reflection.GeneratedProtocolMessageType('BlockCount', (_message.Message,), dict( + DESCRIPTOR = _BLOCKCOUNT, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:protos.BlockCount) + )) +_sym_db.RegisterMessage(BlockCount) + + +import abc +import six +from grpc.beta import implementations as beta_implementations +from grpc.beta import interfaces as beta_interfaces +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + +class BetaOpenchainServicer(object): + """Interface exported by the server. + """ + def GetBlockchainInfo(self, request, context): + """GetBlockchainInfo returns information about the blockchain ledger such as + height, current block hash, and previous block hash. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def GetBlockByNumber(self, request, context): + """GetBlockByNumber returns the data contained within a specific block in the + blockchain. The genesis block is block zero. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def GetBlockCount(self, request, context): + """GetBlockCount returns the current number of blocks in the blockchain data + structure. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def GetPeers(self, request, context): + """GetPeers returns a list of all peer nodes currently connected to the target + peer. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaOpenchainStub(object): + """Interface exported by the server. + """ + def GetBlockchainInfo(self, request, timeout): + """GetBlockchainInfo returns information about the blockchain ledger such as + height, current block hash, and previous block hash. + """ + raise NotImplementedError() + GetBlockchainInfo.future = None + def GetBlockByNumber(self, request, timeout): + """GetBlockByNumber returns the data contained within a specific block in the + blockchain. The genesis block is block zero. + """ + raise NotImplementedError() + GetBlockByNumber.future = None + def GetBlockCount(self, request, timeout): + """GetBlockCount returns the current number of blocks in the blockchain data + structure. + """ + raise NotImplementedError() + GetBlockCount.future = None + def GetPeers(self, request, timeout): + """GetPeers returns a list of all peer nodes currently connected to the target + peer. + """ + raise NotImplementedError() + GetPeers.future = None + +def beta_create_Openchain_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import google.protobuf.empty_pb2 + import fabric_pb2 + import api_pb2 + import fabric_pb2 + import google.protobuf.empty_pb2 + import api_pb2 + import google.protobuf.empty_pb2 + import fabric_pb2 + request_deserializers = { + ('protos.Openchain', 'GetBlockByNumber'): api_pb2.BlockNumber.FromString, + ('protos.Openchain', 'GetBlockCount'): google.protobuf.empty_pb2.Empty.FromString, + ('protos.Openchain', 'GetBlockchainInfo'): google.protobuf.empty_pb2.Empty.FromString, + ('protos.Openchain', 'GetPeers'): google.protobuf.empty_pb2.Empty.FromString, + } + response_serializers = { + ('protos.Openchain', 'GetBlockByNumber'): fabric_pb2.Block.SerializeToString, + ('protos.Openchain', 'GetBlockCount'): api_pb2.BlockCount.SerializeToString, + ('protos.Openchain', 'GetBlockchainInfo'): fabric_pb2.BlockchainInfo.SerializeToString, + ('protos.Openchain', 'GetPeers'): fabric_pb2.PeersMessage.SerializeToString, + } + method_implementations = { + ('protos.Openchain', 'GetBlockByNumber'): face_utilities.unary_unary_inline(servicer.GetBlockByNumber), + ('protos.Openchain', 'GetBlockCount'): face_utilities.unary_unary_inline(servicer.GetBlockCount), + ('protos.Openchain', 'GetBlockchainInfo'): face_utilities.unary_unary_inline(servicer.GetBlockchainInfo), + ('protos.Openchain', 'GetPeers'): face_utilities.unary_unary_inline(servicer.GetPeers), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_Openchain_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import google.protobuf.empty_pb2 + import fabric_pb2 + import api_pb2 + import fabric_pb2 + import google.protobuf.empty_pb2 + import api_pb2 + import google.protobuf.empty_pb2 + import fabric_pb2 + request_serializers = { + ('protos.Openchain', 'GetBlockByNumber'): api_pb2.BlockNumber.SerializeToString, + ('protos.Openchain', 'GetBlockCount'): google.protobuf.empty_pb2.Empty.SerializeToString, + ('protos.Openchain', 'GetBlockchainInfo'): google.protobuf.empty_pb2.Empty.SerializeToString, + ('protos.Openchain', 'GetPeers'): google.protobuf.empty_pb2.Empty.SerializeToString, + } + response_deserializers = { + ('protos.Openchain', 'GetBlockByNumber'): fabric_pb2.Block.FromString, + ('protos.Openchain', 'GetBlockCount'): api_pb2.BlockCount.FromString, + ('protos.Openchain', 'GetBlockchainInfo'): fabric_pb2.BlockchainInfo.FromString, + ('protos.Openchain', 'GetPeers'): fabric_pb2.PeersMessage.FromString, + } + cardinalities = { + 'GetBlockByNumber': cardinality.Cardinality.UNARY_UNARY, + 'GetBlockCount': cardinality.Cardinality.UNARY_UNARY, + 'GetBlockchainInfo': cardinality.Cardinality.UNARY_UNARY, + 'GetPeers': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.Openchain', cardinalities, options=stub_options) +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/ca_pb2.py b/bddtests/ca_pb2.py new file mode 100644 index 00000000000..907a2618201 --- /dev/null +++ b/bddtests/ca_pb2.py @@ -0,0 +1,2677 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: ca.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='ca.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x08\x63\x61.proto\x12\x06protos\x1a\x1fgoogle/protobuf/timestamp.proto\"`\n\x08\x43\x41Status\x12+\n\x06status\x18\x01 \x01(\x0e\x32\x1b.protos.CAStatus.StatusCode\"\'\n\nStatusCode\x12\x06\n\x02OK\x10\x00\x12\x11\n\rUNKNOWN_ERROR\x10\x01\"\x07\n\x05\x45mpty\"\x16\n\x08Identity\x12\n\n\x02id\x18\x01 \x01(\t\"\x14\n\x05Token\x12\x0b\n\x03tok\x18\x01 \x01(\x0c\"\x14\n\x04Hash\x12\x0c\n\x04hash\x18\x01 \x01(\x0c\":\n\tPublicKey\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.protos.CryptoType\x12\x0b\n\x03key\x18\x02 \x01(\x0c\";\n\nPrivateKey\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.protos.CryptoType\x12\x0b\n\x03key\x18\x02 \x01(\x0c\"C\n\tSignature\x12 \n\x04type\x18\x01 \x01(\x0e\x32\x12.protos.CryptoType\x12\t\n\x01r\x18\x02 \x01(\x0c\x12\t\n\x01s\x18\x03 \x01(\x0c\"q\n\x0fRegisterUserReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04role\x18\x02 \x01(\x0e\x32\x0c.protos.Role\x12\x0f\n\x07\x61\x63\x63ount\x18\x03 \x01(\t\x12\x13\n\x0b\x61\x66\x66iliation\x18\x04 \x01(\t\"k\n\x0eReadUserSetReq\x12\x1d\n\x03req\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04role\x18\x02 \x01(\x0e\x32\x0c.protos.Role\x12\x1e\n\x03sig\x18\x03 \x01(\x0b\x32\x11.protos.Signature\"@\n\x04User\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04role\x18\x02 \x01(\x0e\x32\x0c.protos.Role\"&\n\x07UserSet\x12\x1b\n\x05users\x18\x01 \x03(\x0b\x32\x0c.protos.User\"\xd3\x01\n\x0e\x45\x43\x65rtCreateReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x02id\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x03tok\x18\x03 \x01(\x0b\x32\r.protos.Token\x12\x1f\n\x04sign\x18\x04 \x01(\x0b\x32\x11.protos.PublicKey\x12\x1e\n\x03\x65nc\x18\x05 \x01(\x0b\x32\x11.protos.PublicKey\x12\x1e\n\x03sig\x18\x06 \x01(\x0b\x32\x11.protos.Signature\"}\n\x0f\x45\x43\x65rtCreateResp\x12\x1f\n\x05\x63\x65rts\x18\x01 \x01(\x0b\x32\x10.protos.CertPair\x12\x1c\n\x05\x63hain\x18\x02 \x01(\x0b\x32\r.protos.Token\x12\x0f\n\x07pkchain\x18\x04 \x01(\x0c\x12\x1a\n\x03tok\x18\x03 \x01(\x0b\x32\r.protos.Token\",\n\x0c\x45\x43\x65rtReadReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\"j\n\x0e\x45\x43\x65rtRevokeReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04\x63\x65rt\x18\x02 \x01(\x0b\x32\x0c.protos.Cert\x12\x1e\n\x03sig\x18\x03 \x01(\x0b\x32\x11.protos.Signature\"K\n\x0b\x45\x43\x65rtCRLReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1e\n\x03sig\x18\x02 \x01(\x0b\x32\x11.protos.Signature\"\x96\x01\n\x0eTCertCreateReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x02id\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x1e\n\x03pub\x18\x03 \x01(\x0b\x32\x11.protos.PublicKey\x12\x1e\n\x03sig\x18\x04 \x01(\x0b\x32\x11.protos.Signature\"-\n\x0fTCertCreateResp\x12\x1a\n\x04\x63\x65rt\x18\x01 \x01(\x0b\x32\x0c.protos.Cert\"\xb2\x01\n\x11TCertCreateSetReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x02id\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x0b\n\x03num\x18\x03 \x01(\r\x12*\n\nattributes\x18\x04 \x03(\x0b\x32\x16.protos.TCertAttribute\x12\x1e\n\x03sig\x18\x05 \x01(\x0b\x32\x11.protos.Signature\"?\n\x0eTCertAttribute\x12\x15\n\rattributeName\x18\x01 \x01(\t\x12\x16\n\x0e\x61ttributeValue\x18\x02 \x01(\t\"4\n\x12TCertCreateSetResp\x12\x1e\n\x05\x63\x65rts\x18\x01 \x01(\x0b\x32\x0f.protos.CertSet\"\xaf\x01\n\x0cTCertReadReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1a\n\x04hash\x18\x02 \x01(\x0b\x32\x0c.protos.Hash\x12\x1d\n\x03req\x18\x03 \x01(\x0b\x32\x10.protos.Identity\x12\x1c\n\x02id\x18\x04 \x01(\x0b\x32\x10.protos.Identity\x12\x1e\n\x03sig\x18\x05 \x01(\x0b\x32\x11.protos.Signature\"\xa3\x01\n\x0fTCertReadSetReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x03req\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x1c\n\x02id\x18\x03 \x01(\x0b\x32\x10.protos.Identity\x12\x0b\n\x03num\x18\x04 \x01(\r\x12\x1e\n\x03sig\x18\x05 \x01(\x0b\x32\x11.protos.Signature\"\xc1\x01\n\x10TCertReadSetsReq\x12)\n\x05\x62\x65gin\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x03\x65nd\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1d\n\x03req\x18\x03 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04role\x18\x04 \x01(\x0e\x32\x0c.protos.Role\x12\x1e\n\x03sig\x18\x05 \x01(\x0b\x32\x11.protos.Signature\"j\n\x0eTCertRevokeReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04\x63\x65rt\x18\x02 \x01(\x0b\x32\x0c.protos.Cert\x12\x1e\n\x03sig\x18\x03 \x01(\x0b\x32\x11.protos.Signature\"y\n\x11TCertRevokeSetReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12&\n\x02ts\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1e\n\x03sig\x18\x03 \x01(\x0b\x32\x11.protos.Signature\"K\n\x0bTCertCRLReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1e\n\x03sig\x18\x02 \x01(\x0b\x32\x11.protos.Signature\"\x98\x01\n\x10TLSCertCreateReq\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x02id\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x1e\n\x03pub\x18\x03 \x01(\x0b\x32\x11.protos.PublicKey\x12\x1e\n\x03sig\x18\x04 \x01(\x0b\x32\x11.protos.Signature\"O\n\x11TLSCertCreateResp\x12\x1a\n\x04\x63\x65rt\x18\x01 \x01(\x0b\x32\x0c.protos.Cert\x12\x1e\n\x08rootCert\x18\x02 \x01(\x0b\x32\x0c.protos.Cert\".\n\x0eTLSCertReadReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\"l\n\x10TLSCertRevokeReq\x12\x1c\n\x02id\x18\x01 \x01(\x0b\x32\x10.protos.Identity\x12\x1a\n\x04\x63\x65rt\x18\x02 \x01(\x0b\x32\x0c.protos.Cert\x12\x1e\n\x03sig\x18\x03 \x01(\x0b\x32\x11.protos.Signature\"\x14\n\x04\x43\x65rt\x12\x0c\n\x04\x63\x65rt\x18\x01 \x01(\x0c\"i\n\x05TCert\x12\x0c\n\x04\x63\x65rt\x18\x01 \x01(\x0c\x12%\n\x04keys\x18\x02 \x03(\x0b\x32\x17.protos.TCert.KeysEntry\x1a+\n\tKeysEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"z\n\x07\x43\x65rtSet\x12&\n\x02ts\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1c\n\x02id\x18\x02 \x01(\x0b\x32\x10.protos.Identity\x12\x0b\n\x03key\x18\x03 \x01(\x0c\x12\x1c\n\x05\x63\x65rts\x18\x04 \x03(\x0b\x32\r.protos.TCert\")\n\x08\x43\x65rtSets\x12\x1d\n\x04sets\x18\x01 \x03(\x0b\x32\x0f.protos.CertSet\"%\n\x08\x43\x65rtPair\x12\x0c\n\x04sign\x18\x01 \x01(\x0c\x12\x0b\n\x03\x65nc\x18\x02 \x01(\x0c*)\n\nCryptoType\x12\t\n\x05\x45\x43\x44SA\x10\x00\x12\x07\n\x03RSA\x10\x01\x12\x07\n\x03\x44SA\x10\x02*M\n\x04Role\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06\x43LIENT\x10\x01\x12\x08\n\x04PEER\x10\x02\x12\r\n\tVALIDATOR\x10\x04\x12\x0b\n\x07\x41UDITOR\x10\x08\x12\t\n\x03\x41LL\x10\xff\xff\x03\x32\xb9\x02\n\x04\x45\x43\x41P\x12\x30\n\x11ReadCACertificate\x12\r.protos.Empty\x1a\x0c.protos.Cert\x12H\n\x15\x43reateCertificatePair\x12\x16.protos.ECertCreateReq\x1a\x17.protos.ECertCreateResp\x12=\n\x13ReadCertificatePair\x12\x14.protos.ECertReadReq\x1a\x10.protos.CertPair\x12\x33\n\x15ReadCertificateByHash\x12\x0c.protos.Hash\x1a\x0c.protos.Cert\x12\x41\n\x15RevokeCertificatePair\x12\x16.protos.ECertRevokeReq\x1a\x10.protos.CAStatus2\xea\x01\n\x04\x45\x43\x41\x41\x12\x36\n\x0cRegisterUser\x12\x17.protos.RegisterUserReq\x1a\r.protos.Token\x12\x36\n\x0bReadUserSet\x12\x16.protos.ReadUserSetReq\x1a\x0f.protos.UserSet\x12=\n\x11RevokeCertificate\x12\x16.protos.ECertRevokeReq\x1a\x10.protos.CAStatus\x12\x33\n\nPublishCRL\x12\x13.protos.ECertCRLReq\x1a\x10.protos.CAStatus2\x82\x03\n\x04TCAP\x12\x30\n\x11ReadCACertificate\x12\r.protos.Empty\x1a\x0c.protos.Cert\x12M\n\x14\x43reateCertificateSet\x12\x19.protos.TCertCreateSetReq\x1a\x1a.protos.TCertCreateSetResp\x12\x35\n\x0fReadCertificate\x12\x14.protos.TCertReadReq\x1a\x0c.protos.Cert\x12>\n\x12ReadCertificateSet\x12\x17.protos.TCertReadSetReq\x1a\x0f.protos.CertSet\x12=\n\x11RevokeCertificate\x12\x16.protos.TCertRevokeReq\x1a\x10.protos.CAStatus\x12\x43\n\x14RevokeCertificateSet\x12\x19.protos.TCertRevokeSetReq\x1a\x10.protos.CAStatus2\x82\x02\n\x04TCAA\x12\x41\n\x13ReadCertificateSets\x12\x18.protos.TCertReadSetsReq\x1a\x10.protos.CertSets\x12=\n\x11RevokeCertificate\x12\x16.protos.TCertRevokeReq\x1a\x10.protos.CAStatus\x12\x43\n\x14RevokeCertificateSet\x12\x19.protos.TCertRevokeSetReq\x1a\x10.protos.CAStatus\x12\x33\n\nPublishCRL\x12\x13.protos.TCertCRLReq\x1a\x10.protos.CAStatus2\xfe\x01\n\x06TLSCAP\x12\x30\n\x11ReadCACertificate\x12\r.protos.Empty\x1a\x0c.protos.Cert\x12H\n\x11\x43reateCertificate\x12\x18.protos.TLSCertCreateReq\x1a\x19.protos.TLSCertCreateResp\x12\x37\n\x0fReadCertificate\x12\x16.protos.TLSCertReadReq\x1a\x0c.protos.Cert\x12?\n\x11RevokeCertificate\x12\x18.protos.TLSCertRevokeReq\x1a\x10.protos.CAStatus2I\n\x06TLSCAA\x12?\n\x11RevokeCertificate\x12\x18.protos.TLSCertRevokeReq\x1a\x10.protos.CAStatusb\x06proto3') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_CRYPTOTYPE = _descriptor.EnumDescriptor( + name='CryptoType', + full_name='protos.CryptoType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='ECDSA', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RSA', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DSA', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3397, + serialized_end=3438, +) +_sym_db.RegisterEnumDescriptor(_CRYPTOTYPE) + +CryptoType = enum_type_wrapper.EnumTypeWrapper(_CRYPTOTYPE) +_ROLE = _descriptor.EnumDescriptor( + name='Role', + full_name='protos.Role', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='NONE', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CLIENT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PEER', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='VALIDATOR', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AUDITOR', index=4, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ALL', index=5, number=65535, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3440, + serialized_end=3517, +) +_sym_db.RegisterEnumDescriptor(_ROLE) + +Role = enum_type_wrapper.EnumTypeWrapper(_ROLE) +ECDSA = 0 +RSA = 1 +DSA = 2 +NONE = 0 +CLIENT = 1 +PEER = 2 +VALIDATOR = 4 +AUDITOR = 8 +ALL = 65535 + + +_CASTATUS_STATUSCODE = _descriptor.EnumDescriptor( + name='StatusCode', + full_name='protos.CAStatus.StatusCode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='OK', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UNKNOWN_ERROR', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=110, + serialized_end=149, +) +_sym_db.RegisterEnumDescriptor(_CASTATUS_STATUSCODE) + + +_CASTATUS = _descriptor.Descriptor( + name='CAStatus', + full_name='protos.CAStatus', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='status', full_name='protos.CAStatus.status', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CASTATUS_STATUSCODE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=53, + serialized_end=149, +) + + +_EMPTY = _descriptor.Descriptor( + name='Empty', + full_name='protos.Empty', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=151, + serialized_end=158, +) + + +_IDENTITY = _descriptor.Descriptor( + name='Identity', + full_name='protos.Identity', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.Identity.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=160, + serialized_end=182, +) + + +_TOKEN = _descriptor.Descriptor( + name='Token', + full_name='protos.Token', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='tok', full_name='protos.Token.tok', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=184, + serialized_end=204, +) + + +_HASH = _descriptor.Descriptor( + name='Hash', + full_name='protos.Hash', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='hash', full_name='protos.Hash.hash', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=206, + serialized_end=226, +) + + +_PUBLICKEY = _descriptor.Descriptor( + name='PublicKey', + full_name='protos.PublicKey', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='protos.PublicKey.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='key', full_name='protos.PublicKey.key', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=228, + serialized_end=286, +) + + +_PRIVATEKEY = _descriptor.Descriptor( + name='PrivateKey', + full_name='protos.PrivateKey', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='protos.PrivateKey.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='key', full_name='protos.PrivateKey.key', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=288, + serialized_end=347, +) + + +_SIGNATURE = _descriptor.Descriptor( + name='Signature', + full_name='protos.Signature', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='protos.Signature.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='r', full_name='protos.Signature.r', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='s', full_name='protos.Signature.s', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=349, + serialized_end=416, +) + + +_REGISTERUSERREQ = _descriptor.Descriptor( + name='RegisterUserReq', + full_name='protos.RegisterUserReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.RegisterUserReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='role', full_name='protos.RegisterUserReq.role', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='account', full_name='protos.RegisterUserReq.account', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='affiliation', full_name='protos.RegisterUserReq.affiliation', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=418, + serialized_end=531, +) + + +_READUSERSETREQ = _descriptor.Descriptor( + name='ReadUserSetReq', + full_name='protos.ReadUserSetReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='req', full_name='protos.ReadUserSetReq.req', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='role', full_name='protos.ReadUserSetReq.role', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.ReadUserSetReq.sig', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=533, + serialized_end=640, +) + + +_USER = _descriptor.Descriptor( + name='User', + full_name='protos.User', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.User.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='role', full_name='protos.User.role', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=642, + serialized_end=706, +) + + +_USERSET = _descriptor.Descriptor( + name='UserSet', + full_name='protos.UserSet', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='users', full_name='protos.UserSet.users', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=708, + serialized_end=746, +) + + +_ECERTCREATEREQ = _descriptor.Descriptor( + name='ECertCreateReq', + full_name='protos.ECertCreateReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.ECertCreateReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.ECertCreateReq.id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tok', full_name='protos.ECertCreateReq.tok', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sign', full_name='protos.ECertCreateReq.sign', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='enc', full_name='protos.ECertCreateReq.enc', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.ECertCreateReq.sig', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=749, + serialized_end=960, +) + + +_ECERTCREATERESP = _descriptor.Descriptor( + name='ECertCreateResp', + full_name='protos.ECertCreateResp', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='certs', full_name='protos.ECertCreateResp.certs', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='chain', full_name='protos.ECertCreateResp.chain', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pkchain', full_name='protos.ECertCreateResp.pkchain', index=2, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tok', full_name='protos.ECertCreateResp.tok', index=3, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=962, + serialized_end=1087, +) + + +_ECERTREADREQ = _descriptor.Descriptor( + name='ECertReadReq', + full_name='protos.ECertReadReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.ECertReadReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1089, + serialized_end=1133, +) + + +_ECERTREVOKEREQ = _descriptor.Descriptor( + name='ECertRevokeReq', + full_name='protos.ECertRevokeReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.ECertRevokeReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cert', full_name='protos.ECertRevokeReq.cert', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.ECertRevokeReq.sig', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1135, + serialized_end=1241, +) + + +_ECERTCRLREQ = _descriptor.Descriptor( + name='ECertCRLReq', + full_name='protos.ECertCRLReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.ECertCRLReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.ECertCRLReq.sig', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1243, + serialized_end=1318, +) + + +_TCERTCREATEREQ = _descriptor.Descriptor( + name='TCertCreateReq', + full_name='protos.TCertCreateReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TCertCreateReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertCreateReq.id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pub', full_name='protos.TCertCreateReq.pub', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertCreateReq.sig', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1321, + serialized_end=1471, +) + + +_TCERTCREATERESP = _descriptor.Descriptor( + name='TCertCreateResp', + full_name='protos.TCertCreateResp', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='cert', full_name='protos.TCertCreateResp.cert', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1473, + serialized_end=1518, +) + + +_TCERTCREATESETREQ = _descriptor.Descriptor( + name='TCertCreateSetReq', + full_name='protos.TCertCreateSetReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TCertCreateSetReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertCreateSetReq.id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num', full_name='protos.TCertCreateSetReq.num', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attributes', full_name='protos.TCertCreateSetReq.attributes', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertCreateSetReq.sig', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1521, + serialized_end=1699, +) + + +_TCERTATTRIBUTE = _descriptor.Descriptor( + name='TCertAttribute', + full_name='protos.TCertAttribute', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='attributeName', full_name='protos.TCertAttribute.attributeName', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attributeValue', full_name='protos.TCertAttribute.attributeValue', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1701, + serialized_end=1764, +) + + +_TCERTCREATESETRESP = _descriptor.Descriptor( + name='TCertCreateSetResp', + full_name='protos.TCertCreateSetResp', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='certs', full_name='protos.TCertCreateSetResp.certs', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1766, + serialized_end=1818, +) + + +_TCERTREADREQ = _descriptor.Descriptor( + name='TCertReadReq', + full_name='protos.TCertReadReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TCertReadReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='hash', full_name='protos.TCertReadReq.hash', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='req', full_name='protos.TCertReadReq.req', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertReadReq.id', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertReadReq.sig', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1821, + serialized_end=1996, +) + + +_TCERTREADSETREQ = _descriptor.Descriptor( + name='TCertReadSetReq', + full_name='protos.TCertReadSetReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TCertReadSetReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='req', full_name='protos.TCertReadSetReq.req', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertReadSetReq.id', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num', full_name='protos.TCertReadSetReq.num', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertReadSetReq.sig', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1999, + serialized_end=2162, +) + + +_TCERTREADSETSREQ = _descriptor.Descriptor( + name='TCertReadSetsReq', + full_name='protos.TCertReadSetsReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='begin', full_name='protos.TCertReadSetsReq.begin', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='end', full_name='protos.TCertReadSetsReq.end', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='req', full_name='protos.TCertReadSetsReq.req', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='role', full_name='protos.TCertReadSetsReq.role', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertReadSetsReq.sig', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2165, + serialized_end=2358, +) + + +_TCERTREVOKEREQ = _descriptor.Descriptor( + name='TCertRevokeReq', + full_name='protos.TCertRevokeReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertRevokeReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cert', full_name='protos.TCertRevokeReq.cert', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertRevokeReq.sig', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2360, + serialized_end=2466, +) + + +_TCERTREVOKESETREQ = _descriptor.Descriptor( + name='TCertRevokeSetReq', + full_name='protos.TCertRevokeSetReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertRevokeSetReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TCertRevokeSetReq.ts', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertRevokeSetReq.sig', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2468, + serialized_end=2589, +) + + +_TCERTCRLREQ = _descriptor.Descriptor( + name='TCertCRLReq', + full_name='protos.TCertCRLReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.TCertCRLReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TCertCRLReq.sig', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2591, + serialized_end=2666, +) + + +_TLSCERTCREATEREQ = _descriptor.Descriptor( + name='TLSCertCreateReq', + full_name='protos.TLSCertCreateReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.TLSCertCreateReq.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.TLSCertCreateReq.id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pub', full_name='protos.TLSCertCreateReq.pub', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TLSCertCreateReq.sig', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2669, + serialized_end=2821, +) + + +_TLSCERTCREATERESP = _descriptor.Descriptor( + name='TLSCertCreateResp', + full_name='protos.TLSCertCreateResp', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='cert', full_name='protos.TLSCertCreateResp.cert', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='rootCert', full_name='protos.TLSCertCreateResp.rootCert', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2823, + serialized_end=2902, +) + + +_TLSCERTREADREQ = _descriptor.Descriptor( + name='TLSCertReadReq', + full_name='protos.TLSCertReadReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.TLSCertReadReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2904, + serialized_end=2950, +) + + +_TLSCERTREVOKEREQ = _descriptor.Descriptor( + name='TLSCertRevokeReq', + full_name='protos.TLSCertRevokeReq', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='protos.TLSCertRevokeReq.id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='cert', full_name='protos.TLSCertRevokeReq.cert', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sig', full_name='protos.TLSCertRevokeReq.sig', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2952, + serialized_end=3060, +) + + +_CERT = _descriptor.Descriptor( + name='Cert', + full_name='protos.Cert', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='cert', full_name='protos.Cert.cert', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3062, + serialized_end=3082, +) + + +_TCERT_KEYSENTRY = _descriptor.Descriptor( + name='KeysEntry', + full_name='protos.TCert.KeysEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='protos.TCert.KeysEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='protos.TCert.KeysEntry.value', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')), + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3146, + serialized_end=3189, +) + +_TCERT = _descriptor.Descriptor( + name='TCert', + full_name='protos.TCert', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='cert', full_name='protos.TCert.cert', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='keys', full_name='protos.TCert.keys', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_TCERT_KEYSENTRY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3084, + serialized_end=3189, +) + + +_CERTSET = _descriptor.Descriptor( + name='CertSet', + full_name='protos.CertSet', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ts', full_name='protos.CertSet.ts', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='protos.CertSet.id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='key', full_name='protos.CertSet.key', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='certs', full_name='protos.CertSet.certs', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3191, + serialized_end=3313, +) + + +_CERTSETS = _descriptor.Descriptor( + name='CertSets', + full_name='protos.CertSets', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='sets', full_name='protos.CertSets.sets', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3315, + serialized_end=3356, +) + + +_CERTPAIR = _descriptor.Descriptor( + name='CertPair', + full_name='protos.CertPair', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='sign', full_name='protos.CertPair.sign', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='enc', full_name='protos.CertPair.enc', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3358, + serialized_end=3395, +) + +_CASTATUS.fields_by_name['status'].enum_type = _CASTATUS_STATUSCODE +_CASTATUS_STATUSCODE.containing_type = _CASTATUS +_PUBLICKEY.fields_by_name['type'].enum_type = _CRYPTOTYPE +_PRIVATEKEY.fields_by_name['type'].enum_type = _CRYPTOTYPE +_SIGNATURE.fields_by_name['type'].enum_type = _CRYPTOTYPE +_REGISTERUSERREQ.fields_by_name['id'].message_type = _IDENTITY +_REGISTERUSERREQ.fields_by_name['role'].enum_type = _ROLE +_READUSERSETREQ.fields_by_name['req'].message_type = _IDENTITY +_READUSERSETREQ.fields_by_name['role'].enum_type = _ROLE +_READUSERSETREQ.fields_by_name['sig'].message_type = _SIGNATURE +_USER.fields_by_name['id'].message_type = _IDENTITY +_USER.fields_by_name['role'].enum_type = _ROLE +_USERSET.fields_by_name['users'].message_type = _USER +_ECERTCREATEREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_ECERTCREATEREQ.fields_by_name['id'].message_type = _IDENTITY +_ECERTCREATEREQ.fields_by_name['tok'].message_type = _TOKEN +_ECERTCREATEREQ.fields_by_name['sign'].message_type = _PUBLICKEY +_ECERTCREATEREQ.fields_by_name['enc'].message_type = _PUBLICKEY +_ECERTCREATEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_ECERTCREATERESP.fields_by_name['certs'].message_type = _CERTPAIR +_ECERTCREATERESP.fields_by_name['chain'].message_type = _TOKEN +_ECERTCREATERESP.fields_by_name['tok'].message_type = _TOKEN +_ECERTREADREQ.fields_by_name['id'].message_type = _IDENTITY +_ECERTREVOKEREQ.fields_by_name['id'].message_type = _IDENTITY +_ECERTREVOKEREQ.fields_by_name['cert'].message_type = _CERT +_ECERTREVOKEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_ECERTCRLREQ.fields_by_name['id'].message_type = _IDENTITY +_ECERTCRLREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTCREATEREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTCREATEREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTCREATEREQ.fields_by_name['pub'].message_type = _PUBLICKEY +_TCERTCREATEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTCREATERESP.fields_by_name['cert'].message_type = _CERT +_TCERTCREATESETREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTCREATESETREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTCREATESETREQ.fields_by_name['attributes'].message_type = _TCERTATTRIBUTE +_TCERTCREATESETREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTCREATESETRESP.fields_by_name['certs'].message_type = _CERTSET +_TCERTREADREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTREADREQ.fields_by_name['hash'].message_type = _HASH +_TCERTREADREQ.fields_by_name['req'].message_type = _IDENTITY +_TCERTREADREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTREADREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTREADSETREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTREADSETREQ.fields_by_name['req'].message_type = _IDENTITY +_TCERTREADSETREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTREADSETREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTREADSETSREQ.fields_by_name['begin'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTREADSETSREQ.fields_by_name['end'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTREADSETSREQ.fields_by_name['req'].message_type = _IDENTITY +_TCERTREADSETSREQ.fields_by_name['role'].enum_type = _ROLE +_TCERTREADSETSREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTREVOKEREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTREVOKEREQ.fields_by_name['cert'].message_type = _CERT +_TCERTREVOKEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTREVOKESETREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTREVOKESETREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TCERTREVOKESETREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERTCRLREQ.fields_by_name['id'].message_type = _IDENTITY +_TCERTCRLREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TLSCERTCREATEREQ.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TLSCERTCREATEREQ.fields_by_name['id'].message_type = _IDENTITY +_TLSCERTCREATEREQ.fields_by_name['pub'].message_type = _PUBLICKEY +_TLSCERTCREATEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TLSCERTCREATERESP.fields_by_name['cert'].message_type = _CERT +_TLSCERTCREATERESP.fields_by_name['rootCert'].message_type = _CERT +_TLSCERTREADREQ.fields_by_name['id'].message_type = _IDENTITY +_TLSCERTREVOKEREQ.fields_by_name['id'].message_type = _IDENTITY +_TLSCERTREVOKEREQ.fields_by_name['cert'].message_type = _CERT +_TLSCERTREVOKEREQ.fields_by_name['sig'].message_type = _SIGNATURE +_TCERT_KEYSENTRY.containing_type = _TCERT +_TCERT.fields_by_name['keys'].message_type = _TCERT_KEYSENTRY +_CERTSET.fields_by_name['ts'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_CERTSET.fields_by_name['id'].message_type = _IDENTITY +_CERTSET.fields_by_name['certs'].message_type = _TCERT +_CERTSETS.fields_by_name['sets'].message_type = _CERTSET +DESCRIPTOR.message_types_by_name['CAStatus'] = _CASTATUS +DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY +DESCRIPTOR.message_types_by_name['Identity'] = _IDENTITY +DESCRIPTOR.message_types_by_name['Token'] = _TOKEN +DESCRIPTOR.message_types_by_name['Hash'] = _HASH +DESCRIPTOR.message_types_by_name['PublicKey'] = _PUBLICKEY +DESCRIPTOR.message_types_by_name['PrivateKey'] = _PRIVATEKEY +DESCRIPTOR.message_types_by_name['Signature'] = _SIGNATURE +DESCRIPTOR.message_types_by_name['RegisterUserReq'] = _REGISTERUSERREQ +DESCRIPTOR.message_types_by_name['ReadUserSetReq'] = _READUSERSETREQ +DESCRIPTOR.message_types_by_name['User'] = _USER +DESCRIPTOR.message_types_by_name['UserSet'] = _USERSET +DESCRIPTOR.message_types_by_name['ECertCreateReq'] = _ECERTCREATEREQ +DESCRIPTOR.message_types_by_name['ECertCreateResp'] = _ECERTCREATERESP +DESCRIPTOR.message_types_by_name['ECertReadReq'] = _ECERTREADREQ +DESCRIPTOR.message_types_by_name['ECertRevokeReq'] = _ECERTREVOKEREQ +DESCRIPTOR.message_types_by_name['ECertCRLReq'] = _ECERTCRLREQ +DESCRIPTOR.message_types_by_name['TCertCreateReq'] = _TCERTCREATEREQ +DESCRIPTOR.message_types_by_name['TCertCreateResp'] = _TCERTCREATERESP +DESCRIPTOR.message_types_by_name['TCertCreateSetReq'] = _TCERTCREATESETREQ +DESCRIPTOR.message_types_by_name['TCertAttribute'] = _TCERTATTRIBUTE +DESCRIPTOR.message_types_by_name['TCertCreateSetResp'] = _TCERTCREATESETRESP +DESCRIPTOR.message_types_by_name['TCertReadReq'] = _TCERTREADREQ +DESCRIPTOR.message_types_by_name['TCertReadSetReq'] = _TCERTREADSETREQ +DESCRIPTOR.message_types_by_name['TCertReadSetsReq'] = _TCERTREADSETSREQ +DESCRIPTOR.message_types_by_name['TCertRevokeReq'] = _TCERTREVOKEREQ +DESCRIPTOR.message_types_by_name['TCertRevokeSetReq'] = _TCERTREVOKESETREQ +DESCRIPTOR.message_types_by_name['TCertCRLReq'] = _TCERTCRLREQ +DESCRIPTOR.message_types_by_name['TLSCertCreateReq'] = _TLSCERTCREATEREQ +DESCRIPTOR.message_types_by_name['TLSCertCreateResp'] = _TLSCERTCREATERESP +DESCRIPTOR.message_types_by_name['TLSCertReadReq'] = _TLSCERTREADREQ +DESCRIPTOR.message_types_by_name['TLSCertRevokeReq'] = _TLSCERTREVOKEREQ +DESCRIPTOR.message_types_by_name['Cert'] = _CERT +DESCRIPTOR.message_types_by_name['TCert'] = _TCERT +DESCRIPTOR.message_types_by_name['CertSet'] = _CERTSET +DESCRIPTOR.message_types_by_name['CertSets'] = _CERTSETS +DESCRIPTOR.message_types_by_name['CertPair'] = _CERTPAIR +DESCRIPTOR.enum_types_by_name['CryptoType'] = _CRYPTOTYPE +DESCRIPTOR.enum_types_by_name['Role'] = _ROLE + +CAStatus = _reflection.GeneratedProtocolMessageType('CAStatus', (_message.Message,), dict( + DESCRIPTOR = _CASTATUS, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.CAStatus) + )) +_sym_db.RegisterMessage(CAStatus) + +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), dict( + DESCRIPTOR = _EMPTY, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Empty) + )) +_sym_db.RegisterMessage(Empty) + +Identity = _reflection.GeneratedProtocolMessageType('Identity', (_message.Message,), dict( + DESCRIPTOR = _IDENTITY, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Identity) + )) +_sym_db.RegisterMessage(Identity) + +Token = _reflection.GeneratedProtocolMessageType('Token', (_message.Message,), dict( + DESCRIPTOR = _TOKEN, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Token) + )) +_sym_db.RegisterMessage(Token) + +Hash = _reflection.GeneratedProtocolMessageType('Hash', (_message.Message,), dict( + DESCRIPTOR = _HASH, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Hash) + )) +_sym_db.RegisterMessage(Hash) + +PublicKey = _reflection.GeneratedProtocolMessageType('PublicKey', (_message.Message,), dict( + DESCRIPTOR = _PUBLICKEY, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.PublicKey) + )) +_sym_db.RegisterMessage(PublicKey) + +PrivateKey = _reflection.GeneratedProtocolMessageType('PrivateKey', (_message.Message,), dict( + DESCRIPTOR = _PRIVATEKEY, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.PrivateKey) + )) +_sym_db.RegisterMessage(PrivateKey) + +Signature = _reflection.GeneratedProtocolMessageType('Signature', (_message.Message,), dict( + DESCRIPTOR = _SIGNATURE, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Signature) + )) +_sym_db.RegisterMessage(Signature) + +RegisterUserReq = _reflection.GeneratedProtocolMessageType('RegisterUserReq', (_message.Message,), dict( + DESCRIPTOR = _REGISTERUSERREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.RegisterUserReq) + )) +_sym_db.RegisterMessage(RegisterUserReq) + +ReadUserSetReq = _reflection.GeneratedProtocolMessageType('ReadUserSetReq', (_message.Message,), dict( + DESCRIPTOR = _READUSERSETREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ReadUserSetReq) + )) +_sym_db.RegisterMessage(ReadUserSetReq) + +User = _reflection.GeneratedProtocolMessageType('User', (_message.Message,), dict( + DESCRIPTOR = _USER, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.User) + )) +_sym_db.RegisterMessage(User) + +UserSet = _reflection.GeneratedProtocolMessageType('UserSet', (_message.Message,), dict( + DESCRIPTOR = _USERSET, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.UserSet) + )) +_sym_db.RegisterMessage(UserSet) + +ECertCreateReq = _reflection.GeneratedProtocolMessageType('ECertCreateReq', (_message.Message,), dict( + DESCRIPTOR = _ECERTCREATEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ECertCreateReq) + )) +_sym_db.RegisterMessage(ECertCreateReq) + +ECertCreateResp = _reflection.GeneratedProtocolMessageType('ECertCreateResp', (_message.Message,), dict( + DESCRIPTOR = _ECERTCREATERESP, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ECertCreateResp) + )) +_sym_db.RegisterMessage(ECertCreateResp) + +ECertReadReq = _reflection.GeneratedProtocolMessageType('ECertReadReq', (_message.Message,), dict( + DESCRIPTOR = _ECERTREADREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ECertReadReq) + )) +_sym_db.RegisterMessage(ECertReadReq) + +ECertRevokeReq = _reflection.GeneratedProtocolMessageType('ECertRevokeReq', (_message.Message,), dict( + DESCRIPTOR = _ECERTREVOKEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ECertRevokeReq) + )) +_sym_db.RegisterMessage(ECertRevokeReq) + +ECertCRLReq = _reflection.GeneratedProtocolMessageType('ECertCRLReq', (_message.Message,), dict( + DESCRIPTOR = _ECERTCRLREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.ECertCRLReq) + )) +_sym_db.RegisterMessage(ECertCRLReq) + +TCertCreateReq = _reflection.GeneratedProtocolMessageType('TCertCreateReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTCREATEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertCreateReq) + )) +_sym_db.RegisterMessage(TCertCreateReq) + +TCertCreateResp = _reflection.GeneratedProtocolMessageType('TCertCreateResp', (_message.Message,), dict( + DESCRIPTOR = _TCERTCREATERESP, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertCreateResp) + )) +_sym_db.RegisterMessage(TCertCreateResp) + +TCertCreateSetReq = _reflection.GeneratedProtocolMessageType('TCertCreateSetReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTCREATESETREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertCreateSetReq) + )) +_sym_db.RegisterMessage(TCertCreateSetReq) + +TCertAttribute = _reflection.GeneratedProtocolMessageType('TCertAttribute', (_message.Message,), dict( + DESCRIPTOR = _TCERTATTRIBUTE, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertAttribute) + )) +_sym_db.RegisterMessage(TCertAttribute) + +TCertCreateSetResp = _reflection.GeneratedProtocolMessageType('TCertCreateSetResp', (_message.Message,), dict( + DESCRIPTOR = _TCERTCREATESETRESP, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertCreateSetResp) + )) +_sym_db.RegisterMessage(TCertCreateSetResp) + +TCertReadReq = _reflection.GeneratedProtocolMessageType('TCertReadReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTREADREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertReadReq) + )) +_sym_db.RegisterMessage(TCertReadReq) + +TCertReadSetReq = _reflection.GeneratedProtocolMessageType('TCertReadSetReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTREADSETREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertReadSetReq) + )) +_sym_db.RegisterMessage(TCertReadSetReq) + +TCertReadSetsReq = _reflection.GeneratedProtocolMessageType('TCertReadSetsReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTREADSETSREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertReadSetsReq) + )) +_sym_db.RegisterMessage(TCertReadSetsReq) + +TCertRevokeReq = _reflection.GeneratedProtocolMessageType('TCertRevokeReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTREVOKEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertRevokeReq) + )) +_sym_db.RegisterMessage(TCertRevokeReq) + +TCertRevokeSetReq = _reflection.GeneratedProtocolMessageType('TCertRevokeSetReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTREVOKESETREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertRevokeSetReq) + )) +_sym_db.RegisterMessage(TCertRevokeSetReq) + +TCertCRLReq = _reflection.GeneratedProtocolMessageType('TCertCRLReq', (_message.Message,), dict( + DESCRIPTOR = _TCERTCRLREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCertCRLReq) + )) +_sym_db.RegisterMessage(TCertCRLReq) + +TLSCertCreateReq = _reflection.GeneratedProtocolMessageType('TLSCertCreateReq', (_message.Message,), dict( + DESCRIPTOR = _TLSCERTCREATEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TLSCertCreateReq) + )) +_sym_db.RegisterMessage(TLSCertCreateReq) + +TLSCertCreateResp = _reflection.GeneratedProtocolMessageType('TLSCertCreateResp', (_message.Message,), dict( + DESCRIPTOR = _TLSCERTCREATERESP, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TLSCertCreateResp) + )) +_sym_db.RegisterMessage(TLSCertCreateResp) + +TLSCertReadReq = _reflection.GeneratedProtocolMessageType('TLSCertReadReq', (_message.Message,), dict( + DESCRIPTOR = _TLSCERTREADREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TLSCertReadReq) + )) +_sym_db.RegisterMessage(TLSCertReadReq) + +TLSCertRevokeReq = _reflection.GeneratedProtocolMessageType('TLSCertRevokeReq', (_message.Message,), dict( + DESCRIPTOR = _TLSCERTREVOKEREQ, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TLSCertRevokeReq) + )) +_sym_db.RegisterMessage(TLSCertRevokeReq) + +Cert = _reflection.GeneratedProtocolMessageType('Cert', (_message.Message,), dict( + DESCRIPTOR = _CERT, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.Cert) + )) +_sym_db.RegisterMessage(Cert) + +TCert = _reflection.GeneratedProtocolMessageType('TCert', (_message.Message,), dict( + + KeysEntry = _reflection.GeneratedProtocolMessageType('KeysEntry', (_message.Message,), dict( + DESCRIPTOR = _TCERT_KEYSENTRY, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCert.KeysEntry) + )) + , + DESCRIPTOR = _TCERT, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.TCert) + )) +_sym_db.RegisterMessage(TCert) +_sym_db.RegisterMessage(TCert.KeysEntry) + +CertSet = _reflection.GeneratedProtocolMessageType('CertSet', (_message.Message,), dict( + DESCRIPTOR = _CERTSET, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.CertSet) + )) +_sym_db.RegisterMessage(CertSet) + +CertSets = _reflection.GeneratedProtocolMessageType('CertSets', (_message.Message,), dict( + DESCRIPTOR = _CERTSETS, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.CertSets) + )) +_sym_db.RegisterMessage(CertSets) + +CertPair = _reflection.GeneratedProtocolMessageType('CertPair', (_message.Message,), dict( + DESCRIPTOR = _CERTPAIR, + __module__ = 'ca_pb2' + # @@protoc_insertion_point(class_scope:protos.CertPair) + )) +_sym_db.RegisterMessage(CertPair) + + +_TCERT_KEYSENTRY.has_options = True +_TCERT_KEYSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')) +import abc +import six +from grpc.beta import implementations as beta_implementations +from grpc.beta import interfaces as beta_interfaces +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + +class BetaECAPServicer(object): + """Enrollment Certificate Authority (ECA). + + public service + """ + def ReadCACertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def CreateCertificatePair(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadCertificatePair(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadCertificateByHash(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificatePair(self, request, context): + """a user can revoke only his/her own cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaECAPStub(object): + """Enrollment Certificate Authority (ECA). + + public service + """ + def ReadCACertificate(self, request, timeout): + raise NotImplementedError() + ReadCACertificate.future = None + def CreateCertificatePair(self, request, timeout): + raise NotImplementedError() + CreateCertificatePair.future = None + def ReadCertificatePair(self, request, timeout): + raise NotImplementedError() + ReadCertificatePair.future = None + def ReadCertificateByHash(self, request, timeout): + raise NotImplementedError() + ReadCertificateByHash.future = None + def RevokeCertificatePair(self, request, timeout): + """a user can revoke only his/her own cert + """ + raise NotImplementedError() + RevokeCertificatePair.future = None + +def beta_create_ECAP_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.ECAP', 'CreateCertificatePair'): ca_pb2.ECertCreateReq.FromString, + ('protos.ECAP', 'ReadCACertificate'): ca_pb2.Empty.FromString, + ('protos.ECAP', 'ReadCertificateByHash'): ca_pb2.Hash.FromString, + ('protos.ECAP', 'ReadCertificatePair'): ca_pb2.ECertReadReq.FromString, + ('protos.ECAP', 'RevokeCertificatePair'): ca_pb2.ECertRevokeReq.FromString, + } + response_serializers = { + ('protos.ECAP', 'CreateCertificatePair'): ca_pb2.ECertCreateResp.SerializeToString, + ('protos.ECAP', 'ReadCACertificate'): ca_pb2.Cert.SerializeToString, + ('protos.ECAP', 'ReadCertificateByHash'): ca_pb2.Cert.SerializeToString, + ('protos.ECAP', 'ReadCertificatePair'): ca_pb2.CertPair.SerializeToString, + ('protos.ECAP', 'RevokeCertificatePair'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.ECAP', 'CreateCertificatePair'): face_utilities.unary_unary_inline(servicer.CreateCertificatePair), + ('protos.ECAP', 'ReadCACertificate'): face_utilities.unary_unary_inline(servicer.ReadCACertificate), + ('protos.ECAP', 'ReadCertificateByHash'): face_utilities.unary_unary_inline(servicer.ReadCertificateByHash), + ('protos.ECAP', 'ReadCertificatePair'): face_utilities.unary_unary_inline(servicer.ReadCertificatePair), + ('protos.ECAP', 'RevokeCertificatePair'): face_utilities.unary_unary_inline(servicer.RevokeCertificatePair), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_ECAP_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.ECAP', 'CreateCertificatePair'): ca_pb2.ECertCreateReq.SerializeToString, + ('protos.ECAP', 'ReadCACertificate'): ca_pb2.Empty.SerializeToString, + ('protos.ECAP', 'ReadCertificateByHash'): ca_pb2.Hash.SerializeToString, + ('protos.ECAP', 'ReadCertificatePair'): ca_pb2.ECertReadReq.SerializeToString, + ('protos.ECAP', 'RevokeCertificatePair'): ca_pb2.ECertRevokeReq.SerializeToString, + } + response_deserializers = { + ('protos.ECAP', 'CreateCertificatePair'): ca_pb2.ECertCreateResp.FromString, + ('protos.ECAP', 'ReadCACertificate'): ca_pb2.Cert.FromString, + ('protos.ECAP', 'ReadCertificateByHash'): ca_pb2.Cert.FromString, + ('protos.ECAP', 'ReadCertificatePair'): ca_pb2.CertPair.FromString, + ('protos.ECAP', 'RevokeCertificatePair'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'CreateCertificatePair': cardinality.Cardinality.UNARY_UNARY, + 'ReadCACertificate': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificateByHash': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificatePair': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificatePair': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.ECAP', cardinalities, options=stub_options) + +class BetaECAAServicer(object): + """admin service + """ + def RegisterUser(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadUserSet(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificate(self, request, context): + """an admin can revoke any cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def PublishCRL(self, request, context): + """publishes CRL in the blockchain + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaECAAStub(object): + """admin service + """ + def RegisterUser(self, request, timeout): + raise NotImplementedError() + RegisterUser.future = None + def ReadUserSet(self, request, timeout): + raise NotImplementedError() + ReadUserSet.future = None + def RevokeCertificate(self, request, timeout): + """an admin can revoke any cert + """ + raise NotImplementedError() + RevokeCertificate.future = None + def PublishCRL(self, request, timeout): + """publishes CRL in the blockchain + """ + raise NotImplementedError() + PublishCRL.future = None + +def beta_create_ECAA_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.ECAA', 'PublishCRL'): ca_pb2.ECertCRLReq.FromString, + ('protos.ECAA', 'ReadUserSet'): ca_pb2.ReadUserSetReq.FromString, + ('protos.ECAA', 'RegisterUser'): ca_pb2.RegisterUserReq.FromString, + ('protos.ECAA', 'RevokeCertificate'): ca_pb2.ECertRevokeReq.FromString, + } + response_serializers = { + ('protos.ECAA', 'PublishCRL'): ca_pb2.CAStatus.SerializeToString, + ('protos.ECAA', 'ReadUserSet'): ca_pb2.UserSet.SerializeToString, + ('protos.ECAA', 'RegisterUser'): ca_pb2.Token.SerializeToString, + ('protos.ECAA', 'RevokeCertificate'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.ECAA', 'PublishCRL'): face_utilities.unary_unary_inline(servicer.PublishCRL), + ('protos.ECAA', 'ReadUserSet'): face_utilities.unary_unary_inline(servicer.ReadUserSet), + ('protos.ECAA', 'RegisterUser'): face_utilities.unary_unary_inline(servicer.RegisterUser), + ('protos.ECAA', 'RevokeCertificate'): face_utilities.unary_unary_inline(servicer.RevokeCertificate), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_ECAA_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.ECAA', 'PublishCRL'): ca_pb2.ECertCRLReq.SerializeToString, + ('protos.ECAA', 'ReadUserSet'): ca_pb2.ReadUserSetReq.SerializeToString, + ('protos.ECAA', 'RegisterUser'): ca_pb2.RegisterUserReq.SerializeToString, + ('protos.ECAA', 'RevokeCertificate'): ca_pb2.ECertRevokeReq.SerializeToString, + } + response_deserializers = { + ('protos.ECAA', 'PublishCRL'): ca_pb2.CAStatus.FromString, + ('protos.ECAA', 'ReadUserSet'): ca_pb2.UserSet.FromString, + ('protos.ECAA', 'RegisterUser'): ca_pb2.Token.FromString, + ('protos.ECAA', 'RevokeCertificate'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'PublishCRL': cardinality.Cardinality.UNARY_UNARY, + 'ReadUserSet': cardinality.Cardinality.UNARY_UNARY, + 'RegisterUser': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificate': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.ECAA', cardinalities, options=stub_options) + +class BetaTCAPServicer(object): + """Transaction Certificate Authority (TCA). + + public service + """ + def ReadCACertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def CreateCertificateSet(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadCertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadCertificateSet(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificate(self, request, context): + """a user can revoke only his/her cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificateSet(self, request, context): + """a user can revoke only his/her certs + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaTCAPStub(object): + """Transaction Certificate Authority (TCA). + + public service + """ + def ReadCACertificate(self, request, timeout): + raise NotImplementedError() + ReadCACertificate.future = None + def CreateCertificateSet(self, request, timeout): + raise NotImplementedError() + CreateCertificateSet.future = None + def ReadCertificate(self, request, timeout): + raise NotImplementedError() + ReadCertificate.future = None + def ReadCertificateSet(self, request, timeout): + raise NotImplementedError() + ReadCertificateSet.future = None + def RevokeCertificate(self, request, timeout): + """a user can revoke only his/her cert + """ + raise NotImplementedError() + RevokeCertificate.future = None + def RevokeCertificateSet(self, request, timeout): + """a user can revoke only his/her certs + """ + raise NotImplementedError() + RevokeCertificateSet.future = None + +def beta_create_TCAP_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.TCAP', 'CreateCertificateSet'): ca_pb2.TCertCreateSetReq.FromString, + ('protos.TCAP', 'ReadCACertificate'): ca_pb2.Empty.FromString, + ('protos.TCAP', 'ReadCertificate'): ca_pb2.TCertReadReq.FromString, + ('protos.TCAP', 'ReadCertificateSet'): ca_pb2.TCertReadSetReq.FromString, + ('protos.TCAP', 'RevokeCertificate'): ca_pb2.TCertRevokeReq.FromString, + ('protos.TCAP', 'RevokeCertificateSet'): ca_pb2.TCertRevokeSetReq.FromString, + } + response_serializers = { + ('protos.TCAP', 'CreateCertificateSet'): ca_pb2.TCertCreateSetResp.SerializeToString, + ('protos.TCAP', 'ReadCACertificate'): ca_pb2.Cert.SerializeToString, + ('protos.TCAP', 'ReadCertificate'): ca_pb2.Cert.SerializeToString, + ('protos.TCAP', 'ReadCertificateSet'): ca_pb2.CertSet.SerializeToString, + ('protos.TCAP', 'RevokeCertificate'): ca_pb2.CAStatus.SerializeToString, + ('protos.TCAP', 'RevokeCertificateSet'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.TCAP', 'CreateCertificateSet'): face_utilities.unary_unary_inline(servicer.CreateCertificateSet), + ('protos.TCAP', 'ReadCACertificate'): face_utilities.unary_unary_inline(servicer.ReadCACertificate), + ('protos.TCAP', 'ReadCertificate'): face_utilities.unary_unary_inline(servicer.ReadCertificate), + ('protos.TCAP', 'ReadCertificateSet'): face_utilities.unary_unary_inline(servicer.ReadCertificateSet), + ('protos.TCAP', 'RevokeCertificate'): face_utilities.unary_unary_inline(servicer.RevokeCertificate), + ('protos.TCAP', 'RevokeCertificateSet'): face_utilities.unary_unary_inline(servicer.RevokeCertificateSet), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_TCAP_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.TCAP', 'CreateCertificateSet'): ca_pb2.TCertCreateSetReq.SerializeToString, + ('protos.TCAP', 'ReadCACertificate'): ca_pb2.Empty.SerializeToString, + ('protos.TCAP', 'ReadCertificate'): ca_pb2.TCertReadReq.SerializeToString, + ('protos.TCAP', 'ReadCertificateSet'): ca_pb2.TCertReadSetReq.SerializeToString, + ('protos.TCAP', 'RevokeCertificate'): ca_pb2.TCertRevokeReq.SerializeToString, + ('protos.TCAP', 'RevokeCertificateSet'): ca_pb2.TCertRevokeSetReq.SerializeToString, + } + response_deserializers = { + ('protos.TCAP', 'CreateCertificateSet'): ca_pb2.TCertCreateSetResp.FromString, + ('protos.TCAP', 'ReadCACertificate'): ca_pb2.Cert.FromString, + ('protos.TCAP', 'ReadCertificate'): ca_pb2.Cert.FromString, + ('protos.TCAP', 'ReadCertificateSet'): ca_pb2.CertSet.FromString, + ('protos.TCAP', 'RevokeCertificate'): ca_pb2.CAStatus.FromString, + ('protos.TCAP', 'RevokeCertificateSet'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'CreateCertificateSet': cardinality.Cardinality.UNARY_UNARY, + 'ReadCACertificate': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificate': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificateSet': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificate': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificateSet': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.TCAP', cardinalities, options=stub_options) + +class BetaTCAAServicer(object): + """admin service + """ + def ReadCertificateSets(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificate(self, request, context): + """an admin can revoke any cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificateSet(self, request, context): + """an admin can revoke any cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def PublishCRL(self, request, context): + """publishes CRL in the blockchain + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaTCAAStub(object): + """admin service + """ + def ReadCertificateSets(self, request, timeout): + raise NotImplementedError() + ReadCertificateSets.future = None + def RevokeCertificate(self, request, timeout): + """an admin can revoke any cert + """ + raise NotImplementedError() + RevokeCertificate.future = None + def RevokeCertificateSet(self, request, timeout): + """an admin can revoke any cert + """ + raise NotImplementedError() + RevokeCertificateSet.future = None + def PublishCRL(self, request, timeout): + """publishes CRL in the blockchain + """ + raise NotImplementedError() + PublishCRL.future = None + +def beta_create_TCAA_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.TCAA', 'PublishCRL'): ca_pb2.TCertCRLReq.FromString, + ('protos.TCAA', 'ReadCertificateSets'): ca_pb2.TCertReadSetsReq.FromString, + ('protos.TCAA', 'RevokeCertificate'): ca_pb2.TCertRevokeReq.FromString, + ('protos.TCAA', 'RevokeCertificateSet'): ca_pb2.TCertRevokeSetReq.FromString, + } + response_serializers = { + ('protos.TCAA', 'PublishCRL'): ca_pb2.CAStatus.SerializeToString, + ('protos.TCAA', 'ReadCertificateSets'): ca_pb2.CertSets.SerializeToString, + ('protos.TCAA', 'RevokeCertificate'): ca_pb2.CAStatus.SerializeToString, + ('protos.TCAA', 'RevokeCertificateSet'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.TCAA', 'PublishCRL'): face_utilities.unary_unary_inline(servicer.PublishCRL), + ('protos.TCAA', 'ReadCertificateSets'): face_utilities.unary_unary_inline(servicer.ReadCertificateSets), + ('protos.TCAA', 'RevokeCertificate'): face_utilities.unary_unary_inline(servicer.RevokeCertificate), + ('protos.TCAA', 'RevokeCertificateSet'): face_utilities.unary_unary_inline(servicer.RevokeCertificateSet), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_TCAA_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.TCAA', 'PublishCRL'): ca_pb2.TCertCRLReq.SerializeToString, + ('protos.TCAA', 'ReadCertificateSets'): ca_pb2.TCertReadSetsReq.SerializeToString, + ('protos.TCAA', 'RevokeCertificate'): ca_pb2.TCertRevokeReq.SerializeToString, + ('protos.TCAA', 'RevokeCertificateSet'): ca_pb2.TCertRevokeSetReq.SerializeToString, + } + response_deserializers = { + ('protos.TCAA', 'PublishCRL'): ca_pb2.CAStatus.FromString, + ('protos.TCAA', 'ReadCertificateSets'): ca_pb2.CertSets.FromString, + ('protos.TCAA', 'RevokeCertificate'): ca_pb2.CAStatus.FromString, + ('protos.TCAA', 'RevokeCertificateSet'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'PublishCRL': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificateSets': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificate': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificateSet': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.TCAA', cardinalities, options=stub_options) + +class BetaTLSCAPServicer(object): + """TLS Certificate Authority (TLSCA) + + public service + """ + def ReadCACertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def CreateCertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def ReadCertificate(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def RevokeCertificate(self, request, context): + """a user can revoke only his/her cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaTLSCAPStub(object): + """TLS Certificate Authority (TLSCA) + + public service + """ + def ReadCACertificate(self, request, timeout): + raise NotImplementedError() + ReadCACertificate.future = None + def CreateCertificate(self, request, timeout): + raise NotImplementedError() + CreateCertificate.future = None + def ReadCertificate(self, request, timeout): + raise NotImplementedError() + ReadCertificate.future = None + def RevokeCertificate(self, request, timeout): + """a user can revoke only his/her cert + """ + raise NotImplementedError() + RevokeCertificate.future = None + +def beta_create_TLSCAP_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.TLSCAP', 'CreateCertificate'): ca_pb2.TLSCertCreateReq.FromString, + ('protos.TLSCAP', 'ReadCACertificate'): ca_pb2.Empty.FromString, + ('protos.TLSCAP', 'ReadCertificate'): ca_pb2.TLSCertReadReq.FromString, + ('protos.TLSCAP', 'RevokeCertificate'): ca_pb2.TLSCertRevokeReq.FromString, + } + response_serializers = { + ('protos.TLSCAP', 'CreateCertificate'): ca_pb2.TLSCertCreateResp.SerializeToString, + ('protos.TLSCAP', 'ReadCACertificate'): ca_pb2.Cert.SerializeToString, + ('protos.TLSCAP', 'ReadCertificate'): ca_pb2.Cert.SerializeToString, + ('protos.TLSCAP', 'RevokeCertificate'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.TLSCAP', 'CreateCertificate'): face_utilities.unary_unary_inline(servicer.CreateCertificate), + ('protos.TLSCAP', 'ReadCACertificate'): face_utilities.unary_unary_inline(servicer.ReadCACertificate), + ('protos.TLSCAP', 'ReadCertificate'): face_utilities.unary_unary_inline(servicer.ReadCertificate), + ('protos.TLSCAP', 'RevokeCertificate'): face_utilities.unary_unary_inline(servicer.RevokeCertificate), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_TLSCAP_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.TLSCAP', 'CreateCertificate'): ca_pb2.TLSCertCreateReq.SerializeToString, + ('protos.TLSCAP', 'ReadCACertificate'): ca_pb2.Empty.SerializeToString, + ('protos.TLSCAP', 'ReadCertificate'): ca_pb2.TLSCertReadReq.SerializeToString, + ('protos.TLSCAP', 'RevokeCertificate'): ca_pb2.TLSCertRevokeReq.SerializeToString, + } + response_deserializers = { + ('protos.TLSCAP', 'CreateCertificate'): ca_pb2.TLSCertCreateResp.FromString, + ('protos.TLSCAP', 'ReadCACertificate'): ca_pb2.Cert.FromString, + ('protos.TLSCAP', 'ReadCertificate'): ca_pb2.Cert.FromString, + ('protos.TLSCAP', 'RevokeCertificate'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'CreateCertificate': cardinality.Cardinality.UNARY_UNARY, + 'ReadCACertificate': cardinality.Cardinality.UNARY_UNARY, + 'ReadCertificate': cardinality.Cardinality.UNARY_UNARY, + 'RevokeCertificate': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.TLSCAP', cardinalities, options=stub_options) + +class BetaTLSCAAServicer(object): + """admin service + """ + def RevokeCertificate(self, request, context): + """an admin can revoke any cert + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaTLSCAAStub(object): + """admin service + """ + def RevokeCertificate(self, request, timeout): + """an admin can revoke any cert + """ + raise NotImplementedError() + RevokeCertificate.future = None + +def beta_create_TLSCAA_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import ca_pb2 + import ca_pb2 + request_deserializers = { + ('protos.TLSCAA', 'RevokeCertificate'): ca_pb2.TLSCertRevokeReq.FromString, + } + response_serializers = { + ('protos.TLSCAA', 'RevokeCertificate'): ca_pb2.CAStatus.SerializeToString, + } + method_implementations = { + ('protos.TLSCAA', 'RevokeCertificate'): face_utilities.unary_unary_inline(servicer.RevokeCertificate), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_TLSCAA_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import ca_pb2 + import ca_pb2 + request_serializers = { + ('protos.TLSCAA', 'RevokeCertificate'): ca_pb2.TLSCertRevokeReq.SerializeToString, + } + response_deserializers = { + ('protos.TLSCAA', 'RevokeCertificate'): ca_pb2.CAStatus.FromString, + } + cardinalities = { + 'RevokeCertificate': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.TLSCAA', cardinalities, options=stub_options) +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/compose-defaults.yml b/bddtests/compose-defaults.yml new file mode 100644 index 00000000000..62d85d83837 --- /dev/null +++ b/bddtests/compose-defaults.yml @@ -0,0 +1,27 @@ +version: "2" + +services: + + vp: + image: hyperledger/fabric-peer + environment: + - CORE_PEER_ADDRESSAUTODETECT=true +# - CORE_VM_ENDPOINT=http://172.17.0.1:2375 + - CORE_LOGGING_LEVEL=DEBUG + - CORE_PEER_NETWORKID=${CORE_PEER_NETWORKID} + volumes: + - ./volumes/peer:/var/hyperledger/bddtests/volumes/peer + - /var/run/docker.sock:/var/run/docker.sock + # Script will wait until membersrvc is up (if it exists) before starting + # $$GOPATH (double dollar) required to prevent docker-compose doing its own + # substitution before the value gets to the container + #command: sh -c "exec $$GOPATH/src/github.com/hyperledger/fabric/bddtests/scripts/start-peer.sh" + command: sh -c "sleep 2; peer node start" + + # Use these options if coverage desired for peers + #image: hyperledger/fabric-peer-coverage + #command: ./peer.test --test.coverprofile=coverage.cov node start + +volumes: + + peer: \ No newline at end of file diff --git a/bddtests/devops_pb2.py b/bddtests/devops_pb2.py new file mode 100644 index 00000000000..5318489b35e --- /dev/null +++ b/bddtests/devops_pb2.py @@ -0,0 +1,581 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: devops.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +import chaincode_pb2 as chaincode__pb2 +import fabric_pb2 as fabric__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='devops.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x0c\x64\x65vops.proto\x12\x06protos\x1a\x0f\x63haincode.proto\x1a\x0c\x66\x61\x62ric.proto\"0\n\x06Secret\x12\x10\n\x08\x65nrollId\x18\x01 \x01(\t\x12\x14\n\x0c\x65nrollSecret\x18\x02 \x01(\t\"L\n\nSigmaInput\x12\x1e\n\x06secret\x18\x01 \x01(\x0b\x32\x0e.protos.Secret\x12\x10\n\x08\x61ppTCert\x18\x02 \x01(\x0c\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"g\n\x12\x45xecuteWithBinding\x12@\n\x17\x63haincodeInvocationSpec\x18\x01 \x01(\x0b\x32\x1f.protos.ChaincodeInvocationSpec\x12\x0f\n\x07\x62inding\x18\x02 \x01(\x0c\"A\n\x0bSigmaOutput\x12\r\n\x05tcert\x18\x01 \x01(\x0c\x12\r\n\x05sigma\x18\x02 \x01(\x0c\x12\x14\n\x0c\x61sn1Encoding\x18\x03 \x01(\x0c\"\xba\x01\n\x0b\x42uildResult\x12.\n\x06status\x18\x01 \x01(\x0e\x32\x1e.protos.BuildResult.StatusCode\x12\x0b\n\x03msg\x18\x02 \x01(\t\x12\x37\n\x0e\x64\x65ploymentSpec\x18\x03 \x01(\x0b\x32\x1f.protos.ChaincodeDeploymentSpec\"5\n\nStatusCode\x12\r\n\tUNDEFINED\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x0b\n\x07\x46\x41ILURE\x10\x02\"-\n\x12TransactionRequest\x12\x17\n\x0ftransactionUuid\x18\x01 \x01(\t2\xfe\x04\n\x06\x44\x65vops\x12+\n\x05Login\x12\x0e.protos.Secret\x1a\x10.protos.Response\"\x00\x12\x41\n\x05\x42uild\x12\x15.protos.ChaincodeSpec\x1a\x1f.protos.ChaincodeDeploymentSpec\"\x00\x12\x42\n\x06\x44\x65ploy\x12\x15.protos.ChaincodeSpec\x1a\x1f.protos.ChaincodeDeploymentSpec\"\x00\x12=\n\x06Invoke\x12\x1f.protos.ChaincodeInvocationSpec\x1a\x10.protos.Response\"\x00\x12<\n\x05Query\x12\x1f.protos.ChaincodeInvocationSpec\x1a\x10.protos.Response\"\x00\x12\x46\n\x14GetTransactionResult\x12\x1a.protos.TransactionRequest\x1a\x10.protos.Response\"\x00\x12=\n\x17\x45XP_GetApplicationTCert\x12\x0e.protos.Secret\x1a\x10.protos.Response\"\x00\x12\x36\n\x10\x45XP_PrepareForTx\x12\x0e.protos.Secret\x1a\x10.protos.Response\"\x00\x12:\n\x10\x45XP_ProduceSigma\x12\x12.protos.SigmaInput\x1a\x10.protos.Response\"\x00\x12H\n\x16\x45XP_ExecuteWithBinding\x12\x1a.protos.ExecuteWithBinding\x1a\x10.protos.Response\"\x00\x62\x06proto3') + , + dependencies=[chaincode__pb2.DESCRIPTOR,fabric__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + +_BUILDRESULT_STATUSCODE = _descriptor.EnumDescriptor( + name='StatusCode', + full_name='protos.BuildResult.StatusCode', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SUCCESS', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FAILURE', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=489, + serialized_end=542, +) +_sym_db.RegisterEnumDescriptor(_BUILDRESULT_STATUSCODE) + + +_SECRET = _descriptor.Descriptor( + name='Secret', + full_name='protos.Secret', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='enrollId', full_name='protos.Secret.enrollId', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='enrollSecret', full_name='protos.Secret.enrollSecret', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=55, + serialized_end=103, +) + + +_SIGMAINPUT = _descriptor.Descriptor( + name='SigmaInput', + full_name='protos.SigmaInput', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='secret', full_name='protos.SigmaInput.secret', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='appTCert', full_name='protos.SigmaInput.appTCert', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data', full_name='protos.SigmaInput.data', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=105, + serialized_end=181, +) + + +_EXECUTEWITHBINDING = _descriptor.Descriptor( + name='ExecuteWithBinding', + full_name='protos.ExecuteWithBinding', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='chaincodeInvocationSpec', full_name='protos.ExecuteWithBinding.chaincodeInvocationSpec', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='binding', full_name='protos.ExecuteWithBinding.binding', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=183, + serialized_end=286, +) + + +_SIGMAOUTPUT = _descriptor.Descriptor( + name='SigmaOutput', + full_name='protos.SigmaOutput', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='tcert', full_name='protos.SigmaOutput.tcert', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='sigma', full_name='protos.SigmaOutput.sigma', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='asn1Encoding', full_name='protos.SigmaOutput.asn1Encoding', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=288, + serialized_end=353, +) + + +_BUILDRESULT = _descriptor.Descriptor( + name='BuildResult', + full_name='protos.BuildResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='status', full_name='protos.BuildResult.status', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='msg', full_name='protos.BuildResult.msg', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='deploymentSpec', full_name='protos.BuildResult.deploymentSpec', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _BUILDRESULT_STATUSCODE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=356, + serialized_end=542, +) + + +_TRANSACTIONREQUEST = _descriptor.Descriptor( + name='TransactionRequest', + full_name='protos.TransactionRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='transactionUuid', full_name='protos.TransactionRequest.transactionUuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=544, + serialized_end=589, +) + +_SIGMAINPUT.fields_by_name['secret'].message_type = _SECRET +_EXECUTEWITHBINDING.fields_by_name['chaincodeInvocationSpec'].message_type = chaincode__pb2._CHAINCODEINVOCATIONSPEC +_BUILDRESULT.fields_by_name['status'].enum_type = _BUILDRESULT_STATUSCODE +_BUILDRESULT.fields_by_name['deploymentSpec'].message_type = chaincode__pb2._CHAINCODEDEPLOYMENTSPEC +_BUILDRESULT_STATUSCODE.containing_type = _BUILDRESULT +DESCRIPTOR.message_types_by_name['Secret'] = _SECRET +DESCRIPTOR.message_types_by_name['SigmaInput'] = _SIGMAINPUT +DESCRIPTOR.message_types_by_name['ExecuteWithBinding'] = _EXECUTEWITHBINDING +DESCRIPTOR.message_types_by_name['SigmaOutput'] = _SIGMAOUTPUT +DESCRIPTOR.message_types_by_name['BuildResult'] = _BUILDRESULT +DESCRIPTOR.message_types_by_name['TransactionRequest'] = _TRANSACTIONREQUEST + +Secret = _reflection.GeneratedProtocolMessageType('Secret', (_message.Message,), dict( + DESCRIPTOR = _SECRET, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.Secret) + )) +_sym_db.RegisterMessage(Secret) + +SigmaInput = _reflection.GeneratedProtocolMessageType('SigmaInput', (_message.Message,), dict( + DESCRIPTOR = _SIGMAINPUT, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.SigmaInput) + )) +_sym_db.RegisterMessage(SigmaInput) + +ExecuteWithBinding = _reflection.GeneratedProtocolMessageType('ExecuteWithBinding', (_message.Message,), dict( + DESCRIPTOR = _EXECUTEWITHBINDING, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.ExecuteWithBinding) + )) +_sym_db.RegisterMessage(ExecuteWithBinding) + +SigmaOutput = _reflection.GeneratedProtocolMessageType('SigmaOutput', (_message.Message,), dict( + DESCRIPTOR = _SIGMAOUTPUT, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.SigmaOutput) + )) +_sym_db.RegisterMessage(SigmaOutput) + +BuildResult = _reflection.GeneratedProtocolMessageType('BuildResult', (_message.Message,), dict( + DESCRIPTOR = _BUILDRESULT, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.BuildResult) + )) +_sym_db.RegisterMessage(BuildResult) + +TransactionRequest = _reflection.GeneratedProtocolMessageType('TransactionRequest', (_message.Message,), dict( + DESCRIPTOR = _TRANSACTIONREQUEST, + __module__ = 'devops_pb2' + # @@protoc_insertion_point(class_scope:protos.TransactionRequest) + )) +_sym_db.RegisterMessage(TransactionRequest) + + +import abc +import six +from grpc.beta import implementations as beta_implementations +from grpc.beta import interfaces as beta_interfaces +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + +class BetaDevopsServicer(object): + """Interface exported by the server. + """ + def Login(self, request, context): + """Log in - passed Secret object and returns Response object, where + msg is the security context to be used in subsequent invocations + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def Build(self, request, context): + """Build the chaincode package. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def Deploy(self, request, context): + """Deploy the chaincode package to the chain. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def Invoke(self, request, context): + """Invoke chaincode. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def Query(self, request, context): + """Invoke chaincode. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def GetTransactionResult(self, request, context): + """Request a TransactionResult. The Response.Msg will contain the TransactionResult if successfully found the transaction in the chain. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def EXP_GetApplicationTCert(self, request, context): + """Retrieve a TCert. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def EXP_PrepareForTx(self, request, context): + """Prepare for performing a TX, which will return a binding that can later be used to sign and then execute a transaction. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def EXP_ProduceSigma(self, request, context): + """Prepare for performing a TX, which will return a binding that can later be used to sign and then execute a transaction. + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + def EXP_ExecuteWithBinding(self, request, context): + """Execute a transaction with a specific binding + """ + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + +class BetaDevopsStub(object): + """Interface exported by the server. + """ + def Login(self, request, timeout): + """Log in - passed Secret object and returns Response object, where + msg is the security context to be used in subsequent invocations + """ + raise NotImplementedError() + Login.future = None + def Build(self, request, timeout): + """Build the chaincode package. + """ + raise NotImplementedError() + Build.future = None + def Deploy(self, request, timeout): + """Deploy the chaincode package to the chain. + """ + raise NotImplementedError() + Deploy.future = None + def Invoke(self, request, timeout): + """Invoke chaincode. + """ + raise NotImplementedError() + Invoke.future = None + def Query(self, request, timeout): + """Invoke chaincode. + """ + raise NotImplementedError() + Query.future = None + def GetTransactionResult(self, request, timeout): + """Request a TransactionResult. The Response.Msg will contain the TransactionResult if successfully found the transaction in the chain. + """ + raise NotImplementedError() + GetTransactionResult.future = None + def EXP_GetApplicationTCert(self, request, timeout): + """Retrieve a TCert. + """ + raise NotImplementedError() + EXP_GetApplicationTCert.future = None + def EXP_PrepareForTx(self, request, timeout): + """Prepare for performing a TX, which will return a binding that can later be used to sign and then execute a transaction. + """ + raise NotImplementedError() + EXP_PrepareForTx.future = None + def EXP_ProduceSigma(self, request, timeout): + """Prepare for performing a TX, which will return a binding that can later be used to sign and then execute a transaction. + """ + raise NotImplementedError() + EXP_ProduceSigma.future = None + def EXP_ExecuteWithBinding(self, request, timeout): + """Execute a transaction with a specific binding + """ + raise NotImplementedError() + EXP_ExecuteWithBinding.future = None + +def beta_create_Devops_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + import devops_pb2 + import fabric_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import fabric_pb2 + import chaincode_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + request_deserializers = { + ('protos.Devops', 'Build'): chaincode_pb2.ChaincodeSpec.FromString, + ('protos.Devops', 'Deploy'): chaincode_pb2.ChaincodeSpec.FromString, + ('protos.Devops', 'EXP_ExecuteWithBinding'): devops_pb2.ExecuteWithBinding.FromString, + ('protos.Devops', 'EXP_GetApplicationTCert'): devops_pb2.Secret.FromString, + ('protos.Devops', 'EXP_PrepareForTx'): devops_pb2.Secret.FromString, + ('protos.Devops', 'EXP_ProduceSigma'): devops_pb2.SigmaInput.FromString, + ('protos.Devops', 'GetTransactionResult'): devops_pb2.TransactionRequest.FromString, + ('protos.Devops', 'Invoke'): chaincode_pb2.ChaincodeInvocationSpec.FromString, + ('protos.Devops', 'Login'): devops_pb2.Secret.FromString, + ('protos.Devops', 'Query'): chaincode_pb2.ChaincodeInvocationSpec.FromString, + } + response_serializers = { + ('protos.Devops', 'Build'): chaincode_pb2.ChaincodeDeploymentSpec.SerializeToString, + ('protos.Devops', 'Deploy'): chaincode_pb2.ChaincodeDeploymentSpec.SerializeToString, + ('protos.Devops', 'EXP_ExecuteWithBinding'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'EXP_GetApplicationTCert'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'EXP_PrepareForTx'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'EXP_ProduceSigma'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'GetTransactionResult'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'Invoke'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'Login'): fabric_pb2.Response.SerializeToString, + ('protos.Devops', 'Query'): fabric_pb2.Response.SerializeToString, + } + method_implementations = { + ('protos.Devops', 'Build'): face_utilities.unary_unary_inline(servicer.Build), + ('protos.Devops', 'Deploy'): face_utilities.unary_unary_inline(servicer.Deploy), + ('protos.Devops', 'EXP_ExecuteWithBinding'): face_utilities.unary_unary_inline(servicer.EXP_ExecuteWithBinding), + ('protos.Devops', 'EXP_GetApplicationTCert'): face_utilities.unary_unary_inline(servicer.EXP_GetApplicationTCert), + ('protos.Devops', 'EXP_PrepareForTx'): face_utilities.unary_unary_inline(servicer.EXP_PrepareForTx), + ('protos.Devops', 'EXP_ProduceSigma'): face_utilities.unary_unary_inline(servicer.EXP_ProduceSigma), + ('protos.Devops', 'GetTransactionResult'): face_utilities.unary_unary_inline(servicer.GetTransactionResult), + ('protos.Devops', 'Invoke'): face_utilities.unary_unary_inline(servicer.Invoke), + ('protos.Devops', 'Login'): face_utilities.unary_unary_inline(servicer.Login), + ('protos.Devops', 'Query'): face_utilities.unary_unary_inline(servicer.Query), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + +def beta_create_Devops_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + import devops_pb2 + import fabric_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import chaincode_pb2 + import fabric_pb2 + import chaincode_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + import devops_pb2 + import fabric_pb2 + request_serializers = { + ('protos.Devops', 'Build'): chaincode_pb2.ChaincodeSpec.SerializeToString, + ('protos.Devops', 'Deploy'): chaincode_pb2.ChaincodeSpec.SerializeToString, + ('protos.Devops', 'EXP_ExecuteWithBinding'): devops_pb2.ExecuteWithBinding.SerializeToString, + ('protos.Devops', 'EXP_GetApplicationTCert'): devops_pb2.Secret.SerializeToString, + ('protos.Devops', 'EXP_PrepareForTx'): devops_pb2.Secret.SerializeToString, + ('protos.Devops', 'EXP_ProduceSigma'): devops_pb2.SigmaInput.SerializeToString, + ('protos.Devops', 'GetTransactionResult'): devops_pb2.TransactionRequest.SerializeToString, + ('protos.Devops', 'Invoke'): chaincode_pb2.ChaincodeInvocationSpec.SerializeToString, + ('protos.Devops', 'Login'): devops_pb2.Secret.SerializeToString, + ('protos.Devops', 'Query'): chaincode_pb2.ChaincodeInvocationSpec.SerializeToString, + } + response_deserializers = { + ('protos.Devops', 'Build'): chaincode_pb2.ChaincodeDeploymentSpec.FromString, + ('protos.Devops', 'Deploy'): chaincode_pb2.ChaincodeDeploymentSpec.FromString, + ('protos.Devops', 'EXP_ExecuteWithBinding'): fabric_pb2.Response.FromString, + ('protos.Devops', 'EXP_GetApplicationTCert'): fabric_pb2.Response.FromString, + ('protos.Devops', 'EXP_PrepareForTx'): fabric_pb2.Response.FromString, + ('protos.Devops', 'EXP_ProduceSigma'): fabric_pb2.Response.FromString, + ('protos.Devops', 'GetTransactionResult'): fabric_pb2.Response.FromString, + ('protos.Devops', 'Invoke'): fabric_pb2.Response.FromString, + ('protos.Devops', 'Login'): fabric_pb2.Response.FromString, + ('protos.Devops', 'Query'): fabric_pb2.Response.FromString, + } + cardinalities = { + 'Build': cardinality.Cardinality.UNARY_UNARY, + 'Deploy': cardinality.Cardinality.UNARY_UNARY, + 'EXP_ExecuteWithBinding': cardinality.Cardinality.UNARY_UNARY, + 'EXP_GetApplicationTCert': cardinality.Cardinality.UNARY_UNARY, + 'EXP_PrepareForTx': cardinality.Cardinality.UNARY_UNARY, + 'EXP_ProduceSigma': cardinality.Cardinality.UNARY_UNARY, + 'GetTransactionResult': cardinality.Cardinality.UNARY_UNARY, + 'Invoke': cardinality.Cardinality.UNARY_UNARY, + 'Login': cardinality.Cardinality.UNARY_UNARY, + 'Query': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.Devops', cardinalities, options=stub_options) +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/docker-compose-1-devmode.yml b/bddtests/docker-compose-1-devmode.yml new file mode 100644 index 00000000000..a29e936b6b3 --- /dev/null +++ b/bddtests/docker-compose-1-devmode.yml @@ -0,0 +1,22 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + command: peer node start --peer-chaincodedev + +ccenv: + image: hyperledger/fabric-ccenv + environment: + - CORE_CHAINCODE_ID_NAME=testCC + - CORE_PEER_ADDRESS=vp0:7051 + # $$GOPATH (double dollar) required to prevent docker-compose doing its own + # substitution before the value gets to the container + command: | + sh -c " + go install github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 + exec $$GOPATH/bin/chaincode_example02 + " + links: + - vp0 diff --git a/bddtests/docker-compose-1-empty.yml b/bddtests/docker-compose-1-empty.yml new file mode 100644 index 00000000000..75a1edf9070 --- /dev/null +++ b/bddtests/docker-compose-1-empty.yml @@ -0,0 +1,3 @@ +empty: + image: hyperledger/fabric-src + command: bash -c "sleep inf" diff --git a/bddtests/docker-compose-1-exp.yml b/bddtests/docker-compose-1-exp.yml new file mode 100644 index 00000000000..9173c1f6026 --- /dev/null +++ b/bddtests/docker-compose-1-exp.yml @@ -0,0 +1,8 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + ports: + - 7053:7053 diff --git a/bddtests/docker-compose-1-profiling.yml b/bddtests/docker-compose-1-profiling.yml new file mode 100644 index 00000000000..ad798857bd0 --- /dev/null +++ b/bddtests/docker-compose-1-profiling.yml @@ -0,0 +1,9 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + - CORE_PEER_PROFILE_ENABLED=true + ports: + - 7050:6060 diff --git a/bddtests/docker-compose-1.yml b/bddtests/docker-compose-1.yml new file mode 100644 index 00000000000..dbad207779e --- /dev/null +++ b/bddtests/docker-compose-1.yml @@ -0,0 +1,7 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + diff --git a/bddtests/docker-compose-2-tls-basic.yml b/bddtests/docker-compose-2-tls-basic.yml new file mode 100644 index 00000000000..8e3f6229d1a --- /dev/null +++ b/bddtests/docker-compose-2-tls-basic.yml @@ -0,0 +1,19 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_SERVERHOSTOVERRIDE=OBC + - CORE_PEER_TLS_CERT_FILE=./bddtests/tlsca.cert + - CORE_PEER_TLS_KEY_FILE=./bddtests/tlsca.priv + +vp1: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 diff --git a/bddtests/docker-compose-2.yml b/bddtests/docker-compose-2.yml new file mode 100644 index 00000000000..aaf205ac629 --- /dev/null +++ b/bddtests/docker-compose-2.yml @@ -0,0 +1,17 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + - CORE_PEER_DISCOVERY_PERIOD=1s + - CORE_PEER_DISCOVERY_TOUCHPERIOD=1s + +vp1: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 diff --git a/bddtests/docker-compose-3.yml b/bddtests/docker-compose-3.yml new file mode 100644 index 00000000000..261f688f34c --- /dev/null +++ b/bddtests/docker-compose-3.yml @@ -0,0 +1,24 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + +vp1: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp2: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 diff --git a/bddtests/docker-compose-4-consensus-base.yml b/bddtests/docker-compose-4-consensus-base.yml new file mode 100644 index 00000000000..08d1ab3770c --- /dev/null +++ b/bddtests/docker-compose-4-consensus-base.yml @@ -0,0 +1,24 @@ +vpBase: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_SECURITY_ENABLED=true + - CORE_PEER_PKI_ECA_PADDR=membersrvc0:7054 + - CORE_PEER_PKI_TCA_PADDR=membersrvc0:7054 + - CORE_PEER_PKI_TLSCA_PADDR=membersrvc0:7054 + - CORE_PEER_PKI_TLS_ROOTCERT_FILE=./bddtests/tlsca.cert + # TODO: Currently required due to issue reading obbca configuration location + - CORE_PBFT_GENERAL_N=4 + # The checkpoint interval in sequence numbers + - CORE_PBFT_GENERAL_K=2 + +vpBatch: + extends: + service: vpBase + environment: + - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft + - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s + - CORE_PBFT_GENERAL_MODE=batch + # TODO: This is used for testing as to assure deployment goes through to block + - CORE_PBFT_GENERAL_BATCHSIZE=1 diff --git a/bddtests/docker-compose-4-consensus-batch-1-byzantine.yml b/bddtests/docker-compose-4-consensus-batch-1-byzantine.yml new file mode 100644 index 00000000000..2652cb01297 --- /dev/null +++ b/bddtests/docker-compose-4-consensus-batch-1-byzantine.yml @@ -0,0 +1,55 @@ +membersrvc0: + extends: + file: compose-defaults.yml + service: membersrvc + +vp0: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENROLLID=test_vp0 + - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT + links: + - membersrvc0 + +vp1: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp1 + - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy + links: + - membersrvc0 + - vp0 + +vp2: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp2 + - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ + links: + - membersrvc0 + - vp0 + +vp3: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp3 + - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL + - CORE_PBFT_GENERAL_BYZANTINE=true + links: + - membersrvc0 + - vp0 diff --git a/bddtests/docker-compose-4-consensus-batch.yml b/bddtests/docker-compose-4-consensus-batch.yml new file mode 100644 index 00000000000..100e71ec346 --- /dev/null +++ b/bddtests/docker-compose-4-consensus-batch.yml @@ -0,0 +1,58 @@ +membersrvc0: + extends: + file: compose-defaults.yml + service: membersrvc + +vp0: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENROLLID=test_vp0 + - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT + - CORE_PEER_PROFILE_ENABLED=true + links: + - membersrvc0 +# ports: +# - 7050:6060 + + +vp1: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp1 + - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy + links: + - membersrvc0 + - vp0 + +vp2: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp2 + - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ + links: + - membersrvc0 + - vp0 + +vp3: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBatch + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp3 + - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL + links: + - membersrvc0 + - vp0 diff --git a/bddtests/docker-compose-4-consensus-noops.yml b/bddtests/docker-compose-4-consensus-noops.yml new file mode 100644 index 00000000000..7ba08ae1b0c --- /dev/null +++ b/bddtests/docker-compose-4-consensus-noops.yml @@ -0,0 +1,56 @@ +membersrvc0: + extends: + file: compose-defaults.yml + service: membersrvc + +vp0: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBase + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENROLLID=test_vp0 + - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT + links: + - membersrvc0 + ports: + - 7050:7050 + +vp1: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBase + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp1 + - CORE_SECURITY_ENROLLSECRET=5wgHK9qqYaPy + links: + - membersrvc0 + - vp0 + +vp2: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBase + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp2 + - CORE_SECURITY_ENROLLSECRET=vQelbRvja7cJ + links: + - membersrvc0 + - vp0 + +vp3: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBase + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_SECURITY_ENROLLID=test_vp3 + - CORE_SECURITY_ENROLLSECRET=9LKqKH5peurL + links: + - membersrvc0 + - vp0 diff --git a/bddtests/docker-compose-4-consensus-nvp0.yml b/bddtests/docker-compose-4-consensus-nvp0.yml new file mode 100644 index 00000000000..455027c719a --- /dev/null +++ b/bddtests/docker-compose-4-consensus-nvp0.yml @@ -0,0 +1,13 @@ +nvp0: + extends: + file: docker-compose-4-consensus-base.yml + service: vpBase + environment: + - CORE_PEER_VALIDATOR_ENABLED=false + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + - CORE_PEER_ID=nvp0 + - CORE_SECURITY_ENROLLID=test_nvp0 + - CORE_SECURITY_ENROLLSECRET=iywrPBDEPl0K + links: + - membersrvc0 + - vp0 diff --git a/bddtests/docker-compose-4-consensus-vp3-byzantine.yml b/bddtests/docker-compose-4-consensus-vp3-byzantine.yml new file mode 100644 index 00000000000..b64857f60e8 --- /dev/null +++ b/bddtests/docker-compose-4-consensus-vp3-byzantine.yml @@ -0,0 +1,3 @@ +vp3: + environment: + - CORE_PBFT_GENERAL_BYZANTINE=true diff --git a/bddtests/docker-compose-4.yml b/bddtests/docker-compose-4.yml new file mode 100644 index 00000000000..fa1ca1e78af --- /dev/null +++ b/bddtests/docker-compose-4.yml @@ -0,0 +1,33 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + +vp1: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp2: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp3: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 diff --git a/bddtests/docker-compose-5.yml b/bddtests/docker-compose-5.yml new file mode 100644 index 00000000000..6149dd0affa --- /dev/null +++ b/bddtests/docker-compose-5.yml @@ -0,0 +1,42 @@ +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + +vp1: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp2: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp3: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 + +vp4: + extends: + service: vp0 + environment: + - CORE_PEER_ID=vp4 + - CORE_PEER_DISCOVERY_ROOTNODE=vp0:7051 + links: + - vp0 diff --git a/bddtests/docker-compose-next-4.yml b/bddtests/docker-compose-next-4.yml new file mode 100644 index 00000000000..29e8e93fa1e --- /dev/null +++ b/bddtests/docker-compose-next-4.yml @@ -0,0 +1,65 @@ +version: "2" + +services: + + orderer0: + extends: + file: docker-compose-orderer-solo.yml + service: orderer0 + environment: + - ORDERER_GENERAL_LOCALMSPDIR=${ORDERER0_ORDERER_GENERAL_LOCALMSPDIR} + + + peer0: + extends: + file: docker-compose-next.yml + service: vpNext + environment: + - CORE_PEER_ID=vp0 + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050 + - CORE_PEER_MSPCONFIGPATH=${PEER0_CORE_PEER_MSPCFGPATH} + depends_on: + - orderer0 + # ports: + # - 7050:6060 + + + peer1: + extends: + file: docker-compose-next.yml + service: vpNext + environment: + - CORE_PEER_ID=vp1 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051 + - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050 + - CORE_PEER_MSPCONFIGPATH=${PEER1_CORE_PEER_MSPCFGPATH} + depends_on: + - orderer0 + - peer0 + + peer2: + extends: + file: docker-compose-next.yml + service: vpNext + environment: + - CORE_PEER_ID=vp2 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051 + - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050 + - CORE_PEER_MSPCONFIGPATH=${PEER2_CORE_PEER_MSPCFGPATH} + depends_on: + - orderer0 + - peer0 + + peer3: + extends: + file: docker-compose-next.yml + service: vpNext + environment: + - CORE_PEER_ID=vp3 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051 + - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050 + - CORE_PEER_MSPCONFIGPATH=${PEER3_CORE_PEER_MSPCFGPATH} + depends_on: + - orderer0 + - peer0 diff --git a/bddtests/docker-compose-next.yml b/bddtests/docker-compose-next.yml new file mode 100644 index 00000000000..f341cc8496a --- /dev/null +++ b/bddtests/docker-compose-next.yml @@ -0,0 +1,12 @@ +version: "2" + +services: + + vpNext: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_NEXT=true + - CORE_PEER_ENDORSER_ENABLED=true + diff --git a/bddtests/docker-compose-rest.yml b/bddtests/docker-compose-rest.yml new file mode 100644 index 00000000000..c062c7da350 --- /dev/null +++ b/bddtests/docker-compose-rest.yml @@ -0,0 +1,17 @@ +membersrvc0: + extends: + file: compose-defaults.yml + service: membersrvc + +vp0: + extends: + file: compose-defaults.yml + service: vp + environment: + - CORE_PEER_ID=vp0 + - CORE_SECURITY_ENABLED=true + - CORE_PEER_PKI_ECA_PADDR=membersrvc0:7054 + - CORE_PEER_PKI_TCA_PADDR=membersrvc0:7054 + - CORE_PEER_PKI_TLSCA_PADDR=membersrvc0:7054 + links: + - membersrvc0 \ No newline at end of file diff --git a/bddtests/docker-compose-sdk-node.yml b/bddtests/docker-compose-sdk-node.yml new file mode 100644 index 00000000000..4db31fd2c48 --- /dev/null +++ b/bddtests/docker-compose-sdk-node.yml @@ -0,0 +1,11 @@ +sampleApp0: + image: hyperledger-sdk-node + environment: + - MEMBERSRVC_ADDRESS=membersrvc0:7054 + - PEER_ADDRESS=vp0:7051 + - KEY_VALUE_STORE=/tmp/hl_sdk_node_key_value_store + # Startup of peer must be delayed to allow membersrvc to come up first + command: node sampleSDKApp + links: + - membersrvc0 + - vp0 diff --git a/bddtests/docker-membersrvc-attributes-enabled.yml b/bddtests/docker-membersrvc-attributes-enabled.yml new file mode 100644 index 00000000000..0269d51ef7e --- /dev/null +++ b/bddtests/docker-membersrvc-attributes-enabled.yml @@ -0,0 +1,3 @@ +membersrvc0: + environment: + - MEMBERSRVC_CA_ACA_ENABLED=true diff --git a/bddtests/docker-membersrvc-attributes-encryption-enabled.yml b/bddtests/docker-membersrvc-attributes-encryption-enabled.yml new file mode 100644 index 00000000000..6bb3978cee7 --- /dev/null +++ b/bddtests/docker-membersrvc-attributes-encryption-enabled.yml @@ -0,0 +1,3 @@ +membersrvc0: + environment: + - MEMBERSRVC_CA_TCA_ATTRIBUTE-ENCRYPTION_ENABLED=true diff --git a/bddtests/peer_basic.feature b/bddtests/peer_basic.feature new file mode 100644 index 00000000000..f884eff3d52 --- /dev/null +++ b/bddtests/peer_basic.feature @@ -0,0 +1,1388 @@ +# +# Test Fabric Peers +# +# Tags that can be used and will affect test internals: +# @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario. +# @chaincodeImagesUpToDate use this if all scenarios chaincode images are up to date, and do NOT require building. BE SURE!!! + +#@chaincodeImagesUpToDate +@preV1 +Feature: Network of Peers + As a Fabric developer + I want to run a network of peers + +# @wip + Scenario: Peers list test, single peer issue #827 + Given we compose "docker-compose-1.yml" + When requesting "/network/peers" from "vp0" + Then I should get a JSON response with array "peers" contains "1" elements + +# @wip + Scenario: Peers list test,3 peers issue #827 + Given we compose "docker-compose-3.yml" + When requesting "/network/peers" from "vp0" + Then I should get a JSON response with array "peers" contains "3" elements + +# @doNotDecompose + @wip + @issue_767 + Scenario: Range query test, single peer, issue #767 + Given we compose "docker-compose-1.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/map" with ctor "init" to "vp0" + || + || + + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "2" + + When I invoke chaincode "map" function name "put" on "vp0" + | arg1 | arg2 | + | key1 | value1 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "3" + + When I query chaincode "map" function name "get" on "vp0": + | arg1| + | key1 | + Then I should get a JSON response with "result.message" = "value1" + + When I invoke chaincode "map" function name "put" on "vp0" + | arg1 | arg2 | + | key2 | value2 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "4" + + When I query chaincode "map" function name "keys" on "vp0": + || + || + Then I should get a JSON response with "result.message" = "["key1","key2"]" + + When I invoke chaincode "map" function name "remove" on "vp0" + | arg1 | | + | key1 | | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "5" + + When I query chaincode "map" function name "keys" on "vp0": + || + || + Then I should get a JSON response with "result.message" = "["key2"]" + +# @doNotDecompose + @wip + @issue_477 + Scenario: chaincode shim table API, issue 477 + Given we compose "docker-compose-1.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/bddtests/chaincode/go/table" with ctor "init" to "vp0" + || + || + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "2" + + When I invoke chaincode "table_test" function name "insertRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test1| 10 | 20 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "3" + + When I invoke chaincode "table_test" function name "insertRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test2| 10 | 20 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "4" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test1| + Then I should get a JSON response with "result.message" = "{[string:"test1" int32:10 int32:20 ]}" + + When I invoke chaincode "table_test" function name "insertRowTableTwo" on "vp0" + | arg1 | arg2 | arg3 | arg3 | + | foo2 | 34 | 65 | bar8 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "5" + + When I query chaincode "table_test" function name "getRowTableTwo" on "vp0": + | arg1 | arg2 | arg3 | + | foo2 | 65 | bar8 | + Then I should get a JSON response with "result.message" = "{[string:"foo2" int32:34 int32:65 string:"bar8" ]}" + + When I invoke chaincode "table_test" function name "replaceRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test1| 30 | 40 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "6" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test1| + Then I should get a JSON response with "result.message" = "{[string:"test1" int32:30 int32:40 ]}" + + When I invoke chaincode "table_test" function name "deleteRowTableOne" on "vp0" + | arg1 | + | test1| + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "7" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test1| + Then I should get a JSON response with "result.message" = "{[]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test2| + Then I should get a JSON response with "result.message" = "{[string:"test2" int32:10 int32:20 ]}" + + When I invoke chaincode "table_test" function name "insertRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test3| 10 | 20 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "8" + + When I invoke chaincode "table_test" function name "insertRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test4| 10 | 20 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "9" + + When I invoke chaincode "table_test" function name "insertRowTableOne" on "vp0" + | arg1 | arg2 | arg3 | + | test5| 10 | 20 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "10" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test3| + Then I should get a JSON response with "result.message" = "{[string:"test3" int32:10 int32:20 ]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test4| + Then I should get a JSON response with "result.message" = "{[string:"test4" int32:10 int32:20 ]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test5| + Then I should get a JSON response with "result.message" = "{[string:"test5" int32:10 int32:20 ]}" + + When I invoke chaincode "table_test" function name "insertRowTableTwo" on "vp0" + | arg1 | arg2 | arg3 | arg3 | + | foo2 | 35 | 65 | bar10 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "11" + + When I invoke chaincode "table_test" function name "insertRowTableTwo" on "vp0" + | arg1 | arg2 | arg3 | arg3 | + | foo2 | 36 | 65 | bar11 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "12" + + When I invoke chaincode "table_test" function name "insertRowTableTwo" on "vp0" + | arg1 | arg2 | arg3 | arg3 | + | foo2 | 37 | 65 | bar12 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "13" + + When I invoke chaincode "table_test" function name "insertRowTableTwo" on "vp0" + | arg1 | arg2 | arg3 | arg3 | + | foo2 | 38 | 66 | bar10 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "14" + + When I query chaincode "table_test" function name "getRowsTableTwo" on "vp0": + | arg1 | arg2 | + | foo2 | 65 | + Then I should get a JSON response with "result.message" = "[{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":37}},{"Value":{"Int32":65}},{"Value":{"String_":"bar12"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":34}},{"Value":{"Int32":65}},{"Value":{"String_":"bar8"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":36}},{"Value":{"Int32":65}},{"Value":{"String_":"bar11"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":35}},{"Value":{"Int32":65}},{"Value":{"String_":"bar10"}}]}]" + + When I query chaincode "table_test" function name "getRowsTableTwo" on "vp0": + | arg1 | arg2 | + | foo2 | 66 | + Then I should get a JSON response with "result.message" = "[{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":38}},{"Value":{"Int32":66}},{"Value":{"String_":"bar10"}}]}]" + + When I query chaincode "table_test" function name "getRowsTableTwo" on "vp0": + | arg1 | + | foo2 | + Then I should get a JSON response with "result.message" = "[{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":37}},{"Value":{"Int32":65}},{"Value":{"String_":"bar12"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":34}},{"Value":{"Int32":65}},{"Value":{"String_":"bar8"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":36}},{"Value":{"Int32":65}},{"Value":{"String_":"bar11"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":38}},{"Value":{"Int32":66}},{"Value":{"String_":"bar10"}}]},{"columns":[{"Value":{"String_":"foo2"}},{"Value":{"Int32":35}},{"Value":{"Int32":65}},{"Value":{"String_":"bar10"}}]}]" + + When I invoke chaincode "table_test" function name "deleteAndRecreateTableOne" on "vp0" + || + || + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "15" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test3| + Then I should get a JSON response with "result.message" = "{[]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test4| + Then I should get a JSON response with "result.message" = "{[]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test5| + Then I should get a JSON response with "result.message" = "{[]}" + + When I query chaincode "table_test" function name "getRowTableOne" on "vp0": + | arg1 | + | test2| + Then I should get a JSON response with "result.message" = "{[]}" + + When I query chaincode "table_test" function name "getRowTableTwo" on "vp0": + | arg1 | arg2 | arg3 | + | foo2 | 65 | bar8 | + Then I should get a JSON response with "result.message" = "{[string:"foo2" int32:34 int32:65 string:"bar8" ]}" + + When I invoke chaincode "table_test" function name "insertRowTableThree" on "vp0" + | arg1 | arg2 | arg3 | arg4 | arg5 | arg6 | arg7 | + | foo2 | -38 | -66 | 77 | 88 | hello| true | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "16" + + When I query chaincode "table_test" function name "getRowTableThree" on "vp0": + | arg1 | + | foo2 | + Then I should get a JSON response with "result.message" = "{[string:"foo2" int32:-38 int64:-66 uint32:77 uint64:88 bytes:"hello" bool:true ]}" + + When I invoke chaincode "table_test" function name "insertRowTableFour" on "vp0" + | arg1 | + | foobar | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "17" + + When I query chaincode "table_test" function name "getRowTableFour" on "vp0": + | arg1 | + | foobar | + Then I should get a JSON response with "result.message" = "{[string:"foobar" ]}" + + When I query chaincode "table_test" function name "getRowsTableFour" on "vp0": + | arg1 | + | foobar | + Then I should get a JSON response with "result.message" = "[{"columns":[{"Value":{"String_":"foobar"}}]}]" + +@doNotDecompose +# @wip + Scenario: chaincode example 01 single peer erroneous TX + Given we compose "docker-compose-1.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "2" + + When I invoke chaincode "example1" function name "invoke" on "vp0" + |arg1| + | 1 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "3" + When requesting "/chain/blocks/2" from "vp0" + Then I should get a JSON response containing "transactions" attribute + + When I invoke chaincode "example1" function name "invoke" on "vp0" + |arg1| + | a | + Then I should have received a transactionID + Then I wait "10" seconds + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "4" + When requesting "/chain/blocks/3" from "vp0" + Then I should get a JSON response containing no "transactions" attribute + +# @doNotDecompose +# @wip + @devops + Scenario: chaincode map single peer content generated ID + Given we compose "docker-compose-1.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/map" with ctor "init" to "vp0" + || + || + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When I invoke chaincode "map" function name "put" on "vp0" with "sha256" + | arg1 |arg2| + | a | 10 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + Then I check the transaction ID if it is "73b88d92d86502eb66288f84fafae848fed0d21790f2ef1475850f4b635c47f0" + + Scenario: chaincode example 01 single peer rejection message + Given we compose "docker-compose-1-exp.yml" + Given I start a listener + Then I wait "5" seconds + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When I invoke chaincode "example1" function name "invoke" on "vp0" + |arg1| + | a | + Then I should have received a transactionID + Then I wait "10" seconds + + Then I should get a rejection message in the listener after stopping it + +# @doNotDecompose +# @wip + Scenario: chaincode example 02 single peer + Given we compose "docker-compose-1.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "2" + + When I query chaincode "example2" function name "query" on "vp0": + |arg1| + | a | + Then I should get a JSON response with "result.message" = "100" + + + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "25" seconds for transaction to be committed to all peers + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "3" + + When I query chaincode "example2" function name "query" on "vp0": + |arg1| + | a | + Then I should get a JSON response with "result.message" = "90" + + When I query chaincode "example2" function name "query" on "vp0": + |arg1| + | b | + Then I should get a JSON response with "result.message" = "210" + +# @doNotDecompose +# @wip + Scenario: chaincode example02 with 5 peers, issue #520 + Given we compose "docker-compose-5.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to all peers + + When I query chaincode "example2" function name "query" on all peers: + |arg1| + | a | + Then I should get a JSON response from all peers with "result.message" = "100" + + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 20 | + Then I should have received a transactionID + Then I wait up to "20" seconds for transaction to be committed to all peers + + When I query chaincode "example2" function name "query" on all peers: + |arg1| + | a | + Then I should get a JSON response from all peers with "result.message" = "80" + + +# @doNotDecompose +# @wip + @issue_567 + Scenario Outline: chaincode example02 with 4 peers and 1 membersrvc, issue #567 + + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | vp3 | + + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 20 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "80" + | vp0 | vp1 | vp2 | vp3 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-noops.yml | 60 | + | docker-compose-4-consensus-batch.yml | 60 | + + + #@doNotDecompose + #@wip + @issue_680 + @fab380 + Scenario Outline: chaincode example02 with 4 peers and 1 membersrvc, issue #680 (State transfer) + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + # Build up a sizable blockchain, that vp3 will need to validate at startup + When I invoke chaincode "example2" function name "invoke" on "vp0" "30" times + |arg1|arg2|arg3| + | b | a | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "130" + | vp0 | vp1 | vp2 | vp3 | + + # STOPPING vp3!!!!!!!!!!!!!!!!!!!!!!!!!! + Given I stop peers: + | vp3 | + + # Invoke a transaction to get vp3 out of sync + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "120" + | vp0 | vp1 | vp2 | + + # Now start vp3 again + Given I start peers: + | vp3 | + And I wait "15" seconds + + # Invoke 10 more txs, this will trigger a state transfer, set a target, and execute new outstanding transactions + When I invoke chaincode "example2" function name "invoke" on "vp0" "10" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "20" + | vp0 | vp1 | vp2 | vp3 | + + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + | docker-compose-4-consensus-batch.yml docker-compose-4-consensus-batch-nosnapshotbuffer.yml | 60 | + + +# @doNotDecompose + @issue_724 + Scenario Outline: chaincode example02 with 4 peers and 1 membersrvc, issue #724 + + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | vp3 | + + Given I stop peers: + | vp0 | vp1 | vp2 | vp3 | + + Given I start peers: + | vp0 | vp1 | vp2 | vp3 | + And I wait "15" seconds + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp3 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-noops.yml | 60 | + + +# @doNotDecompose +# @wip + Scenario: basic startup of 3 validating peers + Given we compose "docker-compose-3.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + @TLS +# @doNotDecompose + Scenario: basic startup of 2 validating peers using TLS + Given we compose "docker-compose-2-tls-basic.yml" + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + + Scenario Outline: 4 peers and 1 membersrvc, consensus still works if one backup replica fails + + Given we compose "" + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + And I register with CA supplying username "test_user0" and secret "MS9qrN8hFjlE" on peers: + | vp0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + # get things started. All peers up and executing Txs + When I invoke chaincode "example2" function name "invoke" on "vp0" "5" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "95" + | vp0 | vp1 | vp2 | vp3 | + + # STOP vp2 + Given I stop peers: + | vp2 | + + # continue invoking Txs + When I invoke chaincode "example2" function name "invoke" on "vp0" "5" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp3 | + Then I should get a JSON response from peers with "result.message" = "90" + | vp0 | vp1 | vp3 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + + Scenario Outline: 4 peers and 1 membersrvc, consensus fails if 2 backup replicas fail + + Given we compose "" + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + And I register with CA supplying username "test_user0" and secret "MS9qrN8hFjlE" on peers: + | vp0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + # get things started. All peers up and executing Txs + When I invoke chaincode "example2" function name "invoke" on "vp0" "5" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "95" + | vp0 | vp1 | vp2 | vp3 | + + # STOP vp2 + Given I stop peers: + | vp1 | vp2 | + + # continue invoking Txs + When I invoke chaincode "example2" function name "invoke" on "vp0" "5" times + |arg1|arg2|arg3| + | a | b | 1 | + And I wait "5" seconds + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp3 | + Then I should get a JSON response from peers with "result.message" = "95" + | vp0 | vp3 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + + #@doNotDecompose + #@wip + #@skip + Scenario Outline: 4 peers and 1 membersrvc, consensus still works if 1 peer (vp3) is byzantine + + Given we compose "" + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + And I register with CA supplying username "test_user0" and secret "MS9qrN8hFjlE" on peers: + | vp0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I invoke chaincode "example2" function name "invoke" on "vp0" "50" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "50" + | vp0 | vp1 | vp2 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml docker-compose-4-consensus-vp3-byzantine.yml | 60 | + + + #@doNotDecompose + @issue_1182 + Scenario Outline: chaincode example02 with 4 peers,1 membersrvc, and 1 non-validating peer. + + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | nvp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + +# Current issue as blocks NOT synced yet. +# When requesting "/chain" from "nvp0" +# Then I should get a JSON response with "height" = "1" + + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "nvp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml docker-compose-4-consensus-nvp0.yml | 60 | + + @issue_1000 + Scenario Outline: chaincode example02 with 4 peers and 1 membersrvc, test crash fault + + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + # Build up a sizable blockchain, to advance the sequence number + When I invoke chaincode "example2" function name "invoke" on "vp0" "30" times + |arg1|arg2|arg3| + | b | a | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "130" + | vp0 | vp1 | vp2 | vp3 | + + # Stop vp1, vp2, vp3 + Given I stop peers: + | vp1 | vp2 | vp3 | + + # Now start vp1, vp2 again, hopefully retaining pbft state + Given I start peers: + | vp1 | vp2 | + And I wait "15" seconds + + # Invoke 1 more tx, if the crash recovery worked, it will commit, otherwise, it will not + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "120" + | vp0 | vp1 | vp2 | + + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + + + + @issue_1091 + Scenario Outline: chaincode example02 with 4 peers and 1 membersrvc, issue #1019 (out of date peer) + + Given we compose "" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + # STOPPING vp3!!!!!!!!!!!!!!!!!!!!!!!!!! + Given I stop peers: + | vp3 | + + # Execute one request to get vp3 out of sync + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | b | a | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "101" + | vp0 | vp1 | vp2 | + + # Now start vp3 again + Given I start peers: + | vp3 | + And I wait "15" seconds + + # Invoke 8 more txs, this will trigger a state transfer, but it cannot complete + When I invoke chaincode "example2" function name "invoke" on "vp0" "8" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + # wait a bit to make sure the state is invalid on vp3 + Then I wait "20" seconds + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "21" + | vp0 | vp1 | vp2 | + When I unconditionally query chaincode "example2" function name "query" with value "a" on peers: + | vp3 | + Then I should get a JSON response from peers with "error.data" = "Error when querying chaincode: Error: state may be inconsistent, cannot query" + | vp3 | + + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + + Scenario: chaincode example02 with 4 peers, one paused, issue #1056 + Given we compose "docker-compose-4-consensus-batch.yml" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + Given I pause peers: + | vp3 | + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | + + When I invoke chaincode "example2" function name "invoke" on "vp0" "20" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "20" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "80" + | vp0 | vp1 | vp2 | + + @issue_1873 + Scenario Outline: 4 peers and 1 membersrvc, consensus works if vp0 is stopped TTT3 + Given we compose "" + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + And I register with CA supplying username "test_user0" and secret "MS9qrN8hFjlE" on peers: + | vp0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + # Deploy + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "2" + + # STOP vp0 + Given I stop peers: + | vp0 | + + And I register with CA supplying username "test_user1" and secret "jGlNl6ImkuDo" on peers: + | vp1 | + + When I invoke chaincode "example2" function name "invoke" on "vp1" "5" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "" seconds for transaction to be committed to peers: + | vp1 | vp2 | vp3 | + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "95" + | vp1 | vp2 | vp3 | + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml | 60 | + + @issue_1851 + Scenario Outline: verify reconnect of disconnected peer, issue #1851 + Given we compose "" + + When requesting "/network/peers" from "vp0" + Then I should get a JSON response with array "peers" contains "2" elements + + Given I stop peers: + | vp0 | + + When requesting "/network/peers" from "vp1" + Then I should get a JSON response with array "peers" contains "1" elements + + Given I start peers: + | vp0 | + And I wait "10" seconds + + When requesting "/network/peers" from "vp1" + Then I should get a JSON response with array "peers" contains "2" elements + + Examples: Composition options + | ComposeFile | + | docker-compose-2.yml | + + +@issue_1942 +# @doNotDecompose +Scenario: chaincode example02 with 4 peers, stop and start alternates, reverse + Given we compose "docker-compose-4-consensus-batch.yml" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 1000 | b | 0 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "1000" + | vp0 | vp1 | vp2 | vp3 | + + Given I stop peers: + | vp2 | + And I register with CA supplying username "test_user3" and secret "vWdLCE00vJy0" on peers: + | vp3 | + + When I invoke chaincode "example2" function name "invoke" on "vp3" "3" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I should have received a transactionID + Then I wait up to "180" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp3 | + Then I should get a JSON response from peers with "result.message" = "997" + | vp0 | vp1 | vp3 | + + Given I start peers: + | vp2 | + + And I wait "15" seconds + Given I stop peers: + | vp1 | + When I invoke chaincode "example2" function name "invoke" on "vp3" "20" times + |arg1|arg2|arg3| + | a | b | 1 | + Then I wait up to "300" seconds for transactions to be committed to peers: + | vp0 | vp2 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "977" + | vp0 | vp2 | vp3 | + +@issue_1874a +#@doNotDecompose +Scenario: chaincode example02 with 4 peers, two stopped + Given we compose "docker-compose-4-consensus-batch.yml" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | vp3 | + + Given I stop peers: + | vp2 | vp3 | + + When I invoke chaincode "example2" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + + Given I start peers: + | vp3 | + And I wait "15" seconds + + When I invoke chaincode "example2" function name "invoke" on "vp0" "9" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp3 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp3 | + Then I should get a JSON response from peers with "result.message" = "0" + | vp0 | vp1 | vp3 | + +@issue_1874b +#@doNotDecompose +Scenario: chaincode example02 with 4 peers, two stopped, bring back vp0 + Given we compose "docker-compose-4-consensus-batch.yml" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | vp3 | + + Given I stop peers: + | vp0 | + + And I register with CA supplying username "test_user1" and secret "jGlNl6ImkuDo" on peers: + | vp1 | + + When I invoke chaincode "example2" function name "invoke" on "vp1" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + + Given I stop peers: + | vp3 | + + When I invoke chaincode "example2" function name "invoke" on "vp1" + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + + Given I start peers: + | vp0 | + And I wait "15" seconds + + When I invoke chaincode "example2" function name "invoke" on "vp1" "8" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | + Then I should get a JSON response from peers with "result.message" = "0" + | vp0 | vp1 | vp2 | + +@issue_1874c +Scenario: chaincode example02 with 4 peers, two stopped, bring back both + Given we compose "docker-compose-4-consensus-batch.yml" + And I register with CA supplying username "binhn" and secret "7avZQLwcUe9q" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "100" + | vp0 | vp1 | vp2 | vp3 | + + Given I stop peers: + | vp1 | vp2 | + + When I invoke chaincode "example2" function name "invoke" on "vp0" "1" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + + Given I start peers: + | vp1 | vp2 | + And I wait "15" seconds + + When I invoke chaincode "example2" function name "invoke" on "vp0" "8" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + Then I wait "30" seconds + + When I query chaincode "example2" function name "query" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + Then I should get a JSON response from peers with "result.message" = "10" + | vp0 | vp1 | vp2 | vp3 | + + @issue_2116 + #@doNotDecompose + Scenario Outline: chaincode authorizable_counter with 4 peers, two stopped, bring back both + Given we compose "" + And I register with CA supplying username "diego" and secret "DRJ23pEQl16a" on peers: + | vp0 | + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + | vp1 | test_user1 | jGlNl6ImkuDo | + | vp2 | test_user2 | zMflqOKezFiA | + | vp3 | test_user3 | vWdLCE00vJy0 | + + When requesting "/chain" from "vp0" + Then I should get a JSON response with "height" = "1" + + When I deploy chaincode "github.com/hyperledger/fabric/examples/chaincode/go/authorizable_counter" with ctor "init" to "vp0" + | arg1 | + | 0 | + Then I should have received a chaincode name + Then I wait up to "60" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | + + When I query chaincode "authorizable_counter" function name "read" on "vp0": + |arg1| + | a | + Then I should get a JSON response with "result.message" = "0" + + When I invoke chaincode "authorizable_counter" function name "increment" with attributes "position" on "vp0" + |arg1| + | a | + Then I should have received a transactionID + + When I invoke chaincode "authorizable_counter" function name "increment" on "vp0" "8" times + |arg1|arg2|arg3| + | a | b | 10 | + Then I should have received a transactionID + Then I wait up to "30" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "authorizable_counter" function name "read" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + + Then I should get a JSON response from peers with "result.message" = "1" + | vp0 | vp1 | vp2 | vp3 | + + When I invoke chaincode "authorizable_counter" function name "increment" with attributes "company" on "vp0" + |arg1| + | a | + + When I invoke chaincode "authorizable_counter" function name "increment" with attributes "company, position, age" on "vp0" + |arg1| + | a | + + Then I wait up to "15" seconds for transaction to be committed to peers: + | vp0 | vp1 | vp2 | vp3 | + + When I query chaincode "authorizable_counter" function name "read" with value "a" on peers: + | vp0 | vp1 | vp2 | vp3 | + + Then I should get a JSON response from peers with "result.message" = "2" + | vp0 | vp1 | vp2 | vp3 | + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml docker-membersrvc-attributes-enabled.yml | 120 | + | docker-compose-4-consensus-batch.yml docker-membersrvc-attributes-enabled.yml docker-membersrvc-attributes-encryption-enabled.yml | 120 | + +# noop +# @doNotDecompose + Scenario: noop chaincode test + Given we compose "docker-compose-1.yml" + When I invoke master chaincode "noop" function name "execute" on "vp0" + |arg1| + | aa | + Then I should have received a transactionID diff --git a/bddtests/peer_cli.feature b/bddtests/peer_cli.feature new file mode 100644 index 00000000000..d4bf249b71f --- /dev/null +++ b/bddtests/peer_cli.feature @@ -0,0 +1,25 @@ +# +# Test Command Line Features of a Peer +# +@preV1 +Feature: Peer Command Line Interface + As a User of the Fabric + I want the command line interface to work correctly + + Scenario: List Peers when none are up + Given we compose "docker-compose-1-empty.yml" + When I execute "peer network list" in container empty + Then the command should not complete successfully + + Scenario: List Peers when one is up + Given we compose "docker-compose-1.yml" + When I execute "peer network list" in container vp0 + Then the command should complete successfully + And stdout should contain JSON + And I should get result with "{"Peers":[]}" + + Scenario: List Peers when two are up + Given we compose "docker-compose-2.yml" + When I execute "peer network list" in container vp0 + Then the command should complete successfully + And stdout should contain JSON with "Peers" array of length 1 diff --git a/bddtests/peer_logging.feature b/bddtests/peer_logging.feature new file mode 100644 index 00000000000..4b514a971ba --- /dev/null +++ b/bddtests/peer_logging.feature @@ -0,0 +1,46 @@ +# +# Test Logging Features of Peers +# +# Tags that can be used and will affect test internals: +# @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario. +# @chaincodeImagesUpToDate use this if all scenarios chaincode images are up to date, and do NOT require building. BE SURE!!! +@preV1 +Feature: Peer Logging + As a Fabric Developer + I want to verify my Peers log correctly + + Scenario: Invoke is attempted after deploy in Dev Mode + Given we compose "docker-compose-1-devmode.yml" + When I deploy chaincode with name "testCC" and with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + And I invoke chaincode "testCC" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then ensure after 2 seconds there are no errors in the logs for peer vp0 + + Scenario: Query is attempted after deploy in Dev Mode + Given we compose "docker-compose-1-devmode.yml" + When I deploy chaincode with name "testCC" and with ctor "init" to "vp0" + | arg1 | arg2 | arg3 | arg4 | + | a | 100 | b | 200 | + And I query chaincode "testCC" function name "query" on "vp0": + |arg1| + | a | + Then ensure after 2 seconds there are no errors in the logs for peer vp0 + + Scenario: Invoke is attempted before deploy in Dev Mode + Given we compose "docker-compose-1-devmode.yml" + When I mock deploy chaincode with name "testCC" + And I invoke chaincode "testCC" function name "invoke" on "vp0" + |arg1|arg2|arg3| + | a | b | 10 | + Then I wait up to 5 seconds for an error in the logs for peer vp0 + + Scenario: Query is attempted before deploy in Dev Mode + Given we compose "docker-compose-1-devmode.yml" + When I mock deploy chaincode with name "testCC" + And I query chaincode "testCC" function name "query" on "vp0": + |arg1| + | a | + Then I wait up to 5 seconds for an error in the logs for peer vp0 \ No newline at end of file diff --git a/bddtests/peer_rest.feature b/bddtests/peer_rest.feature new file mode 100644 index 00000000000..f91a2aa9bd2 --- /dev/null +++ b/bddtests/peer_rest.feature @@ -0,0 +1,23 @@ +# +# Test REST API Features of Peers +# +# Tags that can be used and will affect test internals: +# @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario. +# @chaincodeImagesUpToDate use this if all scenarios chaincode images are up to date, and do NOT require building. BE SURE!!! +@preV1 +Feature: Peer REST API + As a Fabric developer + I want to verify REST API behavior + + Scenario: 1 peer and 1 membersrvc, query transaction certs with query parameter count + Given we compose "docker-compose-rest.yml" + And I use the following credentials for querying peers: + | peer | username | secret | + | vp0 | test_user0 | MS9qrN8hFjlE | + And I register with CA supplying username "test_user0" and secret "MS9qrN8hFjlE" on peers: + | vp0 | + + When I request transaction certs with query parameters on "vp0" + | key | value | + | count | 1 | + Then I should get a JSON response with "1" different transaction certs \ No newline at end of file diff --git a/bddtests/scripts/start-peer.sh b/bddtests/scripts/start-peer.sh new file mode 100755 index 00000000000..c05b36d8108 --- /dev/null +++ b/bddtests/scripts/start-peer.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +SCRIPT_DIR=$(dirname $0) +MEMBERSHIP_IP=$(cat /etc/hosts | grep membersrvc | head -n 1 | cut -f1) +TIMEOUT=10 + +if [ -n "$MEMBERSHIP_IP" ]; then + echo "membersrvc detected, waiting for it before starting with a $TIMEOUT second timout" + "$SCRIPT_DIR"/wait-for-it.sh -t "$TIMEOUT" "$MEMBERSHIP_IP":7054 + + if [ $? -ne 0 ]; then + echo "Failed to contact membersrvc within $TIMEOUT seconds" + exit 1 + fi +else + echo "No membersrvc to wait for, starting immediately" +fi + +exec peer node start + diff --git a/bddtests/sdk.feature b/bddtests/sdk.feature new file mode 100644 index 00000000000..5468aac844d --- /dev/null +++ b/bddtests/sdk.feature @@ -0,0 +1,28 @@ +# +# Test the Hyperledger SDK +# +# Tags that can be used and will affect test internals: +# +# @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario. +# +@preV1 +@preV1_sdk +Feature: Node SDK + As a HyperLedger developer + I want to have a single test driver for the various Hyperledger SDKs + + + @doNotDecompose + @sdk + Scenario Outline: test initial sdk setup + + Given we compose "" + And I wait "5" seconds + And I register thru the sample SDK app supplying username "WebAppAdmin" and secret "DJY27pEnl16d" on "sampleApp0" + Then I should get a JSON response with "foo" = "bar" + + + Examples: Consensus Options + | ComposeFile | WaitTime | + | docker-compose-4-consensus-batch.yml docker-compose-sdk-node.yml | 60 | + #| docker-compose-4-consensus-batch.yml docker-compose-sdk-java.yml | 60 | diff --git a/bddtests/steps/peer_basic_impl.py b/bddtests/steps/peer_basic_impl.py new file mode 100644 index 00000000000..046df0dda21 --- /dev/null +++ b/bddtests/steps/peer_basic_impl.py @@ -0,0 +1,768 @@ +# +# Copyright IBM Corp. 2016 All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import os.path +import re +import time +import copy +from behave import * +from datetime import datetime, timedelta +import base64 +import uuid + +import sys, requests, json + +import bdd_test_util +import compose +import bootstrap_util + +CORE_REST_PORT = 7050 +JSONRPC_VERSION = "2.0" + +class ContainerData: + def __init__(self, containerName, ipAddress, envFromInspect, composeService, ports): + self.containerName = containerName + self.ipAddress = ipAddress + self.envFromInspect = envFromInspect + self.composeService = composeService + self.ports = ports + + def getEnv(self, key): + envValue = None + for val in self.envFromInspect: + if val.startswith(key): + envValue = val[len(key):] + break + if envValue == None: + raise Exception("ENV key not found ({0}) for container ({1})".format(key, self.containerName)) + return envValue + +def buildUrl(context, ipAddress, path): + schema = "http" + if 'TLS' in context.tags: + schema = "https" + return "{0}://{1}:{2}{3}".format(schema, ipAddress, CORE_REST_PORT, path) + +def currentTime(): + return time.strftime("%H:%M:%S") + +def getDockerComposeFileArgsFromYamlFile(compose_yaml): + parts = compose_yaml.split() + args = [] + for part in parts: + args = args + ["-f"] + [part] + return args + +@given(u'we compose "{composeYamlFile}"') +def step_impl(context, composeYamlFile): + # time.sleep(10) # Should be replaced with a definitive interlock guaranteeing that all peers/membersrvc are ready + composition = compose.Composition(context, composeYamlFile) + context.compose_containers = composition.containerDataList + context.composition = composition + +@when(u'requesting "{path}" from "{containerName}"') +def step_impl(context, path, containerName): + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, path) + print("Requesting path = {0}".format(request_url)) + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + assert resp.status_code == 200, "Failed to GET url %s: %s" % (request_url,resp.text) + context.response = resp + print("") + +@then(u'I should get a JSON response containing "{attribute}" attribute') +def step_impl(context, attribute): + getAttributeFromJSON(attribute, context.response.json(), "Attribute not found in response (%s)" %(attribute)) + +@then(u'I should get a JSON response containing no "{attribute}" attribute') +def step_impl(context, attribute): + try: + getAttributeFromJSON(attribute, context.response.json(), "") + assert None, "Attribute found in response (%s)" %(attribute) + except AssertionError: + print("Attribute not found as was expected.") + +def getAttributeFromJSON(attribute, jsonObject, msg): + return getHierarchyAttributesFromJSON(attribute.split("."), jsonObject, msg) + +def getHierarchyAttributesFromJSON(attributes, jsonObject, msg): + if len(attributes) > 0: + assert attributes[0] in jsonObject, msg + return getHierarchyAttributesFromJSON(attributes[1:], jsonObject[attributes[0]], msg) + return jsonObject + +def formatStringToCompare(value): + # double quotes are replaced by simple quotes because is not possible escape double quotes in the attribute parameters. + return str(value).replace("\"", "'") + +@then(u'I should get a JSON response with "{attribute}" = "{expectedValue}"') +def step_impl(context, attribute, expectedValue): + foundValue = getAttributeFromJSON(attribute, context.response.json(), "Attribute not found in response (%s)" %(attribute)) + assert (formatStringToCompare(foundValue) == expectedValue), "For attribute %s, expected (%s), instead found (%s)" % (attribute, expectedValue, foundValue) + +@then(u'I should get a JSON response with array "{attribute}" contains "{expectedValue}" elements') +def step_impl(context, attribute, expectedValue): + foundValue = getAttributeFromJSON(attribute, context.response.json(), "Attribute not found in response (%s)" %(attribute)) + assert (len(foundValue) == int(expectedValue)), "For attribute %s, expected array of size (%s), instead found (%s)" % (attribute, expectedValue, len(foundValue)) + +@given(u'I wait "{seconds}" seconds') +def step_impl(context, seconds): + time.sleep(float(seconds)) + +@when(u'I wait "{seconds}" seconds') +def step_impl(context, seconds): + time.sleep(float(seconds)) + +@then(u'I wait "{seconds}" seconds') +def step_impl(context, seconds): + time.sleep(float(seconds)) + +@when(u'I deploy lang chaincode "{chaincodePath}" of "{chainLang}" with ctor "{ctor}" to "{containerName}"') +def step_impl(context, chaincodePath, chainLang, ctor, containerName): + print("Printing chaincode language " + chainLang) + + chaincode = { + "path": chaincodePath, + "language": chainLang, + "constructor": ctor, + "args": getArgsFromContext(context), + } + + deployChainCodeToContainer(context, chaincode, containerName) + +def getArgsFromContext(context): + args = [] + if 'table' in context: + # There is ctor arguments + args = context.table[0].cells + return args + +@when(u'I deploy chaincode "{chaincodePath}" with ctor "{ctor}" to "{containerName}"') +def step_impl(context, chaincodePath, ctor, containerName): + chaincode = { + "path": chaincodePath, + "language": "GOLANG", + "constructor": ctor, + "args": getArgsFromContext(context), + } + + deployChainCodeToContainer(context, chaincode, containerName) + +@when(u'I deploy chaincode with name "{chaincodeName}" and with ctor "{ctor}" to "{containerName}"') +def step_impl(context, chaincodeName, ctor, containerName): + chaincode = { + "name": chaincodeName, + "language": "GOLANG", + "constructor": ctor, + "args": getArgsFromContext(context), + } + + deployChainCodeToContainer(context, chaincode, containerName) + time.sleep(2.0) # After #2068 implemented change this to only apply after a successful ping + +def deployChainCodeToContainer(context, chaincode, containerName): + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/chaincode") + print("Requesting path = {0}".format(request_url)) + + chaincodeSpec = createChaincodeSpec(context, chaincode) + chaincodeOpPayload = createChaincodeOpPayload("deploy", chaincodeSpec) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeOpPayload), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + chaincodeName = resp.json()['result']['message'] + chaincodeSpec['chaincodeID']['name'] = chaincodeName + context.chaincodeSpec = chaincodeSpec + print(json.dumps(chaincodeSpec, indent=4)) + print("") + +def createChaincodeSpec(context, chaincode): + chaincode = validateChaincodeDictionary(chaincode) + args = prepend(chaincode["constructor"], chaincode["args"]) + # Create a ChaincodeSpec structure + chaincodeSpec = { + "type": getChaincodeTypeValue(chaincode["language"]), + "chaincodeID": { + "path" : chaincode["path"], + "name" : chaincode["name"] + }, + "ctorMsg": { + "args" : args + }, + } + + if 'userName' in context: + chaincodeSpec["secureContext"] = context.userName + if 'metadata' in context: + chaincodeSpec["metadata"] = context.metadata + + return chaincodeSpec + +def validateChaincodeDictionary(chaincode): + chaincodeFields = ["path", "name", "language", "constructor", "args"] + + for field in chaincodeFields: + if field not in chaincode: + chaincode[field] = "" + + return chaincode + +def getChaincodeTypeValue(chainLang): + if chainLang == "GOLANG": + return 1 + elif chainLang =="JAVA": + return 4 + elif chainLang == "NODE": + return 2 + elif chainLang == "CAR": + return 3 + elif chainLang == "UNDEFINED": + return 0 + return 1 + +@when(u'I mock deploy chaincode with name "{chaincodeName}"') +def step_impl(context, chaincodeName): + chaincode = { + "name": chaincodeName, + "language": "GOLANG" + } + + context.chaincodeSpec = createChaincodeSpec(context, chaincode) + +@then(u'I should have received a chaincode name') +def step_impl(context): + if 'chaincodeSpec' in context: + assert context.chaincodeSpec['chaincodeID']['name'] != "" + # Set the current transactionID to the name passed back + context.transactionID = context.chaincodeSpec['chaincodeID']['name'] + elif 'grpcChaincodeSpec' in context: + assert context.grpcChaincodeSpec.chaincodeID.name != "" + # Set the current transactionID to the name passed back + context.transactionID = context.grpcChaincodeSpec.chaincodeID.name + else: + fail('chaincodeSpec not in context') + +@when(u'I invoke chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}" with "{idGenAlg}"') +def step_impl(context, chaincodeName, functionName, containerName, idGenAlg): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + invokeChaincode(context, "invoke", functionName, containerName, idGenAlg) + +@when(u'I invoke chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}" "{times}" times') +def step_impl(context, chaincodeName, functionName, containerName, times): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/chain") + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + assert resp.status_code == 200, "Failed to get chain height %s: %s" % (request_url,resp.text) + context.chainheight = getAttributeFromJSON("height", resp.json(), "Height not found in response.") + context.txcount = times + for i in range(int(times)): + invokeChaincode(context, "invoke", functionName, containerName) + +@when(u'I invoke chaincode "{chaincodeName}" function name "{functionName}" with attributes "{attrs}" on "{containerName}"') +def step_impl(context, chaincodeName, functionName, attrs, containerName): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + assert attrs, "attrs were not specified" + invokeChaincode(context, "invoke", functionName, containerName, None, attrs.split(",")) + +@when(u'I invoke chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}"') +def step_impl(context, chaincodeName, functionName, containerName): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + invokeChaincode(context, "invoke", functionName, containerName) + +@when(u'I invoke master chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}"') +def step_impl(context, chaincodeName, functionName, containerName): + invokeMasterChaincode(context, "invoke", chaincodeName, functionName, containerName) + +@then(u'I should have received a transactionID') +def step_impl(context): + assert 'transactionID' in context, 'transactionID not found in context' + assert context.transactionID != "" + pass + +@when(u'I unconditionally query chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}"') +def step_impl(context, chaincodeName, functionName, containerName): + invokeChaincode(context, "query", functionName, containerName) + +@when(u'I query chaincode "{chaincodeName}" function name "{functionName}" on "{containerName}"') +def step_impl(context, chaincodeName, functionName, containerName): + invokeChaincode(context, "query", functionName, containerName) + +def createChaincodeOpPayload(method, chaincodeSpec): + chaincodeOpPayload = { + "jsonrpc": JSONRPC_VERSION, + "method" : method, + "params" : chaincodeSpec, + "id" : 1 + } + return chaincodeOpPayload + +def invokeChaincode(context, devopsFunc, functionName, containerName, idGenAlg=None, attributes=[]): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + # Update the chaincodeSpec ctorMsg for invoke + args = [] + if 'table' in context: + # There is ctor arguments + args = context.table[0].cells + args = prepend(functionName, args) + for idx, attr in enumerate(attributes): + attributes[idx] = attr.strip() + + context.chaincodeSpec['attributes'] = attributes + + #If idGenAlg is passed then, we still using the deprecated devops API because this parameter can't be passed in the new API. + if idGenAlg != None: + context.chaincodeSpec['ctorMsg']['args'] = to_bytes(args) + invokeUsingDevopsService(context, devopsFunc, functionName, containerName, idGenAlg) + else: + context.chaincodeSpec['ctorMsg']['args'] = args + invokeUsingChaincodeService(context, devopsFunc, functionName, containerName) + +def invokeUsingChaincodeService(context, devopsFunc, functionName, containerName): + # Invoke the POST + chaincodeOpPayload = createChaincodeOpPayload(devopsFunc, context.chaincodeSpec) + + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + + request_url = buildUrl(context, ipAddress, "/chaincode") + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + print("Using attributes {0}".format(context.chaincodeSpec['attributes'])) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeOpPayload), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + print("RESULT from {0} of chaincode from peer {1}".format(functionName, containerName)) + print(json.dumps(context.response.json(), indent = 4)) + if 'result' in resp.json(): + result = resp.json()['result'] + if 'message' in result: + transactionID = result['message'] + context.transactionID = transactionID + +def invokeUsingDevopsService(context, devopsFunc, functionName, containerName, idGenAlg): + # Invoke the POST + chaincodeInvocationSpec = { + "chaincodeSpec" : context.chaincodeSpec + } + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + if idGenAlg is not None: + chaincodeInvocationSpec['idGenerationAlg'] = idGenAlg + request_url = buildUrl(context, ipAddress, "/devops/{0}".format(devopsFunc)) + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeInvocationSpec), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + print("RESULT from {0} of chaincode from peer {1}".format(functionName, containerName)) + print(json.dumps(context.response.json(), indent = 4)) + if 'message' in resp.json(): + transactionID = context.response.json()['message'] + context.transactionID = transactionID + +def invokeMasterChaincode(context, devopsFunc, chaincodeName, functionName, containerName): + args = [] + if 'table' in context: + args = context.table[0].cells + args = prepend(functionName, args) + typeGolang = 1 + chaincodeSpec = { + "type": typeGolang, + "chaincodeID": { + "name" : chaincodeName + }, + "ctorMsg": { + "args" : args + } + } + if 'userName' in context: + chaincodeSpec["secureContext"] = context.userName + + chaincodeOpPayload = createChaincodeOpPayload(devopsFunc, chaincodeSpec) + + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/chaincode") + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeOpPayload), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + print("RESULT from {0} of chaincode from peer {1}".format(functionName, containerName)) + print(json.dumps(context.response.json(), indent = 4)) + if 'result' in resp.json(): + result = resp.json()['result'] + if 'message' in result: + transactionID = result['message'] + context.transactionID = transactionID + +@then(u'I wait "{seconds}" seconds for chaincode to build') +def step_impl(context, seconds): + """ This step takes into account the chaincodeImagesUpToDate tag, in which case the wait is reduce to some default seconds""" + reducedWaitTime = 4 + if 'chaincodeImagesUpToDate' in context.tags: + print("Assuming images are up to date, sleeping for {0} seconds instead of {1} in scenario {2}".format(reducedWaitTime, seconds, context.scenario.name)) + time.sleep(float(reducedWaitTime)) + else: + time.sleep(float(seconds)) + +@then(u'I wait "{seconds}" seconds for transaction to be committed to block on "{containerName}"') +def step_impl(context, seconds, containerName): + assert 'transactionID' in context, "transactionID not found in context" + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/transactions/{0}".format(context.transactionID)) + print("{0} GETing path = {1}".format(currentTime(), request_url)) + + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + +def multiRequest(context, seconds, containerDataList, pathBuilderFunc): + """Perform a multi request against the system""" + # Build map of "containerName" : response + respMap = {container.containerName:None for container in containerDataList} + # Set the max time before stopping attempts + maxTime = datetime.now() + timedelta(seconds = int(seconds)) + for container in containerDataList: + ipAddress = container.ipAddress + request_url = buildUrl(context, ipAddress, pathBuilderFunc(context, container)) + + # Loop unless failure or time exceeded + while (datetime.now() < maxTime): + print("{0} GETing path = {1}".format(currentTime(), request_url)) + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + respMap[container.containerName] = resp + else: + raise Exception("Max time exceeded waiting for multiRequest with current response map = {0}".format(respMap)) + +@then(u'I wait up to "{seconds}" seconds for transaction to be committed to all peers') +def step_impl(context, seconds): + assert 'transactionID' in context, "transactionID not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + + # Build map of "containerName" : resp.statusCode + respMap = {container.containerName:0 for container in context.compose_containers} + + # Set the max time before stopping attempts + maxTime = datetime.now() + timedelta(seconds = int(seconds)) + for container in context.compose_containers: + ipAddress = container.ipAddress + request_url = buildUrl(context, ipAddress, "/transactions/{0}".format(context.transactionID)) + + # Loop unless failure or time exceeded + while (datetime.now() < maxTime): + print("{0} GETing path = {1}".format(currentTime(), request_url)) + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + if resp.status_code == 404: + # Pause then try again + respMap[container.containerName] = 404 + time.sleep(1) + continue + elif resp.status_code == 200: + # Success, continue + respMap[container.containerName] = 200 + break + else: + raise Exception("Error requesting {0}, returned result code = {1}".format(request_url, resp.status_code)) + else: + raise Exception("Max time exceeded waiting for transactions with current response map = {0}".format(respMap)) + print("Result of request to all peers = {0}".format(respMap)) + print("") + +@then(u'I check the transaction ID if it is "{tUUID}"') +def step_impl(context, tUUID): + assert 'transactionID' in context, "transactionID not found in context" + assert context.transactionID == tUUID, "transactionID is not tUUID" + +@then(u'I wait up to "{seconds}" seconds for transaction to be committed to peers') +def step_impl(context, seconds): + assert 'transactionID' in context, "transactionID not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers) not found in context" + + aliases = context.table.headings + containerDataList = bdd_test_util.getContainerDataValuesFromContext(context, aliases, lambda containerData: containerData) + + # Build map of "containerName" : resp.statusCode + respMap = {container.containerName:0 for container in containerDataList} + + # Set the max time before stopping attempts + maxTime = datetime.now() + timedelta(seconds = int(seconds)) + for container in containerDataList: + ipAddress = container.ipAddress + request_url = buildUrl(context, ipAddress, "/transactions/{0}".format(context.transactionID)) + + # Loop unless failure or time exceeded + while (datetime.now() < maxTime): + print("{0} GETing path = {1}".format(currentTime(), request_url)) + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + if resp.status_code == 404: + # Pause then try again + respMap[container.containerName] = 404 + time.sleep(1) + continue + elif resp.status_code == 200: + # Success, continue + respMap[container.containerName] = 200 + break + else: + raise Exception("Error requesting {0}, returned result code = {1}".format(request_url, resp.status_code)) + else: + raise Exception("Max time exceeded waiting for transactions with current response map = {0}".format(respMap)) + print("Result of request to all peers = {0}".format(respMap)) + print("") + +@then(u'I wait up to "{seconds}" seconds for transactions to be committed to peers') +def step_impl(context, seconds): + assert 'chainheight' in context, "chainheight not found in context" + assert 'txcount' in context, "txcount not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers) not found in context" + + aliases = context.table.headings + containerDataList = bdd_test_util.getContainerDataValuesFromContext(context, aliases, lambda containerData: containerData) + + # Build map of "containerName" : resp.statusCode + respMap = {container.containerName:0 for container in containerDataList} + + # Set the max time before stopping attempts + maxTime = datetime.now() + timedelta(seconds = int(seconds)) + for container in containerDataList: + ipAddress = container.ipAddress + request_url = buildUrl(context, ipAddress, "/chain") + + # Loop unless failure or time exceeded + while (datetime.now() < maxTime): + print("{0} GETing path = {1}".format(currentTime(), request_url)) + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + if resp.status_code == 404: + # Pause then try again + respMap[container.containerName] = 404 + time.sleep(1) + continue + elif resp.status_code == 200: + height = getAttributeFromJSON("height", resp.json(), "Height not found in response.") + if height >= int(context.chainheight) + int(context.txcount): + # Success, continue + respMap[container.containerName] = 200 + break + else: + continue + else: + raise Exception("Error requesting {0}, returned result code = {1}".format(request_url, resp.status_code)) + else: + raise Exception("Max time exceeded waiting for transactions with current response map = {0}".format(respMap)) + print("Result of request to all peers = {0}".format(respMap)) + print("") + + +@then(u'I should get a rejection message in the listener after stopping it') +def step_impl(context): + assert "eventlistener" in context, "no eventlistener is started" + context.eventlistener.terminate() + output = context.eventlistener.stdout.read() + rejection = "Received rejected transaction" + assert rejection in output, "no rejection message was found" + assert output.count(rejection) == 1, "only one rejection message should be found" + + +@when(u'I query chaincode "{chaincodeName}" function name "{functionName}" on all peers') +def step_impl(context, chaincodeName, functionName): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + # Update the chaincodeSpec ctorMsg for invoke + args = [] + if 'table' in context: + # There is ctor arguments + args = context.table[0].cells + args = prepend(functionName, args) + context.chaincodeSpec['ctorMsg']['args'] = args #context.table[0].cells if ('table' in context) else [] + # Invoke the POST + chaincodeOpPayload = createChaincodeOpPayload("query", context.chaincodeSpec) + + responses = [] + for container in context.compose_containers: + request_url = buildUrl(context, container.ipAddress, "/chaincode") + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeOpPayload), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + responses.append(resp) + context.responses = responses + +@when(u'I unconditionally query chaincode "{chaincodeName}" function name "{functionName}" with value "{value}" on peers') +def step_impl(context, chaincodeName, functionName, value): + query_common(context, chaincodeName, functionName, value, False) + +@when(u'I query chaincode "{chaincodeName}" function name "{functionName}" with value "{value}" on peers') +def step_impl(context, chaincodeName, functionName, value): + query_common(context, chaincodeName, functionName, value, True) + +def query_common(context, chaincodeName, functionName, value, failOnError): + assert 'chaincodeSpec' in context, "chaincodeSpec not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers) not found in context" + assert 'peerToSecretMessage' in context, "peerToSecretMessage map not found in context" + + aliases = context.table.headings + containerDataList = bdd_test_util.getContainerDataValuesFromContext(context, aliases, lambda containerData: containerData) + + # Update the chaincodeSpec ctorMsg for invoke + context.chaincodeSpec['ctorMsg']['args'] = [functionName, value] + # Invoke the POST + # Make deep copy of chaincodeSpec as we will be changing the SecurityContext per call. + chaincodeOpPayload = createChaincodeOpPayload("query", copy.deepcopy(context.chaincodeSpec)) + + responses = [] + for container in containerDataList: + # Change the SecurityContext per call + chaincodeOpPayload['params']["secureContext"] = context.peerToSecretMessage[container.composeService]['enrollId'] + print("Container {0} enrollID = {1}".format(container.containerName, container.getEnv("CORE_SECURITY_ENROLLID"))) + request_url = buildUrl(context, container.ipAddress, "/chaincode") + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(chaincodeOpPayload), timeout=30, verify=False) + if failOnError: + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + print("RESULT from {0} of chaincode from peer {1}".format(functionName, container.containerName)) + print(json.dumps(resp.json(), indent = 4)) + responses.append(resp) + context.responses = responses + +@then(u'I should get a JSON response from all peers with "{attribute}" = "{expectedValue}"') +def step_impl(context, attribute, expectedValue): + assert 'responses' in context, "responses not found in context" + for resp in context.responses: + foundValue = getAttributeFromJSON(attribute, resp.json(), "Attribute not found in response (%s)" %(attribute)) + assert (formatStringToCompare(foundValue) == expectedValue), "For attribute %s, expected (%s), instead found (%s)" % (attribute, expectedValue, foundValue) + +@then(u'I should get a JSON response from peers with "{attribute}" = "{expectedValue}"') +def step_impl(context, attribute, expectedValue): + assert 'responses' in context, "responses not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers) not found in context" + + for resp in context.responses: + foundValue = getAttributeFromJSON(attribute, resp.json(), "Attribute not found in response (%s)" %(attribute)) + assert (formatStringToCompare(foundValue) == expectedValue), "For attribute %s, expected (%s), instead found (%s)" % (attribute, expectedValue, foundValue) + +@given(u'I register with CA supplying username "{userName}" and secret "{secret}" on peers') +def step_impl(context, userName, secret): + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers) not found in context" + + # Get list of IPs to login to + aliases = context.table.headings + containerDataList = bdd_test_util.getContainerDataValuesFromContext(context, aliases, lambda containerData: containerData) + + secretMsg = { + "enrollId": userName, + "enrollSecret" : secret + } + + # Login to each container specified + for containerData in containerDataList: + request_url = buildUrl(context, containerData.ipAddress, "/registrar") + print("{0} POSTing path = {1}".format(currentTime(), request_url)) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(secretMsg), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + print("message = {0}".format(resp.json())) + + # Create new User entry + bdd_test_util.registerUser(context, secretMsg, containerData.composeService) + + # Store the username in the context + context.userName = userName + # if we already have the chaincodeSpec, change secureContext + if 'chaincodeSpec' in context: + context.chaincodeSpec["secureContext"] = context.userName + + +@given(u'I use the following credentials for querying peers') +def step_impl(context): + assert 'compose_containers' in context, "compose_containers not found in context" + assert 'table' in context, "table (of peers, username, secret) not found in context" + + peerToSecretMessage = {} + + # Login to each container specified using username and secret + for row in context.table.rows: + peer, userName, secret = row['peer'], row['username'], row['secret'] + secretMsg = { + "enrollId": userName, + "enrollSecret" : secret + } + + ipAddress = bdd_test_util.ipFromContainerNamePart(peer, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/registrar") + print("POSTing to service = {0}, path = {1}".format(peer, request_url)) + + resp = requests.post(request_url, headers={'Content-type': 'application/json'}, data=json.dumps(secretMsg), verify=False) + assert resp.status_code == 200, "Failed to POST to %s: %s" %(request_url, resp.text) + context.response = resp + print("message = {0}".format(resp.json())) + peerToSecretMessage[peer] = secretMsg + context.peerToSecretMessage = peerToSecretMessage + + +@given(u'I stop peers') +def step_impl(context): + compose_op(context, "stop") + + +@given(u'I start a listener') +def step_impl(context): + gopath = os.environ.get('GOPATH') + assert gopath is not None, "Please set GOPATH properly!" + listener = os.path.join(gopath, "src/github.com/hyperledger/fabric/build/bin/block-listener") + assert os.path.isfile(listener), "Please build the block-listener binary!" + bdd_test_util.start_background_process(context, "eventlistener", [listener, "-listen-to-rejections"] ) + + +@given(u'I start peers') +def step_impl(context): + compose_op(context, "start") + +@given(u'I pause peers') +def step_impl(context): + compose_op(context, "pause") + +@given(u'I unpause peers') +def step_impl(context): + compose_op(context, "unpause") + +def compose_op(context, op): + assert 'table' in context, "table (of peers) not found in context" + assert 'composition' in context, "composition not found in context" + services = context.table.headings + context.composition.issueCommand([op] + services) + context.compose_containers = context.composition.containerDataList + +def to_bytes(strlist): + return [base64.standard_b64encode(s.encode('ascii')) for s in strlist] + +def prepend(elem, l): + if l is None or l == "": + tail = [] + else: + tail = l + if elem is None: + return tail + return [elem] + tail + +@given(u'I do nothing') +def step_impl(context): + pass diff --git a/bddtests/steps/peer_cli_impl.py b/bddtests/steps/peer_cli_impl.py new file mode 100644 index 00000000000..43f5b3bc28f --- /dev/null +++ b/bddtests/steps/peer_cli_impl.py @@ -0,0 +1,97 @@ +# +# Copyright IBM Corp. 2016 All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import json +from behave import * +from bdd_test_util import cli_call, fullNameFromContainerNamePart +from peer_basic_impl import getAttributeFromJSON + +@when(u'I execute "{command}" in container {containerName}') +def step_impl(context, command, containerName): + print("Run command: \"{0}\" in container {1}".format(command, containerName)) + executeCommandInContainer(context, command, containerName) + print("stdout: {0}".format(context.command["stdout"])) + print("stderr: {0}".format(context.command["stderr"])) + print("returnCode: {0}".format(context.command["returnCode"])) + +def executeCommandInContainer(context, command, container): + fullContainerName = fullNameFromContainerNamePart(container, context.compose_containers) + command = "docker exec {} {}".format(fullContainerName, command) + executeCommand(context, command) + +def executeCommand(context, command): + # cli_call expects an array of arguments, hence splitting here. + commandArgs = command.split() + stdout, stderr, retcode = cli_call(commandArgs, expect_success=False) + + context.command = { + "stdout": stdout, + "stderr": stderr, + "returnCode": retcode + } + +@then(u'the command should not complete successfully') +def step_impl(context): + assert not commandCompletedSuccessfully(context) + +@then(u'the command should complete successfully') +def step_impl(context): + assert commandCompletedSuccessfully(context) + +def commandCompletedSuccessfully(context): + return isSuccessfulReturnCode(context.command["returnCode"]) + +def isSuccessfulReturnCode(returnCode): + return returnCode == 0 + +@then(u'{stream} should contain JSON') +def step_impl(context, stream): + assertIsJson(context.command[stream]) + +@then(u'{stream} should contain JSON with "{attribute}" array of length {length}') +def step_impl(context, stream, attribute, length): + data = context.command[stream] + assertIsJson(data) + + json = decodeJson(data) + array = getAttribute(attribute, json) + assertLength(array, int(length)) + +@then(u'I should get result with "{expectResult}"') +def step_impl(context, expectResult): + assert context.command["stdout"].strip('\n') == expectResult + +def assertIsJson(data): + assert isJson(data), "Data is not in JSON format" + +def isJson(data): + try: + decodeJson(data) + except ValueError: + return False + + return True + +def decodeJson(data): + return json.loads(data) + +def getAttribute(attribute, json): + return getAttributeFromJSON(attribute, json, + "Attribute '{}' missing from JSON".format(attribute)) + +def assertLength(array, length): + arrayLength = len(array) + assert arrayLength == length, "Unexpected array length. Expected {}, got {}".format(length, arrayLength) diff --git a/bddtests/steps/peer_logging_impl.py b/bddtests/steps/peer_logging_impl.py new file mode 100755 index 00000000000..177b4349ed4 --- /dev/null +++ b/bddtests/steps/peer_logging_impl.py @@ -0,0 +1,61 @@ +# +# Copyright IBM Corp. 2016 All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import os.path +import re +import time +import copy +from datetime import datetime, timedelta +from behave import * + +import sys, requests, json + +import bdd_test_util + +@then(u'I wait up to {waitTime} seconds for an error in the logs for peer {peerName}') +def step_impl(context, waitTime, peerName): + timeout = time.time() + float(waitTime) + hasError = False + + while timeout > time.time(): + stdout, stderr = getPeerLogs(context, peerName) + hasError = logHasError(stdout) or logHasError(stderr) + + if hasError: + break + + time.sleep(1.0) + + assert hasError is True + +def getPeerLogs(context, peerName): + fullContainerName = bdd_test_util.fullNameFromContainerNamePart(peerName, context.compose_containers) + stdout, stderr, retcode = bdd_test_util.cli_call(["docker", "logs", fullContainerName], expect_success=True) + + return stdout, stderr + +def logHasError(logText): + # This seems to be an acceptable heuristic for detecting errors + return logText.find("-> ERRO") >= 0 + +@then(u'ensure after {waitTime} seconds there are no errors in the logs for peer {peerName}') +def step_impl(context, waitTime, peerName): + time.sleep(float(waitTime)) + stdout, stderr = getPeerLogs(context, peerName) + + assert logHasError(stdout) is False + assert logHasError(stderr) is False \ No newline at end of file diff --git a/bddtests/steps/peer_rest_impl.py b/bddtests/steps/peer_rest_impl.py new file mode 100644 index 00000000000..59f25d9bf9c --- /dev/null +++ b/bddtests/steps/peer_rest_impl.py @@ -0,0 +1,51 @@ +# +# Copyright IBM Corp. 2016 All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import requests +from behave import * +from peer_basic_impl import buildUrl +from peer_basic_impl import getAttributeFromJSON + +import bdd_test_util + + +@when(u'I request transaction certs with query parameters on "{containerName}"') +def step_impl(context, containerName): + assert 'table' in context, "table (of query parameters) not found in context" + assert 'userName' in context, "userName not found in context" + assert 'compose_containers' in context, "compose_containers not found in context" + + ipAddress = bdd_test_util.ipFromContainerNamePart(containerName, context.compose_containers) + request_url = buildUrl(context, ipAddress, "/registrar/{0}/tcert".format(context.userName)) + print("Requesting path = {0}".format(request_url)) + queryParams = {} + for row in context.table.rows: + key, value = row['key'], row['value'] + queryParams[key] = value + + print("Query parameters = {0}".format(queryParams)) + resp = requests.get(request_url, params=queryParams, headers={'Accept': 'application/json'}, verify=False) + + assert resp.status_code == 200, "Failed to GET to %s: %s" % (request_url, resp.text) + context.response = resp + print("") + +@then(u'I should get a JSON response with "{expectedValue}" different transaction certs') +def step_impl(context, expectedValue): + print(context.response.json()) + foundValue = getAttributeFromJSON("OK", context.response.json(), "Attribute not found in response (OK)") + print(len(set(foundValue))) + assert (len(set(foundValue)) == int(expectedValue)), "For attribute OK, expected different transaction cert of size (%s), instead found (%s)" % (expectedValue, len(set(foundValue))) \ No newline at end of file diff --git a/bddtests/steps/sdk_impl.py b/bddtests/steps/sdk_impl.py new file mode 100644 index 00000000000..e149cec21c7 --- /dev/null +++ b/bddtests/steps/sdk_impl.py @@ -0,0 +1,43 @@ +import os +import re +import time +import copy +import base64 +from datetime import datetime, timedelta + +import sys, requests, json + +import bdd_test_util + +from grpc.beta import implementations + +import fabric_pb2 +import chaincode_pb2 +import devops_pb2 + +SDK_NODE_APP_REST_PORT = 8080 + +def buildUrl(context, ipAddress, path): + schema = "http" + if 'TLS' in context.tags: + schema = "https" + return "{0}://{1}:{2}{3}".format(schema, ipAddress, SDK_NODE_APP_REST_PORT, path) + + +@given(u'I register thru the sample SDK app supplying username "{enrollId}" and secret "{enrollSecret}" on "{composeService}"') +def step_impl(context, enrollId, enrollSecret, composeService): + assert 'compose_containers' in context, "compose_containers not found in context" + + # Get the sampleApp IP Address + containerDataList = bdd_test_util.getContainerDataValuesFromContext(context, [composeService], lambda containerData: containerData) + sampleAppIpAddress = containerDataList[0].ipAddress + secretMsg = { + "enrollId": enrollId, + "enrollSecret" : enrollSecret + } + request_url = buildUrl(context, sampleAppIpAddress, "/") + resp = requests.get(request_url, headers={'Accept': 'application/json'}, verify=False) + assert resp.status_code == 200, "Failed to GET url %s: %s" % (request_url,resp.text) + context.response = resp + print("") + diff --git a/bddtests/tlsca.cert b/bddtests/tlsca.cert new file mode 100644 index 00000000000..990911284de --- /dev/null +++ b/bddtests/tlsca.cert @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBwTCCAUegAwIBAgIBATAKBggqhkjOPQQDAzApMQswCQYDVQQGEwJVUzEMMAoG +A1UEChMDSUJNMQwwCgYDVQQDEwNPQkMwHhcNMTYwMTIxMjI0OTUxWhcNMTYwNDIw +MjI0OTUxWjApMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMQwwCgYDVQQDEwNP +QkMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR6YAoPOwMzIVi+P83V79I6BeIyJeaM +meqWbmwQsTRlKD6g0L0YvczQO2vp+DbxRN11okGq3O/ctcPzvPXvm7Mcbb3whgXW +RjbsX6wn25tF2/hU6fQsyQLPiJuNj/yxknSjQzBBMA4GA1UdDwEB/wQEAwIChDAP +BgNVHRMBAf8EBTADAQH/MA0GA1UdDgQGBAQBAgMEMA8GA1UdIwQIMAaABAECAwQw +CgYIKoZIzj0EAwMDaAAwZQIxAITGmq+x5N7Q1jrLt3QFRtTKsuNIosnlV4LR54l3 +yyDo17Ts0YLyC0pZQFd+GURSOQIwP/XAwoMcbJJtOVeW/UL2EOqmKA2ygmWX5kte +9Lngf550S6gPEWuDQOcY95B+x3eH +-----END CERTIFICATE----- diff --git a/bddtests/tlsca.priv b/bddtests/tlsca.priv new file mode 100644 index 00000000000..3652958387e --- /dev/null +++ b/bddtests/tlsca.priv @@ -0,0 +1,6 @@ +-----BEGIN ECDSA PRIVATE KEY----- +MIGkAgEBBDDSK85W5GPJ4WVYV/6I8NQuwXswMvoNJ/FzKjCgdWLAfcvYM4jO/rIo +ytwrwphFijigBwYFK4EEACKhZANiAAR6YAoPOwMzIVi+P83V79I6BeIyJeaMmeqW +bmwQsTRlKD6g0L0YvczQO2vp+DbxRN11okGq3O/ctcPzvPXvm7Mcbb3whgXWRjbs +X6wn25tF2/hU6fQsyQLPiJuNj/yxknQ= +-----END ECDSA PRIVATE KEY-----