class AccessRight(ExpiringResource, SubscribableResource, AnnounceableResource): """See TS 102.921 10.11.1.""" searchStrings = ListAttribute(mandatory=False) permissions = ListAttribute(mandatory=False, content_type=Permission) selfPermissions = ListAttribute(mandatory=True, content_type=Permission) id = UnicodeAttribute(mandatory=False, id_attribute=True)
class PermissionHolder(Entity): """See TS 102.921 table 11.18""" holderRefs = ListAttribute(mandatory=False) applicationIDs = ListAttribute(mandatory=False) sclIDs = ListAttribute(mandatory=False) all = Attribute(bool, mandatory=False, default=None) domains = ListAttribute(mandatory=False)
class Scl(ExpiringResource, SubscribableResource, AnnounceableResource): """See TS 102.921 10.6.1.""" containers = SubresourceMember(Containers) groups = SubresourceMember(Groups) applications = SubresourceMember(Applications) accessRights = SubresourceMember(AccessRights) mgmtObjs = SubresourceMember(MgmtObjs) notificationChannels = SubresourceMember(NotificationChannels) communicationChannels = SubresourceMember(CommunicationChannels) sclAnncs = SubresourceMember(SclAnncs) m2mPocs = SubresourceMember(M2mPocs) attachedDevices = SubresourceMember(AttachedDevices) sclId = UnicodeAttribute(id_attribute=True, mandatory=True) pocs = ListAttribute(content_type=AnyURI) remTriggerAddr = UnicodeAttribute(mandatory=False) onlineStatus = UnicodeAttribute(mandatory=False, accesstype=Attribute.RO) serverCapability = Attribute(bool, mandatory=False, accesstype=Attribute.RO) link = UnicodeAttribute(mandatory=True, accesstype=Attribute.WO) schedule = UnicodeAttribute(mandatory=False) accessRightID = UnicodeAttribute(mandatory=False) searchStrings = ListAttribute() locTargetDevice = UnicodeAttribute(mandatory=False) mgmtProtocolType = UnicodeAttribute(mandatory=True, update_mandatory=True) integrityValResults = UnicodeAttribute(mandatory=False) aPocHandling = UnicodeAttribute(mandatory=False, accesstype=Attribute.RO) sclType = Attribute(SCLType, mandatory=True, accesstype=Attribute.WO, version="2.0") publicDomain = UnicodeAttribute(mandatory=False, accesstype=Attribute.RO, version="2.0")
class AccessControlPolicyAnnc(AnnouncedSubordinateResourceC, SubscribableResource): privileges = ListAttribute(AccessControlRuleC) selfPrivileges = ListAttribute(AccessControlRuleC) __child_types__ = ( Subscription, )
class SecurityInfo(OneM2MEntity): securityInfoType = Attribute(SecurityInfoTypeE) # dasRequest = ListAttribute() # lists are wrong? # dasResponse = ListAttribute() dasRequest = EntityAttribute(DynAuthDasRequestC) dasResponse = EntityAttribute(DynAuthDasResponseC) esprimRandObject = ListAttribute() # m2m:receiverESPrimRandObject esprimObject = ListAttribute() # m2m:e2eCompactJWE escertkeMessage = ListAttribute() # xs:base64Binary
class AccessControlRuleC(OneM2MEntity): accessControlOriginators = ListOfURIsS() # m2m:listOfURIs # Mand accessControlOperations = ListAttribute(AccessControlOperationE) # Mand accessControlContexts = ListAttribute(AccessControlContextsC) # Opt # accessControlContexts = EntityAttribute(AccessControlContextsC) # Opt # TODO(rkr): currently default of the Flag is set to False; # TODO if not explicitly set to True the authorization is performed without authentication # TODO when authentication is used, it should maybe set to be True by default accessControlAuthenticationFlag = Attribute(bool, default=False) # Opt
class ContentInstance(DefaultResource): """See TS 102.921 10.19.1.""" id = UnicodeAttribute(mandatory=False, id_attribute=True) href = UnicodeAttribute(mandatory=False, path_attribute=True) contentTypes = ListAttribute() contentSize = Attribute(int) # creationTime # lastModifiedTime delayTolerance = UnicodeAttribute(mandatory=False) # todo content = EntityAttribute(Content) searchStrings = ListAttribute(version="2.0")
class Group(SubscribableResource, ExpiringResource, AnnounceableResource): """See TS 102.921 10.21.1.""" id = UnicodeAttribute(id_attribute=True) accessRightID = UnicodeAttribute(mandatory=False) searchStrings = ListAttribute(mandatory=False) members = ListAttribute(mandatory=False, content_type=AnyURI) membersContent = SubresourceMember(MembersContent) memberType = UnicodeAttribute(mandatory=True, accesstype=Attribute.WO) currentNrOfMembers = Attribute(int, default=0, accesstype=Attribute.RO) maxNrOfMembers = Attribute(int) membersContentAccessRightID = UnicodeAttribute(mandatory=False) memberTypeValidated = Attribute(bool, accesstype=Attribute.RO) consistencyStrategy = UnicodeAttribute(mandatory=False)
class FilterCriteria(Entity): """See TS 102.921 table 11.23""" ifModifiedSince = DatetimeAttribute(mandatory=False) ifUnmodifiedSince = DatetimeAttribute(mandatory=False) ifNoneMatch = ListAttribute(mandatory=False, default=None) attributeAccessor = Attribute(str, mandatory=False) searchString = ListAttribute(mandatory=False, default=None) createdAfter = DatetimeAttribute(mandatory=False) createdBefore = DatetimeAttribute(mandatory=False) sizeFrom = Attribute(int, mandatory=False) sizeUntil = Attribute(int, mandatory=False) contentType = ListAttribute(mandatory=False, default=None) metaDataOnly = Attribute(bool, mandatory=False)
class rcatParamList(DefaultResource): """See TS 102.690 B.2.1.5.""" # For each RCAT (0-7) rcatValue = Attribute(int, default=0) maxPendReq = Attribute(int, default=-1) maxPendData = Attribute(int, default=-1) anSelList = ListAttribute()
class ResourceC(LabeledResource): __child_types__ = () typename = None resourceName = UnicodeAttribute(accesstype=Attribute.WO, mandatory=False) resourceType = EntityAttribute(ResourceTypeE, accesstype=Attribute.RO) resourceID = IDS(accesstype=Attribute.RO) parentID = NhURIS(accesstype=Attribute.RO) lastModifiedTime = TimestampS(accesstype=Attribute.RO) creationTime = TimestampS(accesstype=Attribute.RO) childResource = ListAttribute() @property def name(self): return self.resourceName @property def id(self): return self.resourceID def __repr__(self): return "%s(path='%s', id='%s')" % (type(self).__name__, self.path, self.id) def has_child_type(self, resource_type): return resource_type in self.__child_types__
class Application(ExpiringResource, SubscribableResource, AnnounceableResource): """See TS 102.921 10.8.1.""" containers = SubresourceMember(Containers) groups = SubresourceMember(Groups) accessRights = SubresourceMember(AccessRights) notificationChannels = SubresourceMember(NotificationChannels) appId = UnicodeAttribute(mandatory=False, id_attribute=True, id_immutable=True) accessRightID = UnicodeAttribute(mandatory=False) searchStrings = ListAttribute(mandatory=False) aPoC = UnicodeAttribute(mandatory=False) aPoCPaths = ListAttribute(mandatory=False, content_type=APocPath) locrequester = UnicodeAttribute(mandatory=False) # todo referencePoint = UnicodeAttribute(accesstype=Attribute.RO, version="2.0")
class safPolicySet(ExpiringResource, SubscribableResource): """See TS 102.690 B.2.1.2.""" # For each Policy anpPolicyCollection = CollectionMember(anpPolicy) m2mSpPolicy = SubresourceMember(m2mSpPolicy) # Either "default" or list of app IDs where this policy applies policyScope = ListAttribute()
class FilterCriteria(OneM2MEntity): createdBefore = TimestampS() createdAfter = TimestampS() modifiedSince = TimestampS() unmodifiedSince = TimestampS() stateTagSmaller = Attribute(int) # xs:positiveInteger stateTagBigger = Attribute(int) # xs:nonNegativeInteger expireBefore = TimestampS() expireAfter = TimestampS() labels = StringListAttribute() resourceType = ListAttribute(ResourceTypeE) sizeAbove = Attribute(int) # xs:nonNegativeInteger sizeBelow = Attribute(int) # xs:positiveInteger contentType = UnicodeAttribute() # m2m:typeOfContent attribute = ListAttribute() # m2m:attribute filterUsage = EntityAttribute(FilterUsageE) limit = Attribute(int) # xs:nonNegativeInteger
class Container(ExpiringResource, SubscribableResource, AnnounceableResource): """See TS 102.921 10.14.1.""" contentInstances = SubresourceMember(ContentInstances) id = UnicodeAttribute(id_attribute=True) accessRightID = UnicodeAttribute(mandatory=False) # todo searchStrings = ListAttribute(mandatory=False) maxNrOfInstances = Attribute(int, default=-1) maxByteSize = Attribute(int, default=-1) maxInstanceAge = UnicodeAttribute(mandatory=False) # todo
class AccessControlObjectDetailsC(OneM2MEntity): # specifies to which resource type the rule applies resourceType = EntityAttribute(ResourceTypeE) # TODO(rkr): Child resource types listed in the childResourceType component are subject of # TODO access control for the Create operation only. Once a child resource is created, # TODO the Access Control Policies assigned directly to it apply. # for create operation only, list of creatable child resources childResourceType = ListAttribute(ResourceTypeE) specializationID = Attribute(AnyURI) # xs:anyURI
class MgmtObj(FlexibleAttributesMixin, ExpiringResource, SubscribableResource): """See TS 102.921 10.29.1.""" id = UnicodeAttribute(id_attribute=True) moID = UnicodeAttribute(mandatory=True, accesstype=Attribute.WO) accessRightID = UnicodeAttribute(mandatory=False) # todo searchStrings = ListAttribute(mandatory=False) description = UnicodeAttribute(mandatory=False) # todo originalMO = UnicodeAttribute(mandatory=False, accesstype=Attribute.WO) parametersCollection = CollectionMember(Parameters)
class AnnouncementResource(ExpiringResource): id = UnicodeAttribute(id_attribute=True) accessRightID = UnicodeAttribute(mandatory=False) # todo searchStrings = ListAttribute(mandatory=True) # TODO(rst): workaround -> change back to RW later link = UnicodeAttribute(mandatory=True, accesstype=Attribute.RW, update_mandatory=False) announceTo = EntityAttribute(mandatory=False, type=AnnounceTo, default=None)
class MgmtCmd(ExpiringResource, SubscribableResource): """See TS 102.921 10.31.1.""" id = UnicodeAttribute(id_attribute=True) accessRightID = UnicodeAttribute(mandatory=False) # todo searchStrings = ListAttribute(mandatory=False) description = UnicodeAttribute(mandatory=False) # todo originalMO = UnicodeAttribute(mandatory=False, accesstype=Attribute.WO) cmdType = UnicodeAttribute(mandatory=True, update_mandatory=False) execEnable = UnicodeAttribute(mandatory=True, accesstype=Attribute.WO) execReqArgs = UnicodeAttribute(mandatory=False) execInstances = SubresourceMember(ExecInstances)
class SclBase(DefaultResource, SubscribableResource): """See TS 102.921 10.4.1.""" scls = SubresourceMember(Scls) applications = SubresourceMember(Applications) containers = SubresourceMember(Containers) groups = SubresourceMember(Groups) accessRights = SubresourceMember(AccessRights) discovery = SubresourceMember(Discovery) # todo accessRightID = UnicodeAttribute() searchStrings = ListAttribute() aPocHandling = UnicodeAttribute()
class LocationContainer(ExpiringResource, SubscribableResource, AnnounceableResource): """See TS 102.921 10.16.1.""" contentInstances = SubresourceMember(ContentInstances) id = UnicodeAttribute(id_attribute=True) accessRightID = UnicodeAttribute(mandatory=False) # todo searchStrings = ListAttribute(mandatory=False) # announceTo maxNrOfInstances = Attribute(int) maxByteSize = Attribute(int) maxInstanceAge = UnicodeAttribute(mandatory=False) # todo locationContainerType = UnicodeAttribute(mandatory=True, accesstype=Attribute.WO)
class EventNotificationCriteria(OneM2MEntity): """See TS-0004 Table 6.3.2.3-1""" createdBefore = TimestampS() createdAfter = TimestampS() modifiedSince = TimestampS() unmodifiedSince = TimestampS() stateTagSmaller = Attribute(int) stateTagBigger = Attribute(int) expireBefore = TimestampS() expireAfter = TimestampS() sizeAbove = Attribute(int) sizeBelow = Attribute(int) operationMonitor = UnicodeAttribute() # ListAttribute(m2m:operation) # attribute = Attribute(int) # enum but to be defined in the standard attribute = UnicodeAttribute() # ListAttribute(m2m:attribute) notificationEventType = ListAttribute(NotificationEventTypeE)
class AnnounceTo(Entity): """See TS 102.921 table 11.28""" activated = Attribute(bool, mandatory=False, default=True) sclList = ListAttribute(mandatory=False, content_type=AnyURI)
class BlockList(DefaultResource): blockItems = ListAttribute(BlockItem)
class BlockItem(DefaultResource): failedAttempts = ListAttribute(long) blockDuration = Attribute(long)
class RcatSchedList(DefaultResource): rcatSchedule = ListAttribute(RcatSchedule)
class RcatSchedule(DefaultResource): rcatValue = ListAttribute(RcatType) schedItem = ListAttribute(SchedItem)
class SchedItem(DefaultResource): absTimeSpan = ListAttribute(AbsTimeSpan) schedule = ListAttribute(Schedule)
class Schedule(DefaultResource): scheduleStrings = ListAttribute(ScheduleString)
class RcatList(DefaultResource): rcatTypes = ListAttribute(RcatType)