Ejemplo n.º 1
0
#
#	BATAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	BAT : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
batAPolicies = constructPolicy(['btl', 'bts'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, batAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class BATAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = batAPolicies  # only the resource type's own policies
        super().__init__(dct,
                         pi,
                         mgd=T.BAT,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 2
0
#
#	ACPAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	Acp : Announceable variant
#

from .AnnouncedResource import AnnouncedResource
from .Resource import *
from Types import ResourceTypes as T, Permission, JSON
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy(
    ['et', 'acpi', 'lbl', 'daci', 'loc', 'lnk'])
acpAPolicies = constructPolicy([
    'pv',
    'pvs',
    'adri',
    'apri',
    'airi',
])
attributePolicies = addPolicy(attributePolicies, acpAPolicies)
# TODO announceSyncType


class ACPAnnc(AnnouncedResource):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
Ejemplo n.º 3
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:DeviceCapability
#

from .MgmtObj import *
from Constants import Constants as C
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa',
    'daci', 'mgd', 'obis', 'obps', 'dc', 'mgs', 'cmlk', 'can', 'att', 'cas',
    'ena', 'dis', 'cus'
])


class DVC(MgmtObj):
    def __init__(self,
                 jsn: dict = None,
                 pi: str = None,
                 create: bool = False) -> None:
        super().__init__(jsn,
                         pi,
                         C.tsDVC,
                         C.mgdDVC,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 4
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	CSR : Announceable variant
#


from .AnnouncedResource import AnnouncedResource
from .Resource import *
from Types import ResourceTypes as T, JSON
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'et', 'acpi', 'lbl','daci', 'loc',
	'lnk'
])
csrAPolicies = constructPolicy([
	'cst', 'poa', 'cb', 'csi', 'rr', 'nl', 'csz', 'esi', 'dcse', 'mtcc', 'egid', 'tren', 'ape', 'srv'
])
attributePolicies =  addPolicy(attributePolicies, csrAPolicies)
# TODO announceSyncType



class CSRAnnc(AnnouncedResource):

	def __init__(self, dct:JSON=None, pi:str=None, create:bool=False) -> None:
		super().__init__(T.CSRAnnc, dct, pi=pi, create=create, attributePolicies=attributePolicies)

Ejemplo n.º 5
0
#
#	MEMAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	MEM : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
memAPolicies = constructPolicy(['mma', 'mmt'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, memAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class MEMAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = memAPolicies  # only the resource type's own policies
        super().__init__(dct,
                         pi,
                         mgd=T.MEM,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 6
0
#
#	EVLAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	EVL : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
evlAPolicies = constructPolicy(['lgt', 'lgd', 'lgst', 'lga', 'lgo'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, evlAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class EVLAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = evlAPolicies  # only the resource type's own policies
        super().__init__(dct,
                         pi,
                         mgd=T.EVL,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 7
0
from Validator import constructPolicy, addPolicy
from Logging import Logging
import Utils, CSE
from .Resource import *
from .AnnounceableResource import AnnounceableResource
import resources.Factory as Factory

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty',
    'ri',
    'rn',
    'pi',
    'acpi',
    'ct',
    'lt',
    'et',
    'lbl',
    'at',
    'aa',
    'daci',
    'cr',
    'hld',
])
grpPolicies = constructPolicy([
    'mt', 'spty', 'cnm', 'mnm', 'mid', 'macp', 'mtv', 'csy', 'gn', 'ssi', 'nar'
])
attributePolicies = addPolicy(attributePolicies, grpPolicies)


class GRP(AnnounceableResource):
    def __init__(self,
Ejemplo n.º 8
0
#
#	FCI.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: FlexContainerInstance
#

from Constants import Constants as C
from .Resource import *
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy(
    ['ty', 'ri', 'rn', 'pi', 'ct', 'et', 'lbl', 'acpi', 'cs'])


class FCI(Resource):
    def __init__(self,
                 jsn: dict = None,
                 pi: str = None,
                 fcntType: str = None,
                 create: bool = False) -> None:
        super().__init__(fcntType,
                         jsn,
                         pi,
                         C.tFCI,
                         create=create,
                         inheritACP=True,
                         readOnly=True,
Ejemplo n.º 9
0
# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'rn',
    'ty',
    'ri',
    'pi',
    'et',
    'lbl',
    'ct',
    'lt',
    'cr',
    'hld',
    'acpi',
    'daci',
    'enc',
    'exc',
    'nu',
    'gpi',
    'nfu',
    'bn',
    'rl',
    'psn',
    'pn',
    'nsp',
    'ln',
    'nct',
    'nec',
    'su',
    'acrs'  #	primitiveProfileID missing in TS-0004
])
Ejemplo n.º 10
0
import Utils
from .Resource import *
from Logging import Logging
from .AnnounceableResource import AnnounceableResource
import CSE

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty',
    'ri',
    'rn',
    'pi',
    'acpi',
    'ct',
    'lt',
    'et',
    'lbl',
    'at',
    'aa',
    'daci',
    'loc',
    'st',
    'hld',
])
aePolicies = constructPolicy([
    'apn', 'api', 'aei', 'poa', 'nl', 'rr', 'csz', 'esi', 'mei', 'srv', 'regs',
    'trps', 'scp', 'tren', 'ape', 'or'
])
attributePolicies = addPolicy(attributePolicies, aePolicies)

Ejemplo n.º 11
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:DeviceInfo
#

from .MgmtObj import *
from Constants import Constants as C
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa', 'daci', 
	'mgd', 'obis', 'obps', 'dc', 'mgs', 'cmlk',
	'dlb', 'man', 'mfdl', 'mfd', 'mod', 'smod', 'dty', 'dvnm', 'fwv', 'swv', 
	'hwv', 'osv', 'cnty', 'loc', 'syst', 'spur', 'purl', 'ptl'
])

