Example #1
0
    def create_networks(self, dns_nameservers=None, **kwargs):
        namestart = 'lbv1-ops'
        routers_client = self.routers_client
        networks_client = self.networks_client
        subnets_client = self.subnets_client

        router_kwargs = dict(client=routers_client, namestart=namestart)
        for k in kwargs.keys():
            if k in ('distributed', 'router_type', 'router_size'):
                router_kwargs[k] = kwargs.pop(k)
        router = self._create_router(**router_kwargs)
        HELO.router_gateway_set(self, router['id'],
                                CONF.network.public_network_id)

        network = self._create_network(routers_client=routers_client,
                                       networks_client=networks_client,
                                       namestart=namestart)

        subnet_kwargs = dict(network=network,
                             namestart=namestart,
                             subnets_client=subnets_client)
        # use explicit check because empty list is a valid option
        if dns_nameservers is not None:
            subnet_kwargs['dns_nameservers'] = dns_nameservers
        subnet = self._create_subnet(**subnet_kwargs)
        HELO.router_interface_add(self, router['id'], subnet['id'],
                                  routers_client)
        return network, subnet, router
Example #2
0
 def _router_set_gateway(self, router_id, network_id, client=None):
     routers_client = client or self.routers_client
     return HELO.router_gateway_set(self,
                                    router_id,
                                    network_id,
                                    client=routers_client)