From fc35e10dc4acd5149b465b8f1959aae941ff198e Mon Sep 17 00:00:00 2001 From: imarom Date: Tue, 22 Nov 2016 19:32:30 +0200 Subject: RX features - removed 'none' and used Json::nullValue Signed-off-by: imarom --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 13 ++++--------- src/trex_port_attr.cpp | 2 +- src/trex_port_attr.h | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index aeff64de..d225c31c 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -847,7 +847,7 @@ class Port(object): info['src_mac'] = attr.get('src_mac', 'N/A') info['src_ipv4'] = attr.get('src_ipv4', 'N/A') - if info['src_ipv4'] == 'none': + if info['src_ipv4'] is None: info['src_ipv4'] = 'Not Configured' # dest @@ -860,11 +860,11 @@ class Port(object): info['arp'] = dest.get('arp', 'N/A') - if info['dest'] == 'none': + if info['dest'] is None: info['dest'] = 'Not Configured' - if info['arp'] == 'none': + if info['arp'] is None: info['arp'] = 'unresolved' @@ -896,10 +896,7 @@ class Port(object): def get_src_addr (self): src_mac = self.__attr['src_mac'] - src_ipv4 = self.__attr['src_ipv4'] - if src_ipv4 == 'none': - src_ipv4 = None return {'mac': src_mac, 'ipv4': src_ipv4} @@ -915,8 +912,6 @@ class Port(object): elif dest['type'] == 'ipv4': dst_ipv4 = dest['addr'] dst_mac = dest['arp'] - if dst_mac == 'none': - dst_mac = None else: assert(0) @@ -1272,7 +1267,7 @@ class PingResolver(Resolver): return self.port.err('Ping - port does not have an IPv4 address configured') if dst['mac'] is None: - return self.port.err('Ping - port is not ARP resolved') + return self.port.err('Ping - port has an unresolved destination, cannot determine next hop MAC address') if self.ping_ip == src['ipv4']: return self.port.err('Ping - cannot ping own IP') diff --git a/src/trex_port_attr.cpp b/src/trex_port_attr.cpp index 26199e33..20b441e2 100644 --- a/src/trex_port_attr.cpp +++ b/src/trex_port_attr.cpp @@ -57,7 +57,7 @@ TRexPortAttr::to_json(Json::Value &output) { if (get_src_ipv4() != 0) { output["src_ipv4"] = utl_uint32_to_ipv4(get_src_ipv4()); } else { - output["src_ipv4"] = "none"; + output["src_ipv4"] = Json::nullValue; } diff --git a/src/trex_port_attr.h b/src/trex_port_attr.h index eb7c85de..95050d1b 100755 --- a/src/trex_port_attr.h +++ b/src/trex_port_attr.h @@ -126,7 +126,7 @@ public: if (is_resolved()) { output["arp"] = utl_macaddr_to_str(m_mac); } else { - output["arp"] = "none"; + output["arp"] = Json::nullValue; } break; -- cgit 1.2.3-korg