defaultDeviceType = 'unknown'
defaultModel = "unknown"
defaultManufacturer = "unknown"
defaultDeviceLabel = "unknown serial id"

class DVI(MgmtObj):

	def __init__(self, jsn: dict = None, pi: str = None, create: bool = False) -> None:
		super().__init__(jsn, pi, C.tsDVI, C.mgdDVI, create=create, attributePolicies=attributePolicies)

		if self.json is not None:
			self.setAttribute('dty', defaultDeviceType, overwrite=False)
Ejemplo n.º 12
0
#
#	NYCFCnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	NYCFC : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
nycfcAPolicies = constructPolicy(['suids', 'mcff', 'mcfc'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, nycfcAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class NYCFCAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = nycfcAPolicies  # only the resource type's own policies
        super().__init__(dct,
                         pi,
                         mgd=T.NYCFC,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 13
0
#
#	ResourceType: Container
#

from typing import Tuple, List
from Logging import Logging
from Configuration import Configuration
from Constants import Constants as C
from Validator import constructPolicy
import Utils, CSE
from .Resource import *

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'st', 'lbl', 'at', 'aa', 'daci', 'loc',
	'cr', 
	'mni', 'mbs', 'mia', 'cni', 'cbs', 'li', 'or', 'disr'
])


class CNT(Resource):


	def __init__(self, jsn: dict = None, pi: str = None, create: bool = False) -> None:
		super().__init__(C.tsCNT, jsn, pi, C.tCNT, create=create, attributePolicies=attributePolicies)

		if self.json is not None:
			self.setAttribute('mni', Configuration.get('cse.cnt.mni'), overwrite=False)
			self.setAttribute('mbs', Configuration.get('cse.cnt.mbs'), overwrite=False)
			self.setAttribute('cni', 0, overwrite=False)
			self.setAttribute('cbs', 0, overwrite=False)
Ejemplo n.º 14
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:areaNwkDeviceInfo
#

from .MgmtObj import *
from Constants import Constants as C
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa',
    'daci', 'mgd', 'obis', 'obps', 'dc', 'mgs', 'cmlk', 'dvd', 'dvt', 'awi',
    'sli', 'sld', 'ss', 'lnh'
])

defaultAreaNwkType = ''


class ANDI(MgmtObj):
    def __init__(self,
                 jsn: dict = None,
                 pi: str = None,
                 create: bool = False) -> None:
        super().__init__(jsn,
                         pi,
                         C.tsANDI,
                         C.mgdANDI,
Ejemplo n.º 15
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	CNT : Announceable variant
#


from .AnnouncedResource import AnnouncedResource
from .Resource import *
from Types import ResourceTypes as T, JSON
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'et', 'acpi', 'lbl','daci', 'loc',
	'lnk'
])
cntAPolicies = constructPolicy([
	'mni', 'mbs', 'mia', 'li', 'or', 'disr'
])
attributePolicies =  addPolicy(attributePolicies, cntAPolicies)
# TODO announceSyncType


