Skip to content

Commit 573a473

Browse files
committed
test/exclusive_ip.robot: IP exclusivity test suite
Test suite covering some possible use cases od IP exclusivity detection. IP/ID fake DUT data in robot file must be kept in sync with Snipe-IT. Added Check Out By Asset ID to common keywords. Signed-off-by: Mateusz Maciejewski <[email protected]>
1 parent 9c075eb commit 573a473

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed

osfv_cli/test/common/keywords.robot

+17
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ Check Out
4545
... --rte_ip
4646
... ${rte_ip}
4747
... env:SNIPEIT_CONFIG_FILE_PATH=${snipeit_config}
48+
Log ${snipeit_config}
49+
Log ${result.stdout}
50+
Log ${result.stderr}
51+
RETURN ${result}
52+
53+
Check Out By Asset ID
54+
[Documentation] Check out asset using osfv_cli as user defined
55+
... in ~/.osfv.snipeit.yml
56+
[Arguments] ${asset_id} ${snipeit_config}=%{HOME}/.osfv/snipeit.yml
57+
${result}= Run Process
58+
... osfv_cli
59+
... snipeit
60+
... check_out
61+
... --asset_id
62+
... ${asset_id}
63+
... env:SNIPEIT_CONFIG_FILE_PATH=${snipeit_config}
64+
Log ${snipeit_config}
4865
Log ${result.stdout}
4966
Log ${result.stderr}
5067
RETURN ${result}

osfv_cli/test/exclusive_ip.robot

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
*** Settings ***
2+
Documentation IP duplication protection (IP, RTE IP, Sonoff IP, PiKVM IP) test suite.
3+
4+
Library Process
5+
Resource ../test/common/keywords.robot
6+
7+
8+
*** Variables ***
9+
${UNIT_00_ID}= 226
10+
${UNIT_01_ID}= 227
11+
${UNIT_02_ID}= 228
12+
${UNIT_03_ID}= 229
13+
14+
${UNIT_00_IP}= 127.1.0.1
15+
${UNIT_01_IP}= 127.1.1.1
16+
${UNIT_02_IP}= 127.1.2.1
17+
${UNIT_03_IP}= 127.1.0.1
18+
19+
${UNIT_00_RTE_IP}= 127.100.1.1
20+
${UNIT_01_RTE_IP}= 127.100.1.1
21+
${UNIT_02_RTE_IP}= 127.100.2.1
22+
${UNIT_03_RTE_IP}= 127.100.1.1
23+
24+
${UNIT_00_SONOFF_IP}= 127.7.0.1
25+
${UNIT_01_SONOFF_IP}= 127.7.1.1
26+
${UNIT_02_SONOFF_IP}= 127.7.0.1
27+
${UNIT_03_SONOFF_IP}= 127.7.0.1
28+
29+
${UNIT_00_PIKVM_IP}= 127.200.1.1
30+
${UNIT_01_PIKVM_IP}= 127.200.1.1
31+
${UNIT_02_PIKVM_IP}= 127.200.1.1
32+
${UNIT_03_PIKVM_IP}= 127.200.1.1
33+
34+
${BY_RTE_FAILURE_PRE}= SEPARATOR= osfv.libs.snipeit_api.SnipeIT.
35+
... DuplicatedIpException: FATAL: You are trying to access an asset with
36+
${BY_RTE_FAILURE_POST}= SEPARATOR= which is not exclusive. Please check Snipe-IT data.
37+
38+
39+
*** Test Cases *** ***
40+
Check Out By RTE IP Negative failing on RTE IP
41+
[Documentation] Should fail due to RTE IP non-exclusivity
42+
${checkout_result}= Check Out rte_ip=${UNIT_00_RTE_IP}
43+
44+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
45+
... RTE IP: ${UNIT_00_RTE_IP} ${BY_RTE_FAILURE_POST}
46+
Should Match ${checkout_result.stderr} ${expected}
47+
48+
Check Out By RTE Negative failing on Sonoff IP
49+
[Documentation] Should fail due to Sonoff IP non-exclusivity
50+
${checkout_result}= Check Out rte_ip=${UNIT_02_RTE_IP}
51+
52+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
53+
... Sonoff IP: ${UNIT_02_SONOFF_IP} ${BY_RTE_FAILURE_POST}
54+
55+
Should Match ${checkout_result.stderr} ${expected}
56+
57+
Check Out By ID Negative failing on PiKVM IP
58+
[Documentation] Should fail due to PiKVM IP non-exclusivity
59+
${checkout_result}= Check Out By Asset ID asset_id=${UNIT_01_ID}
60+
61+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
62+
... PiKVM IP: ${UNIT_02_PIKVM_IP} ${BY_RTE_FAILURE_POST}
63+
64+
Should Match ${checkout_result.stderr} ${expected}
65+
66+
Check Out By ID Negative failing on Sonoff IP
67+
[Documentation] Should fail due to Sonoff IP non-exclusivity
68+
${checkout_result}= Check Out By Asset ID asset_id=${UNIT_03_ID}
69+
70+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
71+
... Sonoff IP: ${UNIT_03_SONOFF_IP} ${BY_RTE_FAILURE_POST}
72+
73+
Should Match ${checkout_result.stderr} ${expected}
74+
75+
Flash Probe Negative by RTE IP failing on RTE IP
76+
[Documentation] Should fail due to RTE IP non-exclusivity
77+
${probe_result}= Run Process osfv_cli rte --rte_ip
78+
... ${UNIT_00_RTE_IP} flash probe
79+
Should Be Equal As Integers ${probe_result.rc} 1
80+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
81+
... RTE IP: ${UNIT_00_RTE_IP} ${BY_RTE_FAILURE_POST}
82+
83+
Should Match ${probe_result.stderr} ${expected}
84+
85+
Flash Probe Negative by RTE IP failing on Sonoff IP
86+
${probe_result}= Run Process osfv_cli rte --rte_ip
87+
... ${UNIT_02_RTE_IP} flash probe
88+
Should Be Equal As Integers ${probe_result.rc} 1
89+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
90+
... Sonoff IP: ${UNIT_02_SONOFF_IP} ${BY_RTE_FAILURE_POST}
91+
92+
Should Match ${probe_result.stderr} ${expected}
93+
94+
Sonoff Get Negative by Sonoff IP failing on PiKVM IP
95+
[Documentation] Should fail due to PiKVM IP non-exclusivity
96+
${probe_result}= Run Process osfv_cli sonoff --sonoff_ip
97+
... ${UNIT_01_SONOFF_IP} get
98+
Should Be Equal As Integers ${probe_result.rc} 1
99+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
100+
... PiKVM IP: ${UNIT_01_PIKVM_IP} ${BY_RTE_FAILURE_POST}
101+
102+
Should Match ${probe_result.stderr} ${expected}
103+
104+
Snoff Get Negative by RTE IP failing on Sonoff IP
105+
[Documentation] Should fail due to PiKVM IP non-exclusivity
106+
${probe_result}= Run Process osfv_cli sonoff --rte_ip
107+
... ${UNIT_02_RTE_IP} get
108+
Should Be Equal As Integers ${probe_result.rc} 1
109+
${expected}= Catenate SEPARATOR=${SPACE} ${BY_RTE_FAILURE_PRE}
110+
... Sonoff IP: ${UNIT_02_SONOFF_IP} ${BY_RTE_FAILURE_POST}
111+
112+
Should Match ${probe_result.stderr} ${expected}

0 commit comments

Comments
 (0)