
The commit added the support to publish ptp status for v2 API in the notification-service. It also renamed the previously name v0 API to v1 API. Test Plan: Pass: PTP status push notification v2 API Pass: PTP status push notification v1 API Pass: Subscribe/List/Delete subscription in v2 API Pass: Subscribe/List/Delete subscription in v1 API Story: 2010056 Task: 45809 Signed-off-by: Teresa Ho <teresa.ho@windriver.com> Change-Id: Id5a1ff955eade59d68b6bcadfea4ffe6ed1567cd
30 lines
835 B
Python
30 lines
835 B
Python
#
|
|
# Copyright (c) 2021-2022 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from notificationclientsdk.model.dto.subscription import SubscriptionInfoV1
|
|
from notificationclientsdk.model.dto.subscription import SubscriptionInfoV2
|
|
from notificationclientsdk.model.dto.subscription import ResourceQualifierPtp
|
|
|
|
from wsme.rest.json import tojson
|
|
|
|
@tojson.when_object(SubscriptionInfoV1)
|
|
def subscriptioninfo_tojson(datatype, value):
|
|
if value is None:
|
|
return None
|
|
return value.to_dict()
|
|
|
|
@tojson.when_object(ResourceQualifierPtp)
|
|
def resourcequalifierptp_tojson(datatype, value):
|
|
if value is None:
|
|
return None
|
|
return value.to_dict()
|
|
|
|
@tojson.when_object(SubscriptionInfoV2)
|
|
def subscriptioninfo_tojson(datatype, value):
|
|
if value is None:
|
|
return None
|
|
return value.to_dict()
|