Versions Compared

Key

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

...

Code Block
languagebash
titleCamera development start
docker run --network=host -v .:/epics/ioc/config -it baltig.infn.it:4567/epics-containers/infn-epics-ioc

IBEK support and "IBEKisation step"

To allow an easy portability of a IOC (in particular IOC that can run inside containers) once an IOC or support is ready and tested, the next step is the DiamonLightSsource "ibekization". This steps in few words allows to instantiate a general st.cmd with support through a simple YAML file. 

1- Add a new support in infn-epics-ioc

Once your IOC has its own GIT project, clone the infn-epics-ioc project that is the project the build the container with all IOC supports for infn.

...

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


2- Create support directory 

Suppose your new support is named  <mynewsupportname>

...

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

...

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.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 %}

...

8- Test your support with template

...


9- Commit, Tag to create a new image

Deploy on the target EPIK8S 

...