summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-12-01 14:07:27 +0200
committerimarom <imarom@cisco.com>2016-12-01 14:07:27 +0200
commitc420d1fd8c17118f2ccaee4b05b81ec3dd515fa6 (patch)
treef8a345a69c3e96a1c0b183720e343f3ed821843b /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
parente5ee9a836a1ec8e4f3d7bf36b821f593c2e4c5b6 (diff)
refactor RX core
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py33
1 files changed, 14 insertions, 19 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 42b7b89b..9b955465 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
@@ -825,37 +825,32 @@ class Port(object):
else:
info['is_virtual'] = 'N/A'
- if 'speed' in attr:
- info['speed'] = self.get_formatted_speed()
- else:
- info['speed'] = 'N/A'
-
+ # speed
+ info['speed'] = self.get_formatted_speed()
- if 'rx_filter_mode' in attr:
- info['rx_filter_mode'] = 'hardware match' if attr['rx_filter_mode'] == 'hw' else 'fetch all'
- else:
- info['rx_filter_mode'] = 'N/A'
+ # RX filter mode
+ info['rx_filter_mode'] = 'hardware match' if attr['rx_filter_mode'] == 'hw' else 'fetch all'
# src MAC and IPv4
- info['src_mac'] = attr.get('src_mac', 'N/A')
-
- info['src_ipv4'] = attr.get('src_ipv4', 'N/A')
+ info['src_mac'] = attr['src_mac']
+ info['src_ipv4'] = attr['src_ipv4']
+
if info['src_ipv4'] is None:
info['src_ipv4'] = 'Not Configured'
# dest
dest = attr['dest']
if dest['type'] == 'mac':
- info['dest'] = dest['mac']
- info['arp'] = '-'
+ info['dest'] = dest['mac']
+ info['arp'] = '-'
elif dest['type'] == 'ipv4':
- info['dest'] = dest['ipv4']
- info['arp'] = dest['arp']
+ info['dest'] = dest['ipv4']
+ info['arp'] = dest['arp']
elif dest['type'] == 'ipv4_u':
- info['dest'] = dest['ipv4']
- info['arp'] = 'unresolved'
+ info['dest'] = dest['ipv4']
+ info['arp'] = 'unresolved'
# RX info
@@ -900,7 +895,7 @@ class Port(object):
assert(0)
- # return True if the port is resolved
+ # port is considered resolved if it's dest is either MAC or resolved IPv4
def is_resolved (self):
return (self.get_dst_addr()['mac'] is not None)