12 #include <plugin_api.h> 18 #include <plugin_exception.h> 23 #include <simple_https.h> 24 #include <simple_http.h> 25 #include <config_category.h> 26 #include "rapidjson/writer.h" 27 #include "rapidjson/stringbuffer.h" 28 #include "json_utils.h" 29 #include "libcurl_https.h" 31 #include "string_utils.h" 33 #include <linkedlookup.h> 37 #define PLUGIN_NAME "OMF" 38 #define TYPE_ID_KEY "type-id" 39 #define SENT_TYPES_KEY "sentDataTypes" 40 #define DATA_KEY "dataTypes" 41 #define DATA_KEY_SHORT "dataTypesShort" 42 #define DATA_KEY_HINT "hintChecksum" 43 #define NAMING_SCHEME "namingScheme" 44 #define AFH_HASH "afhHash" 45 #define AF_HIERARCHY "afHierarchy" 46 #define AF_HIERARCHY_ORIG "afHierarchyOrig" 49 #define PROPERTY_TYPE "type" 50 #define PROPERTY_NUMBER "number" 51 #define PROPERTY_STRING "string" 53 #define ENDPOINT_URL_PI_WEB_API "https://HOST_PLACEHOLDER:PORT_PLACEHOLDER/piwebapi/omf" 54 #define ENDPOINT_URL_CR "https://HOST_PLACEHOLDER:PORT_PLACEHOLDER/ingress/messages" 55 #define ENDPOINT_URL_OCS "https://REGION_PLACEHOLDER.osisoft.com:PORT_PLACEHOLDER/api/v1/tenants/TENANT_ID_PLACEHOLDER/Namespaces/NAMESPACE_ID_PLACEHOLDER/omf" 56 #define ENDPOINT_URL_ADH "https://REGION_PLACEHOLDER.datahub.connect.aveva.com:PORT_PLACEHOLDER/api/v1/Tenants/TENANT_ID_PLACEHOLDER/Namespaces/NAMESPACE_ID_PLACEHOLDER/omf" 58 #define ENDPOINT_URL_EDS "http://localhost:PORT_PLACEHOLDER/api/v1/tenants/default/namespaces/default/omf" 61 enum OMF_ENDPOINT_PORT {
62 ENDPOINT_PORT_PIWEB_API=443,
63 ENDPOINT_PORT_CR=5460,
64 ENDPOINT_PORT_OCS=443,
65 ENDPOINT_PORT_EDS=5590,
73 #define NOT_BLOCKING_ERRORS_DEFAULT QUOTE( \ 76 "Redefinition of the type with the same ID is not allowed", \ 77 "Invalid value type for the property", \ 78 "Property does not exist in the type definition", \ 79 "Container is not defined", \ 80 "Unable to find the property of the container of type" \ 85 #define NOT_BLOCKING_ERRORS_DEFAULT_PI_WEB_API QUOTE( \ 88 "The specified value is outside the allowable range" \ 93 #define AF_HIERARCHY_RULES QUOTE( \ 108 void start(
const std::string& storedData);
109 uint32_t
send(
const vector<Reading *>& readings);
112 void loadSentDataTypes(rapidjson::Document& JSONData);
114 int PIWebAPIGetVersion(
bool logMessage =
true);
116 void SetOMFVersion();
117 void CheckDataActionCode();
118 std::string OCSRetrieveAuthToken();
119 OMF_ENDPOINT identifyPIServerEndpoint();
120 std::string saveSentDataTypes();
121 unsigned long calcTypeShort(
const std::string& dataTypes);
122 void ParseProductVersion(std::string &versionString,
int *major,
int *minor);
123 std::string ParseEDSProductInformation(std::string json);
124 std::string AuthBasicCredentialsGenerate(std::string& userId, std::string& password);
125 void AuthKerberosSetup(std::string& keytabEnv, std::string& keytabFileName);
126 double GetElapsedTime(
struct timeval *startTime);
127 bool IsPIWebAPIConnected();
128 void handleOMFTracing();
134 bool m_sendFullStructure;
137 string m_hostAndPort;
138 unsigned int m_retrySleepTime;
139 unsigned int m_maxRetry;
140 unsigned int m_timeout;
143 string m_dataActionCode;
145 string m_producerToken;
146 string m_formatNumber;
147 string m_formatInteger;
148 OMF_ENDPOINT m_PIServerEndpoint;
149 NAMINGSCHEME_ENDPOINT
151 string m_DefaultAFLocation;
155 string m_prefixAFAsset;
156 string m_PIWebAPIProductTitle;
157 string m_RestServerVersion;
158 string m_PIWebAPIAuthMethod;
159 string m_PIWebAPICredentials;
160 string m_KerberosKeytab;
169 string m_OCSNamespace;
170 string m_OCSTenantId;
171 string m_OCSClientId;
172 string m_OCSClientSecret;
175 vector<pair<string, string>>
178 std::vector<std::string>
181 std::map<std::string, OMFDataTypes>
187 bool m_tracingEnabled;
Fledge Logger class used to log to syslog.
Definition: logger.h:26
Definition: config_category.h:56
The OMF class.
Definition: omf.h:109
Definition: http_sender.h:20