def setUpClass(cls, extra_config_knobs=None):
        super(VncPodTest, cls).setUpClass(
            extra_config_knobs=extra_config_knobs)
        DBBaseKM.set_nested(False)
        cls.domain = 'default-domain'
        cls.cluster_project = 'test-project'
        cls.vn_name = cls.cluster_name() + '-test-pod-network'
        cls.service_vn_name = cls.cluster_name() + '-test-service-network'
        cls.ns_name = 'test-namespace'

        cls.pod_name = 'test-pod'
        cls.pod_status = {
            'hostIP': cls.get_kubernetes_node_ip(),
            'phase': 'created'
        }

        cn_dict = {
            'domain': cls.domain,
            'project': cls.cluster_project,
            'name': cls.vn_name
        }
        service_cn_dict = {
            'domain': cls.domain,
            'project': cls.cluster_project,
            'name': cls.service_vn_name
        }
        cp_dict = {'project': cls.cluster_project}

        kube_config.VncKubernetesConfig.args(). \
            cluster_project = repr(cp_dict)
        kube_config.VncKubernetesConfig.args(). \
            cluster_pod_network = repr(cn_dict)
        kube_config.VncKubernetesConfig.args(). \
            cluster_service_network = repr(service_cn_dict)
        kube_config.VncKubernetesConfig.vnc_kubernetes_config[
            'cluster_pod_ipam_fq_name'] = \
            ['default-domain', cls.cluster_project, 'pod-ipam']

        # Create Vrouter Object.
        cls.vrouter_name = 'test-VncPodTest-vrouter'
        cls.vrouter_obj = cls.create_virtual_router(cls.vrouter_name)
 def test_nested_mode(self):
     old_nested_mode = DBBaseKM.is_nested()
     self.args.nested_mode = "1"
     vnc_kubernetes.VncKubernetes(self.args, Mock())
     self.assertTrue(DBBaseKM.is_nested())
     DBBaseKM.set_nested(old_nested_mode)
 def test_nested_mode(self):
     old_nested_mode = DBBaseKM.is_nested()
     self.args.nested_mode = "1"
     vnc_kubernetes.VncKubernetes(self.args, Mock())
     self.assertTrue(DBBaseKM.is_nested())
     DBBaseKM.set_nested(old_nested_mode)
Esempio n. 4
0
 def tearDownClass(cls):
     super(VncEndpointsNestedTest, cls).tearDownClass()
     DBBaseKM.set_nested(False)
 def tearDownClass(cls):
     super(VncEndpointsNestedTest, cls).tearDownClass()
     DBBaseKM.set_nested(False)