| 1 |  |  | """ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |     Test tracing.trace_entries | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | """ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 | 1 |  | import pytest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 | 1 |  | from napps.amlight.sdntrace.tracing.trace_entries import TraceEntries | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 | 1 |  | class TestDpid: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |     """Test all combinations for DPID""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 | 1 |  |     def test_incorrect_dpid_int(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         """DPID cannot be integer""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 | 1 |  |             self.trace_entries.dpid = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 1 |  |     def test_incorrect_dpid_empty_str(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         """DPID cannot be an empty str""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 1 |  |             self.trace_entries.dpid = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 1 |  |     def test_incorrect_dpid_invalid_characters_plus(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         """DPID cannot be a special character (only ':' is allowed)""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 | 1 |  |             self.trace_entries.dpid = "+" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 1 |  |     def test_incorrect_dpid_invalid_characters_comma(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         """DPID cannot be a special character (only ':' is allowed)""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 1 |  |             self.trace_entries.dpid = "," | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 1 |  |     def test_incorrect_dpid_invalid_length(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         """DPID cannot be longer than 16 without ':'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 | 1 |  |             self.trace_entries.dpid = "00000000000000001" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 1 |  |     def test_correct_dpid_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         """Correct DPID with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 1 |  |         self.trace_entries.dpid = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 | 1 |  |     def test_read_dpid_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 | 1 |  |         self.test_correct_dpid_char() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 | 1 |  |         assert self.trace_entries.dpid == "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 1 |  |     def test_correct_dpid_complete(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         """Correct DPID with colons, numbers, and letters""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 1 |  |         self.trace_entries.dpid = "ab:cd:ef:ab:cd:ef:00:01" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 1 |  |     def test_read_dpid_complete(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 1 |  |         self.test_correct_dpid_complete() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 1 |  |         assert self.trace_entries.dpid == "ab:cd:ef:ab:cd:ef:00:01" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 1 |  | class TestInPort: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     """Test all combinations for IN_PORT""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 1 |  |     def test_incorrect_in_port_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         """IN_PORT cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 1 |  |             self.trace_entries.in_port = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 | 1 |  |     def test_incorrect_in_port_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         """IN_PORT cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 1 |  |             self.trace_entries.in_port = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 1 |  |     def test_correct_in_port(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         """IN_PORT Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 1 |  |         self.trace_entries.in_port = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 | 1 |  |     def test_read_in_port(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 | 1 |  |         self.test_correct_in_port() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 1 |  |         assert self.trace_entries.in_port == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 1 |  | class TestDlSrc: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     """Test all combinations for DL_SRC""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 1 |  |     def test_incorrect_dl_src_int(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         """dl_src cannot be integer""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 | 1 |  |             self.trace_entries.dl_src = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 | 1 |  |     def test_incorrect_dl_src_empty_str(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         """dl_src cannot be an empty str""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 | 1 |  |             self.trace_entries.dl_src = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 1 |  |     def test_incorrect_dl_src_invalid_characters_plus(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         """dl_src only accepts ':' snd '-'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 1 |  |             self.trace_entries.dl_src = "+" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 | 1 |  |     def test_incorrect_dl_src_invalid_characters_comma(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         """dl_src cannot be a special character (only ':' is allowed)""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 | 1 |  |             self.trace_entries.dl_src = "," | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 1 |  |     def test_incorrect_dl_src_invalid_length(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         """dl_src cannot be longer than 16 without ':'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 | 1 |  |             self.trace_entries.dl_src = "000000000000000001" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 | 1 |  |     def test_correct_dl_src_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         """Correct dl_src with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 1 |  |         self.trace_entries.dl_src = "ab:cd:ef:ab:cd:00" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 | 1 |  |     def test_read_dl_src_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         """Read dl_src '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 | 1 |  |         self.test_correct_dl_src_char() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 | 1 |  |         assert self.trace_entries.dl_src == "ab:cd:ef:ab:cd:00" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 | 1 |  | class TestDlDst: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     """Test all combinations for DL_DST""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 | 1 |  |     def test_incorrect_dl_dst_int(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |         """dl_dst cannot be integer""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 | 1 |  |             self.trace_entries.dl_dst = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 | 1 |  |     def test_incorrect_dl_dst_empty_str(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |         """dl_dst cannot be an empty str""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 | 1 |  |             self.trace_entries.dl_dst = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 | 1 |  |     def test_incorrect_dl_dst_invalid_characters_plus(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         """dl_dst only accepts ':' snd '-'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 | 1 |  |             self.trace_entries.dl_dst = "+" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 | 1 |  |     def test_incorrect_dl_dst_invalid_characters_comma(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         """dl_dst cannot be a special character (only ':' is allowed)""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 1 |  |             self.trace_entries.dl_dst = "," | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 1 |  |     def test_incorrect_dl_dst_invalid_length(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         """dl_dst cannot be longer than 16 without ':'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 | 1 |  |             self.trace_entries.dl_dst = "000000000000000001" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 | 1 |  |     def test_correct_dl_dst_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         """Correct dl_dst with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 | 1 |  |         self.trace_entries.dl_dst = "ab:cd:ef:ab:cd:00" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 1 |  |     def test_read_dl_dst_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |         """Read dl_dst '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 | 1 |  |         self.test_correct_dl_dst_char() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 | 1 |  |         assert self.trace_entries.dl_dst == "ab:cd:ef:ab:cd:00" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 | 1 |  | class TestDlVlan: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     """Test all combinations for DL_VLAN""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 | 1 |  |     def test_incorrect_dl_vlan_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         """dl_vlan cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 | 1 |  |             self.trace_entries.dl_vlan = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 | 1 |  |     def test_incorrect_dl_vlan_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         """dl_vlan cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 | 1 |  |             self.trace_entries.dl_vlan = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 1 |  |     def test_incorrect_dl_vlan_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         """dl_vlan cannot be bigger than 4095""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 | 1 |  |             self.trace_entries.dl_vlan = 4096 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 | 1 |  |     def test_correct_dl_vlan(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         """dl_vlan Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 | 1 |  |         self.trace_entries.dl_vlan = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 | 1 |  |     def test_read_dl_vlan(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 | 1 |  |         self.test_correct_dl_vlan() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 1 |  |         assert self.trace_entries.dl_vlan == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 | 1 |  | class TestDlType: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     """Test all combinations for dl_type""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 | 1 |  |     def test_incorrect_dl_type_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         """dl_type cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 | 1 |  |             self.trace_entries.dl_type = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 | 1 |  |     def test_incorrect_dl_type_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         """dl_type cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 | 1 |  |             self.trace_entries.dl_type = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 | 1 |  |     def test_incorrect_dl_type_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         """dl_type cannot be bigger than 4095""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 1 |  |             self.trace_entries.dl_type = 65536 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 1 |  |     def test_correct_dl_type(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |         """dl_type Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 | 1 |  |         self.trace_entries.dl_type = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 | 1 |  |     def test_read_dl_type(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 1 |  |         self.test_correct_dl_type() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 | 1 |  |         assert self.trace_entries.dl_type == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 | 1 |  | class TestDlVlanPcp: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |     """Test all combinations for dl_vlan_pcp""" | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 237 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 238 | 1 |  |     def setup_method(self): | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  |         """Set up before each test method""" | 
            
                                                                        
                            
            
                                    
            
            
                | 240 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 | 1 |  |     def test_incorrect_dl_vlan_pcp_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         """dl_vlan_pcp cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 1 |  |             self.trace_entries.dl_vlan_pcp = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 | 1 |  |     def test_incorrect_dl_vlan_pcp_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |         """dl_vlan_pcp cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 1 |  |             self.trace_entries.dl_vlan_pcp = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 | 1 |  |     def test_incorrect_dl_vlan_pcp_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         """dl_vlan_pcp cannot be bigger than 7""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 | 1 |  |             self.trace_entries.dl_vlan_pcp = 8 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 | 1 |  |     def test_correct_dl_vlan_pcp(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         """dl_vlan_pcp Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 | 1 |  |         self.trace_entries.dl_vlan_pcp = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 | 1 |  |     def test_read_dl_vlan_pcp(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 1 |  |         self.test_correct_dl_vlan_pcp() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 | 1 |  |         assert self.trace_entries.dl_vlan_pcp == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 | 1 |  | class TestNwTos: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |     """Test all combinations for nw_tos""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 | 1 |  |     def test_incorrect_nw_tos_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |         """nw_tos cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 1 |  |             self.trace_entries.nw_tos = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 | 1 |  |     def test_incorrect_nw_tos_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         """nw_tos cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 | 1 |  |             self.trace_entries.nw_tos = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 | 1 |  |     def test_incorrect_nw_tos_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         """nw_tos cannot be bigger than 7""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 | 1 |  |             self.trace_entries.nw_tos = 8 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 | 1 |  |     def test_correct_nw_tos(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         """nw_tos Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 | 1 |  |         self.trace_entries.nw_tos = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 | 1 |  |     def test_read_nw_tos(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 | 1 |  |         self.test_correct_nw_tos() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 | 1 |  |         assert self.trace_entries.nw_tos == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 1 |  | class TestNwSrc: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     """Test all combinations for NW_SRC""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 | 1 |  |     def test_incorrect_nw_src_int(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |         """nw_src cannot be integer""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 | 1 |  |             self.trace_entries.nw_src = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 | 1 |  |     def test_incorrect_nw_src_empty_str(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |         """nw_src cannot be an empty str""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 | 1 |  |             self.trace_entries.nw_src = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 | 1 |  |     def test_incorrect_nw_src_invalid_characters_plus(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         """nw_src only accepts '.'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 | 1 |  |             self.trace_entries.nw_src = "+" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 | 1 |  |     def test_incorrect_nw_src_256(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         """Correct nw_src with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 | 1 |  |             self.trace_entries.nw_src = "0.0.0.256" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 | 1 |  |     def test_correct_nw_src_zeroed(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |         """Correct nw_src with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 | 1 |  |         self.trace_entries.nw_src = "0.0.0.0" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 | 1 |  |     def test_read_nw_src_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |         """Read nw_src '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 | 1 |  |         self.test_correct_nw_src_zeroed() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 | 1 |  |         assert self.trace_entries.nw_src == "0.0.0.0" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 | 1 |  |     def test_correct_nw_src_255(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         """Correct nw_src with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 | 1 |  |         self.trace_entries.nw_src = "255.255.255.255" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 | 1 |  |     def test_read_nw_src_char_255(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |         """Read nw_src '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 | 1 |  |         self.test_correct_nw_src_255() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 | 1 |  |         assert self.trace_entries.nw_src == "255.255.255.255" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 | 1 |  | class TestNwDst: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     """Test all combinations for NW_DST""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 | 1 |  |     def test_incorrect_nw_dst_int(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |         """nw_dst cannot be integer""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 | 1 |  |             self.trace_entries.nw_dst = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 | 1 |  |     def test_incorrect_nw_dst_empty_str(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |         """nw_dst cannot be an empty str""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 | 1 |  |             self.trace_entries.nw_dst = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 | 1 |  |     def test_incorrect_nw_dst_invalid_characters_plus(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         """nw_dst only accepts '.'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 | 1 |  |             self.trace_entries.nw_dst = "+" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 | 1 |  |     def test_incorrect_nw_dst_256(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         """Correct nw_dst with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 | 1 |  |             self.trace_entries.nw_dst = "0.0.0.256" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 | 1 |  |     def test_correct_nw_dst_zeroed(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |         """Correct nw_dst with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 | 1 |  |         self.trace_entries.nw_dst = "0.0.0.0" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 | 1 |  |     def test_read_nw_dst_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         """Read nw_dst '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 | 1 |  |         self.test_correct_nw_dst_zeroed() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 | 1 |  |         assert self.trace_entries.nw_dst == "0.0.0.0" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 | 1 |  |     def test_correct_nw_dst_255(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |         """Correct nw_dst with char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 | 1 |  |         self.trace_entries.nw_dst = "255.255.255.255" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 | 1 |  |     def test_read_nw_dst_char_255(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         """Read nw_dst '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 | 1 |  |         self.test_correct_nw_dst_255() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 | 1 |  |         assert self.trace_entries.nw_dst == "255.255.255.255" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 | 1 |  | class TestTpSrc: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |     """Test all combinations for tp_src""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 | 1 |  |     def test_incorrect_tp_src_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |         """tp_src cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 | 1 |  |             self.trace_entries.tp_src = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 | 1 |  |     def test_incorrect_tp_src_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |         """tp_src cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 | 1 |  |             self.trace_entries.tp_src = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 | 1 |  |     def test_incorrect_tp_src_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         """tp_src cannot be bigger than 4095""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 | 1 |  |             self.trace_entries.tp_src = 65536 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 | 1 |  |     def test_correct_tp_src(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         """tp_src Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 | 1 |  |         self.trace_entries.tp_src = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 | 1 |  |     def test_read_tp_src(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 | 1 |  |         self.test_correct_tp_src() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 | 1 |  |         assert self.trace_entries.tp_src == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 | 1 |  | class TestTpDst: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |     """Test all combinations for tp_dst""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 | 1 |  |     def test_incorrect_tp_dst_char(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |         """tp_dst cannot be a char""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 | 1 |  |             self.trace_entries.tp_dst = "1" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 | 1 |  |     def test_incorrect_tp_dst_negative(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         """tp_dst cannot be negative""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 | 1 |  |             self.trace_entries.tp_dst = -1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 | 1 |  |     def test_incorrect_tp_dst_too_big(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |         """tp_dst cannot be bigger than 4095""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 | 1 |  |             self.trace_entries.tp_dst = 65536 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 | 1 |  |     def test_correct_tp_dst(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |         """tp_dst Correct""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 | 1 |  |         self.trace_entries.tp_dst = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 | 1 |  |     def test_read_tp_dst(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |         """Read DPID '1'""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 | 1 |  |         self.test_correct_tp_dst() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 | 1 |  |         assert self.trace_entries.tp_dst == 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 | 1 |  | class TestLoadEntries: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |     """Now, load all entries at once""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 | 1 |  |     def setup_method(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |         """Set up before each test method""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 | 1 |  |         self.trace_entries = TraceEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 | 1 |  |     def test_missing_trace(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |         """key trace is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 | 1 |  |             entries = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 | 1 |  |     def test_trace_non_dict(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |         """key trace has to be a dict""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 | 1 |  |             entries = {"trace:": 0} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 | 1 |  |     def test_missing_switch(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         """key trace/switch is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 | 1 |  |             entries = {"trace": {}} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 | 1 |  |     def test_missing_dpid(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |         """key trace/switch is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 | 1 |  |             dpid = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 | 1 |  |             switch = {"switch": dpid} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 | 1 |  |             entries = {"trace": switch} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 | 1 |  |     def test_missing_in_port(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |         """key trace/switch is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 | 1 |  |             dpid = {"dpid": "a"} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 | 1 |  |             switch = {"switch": dpid} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 | 1 |  |             entries = {"trace": switch} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 | 1 |  |     def test_invalid_eth(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |         """key trace/switch is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 | 1 |  |         with pytest.raises(ValueError): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 | 1 |  |             eth = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 | 1 |  |             dpid = {"dpid": "a", "in_port": 1} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 | 1 |  |             switch = {"switch": dpid, "eth": eth} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 | 1 |  |             entries = {"trace": switch} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 | 1 |  |             self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 | 1 |  |     def test_default_eth(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         """Test default eth""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 | 1 |  |         dpid = {"dpid": "a", "in_port": 1} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 | 1 |  |         switch = {"switch": dpid} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 | 1 |  |         entries = {"trace": switch} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 | 1 |  |         self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 | 1 |  |         assert not self.trace_entries.dl_vlan | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 | 1 |  |     def test_minimally_correct(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |         """key trace/switch is mandatory""" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 | 1 |  |         eth = {"dl_vlan": 100} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 | 1 |  |         dpid = {"dpid": "a", "in_port": 1} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 | 1 |  |         switch = {"switch": dpid, "eth": eth} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 | 1 |  |         entries = {"trace": switch} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 | 1 |  |         self.trace_entries.load_entries(entries) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 | 1 |  |         assert self.trace_entries.dl_vlan == eth["dl_vlan"] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 | 1 |  |         assert self.trace_entries.dpid == dpid["dpid"] | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 522 |  |  |         assert self.trace_entries.in_port == dpid["in_port"] | 
            
                                                        
            
                                    
            
            
                | 523 |  |  |  |