def test_backout_ip_assignments_failed_unassign(self, m_unassign):
        """
        Test backout_ip_assignment processing when unassignment fails.
        :return:
        """
        m_unassign.return_value = False

        cnm_ep = {"Interfaces": [{"Address": "1.2.3.4"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("1.2.3.4"))
예제 #2
0
    def test_backout_ip_assignments_failed_unassign(self, m_unassign):
        """
        Test backout_ip_assignment processing when unassignment fails.
        :return:
        """
        m_unassign.return_value = False

        cnm_ep = {"Interfaces": [{"Address": "1.2.3.4"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("1.2.3.4"))
    def test_backout_ip_assignments(self, m_unassign):
        """
        Test backout_ip_assignment processing.
        :return:
        """
        m_unassign.return_value = True

        cnm_ep = {"Interfaces": [{"Address": "1.2.3.4"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("1.2.3.4"))
        m_unassign.reset_mock()

        cnm_ep = {"Interfaces": [{"AddressIPv6": "aa:bb::ff"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("aa:bb::ff"))
        m_unassign.reset_mock()

        cnm_ep = {
            "Interfaces": [{
                "Address": "1.2.3.4",
                "AddressIPv6": "aa:bb::ff"
            }]
        }
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_has_calls(
            [call(IPAddress("1.2.3.4")),
             call(IPAddress("aa:bb::ff"))])
예제 #4
0
    def test_backout_ip_assignments(self, m_unassign):
        """
        Test backout_ip_assignment processing.
        :return:
        """
        m_unassign.return_value = True

        cnm_ep = {"Interfaces": [{"Address": "1.2.3.4"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("1.2.3.4"))
        m_unassign.reset_mock()

        cnm_ep = {"Interfaces": [{"AddressIPv6": "aa:bb::ff"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_called_once_with(IPAddress("aa:bb::ff"))
        m_unassign.reset_mock()

        cnm_ep = {"Interfaces": [{"Address": "1.2.3.4",
                                  "AddressIPv6": "aa:bb::ff"}]}
        docker_plugin.backout_ip_assignments(cnm_ep)
        m_unassign.assert_has_calls([call(IPAddress("1.2.3.4")),
                                     call(IPAddress("aa:bb::ff"))])