Skip to content

Commit

Permalink
Fix/span test for sonic (floodlight#15)
Browse files Browse the repository at this point in the history
* Replace fixed port number with variable
  • Loading branch information
charleschou56 authored Feb 14, 2020
1 parent 83d59c2 commit aac7893
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 10 additions & 10 deletions mars/span_test.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class SetAndGetTest(SPANTest):

def runTest(self):
session_id = 1
source_port = 46
target_port = 48
source_port = cfg.leaf0['port46'].number
target_port = cfg.leaf0['port48'].number
direction = 'both'

span = (
Expand Down Expand Up @@ -137,8 +137,8 @@ def runTest(self):
ports = sorted(config["port_map"].keys())

session_id = 1
source_port = 46
target_port = 48
source_port = cfg.leaf0['port46'].number
target_port = cfg.leaf0['port48'].number

for direction in ['rx', 'both']:
span = (
Expand Down Expand Up @@ -194,8 +194,8 @@ def runTest(self):
)

session_id = 1
source_port = 48
target_port = 46
source_port = cfg.leaf0['port48'].number
target_port = cfg.leaf0['port46'].number

for direction in ['tx', 'both']:
span = (
Expand Down Expand Up @@ -252,8 +252,8 @@ def runTest(self):
ports = sorted(config["port_map"].keys())

session_id = 1
source_port = 46
target_port = 46
source_port = cfg.leaf0['port46'].number
target_port = cfg.leaf1['port46'].number
direction = 'rx'

for direction in ['rx', 'both']:
Expand Down Expand Up @@ -310,8 +310,8 @@ def runTest(self):
)

session_id = 1
source_port = 48
target_port = 46
source_port = cfg.leaf1['port48'].number
target_port = cfg.leaf0['port46'].number

for direction in ['tx', 'both']:
span = (
Expand Down
8 changes: 8 additions & 0 deletions mars/utils.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,14 @@ def name(self):
return "{}/{}".format(port_str, tagged_str)
else:
return "{}/{}".format(self._port_id, tagged_str)
@property
def number(self):
if self._nos == 'aos':
return self._port_id
elif self._nos == 'sonic':
return self._port_id - 1
else:
return self._port_id

class PolicyRoute():

Expand Down

0 comments on commit aac7893

Please sign in to comment.