示例#1
0
    def test_neutron_networking_parameters(self):
        cluster = self.env.create_cluster(api=False, net_provider='neutron')
        self.db.delete(cluster.network_config)
        kw = {
            "net_l23_provider": "ovs",
            "segmentation_type": "gre",
            "vlan_range": [1000, 1030],
            "gre_id_range": [2, 65534],
            "base_mac": "fa:16:3e:00:00:00",
            "internal_cidr": "192.168.111.0/24",
            "internal_gateway": "192.168.111.1",
            "floating_ranges": [["172.16.0.130", "172.16.0.254"]],
            "dns_nameservers": ["8.8.4.4", "8.8.8.8"],
            "cluster_id": cluster.id
        }
        nc = NeutronConfig(**kw)
        self.db.add(nc)
        self.db.flush()
        self.db.refresh(cluster)

        nw_params = NeutronNetworkConfigurationSerializer. \
            serialize_network_params(cluster)

        kw.pop("cluster_id")
        self.assertEqual(nw_params, kw)
示例#2
0
 def create_neutron_config(cls, cluster, segment_type):
     neutron_config = NeutronConfig(
         cluster_id=cluster.id,
         segmentation_type=segment_type,
     )
     db().add(neutron_config)
     meta = cluster.release.networks_metadata["neutron"]["config"]
     for key, value in meta.iteritems():
         if hasattr(neutron_config, key):
             setattr(neutron_config, key, value)
     db().flush()
示例#3
0
 def create_neutron_config(cls, cluster):
     meta = cluster.release.networks_metadata["neutron"]["config"]
     neutron_config = NeutronConfig(
         cluster_id=cluster.id,
         parameters=meta["parameters"],
         predefined_networks=cls._generate_predefined_networks(cluster),
         L2=cls._generate_l2(cluster),
         L3=cls._generate_l3(cluster),
         segmentation_type=cluster.net_segment_type,
     )
     db().add(neutron_config)
     db().flush()
示例#4
0
 def create_neutron_config(
         cls,
         cluster,
         segmentation_type,
         net_l23_provider=consts.NEUTRON_L23_PROVIDERS.ovs):
     neutron_config = NeutronConfig(cluster_id=cluster.id,
                                    segmentation_type=segmentation_type,
                                    net_l23_provider=net_l23_provider)
     db().add(neutron_config)
     meta = cluster.release.networks_metadata["neutron"]["config"]
     for key, value in meta.iteritems():
         if hasattr(neutron_config, key):
             setattr(neutron_config, key, value)
     db().flush()
示例#5
0
    def check_neutron_networking_parameters(self, floating_ranges):
        cluster = self.env.create_cluster(
            api=False, net_provider=consts.CLUSTER_NET_PROVIDERS.neutron)
        self.db.delete(cluster.network_config)
        self.network_config['floating_ranges'] = floating_ranges
        self.network_config['cluster_id'] = cluster.id
        nc = NeutronConfig(**self.network_config)
        self.db.add(nc)
        self.db.flush()
        self.db.refresh(cluster)

        nw_params = NeutronNetworkConfigurationSerializer. \
            serialize_network_params(cluster)

        self.network_config.pop("cluster_id")
        self.assertItemsEqual(nw_params, self.network_config)