
When adding a new subscription check for an existing matching one, considering the source uri hierachy. Deny a new individual if there is already a sync all subscription, and deny a new sync all if there is already an invidual one. After a new sync all subscription is created a set of event messages are sent to the client containing the initial state of each source down in the hierarchy. And, every time one of the source states changes a new message is sent. Test Plan: PASS: Build the container images PASS: Mannually deploy them and test with v2 client PASS: Create a '/././sync' subscription and check the event messages PASS: Check current subscription list PASS: Change GNSS sync state and check the event messages PASS: Attempt to create a new individual subscription and check it fails PASS: Delete the '/././sync' subscription PASS: Check current subscription list again Closes-bug: 2009188 Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com> Change-Id: I90b642e73f30fb1798f4a93ab5313411c177949c
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
#
|
|
# Copyright (c) 2021-2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
class NodeNotAvailable(Exception):
|
|
def __init__(self, node_name):
|
|
self.node_name = node_name
|
|
|
|
def __str__(self):
|
|
return "Node:{0} not available".format(self.node_name)
|
|
|
|
|
|
class ResourceNotAvailable(Exception):
|
|
def __init__(self, node_name, resource_type):
|
|
self.node_name = node_name
|
|
self.resource_type = resource_type
|
|
|
|
def __str__(self):
|
|
return "Resource with type:{0} is not available on node:{1}".format(
|
|
self.resource_type, self.node_name)
|
|
|
|
|
|
class InvalidEndpoint(Exception):
|
|
def __init__(self, endpoint_uri):
|
|
self.endpoint_uri = endpoint_uri
|
|
|
|
def __str__(self):
|
|
return "Endpoint is invalid: {0}".format(self.endpoint_uri)
|
|
|
|
class InvalidResource(Exception):
|
|
def __init__(self, resource):
|
|
self.resource = resource
|
|
|
|
def __str__(self):
|
|
return "Resource is invalid: {0}".format(self.resource)
|
|
|
|
class InvalidSubscription(Exception):
|
|
def __init__(self, subscriptioninfo):
|
|
self.subscriptioninfo = subscriptioninfo
|
|
|
|
def __str__(self):
|
|
return "Subscription is invalid:{0}".format(
|
|
self.subscriptioninfo.to_dict())
|
|
|
|
class SubscriptionAlreadyExists(Exception):
|
|
def __init__(self, subscriptioninfo):
|
|
self.subscriptioninfo = subscriptioninfo
|
|
|
|
def __str__(self):
|
|
return "Subscription already exists: {0}".format(
|
|
self.subscriptioninfo)
|
|
|
|
class ServiceError(Exception):
|
|
def __init__(self, code, *args):
|
|
super().__init__(args)
|
|
self.code = code
|
|
|
|
def __str__(self):
|
|
return str(self.code)
|