class CNTAnnc(AnnouncedResource):

	def __init__(self, dct:JSON=None, pi:str=None, create:bool=False) -> None:
		super().__init__(T.CNTAnnc, dct, pi=pi, create=create, attributePolicies=attributePolicies)


	# Enable check for allowed sub-resources
Ejemplo n.º 16
0
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: AccessControlPolicy
#

from typing import Tuple, List
from Constants import Constants as C
from Validator import constructPolicy
from .Resource import *
import Utils


# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'rn', 'ty', 'ri', 'pi', 'et', 'lbl', 'ct', 'lt', 'at', 'aa', 
	'pv', 'pvs', 'adri', 'apri', 'airi'
])

class ACP(Resource):

	def __init__(self, jsn: dict = None, pi: str = None, rn: str = None, create: bool = False, createdInternally: str = None) -> None:
		super().__init__(C.tsACP, jsn, pi, C.tACP, create=create, inheritACP=True, rn=rn, attributePolicies=attributePolicies)
		
		if self.json is not None:
			self.setAttribute('pv/acr', [], overwrite=False)
			self.setAttribute('pvs/acr', [], overwrite=False)
			if createdInternally is not None:
				self.setAttribute(self._createdInternally, createdInternally)


	# Enable check for allowed sub-resources
Ejemplo n.º 17
0
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: RemoteCSE
#

from Constants import Constants as C
from Types import ResourceTypes as T, Result, JSON
from Configuration import Configuration
from Validator import constructPolicy, addPolicy
from .Resource import *
from .AnnounceableResource import AnnounceableResource

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa', 'cr',
    'daci', 'loc', 'hld'
])
csrPolicies = constructPolicy([
    'cst', 'poa', 'cb', 'csi', 'mei', 'tri', 'rr', 'nl', 'csz', 'esi', 'trn',
    'dcse', 'mtcc', 'egid', 'tren', 'ape', 'srv'
])
attributePolicies = addPolicy(attributePolicies, csrPolicies)

# TODO ^^^ Add Attribute EnableTimeCompensation, also in CSRAnnc


class CSR(AnnounceableResource):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 rn: str = None,
Ejemplo n.º 18
0
#	DVI.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:DeviceInfo
#

from .MgmtObj import *
from Types import ResourceTypes as T, JSON
from Validator import constructPolicy, addPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
dviPolicies = constructPolicy([
    'dlb', 'man', 'mfdl', 'mfd', 'mod', 'smod', 'dty', 'dvnm', 'fwv', 'swv',
    'hwv', 'osv', 'cnty', 'loc', 'syst', 'spur', 'purl', 'ptl'
])
attributePolicies = addPolicy(mgmtObjAttributePolicies, dviPolicies)

defaultDeviceType = 'unknown'
defaultModel = "unknown"
defaultManufacturer = "unknown"
defaultDeviceLabel = "unknown serial id"


class DVI(MgmtObj):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = dviPolicies  # only the resource type's own policies
Ejemplo n.º 19
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:Software
#

from .MgmtObj import *
from Constants import Constants as C
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa',
    'daci', 'mgd', 'obis', 'obps', 'dc', 'mgs', 'cmlk', 'vr', 'swn', 'url',
    'ins', 'acts', 'in', 'un', 'act', 'dea'
])

statusUninitialized = 0
statusSuccessful = 1
statusFailure = 2
statusInProcess = 3

defaultSoftwareName = 'unknown'
defaultVersion = '0.0'
defaultURL = 'unknown'
defaultStatus = {'acn': '', 'sus': statusUninitialized}


class SWR(MgmtObj):
Ejemplo n.º 20
0
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: CSEBase
#

from Constants import Constants as C
from Types import ResourceTypes as T, Result, JSON
from Configuration import Configuration
from Validator import constructPolicy
from .Resource import *
import CSE

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'rn', 'ty', 'ri', 'pi', 'ct', 'lt', 'lbl', 'loc', 'hld', 'acpi', 'poa',
    'nl', 'daci', 'esi', 'srv', 'cst', 'csi', 'csz'
])


