@@ 1850-1913 (lines=64) @@ | ||
1847 | result = EVCDeploy.check_list_traces([evc]) |
|
1848 | assert result[evc.id] is True |
|
1849 | ||
1850 | @patch("napps.kytos.mef_eline.models.evc.log") |
|
1851 | @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces") |
|
1852 | def test_check_list_traces_untagged_cases(self, bulk_sdntraces_mock, _): |
|
1853 | """Test check_list_traces method.""" |
|
1854 | evc = self.create_evc_inter_switch("untagged", "untagged") |
|
1855 | ||
1856 | for link in evc.primary_links: |
|
1857 | link.metadata['s_vlan'] = MagicMock(value=link.metadata['s_vlan']) |
|
1858 | evc.current_path = evc.primary_links |
|
1859 | ||
1860 | trace_a = [ |
|
1861 | { |
|
1862 | "dpid": 1, |
|
1863 | "port": 2, |
|
1864 | "time": "t1", |
|
1865 | "type": "starting", |
|
1866 | "vlan": 0 |
|
1867 | }, |
|
1868 | { |
|
1869 | "dpid": 2, |
|
1870 | "port": 10, |
|
1871 | "time": "t2", |
|
1872 | "type": "intermediary", |
|
1873 | "vlan": 5 |
|
1874 | }, |
|
1875 | { |
|
1876 | "dpid": 3, |
|
1877 | "port": 12, |
|
1878 | 'out': {'port': 3}, |
|
1879 | "time": "t3", "type": |
|
1880 | "last", |
|
1881 | "vlan": 6 |
|
1882 | }, |
|
1883 | ] |
|
1884 | trace_z = [ |
|
1885 | { |
|
1886 | "dpid": 3, |
|
1887 | "port": 3, |
|
1888 | "time": "t1", |
|
1889 | "type": "starting", |
|
1890 | "vlan": 0 |
|
1891 | }, |
|
1892 | { |
|
1893 | "dpid": 2, |
|
1894 | "port": 11, |
|
1895 | "time": "t2", |
|
1896 | "type": "intermediary", |
|
1897 | "vlan": 6 |
|
1898 | }, |
|
1899 | { |
|
1900 | "dpid": 1, |
|
1901 | "port": 9, |
|
1902 | 'out': {'port': 2}, |
|
1903 | "time": "t3", |
|
1904 | "type": "last", |
|
1905 | "vlan": 5 |
|
1906 | }, |
|
1907 | ] |
|
1908 | ||
1909 | bulk_sdntraces_mock.return_value = { |
|
1910 | "result": [trace_a, trace_z] |
|
1911 | } |
|
1912 | result = EVCDeploy.check_list_traces([evc]) |
|
1913 | assert result[evc.id] is True |
|
1914 | ||
1915 | @patch("napps.kytos.mef_eline.models.evc.log") |
|
1916 | @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces") |
|
@@ 1785-1848 (lines=64) @@ | ||
1782 | result = EVCDeploy.check_list_traces([evc]) |
|
1783 | assert result[evc.id] is False |
|
1784 | ||
1785 | @patch("napps.kytos.mef_eline.models.evc.log") |
|
1786 | @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces") |
|
1787 | def test_check_list_traces_any_cases(self, run_bulk_sdntraces_mock, _): |
|
1788 | """Test check_list_traces method.""" |
|
1789 | evc = self.create_evc_inter_switch("any", "any") |
|
1790 | ||
1791 | for link in evc.primary_links: |
|
1792 | link.metadata['s_vlan'] = MagicMock(value=link.metadata['s_vlan']) |
|
1793 | evc.current_path = evc.primary_links |
|
1794 | ||
1795 | trace_a = [ |
|
1796 | { |
|
1797 | "dpid": 1, |
|
1798 | "port": 2, |
|
1799 | "time": "t1", |
|
1800 | "type": "starting", |
|
1801 | "vlan": 1 |
|
1802 | }, |
|
1803 | { |
|
1804 | "dpid": 2, |
|
1805 | "port": 10, |
|
1806 | "time": "t2", |
|
1807 | "type": "intermediary", |
|
1808 | "vlan": 5 |
|
1809 | }, |
|
1810 | { |
|
1811 | "dpid": 3, |
|
1812 | "port": 12, |
|
1813 | 'out': {'port': 3, 'vlan': 1}, |
|
1814 | "time": "t3", |
|
1815 | "type": "last", |
|
1816 | "vlan": 6 |
|
1817 | }, |
|
1818 | ] |
|
1819 | trace_z = [ |
|
1820 | { |
|
1821 | "dpid": 3, |
|
1822 | "port": 3, |
|
1823 | "time": "t1", |
|
1824 | "type": "starting", |
|
1825 | "vlan": 1 |
|
1826 | }, |
|
1827 | { |
|
1828 | "dpid": 2, |
|
1829 | "port": 11, |
|
1830 | "time": "t2", |
|
1831 | "type": "intermediary", |
|
1832 | "vlan": 6 |
|
1833 | }, |
|
1834 | { |
|
1835 | "dpid": 1, |
|
1836 | "port": 9, |
|
1837 | 'out': {'port': 2, 'vlan': 1}, |
|
1838 | "time": "t3", |
|
1839 | "type": "last", |
|
1840 | "vlan": 5 |
|
1841 | }, |
|
1842 | ] |
|
1843 | ||
1844 | run_bulk_sdntraces_mock.return_value = { |
|
1845 | "result": [trace_a, trace_z] |
|
1846 | } |
|
1847 | result = EVCDeploy.check_list_traces([evc]) |
|
1848 | assert result[evc.id] is True |
|
1849 | ||
1850 | @patch("napps.kytos.mef_eline.models.evc.log") |
|
1851 | @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces") |