Add Honeycomb notifications tests
[csit.git] / resources / libraries / robot / honeycomb / notifications.robot
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.honeycomb.Notifications | ${hello}
16 | ... | ${subscription}
17 | Documentation | Keywords used to test Honeycomb notifications over Netconf.
18
19 *** Variables ***
20 # hello message sent to Honeycomb through Netconf
21 | ${hello}= | <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
22 | ... | <capabilities><capability>urn:ietf:params:netconf:base:1.0
23 | ... | </capability></capabilities></hello>]]>]]>
24 # rpc call to add a subscription to Netconf notifications
25 | ${subscription}= | <netconf:rpc netconf:message-id="101"
26 | ... | xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
27 | ... | <create-subscription
28 | ... | xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
29 | ... | <stream>honeycomb</stream></create-subscription></netconf:rpc>]]>]]>
30
31 *** Keywords ***
32 | Notification listener is established
33 | | [Documentation] | Connects to Honeycomb notification service.
34 | | ...
35 | | ... | *Arguments:*
36 | | ... | - node - information about a DUT node. Type: dictionary
37 | | ...
38 | | ... | *Example:*
39 | | ...
40 | | ... | \| Notification listener is established \| ${nodes['DUT1']} \|
41 | | [Arguments] | ${node}
42 | | Create session | ${node}
43 | | Add notification listener
44
45 | Honeycomb should send interface state notification
46 | | [Documentation] | Reads notification from Honeycomb and verifies\
47 | | ... | notification type, interface name and interface admin-state.
48 | | ...
49 | | ... | *Arguments:*
50 | | ... | - interface - name of the affected interface. Type: string
51 | | ... | - state - expected state of interface, 'up' or 'down'. Type: string
52 | | ...
53 | | ... | *Example:*
54 | | ...
55 | | ... | \| Honeycomb should send interface state notification \
56 | | ... | \| GigabitEthernet0/8/0 \| up \|
57 | | [Arguments] | ${interface} | ${state}
58 | | ${reply}= | Get notification
59 | | Should contain | ${reply} | <interface-state-change
60 | | Should contain | ${reply} | <name>${interface}</name>
61 | | Should contain | ${reply} | <admin-status>${state}</admin-status>
62
63 | Honeycomb should send interface deleted notification
64 | | [Documentation] | Reads notification from Honeycomb and verifies\
65 | | ... | notification type and interface name.
66 | | ...
67 | | ... | *Arguments:*
68 | | ... | - interface - name of the deleted interface. Type: string
69 | | ...
70 | | ... | *Example:*
71 | | ...
72 | | ... | \| Honeycomb should send interface deleted notification \
73 | | ... | \| temp_interface \|
74 | | [Arguments] | ${interface}
75 | | ${reply}= | Get notification
76 | | Should contain | ${reply} | <interface-deleted
77 | | Should contain | ${reply} | <name>${interface}</name>