class CSEBase(Resource):
    def __init__(self, dct: JSON = None, create: bool = False) -> None:
        super().__init__(T.CSEBase,
                         dct,
                         '',
                         create=create,
                         attributePolicies=attributePolicies)

        if self.dict is not None:
            self.setAttribute('ri', 'cseid', overwrite=False)
            self.setAttribute('rn', 'cse', overwrite=False)
            self.setAttribute('csi', 'cse', overwrite=False)
Ejemplo n.º 21
0
from Constants import Constants as C
from Types import ResourceTypes as T, Result, ResponseCode as RC, JSON
from Validator import constructPolicy, addPolicy
from .Resource import *
from .AnnounceableResource import AnnounceableResource
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'rn',
    'ty',
    'ri',
    'pi',
    'et',
    'ct',
    'lt',
    'st',
    'lbl',
    'at',
    'aa',
    'cr',
])
cinPolicies = constructPolicy(['cnf', 'cs', 'conr', 'con', 'or', 'conr'])
attributePolicies = addPolicy(attributePolicies, cinPolicies)


class CIN(AnnounceableResource):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
Ejemplo n.º 22
0
from Logging import Logging
from .Resource import *
from .AnnounceableResource import AnnounceableResource
import resources.Factory as Factory
import functools

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([
    'ty',
    'ri',
    'rn',
    'pi',
    'acpi',
    'ct',
    'lt',
    'et',
    'st',
    'lbl',
    'at',
    'aa',
    'cr',
    'hld',
    'daci',
    'loc',
])
fcntPolicies = constructPolicy(
    ['cnd', 'or', 'cs', 'nl', 'mni', 'mia', 'mbs', 'cni', 'dgt'])
attributePolicies = addPolicy(attributePolicies, fcntPolicies)


