Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix IPv6 ARP CRUD tests using ipv4 addresses #1500

Merged
merged 2 commits into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/robot/libraries/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ def Check_Linux_Interface_IP_Presence(data, mac, ip):


def parse_linux_arp_entries(data):
"""Parse output of arp command and return list of ARP entries.

:param data: output of 'arp' command.
:type data: str
:returns: Parsed ARP entries.
:rtype: list of dict
"""
entries = []

for line in data.splitlines():
Expand All @@ -76,3 +82,29 @@ def parse_linux_arp_entries(data):
entries.append(entry)

return entries


def parse_linux_ipv6_neighbor_entries(data):
"""Parse output of ip neighbor command and return list of neighbor entries.

:param data: output of 'ip neighbor' command.
:type data: str
:returns: Parsed neighbor entries.
:rtype: list of dict
"""
entries = []

for line in data.splitlines():
if "ip address" in line.lower():
# skip column headers line
continue
entry_data = line.split()
entry = {
"interface": entry_data[2],
"ip_addr": entry_data[0],
"mac_addr": entry_data[4]
}
entries.append(entry)

return entries

10 changes: 10 additions & 0 deletions tests/robot/libraries/linux.robot
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,13 @@ linux: Check ARP
Run Keyword If "${presence}" == "True"
... Should Contain ${arps} ${wanted}
... ELSE Should Not Contain ${arps} ${wanted}

linux: Check IPv6 Neighbor
[Arguments] ${node} ${interface} ${ip_address} ${mac_address} ${presence}
[Documentation] Check IPv6 Neighbor presence in linux
${out}= Execute In Container ${node} ip -6 neighbour
${arps}= Parse Linux IPv6 Neighbor Entries ${out}
${wanted}= Create Dictionary interface=${interface} ip_addr=${ip_address} mac_addr=${mac_address}
Run Keyword If "${presence}" == "True"
... Should Contain ${arps} ${wanted}
... ELSE Should Not Contain ${arps} ${wanted}
45 changes: 42 additions & 3 deletions tests/robot/libraries/vpp_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,51 @@ def Find_MAC_In_Text(text):

# input - output from sh ip arp command
# output - state info list
def Parse_ARP(info, intf, ip, mac):
def parse_arp(info, intf, ip, mac):
"""Parse ARP list from vpp console and find a specific entry using the provided arguments.

:param info: ARP list from VPP console.
:param intf: VPP-internal name of the interface configured with this ARP entry.
:param ip: IP address of the ARP entry.
:param mac: MAC address of the ARP entry.
:type info: str
:type intf: str
:type ip: str
:type mac: str
:returns: True if a matching entry is found, else False
:rtype: bool
"""

for line in info.splitlines():
if intf in line and ip in line and mac in line:
print("ARP Found:"+line)
return True
logger.debug("ARP not Found")
return False


# input - output from sh ip arp command
# output - state info list
def parse_neighbor(info, intf, ip, mac):
"""Parse neighbor list from vpp console and find a specific entry using the provided arguments.

:param info: Neighbor list from VPP console.
:param intf: VPP-internal name of the interface configured with this neighbor.
:param ip: IP address of the neighbor entry.
:param mac: MAC address of the neighbor entry.
:type info: str
:type intf: str
:type ip: str
:type mac: str
:returns: True if a matching entry is found, else False
:rtype: bool
"""

for line in info.splitlines():
if intf in line and ip in line and mac in line:
print("ARP Found:"+line)
print("Neighbor Found:"+line)
return True
print("ARP Found")
logger.debug("Neighbor not Found")
return False


Expand Down
19 changes: 17 additions & 2 deletions tests/robot/libraries/vpp_term.robot
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ vpp_term: Add Route
vpp_term: Show ARP
[Arguments] ${node}
[Documentation] Show ARPs through vpp terminal
${out}= vpp_term: Issue Command ${node} sh ip arp
${out}= vpp_term: Issue Command ${node} show ip arp
#OperatingSystem.Create File ${REPLY_DATA_FOLDER}/reply_arp.json ${out}
[Return] ${out}

Expand All @@ -289,10 +289,25 @@ vpp_term: Check ARP
[Documentation] Check ARPs presence on interface
${out}= vpp_term: Show ARP ${node}
${internal_name}= Get Interface Internal Name ${node} ${interface}
#Should Not Be Equal ${internal_name} ${None}
${status}= Run Keyword If '${internal_name}'!='${None}' Parse ARP ${out} ${internal_name} ${ipv4} ${MAC} ELSE Set Variable False
Should Be Equal As Strings ${status} ${presence}

