aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2016-11-11 12:51:01 +0100
committerJan Gelety <jgelety@cisco.com>2016-11-11 14:11:26 +0000
commitf05038a5ff02bc15e0bf8a85e50ae9e4ccc8177a (patch)
tree93537a13c272e4428f0a4c5e3697284c53d5c6d4
parentd66231fae814118def33c6e7b6fcc7b740aaba92 (diff)
CSIT-471: Fix check of DHCPv6 message types.
- use message typoe check for every DHCPv6 message - remove EXPECTED_FAILING tag from TC01: VPP proxies valid DHCPv6 request to DHCPv6 server Change-Id: Idf1d3feb0f445bb5b0acc03671344ca63acbf4f3 Signed-off-by: Jan Gelety <jgelety@cisco.com>
-rwxr-xr-xresources/traffic_scripts/dhcp/send_dhcp_v6_messages.py54
-rw-r--r--tests/func/dhcp/dhcp_v6_proxy.robot1
2 files changed, 42 insertions, 13 deletions
diff --git a/resources/traffic_scripts/dhcp/send_dhcp_v6_messages.py b/resources/traffic_scripts/dhcp/send_dhcp_v6_messages.py
index 50dec47bb8..09742565ee 100755
--- a/resources/traffic_scripts/dhcp/send_dhcp_v6_messages.py
+++ b/resources/traffic_scripts/dhcp/send_dhcp_v6_messages.py
@@ -30,6 +30,32 @@ def _check_udp_checksum(pkt):
return new['UDP'].chksum == pkt['UDP'].chksum
+def _get_dhcpv6_msgtype(msg_index):
+ """Return DHCPv6 message type string.
+
+ :param msg_index: Index of message type.
+ :return: Message type.
+ :type msg_index: int
+ :rtype msg_str: str
+ """
+ dhcp6_messages = {
+ 1: "SOLICIT",
+ 2: "ADVERTISE",
+ 3: "REQUEST",
+ 4: "CONFIRM",
+ 5: "RENEW",
+ 6: "REBIND",
+ 7: "REPLY",
+ 8: "RELEASE",
+ 9: "DECLINE",
+ 10: "RECONFIGURE",
+ 11: "INFORMATION-REQUEST",
+ 12: "RELAY-FORW",
+ 13: "RELAY-REPL"
+ }
+ return dhcp6_messages[msg_index]
+
+
def dhcpv6_solicit(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
server_ip, server_mac, client_duid, client_mac):
"""Send and check DHCPv6 SOLICIT proxy packet.
@@ -91,11 +117,12 @@ def dhcpv6_solicit(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
ether['IPv6'].dst, server_ip))
print "Destination IP address: OK."
- if ether['IPv6']['UDP']\
- ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)']:
- print "Relay Agent/Server Message: OK."
- else:
- raise RuntimeError("Relay Agent/Server Message error.")
+ msgtype = _get_dhcpv6_msgtype(ether['IPv6']['UDP']
+ ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].msgtype)
+ if msgtype != 'RELAY-FORW':
+ raise RuntimeError("Message type error: {} != RELAY-FORW".format(
+ msgtype))
+ print "Message type: OK."
linkaddr = ether['IPv6']['UDP']\
['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].linkaddr
@@ -168,7 +195,8 @@ def dhcpv6_advertise(rx_if, tx_if, link_local_ip, proxy_ip,
raise RuntimeError("Checksum error!")
print "Checksum: OK."
- msgtype = ether['IPv6']['UDP']['DHCPv6 Advertise Message'].msgtype
+ msgtype = _get_dhcpv6_msgtype(ether['IPv6']['UDP']
+ ['DHCPv6 Advertise Message'].msgtype)
if msgtype != 'ADVERTISE':
raise RuntimeError("Message type error: {} != ADVERTISE".format(
msgtype))
@@ -227,11 +255,12 @@ def dhcpv6_request(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
ether['IPv6'].dst, server_ip))
print "Destination IP address: OK."
- if ether['IPv6']['UDP']\
- ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)']:
- print "Relay Agent/Server Message: OK."
- else:
- raise RuntimeError("Relay Agent/Server Message error.")
+ msgtype = _get_dhcpv6_msgtype(ether['IPv6']['UDP']
+ ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].msgtype)
+ if msgtype != 'RELAY-FORW':
+ raise RuntimeError("Message type error: {} != RELAY-FORW".format(
+ msgtype))
+ print "Message type: OK."
linkaddr = ether['IPv6']['UDP']\
['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].linkaddr
@@ -293,7 +322,8 @@ def dhcpv6_reply(rx_if, tx_if, link_local_ip, proxy_ip, server_ip, server_mac,
raise RuntimeError("Checksum error!")
print "Checksum: OK."
- msgtype = ether['IPv6']['UDP']['DHCPv6 Reply Message'].msgtype
+ msgtype = _get_dhcpv6_msgtype(ether['IPv6']['UDP']
+ ['DHCPv6 Reply Message'].msgtype)
if msgtype != 'REPLY':
raise RuntimeError("Message type error: {} != REPLY".format(msgtype))
print "Message type: OK."
diff --git a/tests/func/dhcp/dhcp_v6_proxy.robot b/tests/func/dhcp/dhcp_v6_proxy.robot
index 850b685e88..eeaf796a28 100644
--- a/tests/func/dhcp/dhcp_v6_proxy.robot
+++ b/tests/func/dhcp/dhcp_v6_proxy.robot
@@ -47,7 +47,6 @@
| | ... | server through DHCP proxy.
| | ... | [Ref] RFC 3315
| | ...
-| | [Tags] | EXPECTED_FAILING
| | Given Path for 2-node testing is set
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
| | And Interfaces in 2-node path are up