Skip to content

Commit d0cde09

Browse files
d-linkoDavidEdellDavid LinkoBrianSipos
authored
281 user friendly decommutation of received reports (#332)
* Grafana updates including: Upgraded to v12, switched internal DB to PostgresSQL, consolidated dashboard+widget definitions and moved to a text provisioning file, and updated anms-ui monitor to use the new dashboard. Address #282 and #283 * Added to UI a prototype Help page and a Not Found page handler. * Resolve default database warning in grafana (hopefully). * Added upgrading file * Add amp-manager to UI Status page * added inifinity-datasource plugin and example panels * updated layout of panels * Fix core '/services' REST API to return JSON instead of text * Core REST API bugfixes to detect timeouts and resolve potential error with overloaded status variable. * initial dev creating a internal transcoder * working version, added new profile default is internal transcoding * working transcoder fixed issue with threading and DB * Automatically create GHCR images when a tag is created. This supplements the formal release process which also triggers publication. * Fix ghcr name if triggered by tag * Fixing grafana authnz/demo websocket proxy configuration. * removed services related to transcoder since they arent up by default * added --ignore flag for podman volume creaete to avoid name error * moved grafana db password to enviroment var * moving adms init * Updated REST APIs to return correct error codes, and updated dtnma-tools to bring in fixes for SQL concurrency causing reliability issues. * moved init adms logic into transcoder * added new folder for adding new ADMS in core * added gitignore to extra_adms to avoid extra adms be added to main * Add REFDA startup to allow ipn-scheme managers all access * Updating all deps references. * Force CI build to run with no-cache * moved init logic to avoid loop startup error * loading default ADMs controlled by a new route * Revert "Force CI build to run with no-cache" This reverts commit b19e333. * Address SonarQube documentation warning. * Use HTTP status code enums consistently. * setting cache to store processed reports * Fixed an additional error return. * updated to to use newest SQL for reports * added COPY for startup.uri * added for querying for report templates * updated grafana to use new rptsets * updated to include rpt_item_index * updated to uses time_offset as a timestamp * updated test execset * removed special char * adding logs * latest dtnma-tools * updated to latest dntma-tools * removed rpt_item_index * changed time_offset to agent_time * updated to align with latest dtnma-tools * combining reports that are the same ARI but stored with nn or no nn * adding missing _ in transcoder_put_str * removed extra logs * addressing sonar issues --------- Co-authored-by: David Edell <david.edell@jhuapl.edu> Co-authored-by: David Linko <david.linko@jhuapl.edu> Co-authored-by: Brian Sipos <brian.sipos@jhuapl.edu>
1 parent 6367b9c commit d0cde09

22 files changed

Lines changed: 1086 additions & 502 deletions

File tree

anms-core/anms/components/schemas/ARIs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@
5353
from .registered_agent import RegisteredAgentInDBBase
5454
from .rpt_entry import RptEntry
5555
from .rpt_entry import RptEntryName
56+
from .rpt_entry import RptEntryFull
5657
from .rpt_entry import RptEntryBaseInDBBase

anms-core/anms/components/schemas/ARIs/rpt_entry.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,25 @@ class RptEntryBase(BaseModel):
3232
class Config:
3333
arbitrary_types_allowed = True
3434

35-
ari_rptset_id: Optional[str] = None
36-
reference_time: Optional[datetime] = None
37-
report_list: Optional[str] = None
38-
agent_id: Optional[int] = None
39-
35+
ari_rptset_id: Optional[int] = None
36+
reference_time: Optional[datetime] = None
37+
mgr_time: Optional[datetime] = None
38+
nonce_cbor: Optional[str] = None
39+
agent_time: Optional[datetime] = None
40+
report_source: Optional[str] = None
41+
report_items: Optional[list] = None
42+
43+
# Shared properties
44+
class RptEntryFull(RptEntryBase):
45+
class Config:
46+
arbitrary_types_allowed = True
47+
orm_mode = True
4048

49+
agent_id: Optional[int] = None
50+
ari_rptlist_id: Optional[int] = None
51+
52+
53+
4154
class RptEntryBaseInDBBase(RptEntryBase):
4255
class Config:
4356
orm_mode = True
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (c) 2023 The Johns Hopkins University Applied Physics
5+
# Laboratory LLC.
6+
#
7+
# This file is part of the Asynchronous Network Management System (ANMS).
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
# This work was performed for the Jet Propulsion Laboratory, California
20+
# Institute of Technology, sponsored by the United States Government under
21+
# the prime contract 80NM0018D0004 between the Caltech and NASA under
22+
# subcontract 1658085.
23+
#
24+
from typing import Any
25+
from typing import Dict
26+
27+
from anms.models.relational import Model
28+
from sqlalchemy import Column
29+
from sqlalchemy import Integer
30+
from sqlalchemy import String
31+
32+
# class for vw_ctrl_definition used for build ari
33+
class Const(Model):
34+
__tablename__ = 'vw_const_actual'
35+
obj_actual_definition_id = Column(Integer, primary_key=True)
36+
data_type = Column(String)
37+
data_value = Column(String)
38+
use_desc = Column(String)
39+
obj_metadata_id = Column(Integer)
40+
data_model_name = Column(String)
41+
namespace = Column(String)
42+
data_type_id = Column(Integer)
43+
name = Column(String)
44+
data_model_id = Column(Integer)
45+
object_enumeration = Column(Integer)
46+
status = Column(String)
47+
reference = Column(String)
48+
description = Column(String)
49+
50+
def __repr__(self) -> str:
51+
return self.as_dict().__repr__()
52+
53+
def as_dict(self) -> Dict[str, Any]:
54+
dict_obj = {
55+
c.name: getattr(self, c.name) for c in self.__table__.columns
56+
}
57+
58+
return dict_obj

anms-core/anms/models/relational/execution_set.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from sqlalchemy import Integer
3030
from sqlalchemy import String
3131
from sqlalchemy import LargeBinary
32+
from anms.shared.transmogrifier import TRANSMORGIFIER
3233

3334

3435
# class for vw_ctrl_definition used for build ari
@@ -47,7 +48,7 @@ def __repr__(self) -> str:
4748
def as_dict(self) -> Dict[str, Any]:
4849
dict_obj = {
4950
'execution_set_id': getattr(self, 'execution_set_id'),
50-
'nonce_cbor': getattr(self, 'nonce_cbor'),
51+
'nonce_cbor': TRANSMORGIFIER._ace_transcode_just_cbor("0x"+getattr(self, 'nonce_cbor').hex()),
5152
'use_desc': getattr(self, 'use_desc'),
5253
'agent_id': getattr(self, 'agent_id'),
5354
'num_entries': getattr(self, 'num_entries'),

anms-core/anms/models/relational/report.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,48 @@
2424
from typing import Any
2525
from typing import Dict
2626

27+
from anms.shared.transmogrifier import TRANSMORGIFIER
2728
from anms.models.relational import Model
2829
from sqlalchemy import Column
2930
from sqlalchemy import Integer
30-
from sqlalchemy import String
31+
from sqlalchemy import DateTime
32+
from sqlalchemy import ARRAY
3133
from sqlalchemy import LargeBinary
32-
34+
from sqlalchemy import orm
3335

3436
# class for vw_ctrl_definition used for build ari
3537
class Report(Model):
36-
__tablename__ = 'ari_rptset'
37-
ari_rptset_id = Column(Integer, primary_key=True)
38-
nonce_cbor = Column(LargeBinary)
39-
reference_time = Column(Integer)
40-
report_list = Column(String)
41-
report_list_cbor = Column(LargeBinary)
42-
agent_id = Column(Integer)
38+
__tablename__ = 'vw_ari_rpt_set'
39+
ari_rptset_id = Column(Integer, primary_key=True)
40+
mgr_time = Column(DateTime)
41+
reference_time = Column(DateTime)
42+
nonce_cbor = Column(LargeBinary)
43+
agent_id = Column(Integer)
44+
ari_rptset_cbor = Column(LargeBinary)
45+
ari_rptlist_id = Column(Integer)
46+
agent_time = Column( DateTime)
47+
report_source = Column(LargeBinary)
48+
report_items = Column(ARRAY(LargeBinary) )#bytea[] NULL
49+
50+
# processing the raw cbor into an ari object
51+
@orm.reconstructor
52+
def init_on_load(self):
53+
self.nonce_cbor = TRANSMORGIFIER.transcode("0x"+getattr(self, 'nonce_cbor').hex())['uri']
54+
self.report_source = TRANSMORGIFIER.transcode("0x"+getattr(self, 'report_source').hex())['uri']
55+
self.report_items = [TRANSMORGIFIER.transcode("0x"+x.hex())['uri'] for x in getattr(self, 'report_items')]
56+
4357
def __repr__(self) -> str:
4458
return self.as_dict().__repr__()
4559

4660
def as_dict(self) -> Dict[str, Any]:
4761
dict_obj = {
4862
'ari_rptset_id': getattr(self, 'ari_rptset_id'),
49-
'nonce_cbor': getattr(self, 'nonce_cbor'),
5063
'reference_time': getattr(self, 'reference_time'),
51-
'report_list': getattr(self, 'report_list'),
52-
'report_list_cbor': getattr(self, 'report_list_cbor'),
53-
'agent_id': getattr(self, 'agent_id')
64+
'nonce_cbor': getattr(self, 'nonce_cbor'),
65+
'agent_id': getattr(self, 'agent_id'),
66+
'ari_rptlist_id': getattr(self, 'ari_rptlist_id'),
67+
'agent_time': getattr(self, 'agent_time'),
68+
'report_source': getattr(self, 'report_source'),
69+
'report_items': getattr(self, 'report_items')
5470
}
55-
5671
return dict_obj

0 commit comments

Comments
 (0)