Exemplo n.º 1
0
    def _get_service_info(self, endp):
        service = self.Service(
            type=self._MAP.service_endpoints.get(endp['type'],
                                                 taxonomy.UNKNOWN),
            name=endp['name'],
            id=identifier.norm_ns(endp['endpoints'][0]['id']),
            admin_endp=endpoint.Endpoint(name='admin',
                                         url=endp['endpoints'][0]['adminURL']),
            private_endp=endpoint.Endpoint(
                name='private', url=endp['endpoints'][0]['internalURL']),
            public_endp=endpoint.Endpoint(
                name='public', url=endp['endpoints'][0]['publicURL']))

        return service
Exemplo n.º 2
0
 def test_endpoint(self):
     endp = endpoint.Endpoint(url='http://192.168.0.1',
                              name='endpoint name',
                              port='8080')
     self.assertEqual(endp.is_valid(), True)
     dict_endp = endp.as_dict()
     for key in endpoint.ENDPOINT_KEYNAMES:
         self.assertIn(key, dict_endp)
Exemplo n.º 3
0
    def _get_service_info(self, endp):
        service = Service(
            type=self._MAP.service_endpoints.get(
                endp['type'],
                taxonomy.UNKNOWN),
            name=endp['name'],
            id=endp['endpoints'][0].get('id', endp['name']),
            admin_endp=endpoint.Endpoint(
                name='admin',
                url=endp['endpoints'][0].get('adminURL', taxonomy.UNKNOWN)),
            private_endp=endpoint.Endpoint(
                name='private',
                url=endp['endpoints'][0].get('internalURL', taxonomy.UNKNOWN)),
            public_endp=endpoint.Endpoint(
                name='public',
                url=endp['endpoints'][0].get('publicURL', taxonomy.UNKNOWN)))

        return service
Exemplo n.º 4
0
    def test_resource(self):
        res = resource.Resource(typeURI='storage',
                                name='res_name',
                                domain='res_domain',
                                ref='res_ref',
                                credential=credential.Credential(
                                    token=identifier.generate_uuid()),
                                host=host.Host(address='192.168.0.1'),
                                geolocation=geolocation.Geolocation(),
                                geolocationId=identifier.generate_uuid())

        res.add_attachment(attachment.Attachment(typeURI='attachURI',
                                                 content='content',
                                                 name='attachment_name'))
        res.add_address(endpoint.Endpoint(url='http://192.168.0.1'))

        self.assertEqual(res.is_valid(), True)
        dict_res = res.as_dict()
        for key in resource.RESOURCE_KEYNAMES:
            self.assertIn(key, dict_res)