vpp_term: Show IPv6 Neighbor
[Arguments] ${node}
[Documentation] Show Neighbbor list through vpp terminal
${out}= vpp_term: Issue Command ${node} show ip6 neighbors
#OperatingSystem.Create File ${REPLY_DATA_FOLDER}/reply_arp.json ${out}
[Return] ${out}

vpp_term: Check IPv6 Neighbor
[Arguments] ${node} ${interface} ${ip_address} ${mac_address} ${presence}
[Documentation] Check IPv6 neighbor presence on interface
${out}= vpp_term: Show IPv6 neighbor ${node}
${internal_name}= Get Interface Internal Name ${node} ${interface}
${status}= Run Keyword If '${internal_name}'!='${None}' Parse Neighbor ${out} ${internal_name} ${ip_address} ${mac_address} ELSE Set Variable False
Should Be Equal As Strings ${status} ${presence}


vpp_term: Set IPv6 neighbor
[Arguments] ${node} ${interface} ${ipv6} ${MAC}
[Documentation] Sets IPv6 neighbors
Expand Down
91 changes: 44 additions & 47 deletions tests/robot/suites/crudIPv6/arp_crudIPv6.robot
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
*** Settings ***
Library OperatingSystem
#Library RequestsLibrary
#Library SSHLibrary timeout=60s
#Library String

Resource ../../variables/${VARIABLES}_variables.robot

Expand Down Expand Up @@ -41,8 +38,8 @@ ${VXLAN_IP_SRC}= fd31::1:1:0:0:1
${VXLAN_IP_DST}= fd31::1:1:0:0:2
${LOOPBACK_IP}= fd32::1:1:0:0:1
${TAP_IP}= fd33::1:1:0:0:1
${ARP1_IP}= 155.155.155.155
${ARP2_IP}= 155.155.155.150
${ARP1_IP}= ab:cd:12:34::
${ARP2_IP}= ab:cd:12:35::
${ARP1_MAC}= 32:51:51:51:51:51
${ARP2_MAC}= 32:51:51:51:51:52
${ARP1_MAC_MODIFIED}= 32:51:51:51:51:53
Expand Down Expand Up @@ -138,58 +135,58 @@ Add ARPs

Check Memif ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP2_IP} ${ARP2_MAC} True

Check Veth1 ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP2_IP} ${ARP2_MAC} True

Check Veth2 ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP2_IP} ${ARP2_MAC} True

Check VXLan ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_vxlan1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_vxlan1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_vxlan1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_vxlan1
... ${ARP2_IP} ${ARP2_MAC} True

Check Loopback ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_loop1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_loop1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_loop1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_loop1
... ${ARP2_IP} ${ARP2_MAC} True

Check TAP ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_tap1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_tap1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_tap1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_tap1
... ${ARP2_IP} ${ARP2_MAC} True

Check Afpacket ARP
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_afpacket1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_afpacket1
... ${ARP1_IP} ${ARP1_MAC} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_afpacket1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_afpacket1
... ${ARP2_IP} ${ARP2_MAC} True

Modify ARPs
Expand All @@ -205,58 +202,58 @@ Modify ARPs

Check Memif ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP1_IP} ${ARP1_MAC} False

Check Veth1 ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} False

Check Veth2 ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP1_IP} ${ARP1_MAC} False

Check VXLan ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_vxlan1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_vxlan1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} False

Check Loopback ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_loop1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_loop1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} False

Check TAP ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_tap1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_tap1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} False

Check Afpacket ARP After Modify
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_afpacket1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_afpacket1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC} False

Delete ARPs
Expand All @@ -274,58 +271,58 @@ Delete ARPs

Check Memif ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_memif1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_memif1
... ${ARP2_IP} ${ARP2_MAC} False

Check Veth1 ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth1
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth1
... ${ARP1_IP} ${ARP2_MAC} False

Check Veth2 ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... linux: Check ARP agent_vpp_1 vpp1_veth2
... linux: Check IPv6 Neighbor agent_vpp_1 vpp1_veth2
... ${ARP1_IP} ${ARP2_MAC} False

Check VXLan ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_vxlan1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_vxlan1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_vxlan1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_vxlan1
... ${ARP2_IP} ${ARP2_MAC} False

Check Loopback ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_loop1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_loop1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_loop1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_loop1
... ${ARP2_IP} ${ARP2_MAC} False

Check TAP ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_tap1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_tap1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_tap1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_tap1
... ${ARP2_IP} ${ARP2_MAC} False

Check Afpacket ARP After Delete
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_afpacket1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_afpacket1
... ${ARP1_IP} ${ARP1_MAC_MODIFIED} True
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP}
... vpp_term: Check ARP agent_vpp_1 vpp1_afpacket1
... vpp_term: Check IPv6 Neighbor agent_vpp_1 vpp1_afpacket1
... ${ARP2_IP} ${ARP2_MAC} False


Expand Down