Skip to content

Commit

Permalink
Merge pull request #3331 from anarkiwi/coprotable
Browse files Browse the repository at this point in the history
copro table should miss to destination not source.
  • Loading branch information
anarkiwi authored Nov 5, 2019
2 parents 4b2732f + f149d5f commit 70d8368
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions faucet/faucet_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ def _fib_table(ipv, table_id):
VLAN_DEFAULT_CONFIG.table_id + 1,
match_types=(('in_port', False), ('eth_type', False), ('vlan_vid', False)),
vlan_port_scale=1.5,
miss_goto='eth_src',
next_tables=(('eth_src',) + _NEXT_VIP),
miss_goto='eth_dst',
next_tables=(('eth_dst',)),
)
VLAN_ACL_DEFAULT_CONFIG = ValveTableConfig(
'vlan_acl',
Expand Down
24 changes: 22 additions & 2 deletions tests/unit/faucet/test_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.


import copy
import unittest
from ryu.lib import mac
from ryu.lib.packet import slow
Expand Down Expand Up @@ -82,17 +83,36 @@ class ValveCoprocessorTestCase(ValveTestBases.ValveTestSmall):
p2:
number: 2
native_vlan: 0x100
p3:
number: 3
native_vlan: 0x100
""" % DP1_CONFIG

def setUp(self):
self.setup_valve(self.CONFIG)

def test_output(self):
copro_vid_out = 102 | ofp.OFPVID_PRESENT
match = {
direct_match = {
'in_port': 1, 'vlan_vid': copro_vid_out, 'eth_type': ether.ETH_TYPE_IP,
'eth_src': self.P1_V100_MAC, 'eth_dst': mac.BROADCAST_STR}
self.assertTrue(self.table.is_output(match, port=2))
self.assertTrue(self.table.is_output(direct_match, port=2))
p2_host_match = {
'eth_src': self.P1_V100_MAC, 'eth_dst': self.P2_V200_MAC,
'ipv4_src': '10.0.0.2', 'ipv4_dst': '10.0.0.3',
'eth_type': ether.ETH_TYPE_IP}
p2_host_receive = copy.deepcopy(p2_host_match)
p2_host_receive.update({'in_port': 2})
# learn P2 host
self.rcv_packet(2, 0x100, p2_host_receive)
# copro can send to P2 via regular pipeline
p2_copro_host_receive = copy.deepcopy(p2_host_match)
p2_copro_host_receive.update(
{'in_port': 1, 'eth_src': p2_host_match['eth_dst'], 'eth_dst': p2_host_match['eth_src']})
p2_copro_host_receive['vlan_vid'] = 0x100 | ofp.OFPVID_PRESENT
self.assertTrue(self.table.is_output(p2_copro_host_receive, port=2, vid=0x100))
# copro send to P2 was not flooded
self.assertFalse(self.table.is_output(p2_copro_host_receive, port=3, vid=0x100))


class ValveRestBcastTestCase(ValveTestBases.ValveTestSmall):
Expand Down

0 comments on commit 70d8368

Please sign in to comment.