OpFlex Framework  1.7.0
MockOpflexServer.h
Go to the documentation of this file.
1 /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 
14 #include <vector>
15 #include <utility>
16 
18 
19 #pragma once
20 #ifndef OPFLEX_TEST_MOCKOPFLEXSERVER_H
21 #define OPFLEX_TEST_MOCKOPFLEXSERVER_H
22 
23 namespace opflex {
24 
25 namespace engine {
26 namespace internal {
27 
28 class MockOpflexServerImpl;
29 
30 } /* namespace internal */
31 } /* namespace engine */
32 
33 namespace test {
34 
40 public:
44  typedef std::pair<uint8_t, std::string> peer_t;
45 
49  typedef std::vector<peer_t> peer_vec_t;
50 
59  MockOpflexServer(int port, uint8_t roles, peer_vec_t peers,
60  const modb::ModelMetadata& md);
61 
66 
70  void start();
71 
75  void stop();
76 
84  void readPolicy(const std::string& file);
85 
97  void enableSSL(const std::string& caStorePath,
98  const std::string& serverKeyPath,
99  const std::string& serverKeyPass,
100  bool verifyPeers = true);
101 
107  const peer_vec_t& getPeers() const;
108 
114  int getPort() const;
115 
121  uint8_t getRoles() const;
122 
123 private:
124  engine::internal::MockOpflexServerImpl* pimpl;
125 };
126 
127 } /* namespace test */
128 } /* namespace opflex */
129 
130 #endif /* OPFLEX_TEST_MOCKOPFLEXSERVER_H */
131 
An opflex server we can use for mocking interactions with a real Opflex server.
Definition: MockOpflexServer.h:39
std::pair< uint8_t, std::string > peer_t
a pair of a role bitmask and connectivity string
Definition: MockOpflexServer.h:44
Interface definition file for ModelMetadata.
std::vector< peer_t > peer_vec_t
A vector of peers.
Definition: MockOpflexServer.h:49
Definition: OFLogHandler.h:20
Model metadata encapsulated all the metadata for a given model.
Definition: ModelMetadata.h:47