@mock.patch('cloudbaseinit.osutils.windows.WindowsUtils'
                '.check_os_version')
    @mock.patch("cloudbaseinit.utils.windows.network"
                ".get_adapter_addresses")
    def _test_set_static_network_config_v6(self, mock_get_adapter_addresses,
                                           mock_check_os_version,
                                           v6adapters=True, v6error=False):
        friendly_name = "Ethernet0"
        interface_index = "4"
        mac_address = '54:EE:75:19:F4:61'
        address6 = "2001:db8::3"
        netmask6 = "64"
        gateway6 = "2001:db8::1"

        conn = self._wmi_mock.WMI
        netip = conn.return_value.query.return_value[0]
        if v6error:
            netip.Create.side_effect = WMIError
        adapter_addresses = []
        if v6adapters:
            adapter_addresses = [
                {
                    "mac_address": mac_address,
                    "friendly_name": friendly_name,
                    "interface_index": interface_index
                }
            ]
        mock_get_adapter_addresses.return_value = adapter_addresses
        mock_check_os_version.return_value = True

        set_static_call = functools.partial(
            self._winutils.set_static_network_config_v6,
            mac_address, address6, netmask6, gateway6)
        expected_log = []
        if not mock_check_os_version.return_value:
            expected_log.append("Setting IPv6 info not available "
                                "on this system")

        if not v6adapters or v6error:
            self.assertRaises(
                exception.CloudbaseInitException,
                set_static_call)
        else:
            expected_log.append(friendly_name % "Setting IPv6 info for %s")
            with self.snatcher:
                set_static_call()
            mock_get_adapter_addresses.assert_called_once_with()
            select = ("SELECT * FROM MSFT_NetIPAddress "
                      "WHERE InterfaceAlias = '{}'".format(friendly_name))
            conn.return_value.query.assert_called_once_with(select)
            params = {
                "InterfaceIndex": interface_index,
                "InterfaceAlias": friendly_name,
                "IPAddress": address6,
                "AddressFamily": self.windows_utils.AF_INET6,
                "PrefixLength": netmask6,
                # Manual set type.
                "Type": self.windows_utils.UNICAST,
                "PrefixOrigin": self.windows_utils.MANUAL,
                "SuffixOrigin": self.windows_utils.MANUAL,
                "AddressState": self.windows_utils.PREFERRED_ADDR,
                # No expiry.
                "ValidLifetime": None,
                "PreferredLifetime": None,
                "SkipAsSource": False,
                "DefaultGateway": gateway6,
                "PolicyStore": None,
                "PassThru": False,
            }
            netip.Create.assert_called_once_with(**params)
            self.assertEqual(expected_log, self.snatcher.output)
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/osutils/test_windows.py/TestWindowsUtils._test_set_static_network_config_v6/swapped operands of `%`