DHCPv6 messages - increase log info 61/3761/3
authorJan Gelety <jgelety@cisco.com>
Thu, 10 Nov 2016 13:07:44 +0000 (14:07 +0100)
committerJan Gelety <jgelety@cisco.com>
Thu, 10 Nov 2016 14:15:39 +0000 (14:15 +0000)
- log content of variable in case it doesn't match expected value

Change-Id: Ie0718923b347589a85897c6bc7b4f252b724f083
Signed-off-by: Jan Gelety <jgelety@cisco.com>
resources/traffic_scripts/dhcp/send_dhcp_v6_messages.py

index 21357ad..50dec47 100755 (executable)
@@ -77,15 +77,18 @@ def dhcpv6_solicit(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
         raise RuntimeError('DHCPv6 SOLICIT timeout')
 
     if ether.dst != server_mac:
         raise RuntimeError('DHCPv6 SOLICIT timeout')
 
     if ether.dst != server_mac:
-        raise RuntimeError("Destination MAC address error!")
+        raise RuntimeError("Destination MAC address error: {} != {}".format(
+            ether.dst, server_mac))
     print "Destination MAC address: OK."
 
     if ether['IPv6'].src != proxy_ip:
     print "Destination MAC address: OK."
 
     if ether['IPv6'].src != proxy_ip:
-        raise RuntimeError("Source IP address error!")
+        raise RuntimeError("Source IP address error: {} != {}".format(
+            ether['IPv6'].src, proxy_ip))
     print "Source IP address: OK."
 
     if ether['IPv6'].dst != server_ip:
     print "Source IP address: OK."
 
     if ether['IPv6'].dst != server_ip:
-        raise RuntimeError("Destination IP address error!")
+        raise RuntimeError("Destination IP address error: {} != {}".format(
+            ether['IPv6'].dst, server_ip))
     print "Destination IP address: OK."
 
     if ether['IPv6']['UDP']\
     print "Destination IP address: OK."
 
     if ether['IPv6']['UDP']\
@@ -94,10 +97,11 @@ def dhcpv6_solicit(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
     else:
         raise RuntimeError("Relay Agent/Server Message error.")
 
     else:
         raise RuntimeError("Relay Agent/Server Message error.")
 
-    if ether['IPv6']['UDP']\
-        ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)']\
-        .linkaddr != proxy_ip:
-        raise RuntimeError("Proxy IP address error!")
+    linkaddr = ether['IPv6']['UDP']\
+        ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].linkaddr
+    if linkaddr != proxy_ip:
+        raise RuntimeError("Proxy IP address error: {} != {}".format(
+           linkaddr, proxy_ip))
     print "Proxy IP address: OK."
 
     try:
     print "Proxy IP address: OK."
 
     try:
@@ -156,15 +160,18 @@ def dhcpv6_advertise(rx_if, tx_if, link_local_ip, proxy_ip,
         raise RuntimeError('DHCPv6 ADVERTISE timeout')
 
     if ether['IPv6'].src != proxy_ip:
         raise RuntimeError('DHCPv6 ADVERTISE timeout')
 
     if ether['IPv6'].src != proxy_ip:
-        raise RuntimeError("Source IP address error!")
+        raise RuntimeError("Source IP address error: {} != {}".format(
+            ether['IPv6'].src, proxy_ip))
     print "Source IP address: OK."
 
     if not _check_udp_checksum(ether['IPv6']):
         raise RuntimeError("Checksum error!")
     print "Checksum: OK."
 
     print "Source IP address: OK."
 
     if not _check_udp_checksum(ether['IPv6']):
         raise RuntimeError("Checksum error!")
     print "Checksum: OK."
 
-    if ether['IPv6']['UDP']['DHCPv6 Advertise Message'].msgtype != 'ADVERTISE':
-        raise RuntimeError("Message type error!")
+    msgtype = ether['IPv6']['UDP']['DHCPv6 Advertise Message'].msgtype
+    if msgtype != 'ADVERTISE':
+        raise RuntimeError("Message type error: {} != ADVERTISE".format(
+            msgtype))
     print "Message type: OK."
 
 
     print "Message type: OK."
 
 
@@ -211,11 +218,13 @@ def dhcpv6_request(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
         raise RuntimeError('DHCPv6 REQUEST timeout')
 
     if ether['IPv6'].src != proxy_ip:
         raise RuntimeError('DHCPv6 REQUEST timeout')
 
     if ether['IPv6'].src != proxy_ip:
-        raise RuntimeError("Source IP address error!")
+        raise RuntimeError("Source IP address error: {} != {}".format(
+            ether['IPv6'].src, proxy_ip))
     print "Source IP address: OK."
 
     if ether['IPv6'].dst != server_ip:
     print "Source IP address: OK."
 
     if ether['IPv6'].dst != server_ip:
-        raise RuntimeError("Destination IP address error!")
+        raise RuntimeError("Destination IP address error: {} != {}".format(
+            ether['IPv6'].dst, server_ip))
     print "Destination IP address: OK."
 
     if ether['IPv6']['UDP']\
     print "Destination IP address: OK."
 
     if ether['IPv6']['UDP']\
@@ -224,10 +233,11 @@ def dhcpv6_request(tx_if, rx_if, dhcp_multicast_ip, link_local_ip, proxy_ip,
     else:
         raise RuntimeError("Relay Agent/Server Message error.")
 
     else:
         raise RuntimeError("Relay Agent/Server Message error.")
 
-    if ether['IPv6']['UDP']\
-            ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)']\
-            .linkaddr != proxy_ip:
-        raise RuntimeError("Proxy IP address error!")
+    linkaddr = ether['IPv6']['UDP']\
+        ['DHCPv6 Relay Forward Message (Relay Agent/Server Message)'].linkaddr
+    if linkaddr != proxy_ip:
+        raise RuntimeError("Proxy IP address error: {} != {}".format(
+           linkaddr, proxy_ip))
     print "Proxy IP address: OK."
 
 
     print "Proxy IP address: OK."
 
 
@@ -275,15 +285,17 @@ def dhcpv6_reply(rx_if, tx_if, link_local_ip, proxy_ip, server_ip, server_mac,
         raise RuntimeError('DHCPv6 REPLY timeout')
 
     if ether['IPv6'].src != proxy_ip:
         raise RuntimeError('DHCPv6 REPLY timeout')
 
     if ether['IPv6'].src != proxy_ip:
-        raise RuntimeError("Source IP address error!")
+        raise RuntimeError("Source IP address error: {} != {}".format(
+            ether['IPv6'].src, proxy_ip))
     print "Source IP address: OK."
 
     if not _check_udp_checksum(ether['IPv6']):
         raise RuntimeError("Checksum error!")
     print "Checksum: OK."
 
     print "Source IP address: OK."
 
     if not _check_udp_checksum(ether['IPv6']):
         raise RuntimeError("Checksum error!")
     print "Checksum: OK."
 
-    if ether['IPv6']['UDP']['DHCPv6 Reply Message'].msgtype != 'REPLY':
-        raise RuntimeError("Message type error!")
+    msgtype = ether['IPv6']['UDP']['DHCPv6 Reply Message'].msgtype
+    if msgtype != 'REPLY':
+        raise RuntimeError("Message type error: {} != REPLY".format(msgtype))
     print "Message type: OK."
 
 
     print "Message type: OK."