Skip to content

Commit 0e7282c

Browse files
committed
Merge remote-tracking branch 'origin/main' into 324-testing-ci
2 parents cbb8cab + 3a1e57f commit 0e7282c

File tree

20 files changed

+179
-172
lines changed

20 files changed

+179
-172
lines changed

.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ DB_NAME=amp_core
3939
DB_HEALTHCHECK_USER=healthcheck
4040
DB_HEALTHCHECK_PASSWORD=healthcheck
4141

42+
OPENSEARCH_INITIAL_ADMIN_PASSWORD=Bw1YckbI3jroOxVnaQHm
43+
4244
GRAFANA_CONTAINER_PORT=3000
4345
GRAFANA_HOST_PORT=grafana:${GRAFANA_CONTAINER_PORT}
4446
GRAFANA_PROXIES_PATH=localhost/grafana
4547
GRAFANA_DB_NAME=grafana_internal_db
48+
GRAFANA_PASS=grafana
4649

4750
REDIS_PORT=6379
4851
JS_AMP_PORT=3001
@@ -67,4 +70,3 @@ CTR_SOCKDIR=/var/tmp/nm
6770

6871
ADM_PATH=deps/dtnma-adms
6972

70-
GRAFANA_PASS=grafana

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ testresults.xml
2020
# local build files
2121
/anms-core/build/
2222
/anms-ui/release/
23+
docker-compose.override.yml
2324

2425
# Javascript and ESLint related content to be ignored
2526
node_modules

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ If yes, do not rely on this README for operational guidance. Refer to the ANMS P
5252

5353
**3. Are you a developer contributing to ANMS or setting up a development environment?**
5454

