'Sets up network on this host.'

@utils.synchronized('setup_network', external=True)
def _setup_network_on_host(self, context, network):

    if (not network.vpn_public_address):
        address = CONF.vpn_ip
        network.vpn_public_address = address
        network.save()
    else:
        address = network.vpn_public_address
    network.dhcp_server = self._get_dhcp_ip(context, network)
    self._initialize_network(network)
    if ((address == CONF.vpn_ip) and hasattr(self.driver, 'ensure_vpn_forward')):
        self.l3driver.add_vpn(CONF.vpn_ip, network.vpn_public_port, network.vpn_private_address)
    if (not CONF.fake_network):
        dev = self.driver.get_dev(network)
        if network.enable_dhcp:
            elevated = context.elevated()
            self.driver.update_dhcp(elevated, dev, network)
        if CONF.use_ipv6:
            self.driver.update_ra(context, dev, network)
            gateway = utils.get_my_linklocal(dev)
            network.gateway_v6 = gateway
            network.save()
