110 likes | 127 Views
Joint Institute for Nuclear Research, Dubna , Russia. RestDS – C++ Tango REST API implementation. Georgy Sedykh , Evgeny Gorbachev. TANGO Workshop @ ICALEPCS 2017. Web clients. 1. Web technologies progress. 2. Advantages:. Universal Flixible Well-looking Convenient.
E N D
Joint Institute for Nuclear Research, Dubna, Russia RestDS – C++ Tango REST API implementation Georgy Sedykh, Evgeny Gorbachev TANGO Workshop @ ICALEPCS 2017
Web clients 1. Web technologies progress 2. Advantages: • Universal • Flixible • Well-looking • Convenient Universal tools for communication betweenTango Controls and Web clientsare required
REST REST (Representational State Transfer) – architectural principles to design web services that focus on system’s resources. • Global identification of resources (URL); • Manipulation of resources through the standard protocol (HTTP); • Stateless;
Tango REST API RC4 * Describes how to: • Operate with different tango hosts; • Browse Tango units (devices, attributes, properties, commands, pipes); • Write/Read attributes; • Execute commands; • Write/Read pipes; • Get/Set properties; • Use authentication mechanisms; • Transmit arguments as http parameters; • Parse Response JSON; • Use Error codes; http://tangodevel.jinr.ru:8080/tango/rest/rc3/nuclotango.jinr.ru/20000/devices/sys/tg_test/1/attributes/DevDouble/value • Attribute • Command • Pipe • Property Tango host REST Service URL REST API Version Tango device ID * http://tango-rest-api.readthedocs.io/en/latest/
RestDS – Tango module, designed to provide access to tango control system units through http requests; Features: • Developed in C++ with Boost and OpenSSL; • Windows and Linux supported; • Lightweight; • Tango device server; • Both http and https protocols supported; • Basic http authentication supported; • Uses server-side role-based Tango access control and logging system (More info: TUPHA171 – Development of NICA Control System: Access Control and Logging); • Git:http://tangodevel.jinr.ru/git/tango/web/RestDS.git; • Tango REST API RC4 partial support (so far without pipes);
RestDS :: Examples To read attribute: GEThttp(s)://host:port/tango/rest/rc4/devices/domain/family/member/attributes/name/value To write attribute: POST / PUThttp(s)://host:port/tango/rest/rc4/devices/domain/family/member/attributes/name + arguments as POST parameters. To execute command without arguments: POST / PUThttp(s)://host:port/tango/rest/rc4/devices/domain/family/member/commands/name To execute command with arguments: POST / PUThttp(s)://host:port/tango/rest/rc4/devices/domain/family/member/commands/name + arguments as POST parameters.
RestDS :: Operation diagram http://host:port/tango/rest/rc4/devices/thermo/shoulder/1/attributes/T56/value RestDS HTTP code 200 - OK Response as JSON object if success • Host:port • Threads number • Authentication • Security (SSL) { “name”: “T56”, “quality”: “VALID”, “timestamp”: 1473348563, “value”: 273.12, } Web Client Or http error code if failed.. 400 – Bad request 403 – Forbidden 401 – Unauthorized 404 – Not found
Summary: • Web client applications are cross-platform, well-looking and convenient; • Web clients will be widely distributed within the NICA Control system. • RestDS Tango module was developed to provide universal way to communicate between web client and Tango-based control system.