class FCNT(AnnounceableResource):
    def __init__(self,
Ejemplo n.º 23
0
#	MgmtObjAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	MgmtObj : Announceable variant
#

from copy import deepcopy
from .AnnouncedResource import AnnouncedResource
from .Resource import *
from Types import ResourceTypes as T, JSON, AttributePolicies
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy(
    ['et', 'acpi', 'lbl', 'daci', 'loc', 'lnk'])
mgmtObjAPolicies = constructPolicy([
    'mgd',
    'obis',
    'obps',
    'dc',
    'mgs',
    'cmlk',
])
mgmtObjAAttributePolicies = addPolicy(attributePolicies, mgmtObjAPolicies)
# TODO resourceMappingRules, announceSyncType


class MgmtObjAnnc(AnnouncedResource):
    def __init__(self,
                 dct: JSON,
Ejemplo n.º 24
0
#
#	ANIAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ANI : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
aniAPolicies = constructPolicy(['ant', 'ldv'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, aniAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class ANIAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        super().__init__(dct,
                         pi,
                         mgd=T.ANI,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 25
0
#	DVC.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:DeviceCapability
#

from .MgmtObj import *
from Types import ResourceTypes as T, Result, ResponseCode as RC, JSON
from Validator import constructPolicy, addPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
dvcPolicies = constructPolicy([
	'can', 'att', 'cas', 'ena', 'dis', 'cus'
])
attributePolicies = addPolicy(mgmtObjAttributePolicies, dvcPolicies)


class DVC(MgmtObj):

	def __init__(self, dct:JSON=None, pi:str=None, create:bool=False) -> None:
		self.resourceAttributePolicies = dvcPolicies	# only the resource type's own policies
		super().__init__(dct, pi, mgd=T.DVC, create=create, attributePolicies=attributePolicies)

		if self.dict is not None:
			self.setAttribute('can', 'unknown', overwrite=False)
			self.setAttribute('att', False, overwrite=False)
			self.setAttribute('cas', {	"acn" : "unknown", "sus" : 0 }, overwrite=False)
			self.setAttribute('cus', False, overwrite=False)
Ejemplo n.º 26
0
#

from typing import Dict, Any
from Constants import Constants as C
from Types import ResourceTypes as T, ResponseCode as RC, Result, RequestArguments, RequestHeaders, Operation, RequestStatus, CSERequest, JSON
from Validator import constructPolicy, addPolicy
import Utils
from .Resource import *
from .AnnounceableResource import AnnounceableResource
from Configuration import Configuration
import resources.Factory as Factory


# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'daci', 'hld',
])
reqPolicies = constructPolicy([
	'op', 'tg', 'org', 'rid', 'mi', 'pc', 'rs', 'ors'
])
attributePolicies = addPolicy(attributePolicies, reqPolicies)


class REQ(Resource):

	def __init__(self, dct:JSON=None, pi:str=None, create:bool=False) -> None:
		super().__init__(T.REQ, dct, pi, create=create, attributePolicies=attributePolicies)


	# Enable check for allowed sub-resources
	def canHaveChild(self, resource:Resource) -> bool:
Ejemplo n.º 27
0
import Utils, CSE
from Validator import constructPolicy, addPolicy
from .Resource import *
from .AnnounceableResource import AnnounceableResource

# TODO Support cmdhPolicy
# TODO Support storage

attributePolicies = constructPolicy([
    'ty',
    'ri',
    'rn',
    'pi',
    'acpi',
    'ct',
    'lt',
    'et',
    'lbl',
    'at',
    'aa',
    'daci',
    'hld',
])
nodPolicies = constructPolicy(
    ['ni', 'hcl', 'hael', 'hsl', 'mgca', 'rms', 'nid', 'nty'])
attributePolicies = addPolicy(attributePolicies, nodPolicies)


class NOD(AnnounceableResource):
    def __init__(self,
                 dct: JSON = None,
Ejemplo n.º 28
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	FCI : Announceable variant
#


from .AnnouncedResource import AnnouncedResource
from .Resource import *
from Types import ResourceTypes as T, JSON
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'et', 'acpi', 'lbl','daci', 'loc',
	'lnk' 
])
fcinAPolicies = constructPolicy([
])
attributePolicies =  addPolicy(attributePolicies, fcinAPolicies)
# TODO announceSyncType


class FCIAnnc(AnnouncedResource):

	def __init__(self, dct:JSON=None, pi:str=None, create:bool=False) -> None:
		super().__init__(T.FCIAnnc, dct, pi=pi, create=create, attributePolicies=attributePolicies)


	# Enable check for allowed sub-resources
	def canHaveChild(self, resource:Resource) -> bool:
Ejemplo n.º 29
0
#
#	ANDIAnnc.py
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ANDI : Announceable variant
#

from .MgmtObjAnnc import *
from Types import ResourceTypes as T, JSON
import Utils
from Validator import constructPolicy, addPolicy

# Attribute policies for this resource are constructed during startup of the CSE
andiAPolicies = constructPolicy(
    ['dvd', 'dvt', 'awi', 'sli', 'sld', 'ss', 'lnh'])
attributePolicies = addPolicy(mgmtObjAAttributePolicies, andiAPolicies)
# TODO resourceMappingRules, announceSyncType, owner


class ANDIAnnc(MgmtObjAnnc):
    def __init__(self,
                 dct: JSON = None,
                 pi: str = None,
                 create: bool = False) -> None:
        self.resourceAttributePolicies = andiAPolicies  # only the resource type's own policies
        super().__init__(dct,
                         pi,
                         mgd=T.ANDI,
                         create=create,
                         attributePolicies=attributePolicies)
Ejemplo n.º 30
0
#
#	(c) 2020 by Andreas Kraft
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
#	ResourceType: mgmtObj:EventLog
#

from .MgmtObj import *
from Constants import Constants as C
from Validator import constructPolicy
import Utils

# Attribute policies for this resource are constructed during startup of the CSE
attributePolicies = constructPolicy([ 
	'ty', 'ri', 'rn', 'pi', 'acpi', 'ct', 'lt', 'et', 'lbl', 'at', 'aa', 'daci', 
	'mgd', 'obis', 'obps', 'dc', 'mgs', 'cmlk',
	'lgt', 'lgd', 'lgst', 'lga', 'lgo'
])

lgtSystem = 1
lgtSecurity	= 2
lgtEvent = 3
lgtTrace = 4 
lgTPanic = 5

lgstStarted = 1
lgstStopped = 2
lgstUnknown = 3
lgstNotPresent = 4
lgstError = 5