Пример #1
0
def check_services_requirements(cluster):
    ver = cluster.api_client.get_nvp_version()
    # It sounds like 4.1 is the first one where DHCP in NSX/NVP
    # will have the experimental feature
    if ver.major >= 4 and ver.minor >= 1:
        cluster_id = cfg.CONF.default_service_cluster_uuid
        if not lsn_api.service_cluster_exists(cluster, cluster_id):
            raise p_exc.ServiceClusterUnavailable(cluster_id=cluster_id)
    else:
        raise p_exc.NvpInvalidVersion(version=ver)
Пример #2
0
def check_services_requirements(cluster):
    ver = cluster.api_client.get_nvp_version()
    # It sounds like 4.1 is the first one where DHCP in NSX
    # will have the experimental feature
    if ver.major >= 4 and ver.minor >= 1:
        cluster_id = cfg.CONF.default_service_cluster_uuid
        if not lsn_api.service_cluster_exists(cluster, cluster_id):
            raise p_exc.ServiceClusterUnavailable(cluster_id=cluster_id)
    else:
        raise p_exc.NvpInvalidVersion(version=ver)
Пример #3
0
 def test_service_cluster_found(self):
     self.mock_request.return_value = {
         "results": [{
             "_href": "/ws.v1/service-cluster/foo_uuid",
             "display_name": "foo_name",
             "uuid": "foo_uuid",
             "tags": [],
             "_schema": "/ws.v1/schema/ServiceClusterConfig",
             "gateways": []
         }],
         "result_count":
         1
     }
     expected = lsnlib.service_cluster_exists(None, 'foo_uuid')
     self.assertTrue(expected)
Пример #4
0
 def test_service_cluster_found(self):
     self.mock_request.return_value = {
         "results": [
             {
                 "_href": "/ws.v1/service-cluster/foo_uuid",
                 "display_name": "foo_name",
                 "uuid": "foo_uuid",
                 "tags": [],
                 "_schema": "/ws.v1/schema/ServiceClusterConfig",
                 "gateways": []
             }
         ],
         "result_count": 1
     }
     expected = lsnlib.service_cluster_exists(None, 'foo_uuid')
     self.assertTrue(expected)
Пример #5
0
 def test_service_cluster_not_found(self):
     self.mock_request.side_effect = exceptions.NotFound()
     expected = lsnlib.service_cluster_exists(None, 'foo_uuid')
     self.assertFalse(expected)
Пример #6
0
 def test_service_cluster_None(self):
     self.mock_request.return_value = None
     expected = lsnlib.service_cluster_exists(None, None)
     self.assertFalse(expected)
Пример #7
0
 def test_service_cluster_not_found(self):
     self.mock_request.side_effect = exceptions.NotFound()
     expected = lsnlib.service_cluster_exists(None, 'foo_uuid')
     self.assertFalse(expected)
Пример #8
0
 def test_service_cluster_None(self):
     self.mock_request.return_value = None
     expected = lsnlib.service_cluster_exists(None, None)
     self.assertFalse(expected)