HC Test: create Vlan sub-interface using netconf
[csit.git] / resources / libraries / robot / honeycomb / port_mirroring.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.HcAPIKwInterfaces.InterfaceKeywords
16 | ...     | WITH NAME | InterfaceAPI
17 | Library | resources.libraries.python.telemetry.SPAN
18
19 *** Keywords ***
20 | Honeycomb Configures SPAN on interface
21 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
22 | | ... | interface, mirroring one or more interfaces.
23 | | ...
24 | | ... | *Arguments:*
25 | | ... | - node - information about a DUT node. Type: dictionary
26 | | ... | - dst_interface - Mirroring destination interface. Type: string
27 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
28 | | ... | any number of strings
29 | | ...
30 | | ... | *Example:*
31 | | ...
32 | | ... | \| Honeycomb Configures SPAN on interface \| ${nodes['DUT1']} \
33 | | ... | \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
34 | | ...
35 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
36 | | InterfaceAPI.Configure interface SPAN
37 | | ... | ${node} | ${dst_interface} | @{src_interfaces}
38
39 | Interface SPAN configuration from Honeycomb should be
40 | | [Documentation] | Retrieves interface operational data and verifies that\
41 | | ... | SPAN mirroring is configured with the provided interfaces.
42 | | ...
43 | | ... | *Arguments:*
44 | | ... | - node - information about a DUT node. Type: dictionary
45 | | ... | - dst_interface - Mirroring destination interface. Type: string
46 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
47 | | ... | any number of strings
48 | | ...
49 | | ... | *Example:*
50 | | ...
51 | | ... | \| Interface SPAN configuration from Honeycomb should be \
52 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
53 | | ...
54 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
55 | | ${data}= | InterfaceAPI.Get interface oper data | ${node} | ${dst_interface}
56 | | ${data}= | Set Variable
57 | | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']}
58 | | Sort list | ${data}
59 | | Sort list | ${src_interfaces}
60 | | Lists should be equal | ${data} | ${src_interfaces}
61
62 | Interface SPAN configuration from VAT should be
63 | | [Documentation] | Retrieves SPAN configuration from VAT dump and verifies\
64 | | ... | that SPAN mirroring is configured with the provided interfaces.
65 | | ...
66 | | ... | *Arguments:*
67 | | ... | - node - information about a DUT node. Type: dictionary
68 | | ... | - dst_interface - Mirroring destination interface. Type: string
69 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
70 | | ... | any number of strings
71 | | ...
72 | | ... | *Example:*
73 | | ...
74 | | ... | \| Interface SPAN configuration from VAT should be \
75 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
76 | | ...
77 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
78 | | ${data}= | VPP get SPAN configuration by interface
79 | | ... | ${node} | ${dst_interface} | name
80 | | Sort list | ${data}
81 | | Sort list | ${src_interfaces}
82 | | Lists should be equal | ${data} | ${src_interfaces}
83
84 | Honeycomb removes interface SPAN configuration
85 | | [Documentation] | Uses Honeycomb API to remove SPAN confirugation\
86 | | ... | from the specified interface.
87 | | ...
88 | | ... | *Arguments:*
89 | | ... | - node - information about a DUT node. Type: dictionary
90 | | ... | - dst_interface - Mirroring destination interface. Type: string
91 | | ...
92 | | ... | *Example:*
93 | | ...
94 | | ... | \| Honeycomb removes interface SPAN configuration \
95 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
96 | | ...
97 | | [Arguments] | ${node} | ${dst_interface}
98 | | InterfaceAPI.Configure interface SPAN | ${node} | ${dst_interface}
99
100 | Interface SPAN configuration from Honeycomb should not exist
101 | | [Documentation] | Retrieves interface operational data and verifies that\
102 | | ... | SPAN mirroring is not configured.
103 | | ...
104 | | ... | *Arguments:*
105 | | ... | - node - information about a DUT node. Type: dictionary
106 | | ... | - dst_interface - Mirroring destination interface. Type: string
107 | | ...
108 | | ... | *Example:*
109 | | ...
110 | | ... | \|
111 | | [Arguments] | ${node} | ${dst_interface}
112 | | ${data}= | InterfaceAPI.Get interface oper data | ${node} | ${dst_interface}
113 | | Run keyword and expect error | *KeyError* | Set Variable
114 | | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']}
115
116 | SPAN configuration from VAT should not exist
117 | | [Documentation] | Attmepts to retrieve SPAN configuration from VAT dump,\
118 | | ... | and expects to fail with no data retrieved.
119 | | ...
120 | | ... | *Arguments:*
121 | | ... | - node - information about a DUT node. Type: dictionary
122 | | ...
123 | | ... | *Example:*
124 | | ...
125 | | ... | \| SPAN configuration from VAT should not exist \| ${nodes['DUT1']} \|
126 | | [Arguments] | ${node}
127 | | Run keyword and expect error | ValueError: No JSON object could be decoded
128 | | ... | VPP get SPAN configuration by interface | ${node} | local0