| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """Test Match abstraction for v0x04.""" |
||
| 2 | import unittest |
||
| 3 | |||
| 4 | from napps.kytos.of_core.v0x04.flow import Match |
||
| 5 | from napps.kytos.of_core.v0x04.match_fields import MatchDLVLAN |
||
| 6 | |||
| 7 | |||
| 8 | class TestMatch(unittest.TestCase): |
||
| 9 | """Tests for the Match class.""" |
||
| 10 | |||
| 11 | def test_dl_vlan_dict(self): |
||
| 12 | """Convert from JSON dict to OF Match.""" |
||
| 13 | match_dict = {'dl_vlan': 42} |
||
| 14 | match = Match.from_dict(match_dict) |
||
| 15 | self.assertEqual(42, match.dl_vlan) |
||
| 16 | |||
| 17 | def test_dl_vlan_pyof(self): |
||
| 18 | """Convert to and from pyof OxmTLV.""" |
||
| 19 | expected = MatchDLVLAN(42) |
||
| 20 | of_tlv = expected.as_of_tlv() |
||
| 21 | actual = MatchDLVLAN.from_of_tlv(of_tlv) |
||
| 22 | self.assertEqual(expected, actual) |
||
| 23 |