Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageshell
titleShell
├── Dockerfile                   <-- 2 file where to add the new support
├── Dockerfile.all
├── Dockerfile.base
├── LICENSE
├── README.md
├── build
├── build-base
├── epics-support-template-infn  <-- JNJA2 templates for not ibekizable supports
├── ibek-support                 <-- DLS base ibek-support
├── ibek-support-infn            <-- 1 INFN specific ibek supports ADD NEW support HERE
├── ibek-templates               <-- 3 JNJA2 templates to generalize, make sophisticated templates and allow parameters to be given

To add a support:


2- Create support directory 

Suppose your new support is named  <mynewsupportname>

create add a directory in ibek-support-infn/<mynewsupportname> this directory must contain two files (:

- mynewsupportname.ibek.support.yaml
- mynewsupportname.install.yml

...

Code Block
languageshell
titleShell
ibek-support-infn
│   ├── mynewsupportname
│   │   ├── mynewsupportname.ibek.support.yaml   <== here the st.cmd yaml translation instruction
│   │   ├── mynewsupportname.install.yml         <== here the instruction to install
│   ├── Tektronix_MSO58LP
│   │   ├── Tektronix_MSO58LP.ibek.support.yaml
│   │   └── Tektronix_MSO58LP.install.yml


3- Create the install support file  mynewsupportname.install.yml

mynewsupportname.install.yml

...

Code Block
languageyaml
titlemynewsupportname.install.yml
# yaml-language-server: $schema=../../ibek-support/_scripts/support_install_variables.json

module: mynewsupportname ## your git project name
version: devel ## your reversion/tag

# this module uses modbus so requires none of its own libs/dbds
organization: https://github.com/infn-epics/ ## your git organization name

dbds:								## here the dbds used by your ioc/support
  - asyn.dbd
  - stream.dbd
  - calc.dbd
  - asSupport.dbd
  - sscan.dbd
  - <mynewsupportname>.dbd

libs:								#here 
  - asyn
  - stream
  - calc
  - autosave
  - sscan
  - <mynewsupportname>Support  ## if you have support libs


protocol_files:
  - db/<mynewsupportname>.proto ## if you have protocols file


4- Create the support file  mynewsupportname.install.yml

mynewsupportname.ibek.support.yaml

Here you have to instruct how the yaml expand in the st.cmd of your IOC. For rxexample:


Code Block
languageyaml
titlemynewsupportname.install.yml
# yaml-language-server: $schema=https://github.com/epics-containers/ibek/releases/download/3.1.2/ibek.support.schema.json


module: mynewsupportname

entity_models:
  - name: mycontroller
    description: |-
      Create a my controller
    parameters:
      name:
        type: id
        description: |-
          The name of the controller and its Asyn Port Name
      P:
        type: str
        description: |-
          Device PV Prefix
      IP:
        type: str
        description: |-
          IP address of the ethernet2serial
        default: 127.0.0.1 ## localhost

      TCPPORT:
        type: int
        description: |-
          Port of the ethernet2serial
        default: 4001

      ASYNPRIO:
        type: int
        description: |-
          ASYN   PRIORITY, Default : 0
        default: 0

      AUTOCONNECT:
        type: int
        description: |-
          Asyn auto connect
          0: Auto connection
          1: no Auto connection
        default: 0

      NOPRECESSESOS:
        type: int
        description: |-
          ASYN   noProcessEos, Default : 0
          https://epics.anl.gov/tech-talk/2020/msg01705.php
        default: 0

      TPG_UNDERRANGE_ALARM_SEVERITY_A1:
        type: enum
        description: |-
            underrange severity A1
        values:
          MINOR:
          MAJOR:
          NO_ALARM:
        default: MINOR
      
      TPG_UNDERRANGE_ALARM_SEVERITY_A2:
        type: enum
        description: |-
            underrange severity A2
        values:
          MINOR:
          MAJOR:
          NO_ALARM:
        default: MINOR
      
      TPG_UNDERRANGE_ALARM_SEVERITY_B1:
        type: enum
        description: |-
            underrange severity 
        values:
          MINOR:
          MAJOR:
          NO_ALARM:
        default: MINOR

      TPG_UNDERRANGE_ALARM_SEVERITY_B2:
        type: enum
        description: |-
            underrange severity 
        values:
          MINOR:
          MAJOR:
          NO_ALARM:
        default: MINOR
        
    pre_init:
      - value: |
          drvAsynIPPortConfigure("{{name}}", "{{IP}}:{{TCPPORT}}", 0, 0, 0)
          epicsEnvSet "STREAM_PROTOCOL_PATH", "/epics/support/configure/protocol/"

    
        
 
    databases:
      - file: <mymodule1>.db
        args:
          P: 
          PORT: '{{name}}'
          TPG_UNDERRANGE_ALARM_SEVERITY_A1:
          TPG_UNDERRANGE_ALARM_SEVERITY_A2:
          TPG_UNDERRANGE_ALARM_SEVERITY_B1:
          TPG_UNDERRANGE_ALARM_SEVERITY_B2:
          

  - name: mychannel
    description: |-
      Template database for a channel
    parameters:
      controller:
        type: object
        description: |-
          a reference to the controller
      name:
        type: str
        description: |-
          channel prefix
        
      channel:
        type: enum
        description: |-
          Channel 
        values:
          A1:
          A2:
          B1:
          B2:
      
      TPG_UNDERRANGE_ALARM_SEVERITY:
        type: enum
        description: |-
            underrange severity 
        values:
          MINOR:
          MAJOR:
          NO_ALARM:
        default: MINOR


    databases:
      - file: $(MYMODULENAME)/mydb2.template
        args:
          P: '{{controller.P}}'
          NAME: '{{name}}'
          CHAN: '{{channel}}'
          PORT: '{{controller.name}}'
          TPG_UNDERRANGE_ALARM_SEVERITY:

5- Add the new support  to the container 

Edit Dockerfile  and add two lines for mynewsupportname


Code Block
languagedocker
titleDockerfile
.....

COPY ibek-support-infn/motorMicos motorMicos/
RUN ansible.sh motorMicos

COPY ibek-support-infn/cagateway cagateway
RUN ansible.sh cagateway

COPY ibek-support-infn/mynewsupportname mynewsupportname   ## NEW support
RUN ansible.sh mynewsupportname							   ##


6- Build the container inside VScode

CTRL(or Command)+Shift+P (Rebuild Container or open directory in container)

If the build succeed your support has been re-compiled successfully, otherwise check the errors.


7- Create/update a JNJA2 template that use your new support

Your new support to be instantiated needs a YAML that parametrize the values that you defined in your support so for instance for your support a valid YAML could be:

Code Block
languageyaml
titlemynewsupportname.yaml
iocname: mynewioc
description: test


entities:
  - type: mynewsupportname.mycontroller
    name: MYCONTROLLER
    P: "MYBEAMLINE:TEST"
    IP: "192.168.1.1"
    TCPPORT: 4001
        
  - type: mynewsupportname.mychannel
    controller: MYCONTROLLER
    name: "PIPPO"
    channel: A1


Normally a particular module/IOC is re-used multiple time and may include many different types/cases instead to have many YAMLs to configure each of them a single JNJA2 template is written yaml.j2 JNJA2 is a powerful preprocess language that may be applied to any form of text to perform substitutions, logic and flow, it's used in many contextes to create templates. 

So the previous YAML can be templated to be used by EPIK8S. In particular the yaml (deploy/values.yaml) that describes your EPIK8s beamline  will initialize your template.

Code Block
languageyaml
titlemynewsupportname.yaml.j2
iocname: {{iocname}}
description: Templated test


entities:

  - type: {{devtype}}.controller
    name: MYCONTROLLER
    P: "{{iocprefix}}"
    IP: {{server}}
    TCPPORT: {{[port}}
  {%- for t in devices %}
  - type: {{devtype}}.channel
  	controller: MYCONTROLLER
  	name: "{{ t.name }}"
  	channel: {{ t.channel }}
  {%- endfor %}

Deploy on the target EPIK8S 

...