Use RFC 8040 URL for 'odl-mdsal-lowlevel-*' RPCs
[integration/test.git] / csit / libraries / UscUtils.robot
1 *** Settings ***
2 Library     Collections
3 Library     SSHLibrary
4 Library     UtilLibrary.py
5 Resource    RemoteBash.robot
6 Resource    SSHKeywords.robot
7
8
9 *** Variables ***
10 ${REST_VIEW_CHANNEL}        /restconf/operations/usc-channel:view-channel
11 ${REST_ADD_CHANNEL}         /restconf/operations/usc-channel:add-channel
12 ${REST_REMOVE_CHANNEL}      /restconf/operations/usc-channel:remove-channel
13 ${REST_REMOVE_SESSION}      /restconf/operations/usc-channel:remove-session
14 ${REST_SEND_MESSAGE}        /restconf/operations/usc-channel:send-message
15 ${NAV_USC_TOOLS}            cd ~/usc-tools
16 ${CLONE_USC_TOOLS}
17 ...                         [ -f ~/usc-tools/UscAgent.jar ] && echo "The usc-tools does exist, done." || git clone https://github.com/victorxu99/usc-tools.git ~/usc-tools
18 ${ECHO_SERVER_PORT}         2007
19 @{LIST_ECHO_SERVER_PORT}    2007    2008    2009
20 ${TEST_MESSAGE}             This is a test message.
21 ${NUM_OF_MESSAGES}          100
22 ${AgentTcp}                 java -jar UscAgent.jar -t true
23 ${AgentUdp}                 java -jar UscAgent.jar -t false
24 ${AgentTcpCallhome}         java -jar UscAgent.jar -t true -c true -h
25 ${AgentUdpCallhome}         java -jar UscAgent.jar -t false -c true -h
26 ${EchoServerTcp}            java -jar EchoServer.jar -t true -p 2007
27 ${EchoServerUdp}            java -jar EchoServer.jar -t false -p 2007
28
29
30 *** Keywords ***
31 Download Tools
32     [Documentation]    Download UscAgent and EchoServer before any system
33     ...    is run.
34     Log    Download tools begin ...
35     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    ${CLONE_USC_TOOLS}    prompt_timeout=30s
36     Log    Download tools ended.
37
38 Start TCP
39     [Documentation]    Basic setup/cleanup work that can be done safely before any system
40     ...    is run.
41     Log    Start USC test VM for TCP
42     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
43     Set Suite Variable    ${agent_conn_id}
44     Flexible Mininet Login
45     Write    ${NAV_USC_TOOLS}
46     Write    ${AgentTcp}
47     Read
48     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
49     Set Suite Variable    ${echo_conn_id}
50     Flexible Mininet Login
51     Write    ${NAV_USC_TOOLS}
52     Write    ${EchoServerTcp}
53     Read Until    initialized
54
55 Start UDP
56     [Documentation]    Basic setup/cleanup work that can be done safely before any system
57     ...    is run.
58     Log    Start USC test VM for UDP
59     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
60     Set Suite Variable    ${agent_conn_id}
61     Flexible Mininet Login
62     Write    ${NAV_USC_TOOLS}
63     Write    ${AgentUdp}
64     Read
65     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
66     Set Suite Variable    ${echo_conn_id}
67     Flexible Mininet Login
68     Write    ${NAV_USC_TOOLS}
69     Write    ${EchoServerUdp}
70     Read Until    initialized
71
72 Start CALLHOME_TCP
73     [Documentation]    Basic setup/cleanup work that can be done safely before any system
74     ...    is run.
75     Log    Start USC test VM for CALLHOME_TCP
76     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
77     Set Suite Variable    ${agent_conn_id}
78     ${callhomeCmd}=    Catenate    ${AgentTcpCallhome}    ${ODL_SYSTEM_IP}
79     Flexible Mininet Login
80     Write    ${NAV_USC_TOOLS}
81     Write    ${callhomeCmd}
82     Read
83     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
84     Set Suite Variable    ${echo_conn_id}
85     Flexible Mininet Login
86     Write    ${NAV_USC_TOOLS}
87     Write    ${EchoServerTcp}
88     Read Until    initialized
89
90 Start CALLHOME_UDP
91     [Documentation]    Basic setup/cleanup work that can be done safely before any system
92     ...    is run.
93     Log    Start USC test VM for CALLHOME_UDP
94     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
95     Set Suite Variable    ${agent_conn_id}
96     ${callhomeCmd}=    Catenate    ${AgentUdpCallhome}    ${ODL_SYSTEM_IP}
97     Flexible Mininet Login
98     Write    ${NAV_USC_TOOLS}
99     Write    ${callhomeCmd}
100     Read
101     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
102     Set Suite Variable    ${echo_conn_id}
103     Flexible Mininet Login
104     Write    ${NAV_USC_TOOLS}
105     Write    ${EchoServerUdp}
106     Read Until    initialized
107
108 Start Fallback_TCP
109     [Documentation]    Basic setup/cleanup work that can be done safely before any system
110     ...    is run.
111     Log    Start USC test VM for Fallback_TCP
112     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
113     Set Suite Variable    ${echo_conn_id}
114     Flexible Mininet Login
115     Write    ${NAV_USC_TOOLS}
116     Write    ${EchoServerTcp}
117     Read Until    initialized
118
119 Start Fallback_UDP
120     [Documentation]    Basic setup/cleanup work that can be done safely before any system
121     ...    is run.
122     Log    Start USC test VM for Fallback_TCP
123     ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
124     Set Suite Variable    ${echo_conn_id}
125     Flexible Mininet Login
126     Write    ${NAV_USC_TOOLS}
127     Write    ${EchoServerUdp}
128     Read Until    initialized
129
130 Start Multiple_Sessions_TCP
131     [Documentation]    Basic setup/cleanup work that can be done safely before any system
132     ...    is run.
133     Log    Start USC test VM for Multiple_Sessions_TCP
134     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
135     Set Suite Variable    ${agent_conn_id}
136     Flexible Mininet Login
137     Write    ${NAV_USC_TOOLS}
138     Write    ${AgentTcp}
139     Read
140     ${L1}=    Create List
141     FOR    ${port_index}    IN    @{LIST_ECHO_SERVER_PORT}
142         Log    ${port_index}
143         ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
144         Append To List    ${L1}    ${echo_conn_id}
145         Flexible Mininet Login
146         Write    ${NAV_USC_TOOLS}
147         Write    java -jar EchoServer.jar -t true -p ${port_index}
148         Read Until    initialized
149     END
150     Set Suite Variable    ${L1}
151
152 Start Multiple_Sessions_UDP
153     [Documentation]    Basic setup/cleanup work that can be done safely before any system
154     ...    is run.
155     Log    Start USC test VM for Multiple_Sessions_UDP
156     ${agent_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
157     Set Suite Variable    ${agent_conn_id}
158     Flexible Mininet Login
159     Write    ${NAV_USC_TOOLS}
160     Write    ${AgentUdp}
161     Read
162     ${L1}=    Create List
163     FOR    ${port_index}    IN    @{LIST_ECHO_SERVER_PORT}
164         Log    ${port_index}
165         ${echo_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    timeout=30s
166         Append To List    ${L1}    ${echo_conn_id}
167         Flexible Mininet Login
168         Write    ${NAV_USC_TOOLS}
169         Write    java -jar EchoServer.jar -t false -p ${port_index}
170         Read Until    initialized
171     END
172     Set Suite Variable    ${L1}
173
174 Stop Agent_Echo
175     [Documentation]    Cleanup/Shutdown work that should be done at the completion of all
176     ...    tests
177     Log    Stop USC test VM for Agent_Echo
178     Switch Connection    ${agent_conn_id}
179     Read
180     Write_Bare_Ctrl_C
181     Write    exit
182     Close Connection
183     Switch Connection    ${echo_conn_id}
184     Read
185     Write_Bare_Ctrl_C
186     Write    exit
187     Close Connection
188
189 Stop Echo
190     [Documentation]    Cleanup/Shutdown work that should be done at the completion of all
191     ...    tests
192     Log    Stop USC test VM for Echo
193     Switch Connection    ${echo_conn_id}
194     Read
195     Write_Bare_Ctrl_C
196     Write    exit
197     Close Connection
198
199 Stop One_Agent_Multiple_Echo
200     [Documentation]    Cleanup/Shutdown work that should be done at the completion of all
201     ...    tests
202     Log    Stop USC test VM for One_Agent_Multiple_Echo
203     Switch Connection    ${agent_conn_id}
204     Read
205     Write_Bare_Ctrl_C
206     Write    exit
207     Close Connection
208     FOR    ${echo_conn_id}    IN    @{L1}
209         Switch Connection    ${echo_conn_id}
210         Read
211         Write_Bare_Ctrl_C
212         Write    exit
213         Close Connection
214     END