VTN Payload Logging
One of the challenges with the VTN in the Cloud is isolating problems with OpenADR XML payload exchanges. The open source EPRI VTN, the basis for QualityLogic’s cloud offering, provides no support in the administrative interface for viewing payload exchanges. This limitation is particularly serious if the VEN you are using also does not provide payload exchange logging and you encounter errors.
Although unfamiliar with the Ruby on Rails MVC (Model, View, Controller) programming environment used to implement the EPRI VTN, we undertook the task of adding logging functionality to the Cloud VTN supported by QualityLogic. Our goal was to allow the administrative user to enable or disable logging on a selective basis for each VEN, then to allow users to view the composite log of all payload exchanges with appropriate descriptive banners and formatting of the XML data.
Seems simple, but it took us a while to get the lay of the land with regards to the MVP implementation, and we had to modify or create almost 20 source code files to implement this relatively simple functionality. Despite the unexpected effort, we were quite happy with the end result.
Figure 1 below shows the VEN list that is displayed when the sidebar VEN menu option is selected. Note the new column showing whether logging is enabled for each VEN. Selecting the View, Edit option will allow you to configure the VEN, including logging.
Figure 1
Figure 2 below shows that there is now a logging check box on the OpenADR Profile Settings section of the VEN configuration dialogs. Make sure to click “Save” after changing this setting.
Figure 2
Once logging is enabled for one or more VENs and payloads have been exchanged, you can click the View Log option in the sidebar menu to last 3,000 lines of logged data as shown in Figure 3 below. Note that each Request Response exchange has a header with the Date, Time, VEN Name, and VEN ID. The Request and Response banners also indicate the direction of the payload exchange.
Figure 3
We generated a new Amazon cloud master image that includes these logging enhancements, as well as one additional fix that enables use of the EPRI VEN over a secure channel with the VTN in the Cloud. This last improvement requires that secure communication between the VEN and VTN use port 8443. Server images for all new subscribers will use this updated image, and existing customers can request that their Server image be updated to this new runtime by emailing techsupport@qualityLogic.com. Note, however, that updating the Server image will require users to reconfigure their VTN.
There are some minor limitations with the logging implementation:
- The request or response payload must include the venID for the transaction to be logged
- If logging on the venID “TH_VEN” is enabled, payloads for “TH_VEN_1″ will also be logged as they contain the substring “TH_VEN”
- In push interactions, the oadrDistributeEvent payloads will only get logged if the eiTarget for the event includes a venID.
Although VTN in the Cloud users do not have access to the Linux runtime environment, we thought readers might be interested in the scope of changes required to implement this “small” change to the VTN functionality.
Files/Tables | Updated Change Log |
---|---|
vens Table in database>=db/schema.rb | Added “log_state” column to vens table to indicate whether logging is desired for the VEN |
app/model_fields/ven_fields.rbc app/models/ven.rb app/views/vens/_vens_list.html.erb app/views/vens/show.html.erb | Updated files to enable display of “log_state” in list of VENs and to add a check box to the OpenADR Profile Settings section of the Edit VEN dialog. |
app/controllers/oadr20_controller.rb app/services/http/http_agent_a.rb app/services/http/http_agent_b.rb | Added code to cause all push and pull payloads to be pretty printed using REXML and selectively output to info.log file depending on “log_state” for each VEN. Headers for VEN name and ID were added to the log output along with Request and Response banners. |
app/views/application/_navigation.html.erb app/views/venlog/index.html.erb app/helpers/venlog_helper.rb app/controllers/venlog_controller.rb config/routes.rb | Add code to display main sidebar “View Log” menu option, code to display the last 3000 lines of info.log, and to scroll to the bottom of the log display when refreshed. |
app/oadr/oadr_service.rb app/oadr/event_service.rb Added code to write error string to info.log app/services/transport_agent.rb app/oadr/create_distribute_event.rb app/models/event.rb | Comment out oadrLogger calls |