Beispiel #1
0
    def test_update_localnet_network(self, mock_lsp_add_command,
                                     mock_set_command, mock_ls_get_command,
                                     mock_connection):
        mock_ls_get_command.return_value.execute.return_value = (
            TestOvnNorth.NETWORK_LOCALNET_12)
        ovn_north = OvnNorth()
        rest_data = {
            NetworkMapper.REST_NETWORK_NAME: TestOvnNorth.NETWORK_NAME12,
            NetworkMapper.REST_PROVIDER_NETWORK_TYPE:
            NetworkMapper.NETWORK_TYPE_VLAN,
            NetworkMapper.REST_PROVIDER_PHYSICAL_NETWORK:
            TestOvnNorth.LOCALNET_NAME,
            NetworkMapper.REST_PROVIDER_SEGMENTATION_ID:
            TestOvnNorth.LOCALNET_VLAN
        }
        result = ovn_north.update_network(rest_data, TestOvnNorth.NETWORK_ID12)

        self.assert_networks_equal(result, TestOvnNorth.NETWORK_LOCALNET_12)
        assert mock_set_command.call_count == 4
        assert mock_set_command.mock_calls[0] == mock.call(
            ovn_north.idl, ovnconst.TABLE_LS, TestOvnNorth.NETWORK_ID12,
            (NetworkMapper.REST_NETWORK_NAME, TestOvnNorth.NETWORK_NAME12))
        assert mock_lsp_add_command.call_count == 1
        assert mock_lsp_add_command.mock_calls[0] == mock.call(
            ovn_north.idl, str(TestOvnNorth.NETWORK_LOCALNET_12.uuid),
            ovnconst.LOCALNET_SWITCH_PORT_NAME, None, None, False)
        assert mock_ls_get_command.call_count == 2
Beispiel #2
0
    def test_update_network(self, mock_set_command, mock_connection):
        ovn_north = OvnNorth()
        rest_data = {
            NetworkMapper.REST_NETWORK_NAME: TestOvnNorth.NETWORK_NAME10
        }
        result = ovn_north.update_network(rest_data, TestOvnNorth.NETWORK_ID10)

        self.assert_networks_equal(result, TestOvnNorth.NETWORK_10)
        assert mock_set_command.call_count == 1
        assert mock_set_command.mock_calls[0] == mock.call(
            ovn_north.idl, ovnconst.TABLE_LS, TestOvnNorth.NETWORK_ID10,
            (NetworkMapper.REST_NETWORK_NAME, TestOvnNorth.NETWORK_NAME10))