@@ -1623,6 +1623,14 @@ def test_ensure_loadbalancer_lb_not_found(
1623
1623
mock_member_create , mock_update_status ):
1624
1624
self .mock_find_ovn_lbs_with_retry .side_effect = [
1625
1625
idlutils .RowNotFound ]
1626
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1627
+ {'id' : self .loadbalancer_id }]}
1628
+ mock_listener_create .return_value = {constants .LISTENERS : [
1629
+ {'id' : self .listener_id }]}
1630
+ mock_pool_create .return_value = {constants .POOLS : [
1631
+ {'id' : self .pool_id }]}
1632
+ mock_member_create .return_value = {constants .MEMBERS : [
1633
+ {'id' : self .member_id }]}
1626
1634
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1627
1635
mock_lb_create .assert_called_once_with (
1628
1636
self .driver ._get_loadbalancer_request_info (
@@ -1640,6 +1648,13 @@ def test_ensure_loadbalancer_lb_not_found(
1640
1648
self .driver ._get_member_request_info (
1641
1649
self .ref_lb_fully_populated .pools [0 ].members [0 ]),
1642
1650
)
1651
+ expected_status = {
1652
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1653
+ constants .LISTENERS : [{'id' : self .listener_id }],
1654
+ constants .POOLS : [{'id' : self .pool_id }],
1655
+ constants .MEMBERS : [{'id' : self .member_id }]
1656
+ }
1657
+ mock_update_status .assert_called_once_with (expected_status )
1643
1658
1644
1659
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1645
1660
'_update_status_to_octavia' )
@@ -1653,13 +1668,23 @@ def test_ensure_loadbalancer_lb_not_found_without_listeners_or_pools(
1653
1668
idlutils .RowNotFound ]
1654
1669
self .ref_lb_fully_populated .listeners = data_models .UnsetType ()
1655
1670
self .ref_lb_fully_populated .pools = data_models .UnsetType ()
1671
+
1672
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1673
+ {'id' : self .loadbalancer_id }]}
1674
+ mock_listener_create .return_value = {}
1675
+ mock_pool_create .return_value = {}
1676
+
1656
1677
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1657
1678
mock_lb_create .assert_called_once_with (
1658
1679
self .driver ._get_loadbalancer_request_info (
1659
1680
self .ref_lb_fully_populated ),
1660
1681
)
1661
1682
mock_listener_create .assert_not_called ()
1662
1683
mock_pool_create .assert_not_called ()
1684
+ expected_status = {
1685
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }]
1686
+ }
1687
+ mock_update_status .assert_called_once_with (expected_status )
1663
1688
1664
1689
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1665
1690
'_update_status_to_octavia' )
@@ -1672,13 +1697,28 @@ def test_ensure_loadbalancer_lb_not_found_member_without_subnet(
1672
1697
mock_member_create , mock_update_status ):
1673
1698
self .mock_find_ovn_lbs_with_retry .side_effect = [
1674
1699
idlutils .RowNotFound ]
1700
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1701
+ {'id' : self .loadbalancer_id }]}
1702
+ mock_listener_create .return_value = {constants .LISTENERS : [
1703
+ {'id' : self .listener_id }]}
1704
+ mock_pool_create .return_value = {constants .POOLS : [
1705
+ {'id' : self .pool_id }]}
1706
+ mock_member_create .return_value = {constants .MEMBERS : [
1707
+ {'id' : self .member_id }]}
1675
1708
self .ref_lb_fully_populated .listeners = []
1676
1709
self .ref_lb_fully_populated .pools [0 ].members [0 ].subnet_id = None
1677
1710
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1678
1711
mock_member_create .assert_called_once_with (
1679
1712
self .driver ._get_member_request_info (
1680
1713
self .ref_lb_fully_populated .pools [0 ].members [0 ]),
1681
1714
)
1715
+ expected_status = {
1716
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1717
+ constants .LISTENERS : [],
1718
+ constants .POOLS : [{'id' : self .pool_id }],
1719
+ constants .MEMBERS : [{'id' : self .member_id }]
1720
+ }
1721
+ mock_update_status .assert_called_once_with (expected_status )
1682
1722
1683
1723
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1684
1724
'_update_status_to_octavia' )
@@ -1692,6 +1732,16 @@ def test_ensure_loadbalancer_lb_not_found_hm_found(
1692
1732
mock_member_create , mock_hm_create , mock_update_status ):
1693
1733
self .mock_find_ovn_lbs_with_retry .side_effect = [
1694
1734
idlutils .RowNotFound ]
1735
+
1736
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1737
+ {'id' : self .loadbalancer_id }]}
1738
+ mock_listener_create .return_value = {constants .LISTENERS : [
1739
+ {'id' : self .listener_id }]}
1740
+ mock_pool_create .return_value = {constants .POOLS : [
1741
+ {'id' : self .pool_id }]}
1742
+ mock_member_create .return_value = {constants .MEMBERS : [
1743
+ {'id' : self .member_id }]}
1744
+
1695
1745
with mock .patch .object (
1696
1746
ovn_helper .OvnProviderHelper , '_find_ovn_lb_from_hm_id' ) \
1697
1747
as mock_find_ovn_lb_from_hm_id :
@@ -1700,6 +1750,15 @@ def test_ensure_loadbalancer_lb_not_found_hm_found(
1700
1750
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1701
1751
mock_hm_create .assert_not_called ()
1702
1752
1753
+ expected_status = {
1754
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1755
+ constants .LISTENERS : [{'id' : self .listener_id }],
1756
+ constants .POOLS : [{'id' : self .pool_id }],
1757
+ constants .MEMBERS : [{'id' : self .member_id }],
1758
+ constants .HEALTHMONITORS : []
1759
+ }
1760
+ mock_update_status .assert_called_once_with (expected_status )
1761
+
1703
1762
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1704
1763
'_update_status_to_octavia' )
1705
1764
@mock .patch .object (ovn_helper .OvnProviderHelper , 'hm_create' )
@@ -1712,6 +1771,16 @@ def test_ensure_loadbalancer_lb_not_found_hm_lbhc_not_found(
1712
1771
mock_member_create , mock_hm_create , mock_update_status ):
1713
1772
self .mock_find_ovn_lbs_with_retry .side_effect = [
1714
1773
idlutils .RowNotFound ]
1774
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1775
+ {'id' : self .loadbalancer_id }]}
1776
+ mock_listener_create .return_value = {constants .LISTENERS : [
1777
+ {'id' : self .listener_id }]}
1778
+ mock_pool_create .return_value = {constants .POOLS : [
1779
+ {'id' : self .pool_id }]}
1780
+ mock_member_create .return_value = {constants .MEMBERS : [
1781
+ {'id' : self .member_id }]}
1782
+ mock_hm_create .return_value = {constants .HEALTHMONITORS : [
1783
+ {'id' : self .healthmonitor_id }]}
1715
1784
with mock .patch .object (
1716
1785
ovn_helper .OvnProviderHelper , '_find_ovn_lb_from_hm_id' ) \
1717
1786
as mock_find_ovn_lb_from_hm_id :
@@ -1722,6 +1791,14 @@ def test_ensure_loadbalancer_lb_not_found_hm_lbhc_not_found(
1722
1791
self .driver ._get_healthmonitor_request_info (
1723
1792
self .ref_lb_fully_populated .pools [0 ].healthmonitor ),
1724
1793
)
1794
+ expected_status = {
1795
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1796
+ constants .LISTENERS : [{'id' : self .listener_id }],
1797
+ constants .POOLS : [{'id' : self .pool_id }],
1798
+ constants .MEMBERS : [{'id' : self .member_id }],
1799
+ constants .HEALTHMONITORS : [{'id' : self .healthmonitor_id }]
1800
+ }
1801
+ mock_update_status .assert_called_once_with (expected_status )
1725
1802
1726
1803
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1727
1804
'_update_status_to_octavia' )
@@ -1735,6 +1812,10 @@ def test_ensure_loadbalancer_lb_not_found_without_pools(
1735
1812
self .mock_find_ovn_lbs_with_retry .side_effect = [
1736
1813
idlutils .RowNotFound ]
1737
1814
self .ref_lb_fully_populated .pools = data_models .Unset
1815
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1816
+ {'id' : self .loadbalancer_id }]}
1817
+ mock_listener_create .return_value = {constants .LISTENERS : [
1818
+ {'id' : self .listener_id }]}
1738
1819
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1739
1820
mock_lb_create .assert_called_once_with (
1740
1821
self .driver ._get_loadbalancer_request_info (
@@ -1745,6 +1826,11 @@ def test_ensure_loadbalancer_lb_not_found_without_pools(
1745
1826
self .ref_lb_fully_populated .listeners [0 ]),
1746
1827
)
1747
1828
mock_pool_create .assert_not_called ()
1829
+ expected_status = {
1830
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1831
+ constants .LISTENERS : [{'id' : self .listener_id }]
1832
+ }
1833
+ mock_update_status .assert_called_once_with (expected_status )
1748
1834
1749
1835
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1750
1836
'_update_status_to_octavia' )
@@ -1758,6 +1844,13 @@ def test_ensure_loadbalancer_lb_not_found_without_members(
1758
1844
self .mock_find_ovn_lbs_with_retry .side_effect = [
1759
1845
idlutils .RowNotFound ]
1760
1846
self .ref_lb_fully_populated .pools [0 ].members = []
1847
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1848
+ {'id' : self .loadbalancer_id }]}
1849
+ mock_listener_create .return_value = {constants .LISTENERS : [
1850
+ {'id' : self .listener_id }]}
1851
+ mock_pool_create .return_value = {constants .POOLS : [
1852
+ {'id' : self .pool_id }]}
1853
+
1761
1854
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1762
1855
mock_lb_create .assert_called_once_with (
1763
1856
self .driver ._get_loadbalancer_request_info (
@@ -1772,6 +1865,12 @@ def test_ensure_loadbalancer_lb_not_found_without_members(
1772
1865
self .ref_lb_fully_populated .pools [0 ]),
1773
1866
)
1774
1867
mock_member_create .assert_not_called ()
1868
+ expected_status = {
1869
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1870
+ constants .LISTENERS : [{'id' : self .listener_id }],
1871
+ constants .POOLS : [{'id' : self .pool_id }]
1872
+ }
1873
+ mock_update_status .assert_called_once_with (expected_status )
1775
1874
1776
1875
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1777
1876
'_update_status_to_octavia' )
@@ -1787,6 +1886,16 @@ def test_ensure_loadbalancer_lb_not_found_with_hm(
1787
1886
idlutils .RowNotFound ]
1788
1887
self .ref_lb_fully_populated .pools [0 ].members = []
1789
1888
self .ref_pool .healthmonitor = self .ref_health_monitor
1889
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1890
+ {'id' : self .loadbalancer_id }]}
1891
+ mock_listener_create .return_value = {constants .LISTENERS : [
1892
+ {'id' : self .listener_id }]}
1893
+ mock_pool_create .return_value = {constants .POOLS : [
1894
+ {'id' : self .pool_id }]}
1895
+ mock_member_create .return_value = {constants .MEMBERS : [
1896
+ {'id' : self .member_id }]}
1897
+ mock_hm_create .return_value = {constants .HEALTHMONITORS : [
1898
+ {'id' : self .healthmonitor_id }]}
1790
1899
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1791
1900
mock_lb_create .assert_called_once_with (
1792
1901
self .driver ._get_loadbalancer_request_info (
@@ -1805,6 +1914,13 @@ def test_ensure_loadbalancer_lb_not_found_with_hm(
1805
1914
self .driver ._get_healthmonitor_request_info (
1806
1915
self .ref_lb_fully_populated .pools [0 ].healthmonitor ),
1807
1916
)
1917
+ expected_status = {
1918
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1919
+ constants .LISTENERS : [{'id' : self .listener_id }],
1920
+ constants .POOLS : [{'id' : self .pool_id }],
1921
+ constants .HEALTHMONITORS : [{'id' : self .healthmonitor_id }]
1922
+ }
1923
+ mock_update_status .assert_called_once_with (expected_status )
1808
1924
1809
1925
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1810
1926
'_update_status_to_octavia' )
@@ -1818,6 +1934,12 @@ def test_ensure_loadbalancer_lb_not_found_no_listeners(
1818
1934
self .mock_find_ovn_lbs_with_retry .side_effect = [
1819
1935
idlutils .RowNotFound ]
1820
1936
self .ref_lb_fully_populated .listeners = []
1937
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1938
+ {'id' : self .loadbalancer_id }]}
1939
+ mock_pool_create .return_value = {constants .POOLS : [
1940
+ {'id' : self .pool_id }]}
1941
+ mock_member_create .return_value = {constants .MEMBERS : [
1942
+ {'id' : self .member_id }]}
1821
1943
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1822
1944
mock_lb_create .assert_called_once_with (
1823
1945
self .driver ._get_loadbalancer_request_info (
@@ -1832,6 +1954,13 @@ def test_ensure_loadbalancer_lb_not_found_no_listeners(
1832
1954
self .driver ._get_member_request_info (
1833
1955
self .ref_lb_fully_populated .pools [0 ].members [0 ]),
1834
1956
)
1957
+ expected_status = {
1958
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1959
+ constants .LISTENERS : [],
1960
+ constants .POOLS : [{'id' : self .pool_id }],
1961
+ constants .MEMBERS : [{'id' : self .member_id }],
1962
+ }
1963
+ mock_update_status .assert_called_once_with (expected_status )
1835
1964
1836
1965
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1837
1966
'_update_status_to_octavia' )
@@ -1845,6 +1974,10 @@ def test_ensure_loadbalancer_lb_not_found_no_pools(
1845
1974
self .mock_find_ovn_lbs_with_retry .side_effect = [
1846
1975
idlutils .RowNotFound ]
1847
1976
self .ref_lb_fully_populated .pools = []
1977
+ mock_lb_create .return_value = {constants .LOADBALANCERS : [
1978
+ {'id' : self .loadbalancer_id }]}
1979
+ mock_listener_create .return_value = {constants .LISTENERS : [
1980
+ {'id' : self .listener_id }]}
1848
1981
self .driver ._ensure_loadbalancer (self .ref_lb_fully_populated )
1849
1982
mock_lb_create .assert_called_once_with (
1850
1983
self .driver ._get_loadbalancer_request_info (
@@ -1856,6 +1989,12 @@ def test_ensure_loadbalancer_lb_not_found_no_pools(
1856
1989
)
1857
1990
mock_pool_create .assert_not_called ()
1858
1991
mock_member_create .assert_not_called ()
1992
+ expected_status = {
1993
+ constants .LOADBALANCERS : [{'id' : self .loadbalancer_id }],
1994
+ constants .LISTENERS : [{'id' : self .listener_id }],
1995
+ constants .POOLS : []
1996
+ }
1997
+ mock_update_status .assert_called_once_with (expected_status )
1859
1998
1860
1999
@mock .patch .object (ovn_helper .OvnProviderHelper ,
1861
2000
'_update_status_to_octavia' )
0 commit comments