2 Documentation Robot keyword library (Resource) for performing PCEP operations via restconf calls.
4 ... Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
9 Library RequestsLibrary
10 Variables ${CURDIR}/../variables/Variables.py
14 [Documentation] Creates Requests session to be used by subsequent keywords.
15 # Do not append slash at the end uf URL, Requests would add another, resulting in error.
16 Create_Session pcep_session http://${CONTROLLER}:${RESTCONFPORT}/restconf/operations headers=${HEADERS_XML} auth=${AUTH}
18 Teardown_Pcep_Operations
19 [Documentation] Teardown to pair with Setup (otherwise no-op).
20 Log TODO: The following line does not seem to be implemented by RequestsLibrary. Look for a workaround.
21 # Delete_Session pcep_session
23 Add_Xml_Lsp_Return_Json
24 [Arguments] ${xml_data}
25 [Documentation] Instantiate LSP according to XML data and return response (json) text.
27 ${response}= Operate_Xml_Lsp_Return_Json network-topology-pcep:add-lsp ${xml_data}
30 Update_Xml_Lsp_Return_Json
31 [Arguments] ${xml_data}
32 [Documentation] Update LSP according to XML data and return response (json) text.
34 ${response}= Operate_Xml_Lsp_Return_Json network-topology-pcep:update-lsp ${xml_data}
37 Remove_Xml_Lsp_Return_Json
38 [Arguments] ${xml_data}
39 [Documentation] Remove LSP according to XML data and return response (json) text.
41 ${response}= Operate_Xml_Lsp_Return_Json network-topology-pcep:remove-lsp ${xml_data}
44 Operate_Xml_Lsp_Return_Json
45 [Arguments] ${uri_part} ${xml_data}
46 [Documentation] Post XML data to given pcep-operations URI, check status_code is 200 and return response text (JSON).
47 ${response}= RequestsLibrary.Post pcep_session ${uri_part} data=${xml_data}
48 Should_Be_Equal_As_Strings ${response.status_code} 200
49 [Return] ${response.text}
53 [Documentation] Given text should be equal to successfull json response.
54 Should_Be_Equal_As_Strings ${text} {"output":{}}
58 [Documentation] Given text should be equal to json response when device refuses tunnel removal.
59 # FIXME: We probably should normalize text as json (and by that, test whether it is a json at all).
60 Should_Be_Equal_As_Strings ${text} {"output":{"error":[{"error-object":{"ignore":false,"processing-rule":false,"type":19,"value":9}}],"failure":"failed"}}