Add tag api and test
This commit is contained in:
20
tjnetwork.py
20
tjnetwork.py
@@ -40,6 +40,9 @@ VALVES_TYPE_FCV = api.VALVES_TYPE_FCV
|
||||
VALVES_TYPE_TCV = api.VALVES_TYPE_TCV
|
||||
VALVES_TYPE_GPV = api.VALVES_TYPE_GPV
|
||||
|
||||
TAG_TYPE_NODE = api.TAG_TYPE_NODE
|
||||
TAG_TYPE_LINK = api.TAG_TYPE_LINK
|
||||
|
||||
LINK_STATUS_OPEN = api.LINK_STATUS_OPEN
|
||||
LINK_STATUS_CLOSED = api.LINK_STATUS_CLOSED
|
||||
LINK_STATUS_ACTIVE = api.LINK_STATUS_ACTIVE
|
||||
@@ -334,6 +337,23 @@ def delete_valve(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return api.delete_valve(name, cs)
|
||||
|
||||
|
||||
############################################################
|
||||
# tag 8.[TAGS]
|
||||
############################################################
|
||||
|
||||
def get_tag_schema(name: str) -> dict[str, dict[str, Any]]:
|
||||
return api.get_tag_schema(name)
|
||||
|
||||
def get_tag(name: str, t_type: str, id: str) -> dict[str, Any]:
|
||||
return api.get_tag(name, t_type, id)
|
||||
|
||||
# example:
|
||||
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' }))
|
||||
# set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' }))
|
||||
def set_tag(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return api.set_tag(name, cs)
|
||||
|
||||
|
||||
############################################################
|
||||
# demand 9.[DEMANDS]
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user