55-
If yes, refer to both this Readme and the ANMS Wiki [Development Guide](https://github.com/NASA-AMMOS/anms/wiki/Development-Guide) for:
55+
If yes, refer to both this README and the ANMS Wiki [Development Guide](https://github.com/NASA-AMMOS/anms/wiki/Development-Guide) for:
56+
5657
* Local development environment configuration
5758
* Testing workflows
5859
* Contribution guidelines
@@ -66,10 +67,10 @@ This section details prerequisites to installing the ANMS from source on a devel
6667

6768
### Software and OS Versions
6869

69-
The setup of ANMS and demos listed in this README have been tested on macOS 11.6.4 (Big Sur), RHEL 9 and Ubuntu 20.04.
70+
The setup of ANMS and demos listed in this README have been tested on macOS 11.6.4 (Big Sur), RHEL 9 and Ubuntu 20.04.
7071
To run the ANMS tool, you must also install Docker Engine version 20.10.10 or newer or Podman 5.2.2+. You will also need either Docker Compose version 1.29.2+ or podman-compose. Docker and Podman can generally be used interchangeably.
7172

72-
**NOTE:** `docker-compose` can be used with `podman`, and `docker-compose` is generally recommended for improved reliability over `podman-compose`, with some platforms (e.g. Mac) failing to startup correctly with Podman. In all cases, recent versions of the installed compose tool are invoked with `podman compose` or `docker compose` as appropriate.
73+
**NOTE:** `docker-compose` can be used with `podman`, and `docker-compose` is generally recommended for improved reliability over `podman-compose`, with some platforms (e.g. Mac) failing to start up correctly with Podman. In all cases, recent versions of the installed compose tool are invoked with `podman compose` or `docker compose` as appropriate.
7374

7475
The ANMS UI should work on all modern browsers.
7576

@@ -112,7 +113,7 @@ docker stop $(docker ps -q); docker rm $(docker ps --all -q); docker system prun
112113

113114
The quickstart script will configure, pull, and start the ANMS system for the first time. See comments in the script for additional details, including optional ENV variables to override default behavior.
114115

115-
NOTICE: By default, quick start will pull pre-built containers from the github registry (ghcr.io). To force a rebuild, run it as `FORCE_REBULD=y ./quickstart.sh`. See the script header for details.
116+
NOTICE: By default, quick start will pull pre-built containers from the github registry (ghcr.io). To force a rebuild, run it as `FORCE_REBUILD=y ./quickstart.sh`. See the script header for details.
116117

117118
To stop the system, use `podman compose -f testenv-compose.yml -f docker-compose.yml down`.
118119

@@ -121,7 +122,7 @@ To start the system in the future, use `podman compose -f testenv-compose.yml up
121122
## Manual Startup
122123
Choose the appropriate docker, podman, or podman-compose commands in the directions below as appropriate for your system.
123124

124-
- Edit `.env` file as appropriately
125+
- Edit `.env` file as appropriate.
125126
- Select appropriate profile(s) as desired.
126127
- Core ANMS services are always started.
127128
- The 'full' profile starts up all UI and related services.
@@ -142,7 +143,7 @@ Choose the appropriate docker, podman, or podman-compose commands in the directi
142143
- `docker compose -f docker-compose.yml build`
143144
- `podman compose -f docker-compose.yml build`
144145
- `podman-compose --podman-build-args='--format docker' -f docker-compose.yml build`
145-
- Note: The docker format argument here enables suppoort for HEALTHCHECK. If omitted, the system will run but will be unable to report the health of the system. This flag does not appear necessary when using the no-dash version of compose.
146+
- Note: The docker format argument here enables support for HEALTHCHECK. If omitted, the system will run but will be unable to report the health of the system. This flag does not appear necessary when using the no-dash version of compose.
146147
- Build test environment images using one of the following:
147148
- `docker compose -f testenv-compose.yml build`
148149
- `podman compose -f testenv-compose.yml build`
@@ -193,7 +194,7 @@ point. With ANMS running, go to `localhost:8080` and log in to the database with
193194

194195
### ADM and Agent Updates
195196

196-
Changes to ADMs are handled on the Manager by uploading a new version of the ADM via the Web UI.
197+
By default after building the system, ANMS starts with the ADMs defined in `deps/dtnma-adms` and ADMs added to `anms-core/extra_adms`. Changes to and adding new ADMs are handled on the Manager by uploading a new version of the ADM via the Web UI or the REST POST endpoint `http://localhost:5555/adms/`.
197198
The manager will then be able to use the new ADM.
198199

199200
Changes to a test Agent are more complicated, and require auto-generated C sources built into the ION source tree.

anms-core/anms/init_adms.py

Lines changed: 0 additions & 81 deletions
This file was deleted.

anms-core/anms/routes/ARIs/ari.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# subcontract 1658085.
2323
#
2424
import asyncio
25-
from functools import cache
2625
from typing import List
2726

2827
from fastapi import Depends, APIRouter
@@ -36,7 +35,6 @@
3635
from anms.models.relational import get_async_session
3736
from anms.models.relational.actual_parameter import ActualParameter
3837
from anms.models.relational.ari import ARI
39-
from anms.models.relational.adms.data_model_view import DataModel
4038
from anms.models.relational.formal_parameter import FormalParameter
4139

4240

anms-core/anms/routes/adms/adm.py

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -126,71 +126,11 @@ async def remove_adm(enumeration: int, namespace:str):
126126
logger.debug(f"ADM ENUM:{enumeration} in NAMESPACE {namespace} not a known ADM")
127127
raise HTTPException(status_code = status.HTTP_400_BAD_REQUEST, detail = f"ADM ENUM:{enumeration} in NAMESPACE {namespace} not a known ADM")
128128

129-
130-
131-
async def handle_adm(admset: ace.AdmSet, adm_file: ace.models.AdmModule, session, replace=True):
132-
''' Process a received and decoded ADM into the ANMS DB.
133-
134-
:param replace: If true and the ADM exists it will be checked and replaced.
135-
:return: A list of issues with the ADM, which is empty if successful.
136-
'''
137-
logger.info("Adm name: %s", adm_file.norm_name)
138-
data_model_view = await DataModel.get(adm_file.ns_model_enum,adm_file.ns_org_name )
139-
if data_model_view:
140-
if not replace:
141-
logger.info('Not replacing existing ADM name %s', adm_file.norm_name)
142-
return []
143-
data_rec = None
144-
async with get_async_session() as session:
145-
data_rec,_ = await AdmData.get(data_model_view.data_model_id,session)
146-
147-
if data_rec:
148-
# Compare old and new contents
149-
logger.info("Checking existing ADM name %s", adm_file.norm_name)
150-
old_adm = admset.load_from_data(io.BytesIO(data_rec.data), del_dupe=False)
151-
comp = AdmCompare(admset)
152-
if not comp.compare_adms(old_adm, adm_file):
153-
issues = comp.get_errors()
154-
else:
155-
issues = [f"Updating existing adm is not allowed yet"]
156-
return issues
157-
158-
logger.info("Inserting ADM name %s", adm_file.norm_name)
159-
160-
# Use CAmPython to generate sql
161-
out_path = "" # This is empty string since we don't need to write the generated sql to a file
162-
sql_dialect = 'pgsql'
163-
writer = create_sql.Writer(admset, adm_file, out_path, sql_dialect)
164-
string_buffer = io.StringIO()
165-
writer.write(string_buffer)
166-
167-
# execute generated Sql
168-
queries = string_buffer.getvalue()
169-
try:
170-
await session.execute(queries)
171-
await session.commit()
172-
except Exception as err:
173-
logger.error(f"{sql_dialect} execution error: {err.args}")
174-
logger.debug('%s', traceback.format_exc())
175-
raise
176-
177-
# Save the adm file of the new adm
178-
179-
180-
buf = io.StringIO()
181-
ace.adm_yang.Encoder().encode(adm_file, buf)
182-
ret_dm = await DataModel.get(adm_file.ns_model_enum, adm_file.ns_org_name, session)
183-
184-
# Write the encoded string data to the BytesIO object
185-
bytes_io = io.BytesIO()
186-
bytes_io.write(buf.getvalue().encode('utf-8'))
187-
# Reset the pointer to the beginning
188-
bytes_io.seek(0)
189-
data = {"enumeration":ret_dm.data_model_id, "data": bytes_io.getvalue()}
190-
await AdmData.add_data(data, session)
191-
192-
return []
193-
129+
@router.post("/load_default", status_code=status.HTTP_201_CREATED)
130+
async def load_default_adm():
131+
await TRANSMORGIFIER.load_default_adms()
132+
response = JSONResponse(status_code=status.HTTP_200_OK, content={"message": "Initilized default ADMs", "error_details": ""})
133+
return response
194134

195135
@router.post("/", status_code=status.HTTP_201_CREATED,
196136
responses={400: {"model": RequestError}, 405: {"model": UpdateAdmError}, 500: {"model": RequestError}})

0 commit comments

Comments
 (0)