diff --git a/Makefile b/Makefile index e93ec3de..10e11ba7 100644 --- a/Makefile +++ b/Makefile @@ -6,19 +6,19 @@ delete: role: @if [ -z "${TARGET}" ]; then \ - ./scripts/manage_collection.py add role; \ + pixi run make-role; \ else \ - ./scripts/manage_collection.py $(TARGET) role; \ + pixi run $(TARGET)-role; \ fi git status module: @if [ -z "${TARGET}" ]; then \ - ./scripts/manage_collection.py add module; \ + pixi run make-module; \ else \ - ./scripts/manage_collection.py $(TARGET) module; \ + pixi run $(TARGET)-module; \ fi git status report: - ./scripts/manage_collection.py report + pixi run report diff --git a/pixi.toml b/pixi.toml index 8f03c8a6..de16f061 100644 --- a/pixi.toml +++ b/pixi.toml @@ -10,12 +10,12 @@ version = "1.2.0" default = { solve-group = "default" } [tasks] -make-role = "make role" -make-module = "make module" -update-module = "make update module" -delete-role = "make delete role" -delete-module = "make delete module" -report = "make report" +make-role = "scripts/manage_collection.py add role" +make-module = "scripts/manage_collection.py add module" +update-module = "scripts/manage_collection.py update module" +delete-role = "scripts/manage_collection.py delete role" +delete-module = "scripts/manage_collection.py delete module" +report = "scripts/manage_collection.py report" lint-changes = "pre-commit" lint = "pre-commit run --all-files" ruff-fix = "ruff check --fix" diff --git a/roles/deploy_ioc/vars/adxspd.yml b/roles/deploy_ioc/vars/adxspd.yml new file mode 100644 index 00000000..33fbb5cf --- /dev/null +++ b/roles/deploy_ioc/vars/adxspd.yml @@ -0,0 +1,16 @@ +--- + +deploy_ioc_use_ad_common: true +deploy_ioc_required_module: adxspd_986de77 +deploy_ioc_template_root_path: + "{{ deploy_ioc_required_module_path }}/iocs/xspdIOC" +deploy_ioc_req_file_list: + - name: auto_settings.req + macros: "P=$(PREFIX)" +deploy_ioc_device_specific_env: + PORT: "XSPD1" + QSIZE: 20 + NCHANS: 2048 + CBUFFS: 500 + MAX_THREADS: 8 + EPICS_DB_INCLUDE_PATH: "$(ADCORE)/db" diff --git a/roles/device_roles/adxspd/README.md b/roles/device_roles/adxspd/README.md new file mode 100644 index 00000000..1de6d3ea --- /dev/null +++ b/roles/device_roles/adxspd/README.md @@ -0,0 +1,3 @@ +# adxspd + +Ansible role for deploying ADXSPD IOC instances. diff --git a/roles/device_roles/adxspd/example.yml b/roles/device_roles/adxspd/example.yml new file mode 100644 index 00000000..9eaf5406 --- /dev/null +++ b/roles/device_roles/adxspd/example.yml @@ -0,0 +1,13 @@ +--- + +adxspd-01: + type: adxspd + environment: + ENGINEER: C. Engineer + PREFIX: XF:31ID1-ES{XSPD-Det:1} + XSIZE: 1576 + YSIZE: 1200 + NUM_MODULES: 1 + IP: "192.168.1.1" + PORT_NUM: 8008 + DEVICE_ID: "lambda01" diff --git a/roles/device_roles/adxspd/schema.yml b/roles/device_roles/adxspd/schema.yml new file mode 100644 index 00000000..07388700 --- /dev/null +++ b/roles/device_roles/adxspd/schema.yml @@ -0,0 +1,15 @@ +--- + +type: enum("adxspd") +environment: + ENGINEER: str() + PREFIX: str() + XSIZE: int() + YSIZE: int() + NUM_MODULES: int() + IP: any(hostname(), ip()) + PORT_NUM: int() + + # Optional device identifier. + # If not specified, first device discovered will be used. + DEVICE_ID: str(required=False) diff --git a/roles/device_roles/adxspd/tasks/main.yml b/roles/device_roles/adxspd/tasks/main.yml new file mode 100644 index 00000000..93458f93 --- /dev/null +++ b/roles/device_roles/adxspd/tasks/main.yml @@ -0,0 +1,18 @@ +--- +# Tasks for adxspd role + +- name: Install base.cmd + ansible.builtin.template: + src: templates/base.cmd.j2 + dest: "{{ deploy_ioc_ioc_directory }}/iocBoot/base.cmd" + mode: "0664" + owner: "{{ host_config.softioc_user }}" + group: "{{ host_config.softioc_group }}" + +- name: Install auto_settings.req + ansible.builtin.template: + src: templates/auto_settings.req.j2 + dest: "{{ deploy_ioc_as_directory }}/req/auto_settings.req" + mode: "0664" + owner: "{{ host_config.softioc_user }}" + group: "{{ host_config.softioc_group }}" diff --git a/roles/device_roles/adxspd/templates/auto_settings.req.j2 b/roles/device_roles/adxspd/templates/auto_settings.req.j2 new file mode 100644 index 00000000..90586ffb --- /dev/null +++ b/roles/device_roles/adxspd/templates/auto_settings.req.j2 @@ -0,0 +1,8 @@ +file "ADXSPD_settings.req", P=$(P), R=cam1: +file "commonPlugin_settings.req", P=$(P) +{% if deploy_ioc_merged_env.FFMPEGSERVER is defined and ioc.environment.FFMSTREAM_PORT is defined%} +file "ffmpegServer_settings.req", P=$(P), R=ffmstream1: +{% endif %} +{% if deploy_ioc_merged_env.ADCOMPVISION is defined %} +file "NDCV_settings.req", P=$(P), R=CV1: +{% endif %} diff --git a/roles/device_roles/adxspd/templates/base.cmd.j2 b/roles/device_roles/adxspd/templates/base.cmd.j2 new file mode 100644 index 00000000..57ab793e --- /dev/null +++ b/roles/device_roles/adxspd/templates/base.cmd.j2 @@ -0,0 +1,17 @@ + +dbLoadDatabase("{{ deploy_ioc_template_root_path }}/dbd/{{ deploy_ioc_executable }}.dbd") +{{ deploy_ioc_executable }}_registerRecordDeviceDriver(pdbbase) + +# adxspd specific commands +{% if ioc.environment.DEVICE_ID is defined %} +ADXSPDConfig("$(PORT)", "$(IP):$(PORT_NUM)", "$(DEVICE_ID)") +{% else %} +ADXSPDConfig("$(PORT)", "$(IP):$(PORT_NUM)") +{% endif %} + +dbLoadRecords("$(ADXSPD)/db/ADXSPD.template","P=$(PREFIX),R=cam1:,PORT=$(PORT),ADDR=0,TIMEOUT=1") +{% for module_index in range(1, ioc.environment.NUM_MODULES + 1) %} +dbLoadRecords("$(ADXSPD)/db/ADXSPDModule.template", "P=$(PREFIX), R=mod{{ module_index }}:,PORT=$(PORT)_MOD{{ module_index }},ADDR=0,TIMEOUT=1") +{% endfor %} + +set_requestfile_path("$(ADXSPD)/xspdApp/Db") diff --git a/roles/install_module/vars/adxspd_986de77.yml b/roles/install_module/vars/adxspd_986de77.yml new file mode 100644 index 00000000..73a7a37b --- /dev/null +++ b/roles/install_module/vars/adxspd_986de77.yml @@ -0,0 +1,13 @@ +--- + +adxspd_986de77: + name: ADXSPD + version: 986de77 + url: https://github.com/NSLS2/ADXSPD + include_base_ad_config: True + executable: xspdApp + pkg_deps: + - curl-devel + module_deps: + - adcompvision_9750d13 + - adcore_60080dc