Esempio n. 1
0
    def setUp(self):
        # Start container
        self._start_container()
        self.container.start_rel_from_url('res/deploy/basic.yml')

        # Now create client to bank service
        self.resource_registry_service = ResourceRegistryServiceClient()
Esempio n. 2
0
    def setUp(self):
        # Start container
        self._start_container()
        self.container.start_rel_from_url('res/deploy/basic.yml')

        self.resource_registry = ResourceRegistryServiceClient()
        self.identity_management_service = IdentityManagementServiceClient()
        self.org_client = OrgManagementServiceClient()
Esempio n. 3
0
    def setUp(self):
        self._start_container()
        self.container.start_rel_from_url('res/deploy/basic.yml')

        self.ems = ExchangeManagementServiceClient()
        self.rr = ResourceRegistryServiceClient()

        orglist, _ = self.rr.find_resources(RT.Org)
        self.org_id = orglist[0]._id

        # we test actual exchange interaction in pyon, so it's fine to mock the broker interaction here
        self._clear_mocks()
Esempio n. 4
0
    def setUp(self):
        self._start_container()
        self.container.start_rel_from_url('res/deploy/basic.yml')

        self.resource_registry = ResourceRegistryServiceClient()
        self.org_client = OrgManagementServiceClient()
        self.idm_client = IdentityManagementServiceClient()

        self.ui_server_proc = self.container.proc_manager.procs_by_name[
            "ui_server"]
        self.ui_base_url = self.ui_server_proc.base_url
        self.sg_base_url = self.ui_server_proc.gateway_base_url
Esempio n. 5
0
    def is_service_available(self, service_name, local_rr_only=False):

        try:
            service_resource = None
            from pyon.core.bootstrap import container_instance
            from interface.objects import ServiceStateEnum
            # Use container direct RR connection if available, otherwise use messaging to the RR service
            if hasattr(container_instance,
                       'has_capability') and container_instance.has_capability(
                           'RESOURCE_REGISTRY'):
                service_resource, _ = container_instance.resource_registry.find_resources(
                    restype='Service', name=service_name)
            elif not local_rr_only:
                from interface.services.core.iresource_registry_service import ResourceRegistryServiceClient
                rr_client = ResourceRegistryServiceClient(
                    container_instance.node)
                service_resource, _ = rr_client.find_resources(
                    restype='Service', name=service_name)
            else:
                log.warn("is_service_available(%s) - No RR connection" %
                         service_name)

            # The service is available only of there is a single RR object for it and it is in one of these states:
            if service_resource and len(service_resource) > 1:
                log.warn(
                    "is_service_available(%s) - Found multiple service instances: %s",
                    service_name, service_resource)

            # MM 2013-08-17: Added PENDING, because this means service will be there shortly
            if service_resource and service_resource[0].state in (
                    ServiceStateEnum.READY, ServiceStateEnum.STEADY,
                    ServiceStateEnum.PENDING):
                return True
            elif service_resource:
                log.warn(
                    "is_service_available(%s) - Service resource in invalid state",
                    service_resource)

            return False

        except Exception as ex:
            return False