Every resource in OpenNaaS contains its own ProtocolSessionManager. It's created once the user creates the resource. Therefore the URL of the ProtocolSessionManager of a single resource depends on the resource type and the resource name it belongs to.
WADL
URL
http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionmanager?_wadl
Description
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <grammars> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"> <xs:element name="listResponse" type="listResponse" /> <xs:element name="protocolSessionContext" type="protocolSessionContext" /> <xs:complexType name="listResponse"> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="list" nillable="true" type="xs:anyType" /> </xs:sequence> </xs:complexType> <xs:complexType name="protocolSessionContext"> <xs:sequence> <xs:element name="sessionParameters"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="entry"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="key" type="xs:string" /> <xs:element minOccurs="0" name="value" type="xs:anyType" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:schema> </grammars> <resources base="http://localhost:8888/opennaas/router/myre/protocolSessionManager/"> <resource path="/"> <resource path="context/"> <method name="GET"> <response> <representation mediaType="application/xml" /> </response> </method> </resource> <resource path="context/register"> <method name="POST"> <request> <representation mediaType="application/octet-stream" /> </request> <response status="204" /> </method> </resource> <resource path="context/unregister"> <method name="POST"> <request> <representation mediaType="application/xml" /> </request> <response status="204" /> </method> </resource> <resource path="context/{protocol}"> <param name="protocol" style="template" type="xs:string" /> <method name="DELETE"> <request /> <response status="204" /> </method> </resource> <resource path="session/"> <method name="GET"> <response> <representation mediaType="application/xml" /> </response> </method> </resource> <resource path="session/{sessionId}"> <param name="sessionId" style="template" type="xs:string" /> <method name="DELETE"> <request /> <response status="204" /> </method> </resource> <resource path="session/{sessionId}/locked"> <param name="sessionId" style="template" type="xs:string" /> <method name="GET"> <request /> <response> <representation mediaType="application/octet-stream"> <param name="result" style="plain" type="xs:boolean" /> </representation> </response> </method> </resource> </resource> </resources> </application> |
Methods
RegisterContext
Registers a new context on the resource's protocol session manager. The context will be used if a session with the context's protocol is requested.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/context/register | |
Method | POST | |
Body Parameter | ProtocolSessionContext | ProtocolSessionContext containing all necessary information to communicate with the real device. |
Return | - |
Body Example
Following example shows how to send sesessionParameters of the protocolSessionContext. It registers a protocolSessionContext of netconf protocol using username and password as credentials.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <protocolSessionContext> <sessionParameters> <entry> <key>protocol.authType</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">password</value> </entry> <entry> <key>protocol</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">netconf</value> </entry> <entry> <key>protocol.password</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">my_pass</value> </entry> <entry> <key>protocol.username</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">my_username</value> </entry> <entry> <key>protocol.uri</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">ssh://my_username:my_pass@my_router_address/netconf</value> </entry> </sessionParameters> </protocolSessionContext> |
UnregisterContext
Unregisters an existing context of a specific protocol on the resource's protocol session manager.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/context/{protocol} | |
Method | DELETE | |
Path Parameter | String | Protocol which protocol context would be removed. For example, "netconf". |
Return | - |
GetRegisteredContexts
Returns the list of all registered protocolContext of the specific resource.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/context | |
Method | GET | |
Return | ProtocolSessionContexts | List of all protocolSessionContexts registered in the specific resource |
Response Example
Following response contains the protocolSessionContext we registered in the RegisterContext method.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <protocolSessionContexts> <protocolSessionContext> <sessionParameters> <entry> <key>protocol.authType</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">password</value> </entry> <entry> <key>protocol</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">netconf</value> </entry> <entry> <key>protocol.password</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">my_passs</value> </entry> <entry> <key>protocol.username</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">my_username</value> </entry> <entry> <key>protocol.uri</key> <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">ssh://my_username:my_passs@my_device_address/netconf</value> </entry> </sessionParameters> </protocolSessionContext> </protocolSessionContexts> |
GetAllProtocolSessionIds
Returns the ids of all live sessions of a specific resource.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/session | |
Method | GET | |
Return | ListResponse | List with the ids of all current resource live sessions. |
Response Example
Following response example show a list of two alive sessions for the specified resource.
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sessionIdList> <session>4339a0a8-8454-4c56-acb0-d287ce16ee8b</session> <session>562avh48-8712-4h36-lo8j-hg65433hcb12</session> </sessionIdList> |
DestroyProtocolSession
Removes a specific protocolSession from the list of live registered protocolSessions.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/session/{sessionId} | |
Method | DELETE | |
Body Parameter | sessionId | Id of the session to be removed. |
Return | - |
IsLocked
Checks if a given session id is locked.
Value | Description | |
---|---|---|
URL | http://hostname:8888/opennaas/{resourceType}/{resourceName}/protocolSessionManager/session/{sessionId}/locked | |
Method | GET | |
Body Parameter | sessionId | Id of the session which locked state we want to retrieve. |
Return | Boolean | "true" if the given session is locked, "false" otherwise. |
Response Example
No Format |
---|
false |