L2Gw Test Cases Suite1
[integration/test.git] / csit / suites / l2gw / __init__.robot
1 *** Settings ***
2 Documentation     Test suite for HWVTEP Setup
3 Suite Setup       Start Suite
4 Suite Teardown    Stop Suite
5 Library           SSHLibrary
6 Library           Collections
7 Resource          ../../variables/Variables.robot
8 Resource          ../../libraries/Utils.robot
9 Resource          ../../libraries/DevstackUtils.robot
10 Resource          ../../libraries/KarafKeywords.robot
11 Resource          ../../variables/l2gw/Variables.robot
12
13 *** Variables ***
14
15 *** Keywords ***
16 Start Suite
17     [Documentation]    Suite Setup to configure HWVTEP Emulator for L2 Gateway Testcase Verification.
18     Create And Set Hwvtep Connection Id
19     Hwvtep Cleanup
20     Namespace Cleanup
21     Hwvtep Initiate
22     Namespace Intiate
23     Wait Until Keyword Succeeds    30s    1s    Hwvtep Validation
24
25 Stop Suite
26     [Documentation]    Stop Suite to cleanup Hwvtep configuration
27     Hwvtep Cleanup
28     Namespace Cleanup
29     Switch Connection    ${hwvtep_conn_id}
30     close connection
31
32 Hwvtep Cleanup
33     [Documentation]    Cleanup any existing VTEP, VSWITCHD or OVSDB processes.
34     Switch Connection    ${hwvtep_conn_id}
35     Write Commands Until Prompt    ${DEL_OVS_BRIDGE} ${HWVTEP_BRIDGE}    30s
36     Write Commands Until Prompt    ${KILL_VTEP_PROC}    30s
37     Write Commands Until Prompt    ${KILL_VSWITCHD_PROC}    30s
38     Write Commands Until Prompt    ${KILL_OVSDB_PROC}    30s
39     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
40     Log    ${stdout}
41     Write Commands Until Prompt    ${REM_OVSDB}    30s
42     Write Commands Until Prompt    ${REM_VTEPDB}    30s
43
44 Namespace Cleanup
45     [Documentation]    Cleanup the existing namespaces and ports.
46     Switch Connection    ${hwvtep_conn_id}
47     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
48     Log    ${stdout}
49     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT1}    30s
50     Write Commands Until Prompt    ${IP_LINK_DEL} ${NS_PORT2}    30s
51     ${stdout}=    Write Commands Until Prompt    ${NETNS}    30s
52     Log    ${stdout}
53     Write Commands Until Prompt    ${NETNS_DEL} ${HWVTEP_NS1}    30s
54     ${stdout}=    Write Commands Until Prompt    ${IP_LINK}    30s
55     Log    ${stdout}
56
57 Hwvtep Initiate
58     [Documentation]    Configure the Hwvtep Emulation
59     Switch Connection    ${hwvtep_conn_id}
60     Write Commands Until Prompt    ${CREATE_OVSDB}    30s
61     Write Commands Until Prompt    ${CREATE VTEP}    30s
62     Write Commands Until Prompt    ${START_OVSDB_SERVER}    30s
63     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
64     Log    ${stdout}
65     Write Commands Until Prompt    ${INIT_VSCTL}    30s
66     Write Commands Until Prompt    ${DETACH_VSWITCHD}    30s
67     Write Commands Until Prompt    ${CREATE_OVS_BRIDGE} ${HWVTEP_BRIDGE}    30s
68     ${stdout}=    Write Commands Until Prompt    ${OVS_SHOW}    30s
69     Log    ${stdout}
70     Write Commands Until Prompt    ${ADD_VTEP_PS} ${HWVTEP_BRIDGE}    30s
71     Write Commands Until Prompt    ${SET_VTEP_PS}${HWVTEP_IP}    30s
72     Write Commands Until Prompt    ${START_OVSVTEP}    30s
73     ${stdout}=    Write Commands Until Prompt    ${GREP_OVS}    30s
74     Log    ${stdout}
75
76 Namespace Intiate
77     [Documentation]    Create and configure the namespace, bridges and ports.
78     Switch Connection    ${hwvtep_conn_id}
79     Write Commands Until Prompt    ${NETNS_ADD} ${HWVTEP_NS1}    30s
80     Write Commands Until Prompt    ${IP_LINK_ADD} ${NS_TAP1} type veth peer name ${NS_PORT1}    30s
81     Write Commands Until Prompt    ${CREATE_OVS_PORT} ${HWVTEP_BRIDGE} ${NS_PORT1}    30s
82     Write Commands Until Prompt    ${IP_LINK_SET} ${NS_TAP1} netns ${HWVTEP_NS1}    30s
83     Write Commands Until Prompt    ${NETNS_EXEC} ${HWVTEP_NS1} ${IPLINK_SET} ${NS_TAP1} up    30s
84     Write Commands Until Prompt    sudo ${IPLINK_SET} ${NS_PORT1} up    30s
85     ${stdout}=    Write Commands Until Prompt    ${NETNS_EXEC} ${HWVTEP_NS1} ${IFCONF}    30s
86     Log    ${stdout}
87
88 Hwvtep Validation
89     [Documentation]    Initial validation of the Hwvtep Configuration to confirm Phyisical_Switch table entries
90     Switch Connection    ${hwvtep_conn_id}
91     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_SWITCH_TABLE}    30s
92     Should Contain    ${stdout}    ${HWVTEP_BRIDGE}
93     Should Contain    ${stdout}    ${HWVTEP_IP}
94     ${stdout}=    Write Commands Until Prompt    ${VTEP LIST} ${PHYSICAL_PORT_TABLE}    30s
95     Should Contain    ${stdout}    ${NS_PORT1}
96
97 Create And Set Hwvtep Connection Id
98     [Documentation]    To create Hwvtep connection id for the suite
99     ${hwvtep_conn_id}=    SSHLibrary.Open Connection    ${HWVTEP_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
100     Set Suite Variable    ${hwvtep_conn_id}
101     Log    ${hwvtep_conn_id}
102     Flexible SSH Login    ${DEFAULT_USER}    ${DEFAULT_PASSWORD}