From 9ff0b4bd673479d801174e521d1b49fbcff97f6f Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 8 Aug 2019 17:17:21 +0200 Subject: [PATCH] use dns, iocinfo, caputLog, epics7 --- network.fin | 17 ++++----- network.hipa | 14 +++++--- network.proscan | 15 ++++---- network.sls | 22 ++++++------ network.trfcb | 8 ++--- startup.script_common | 81 +++++++++++++++++++++++++++++++------------ startup.script_linux | 24 ++++++++++--- startup.script_part3 | 13 ++----- 8 files changed, 121 insertions(+), 73 deletions(-) diff --git a/network.fin b/network.fin index 10c4261..c914619 100644 --- a/network.fin +++ b/network.fin @@ -1,9 +1,10 @@ # setup mount points -hostAdd ("fileserver","129.129.145.56") -nfsMount ("fileserver", "/export/fin/ioc", "/ioc") -nfsMount ("fileserver", "/export/fin/work", "/fin/work") -nfsMount ("fileserver", "/export/fin/prod", "/fin/prod") -nfsMount ("fileserver", "/export/fin/devl", "/fin/devl") -nfsMount (&sysBootHost, "/home/ioc", "/home/ioc") -putenv("EPICS_CA_AUTO_ADDR_LIST=NO") -putenv("EPICS_CA_ADDR_LIST=172.21.10.255 172.21.11.255 172.21.12.255 172.21.13.255") +nfsMount "gfa-fs", "/export/fin/ioc", "/ioc" +nfsMount "gfa-fs", "/export/fin/work", "/fin/work" +nfsMount "gfa-fs", "/export/fin/prod", "/fin/prod" +nfsMount "gfa-fs", "/export/fin/devl", "/fin/devl" +nfsMount "gfa-fs", "/export/gfa-epics/epics", "/epics" +nfsMount &sysBootHost, "/home/ioc", "/home/ioc" + +putenv "EPICS_CA_AUTO_ADDR_LIST=NO" +putenv "EPICS_CA_ADDR_LIST=172.21.10.255 172.21.11.255 172.21.12.255 172.21.13.255" diff --git a/network.hipa b/network.hipa index 4633b3e..c03f1b9 100644 --- a/network.hipa +++ b/network.hipa @@ -1,7 +1,11 @@ +FACILITY="HIPA" + # setup mount points -hostAdd ("fileserver","129.129.145.42") -nfsMount ("fileserver","/export/hipa/work","/hipa/work") -nfsMount ("fileserver","/export/hipa/prod","/hipa/prod") -nfsMount ("fileserver","/export/hipa/ioc","/ioc") -nfsMount (&sysBootHost, "/home/ioc", "/home/ioc") +nfsMount "hipa-fs", "/export/hipa/ioc", "/ioc" +nfsMount "hipa-fs", "/export/hipa/work", "/hipa/work" +nfsMount "hipa-fs", "/export/gfa-epics/epics", "/epics" +nfsMount &sysBootHost, "/home/ioc", "/home/ioc" + nfsAuthUnixSet &sysBootHost,500,9102 +putenv "EPICS_CA_ADDR_LIST=172.19.10.255 172.19.30.255" +putenv "EPICS_CA_AUTO_ADDR_LIST=NO" diff --git a/network.proscan b/network.proscan index 2f1b24b..a40a4b9 100644 --- a/network.proscan +++ b/network.proscan @@ -1,8 +1,9 @@ # setup mount points -hostAdd ("fileserver","129.129.145.66") -nfsMount ("fileserver","/export/proscan/ioc","/ioc") -nfsMount ("fileserver","/export/proscan/work","/proscan/work") -nfsMount ("fileserver","/export/proscan/prod","/proscan/prod") -nfsMount (&sysBootHost, "/home/ioc", "/home/ioc") -putenv("EPICS_CA_AUTO_ADDR_LIST=NO") -putenv("EPICS_CA_ADDR_LIST=172.25.11.255 172.25.60.255") +nfsMount "proscan-fs", "/export/proscan/ioc", "/ioc" +nfsMount "proscan-fs", "/export/proscan/work", "/proscan/work" +nfsMount "proscan-fs", "/export/proscan/prod", "/proscan/prod" +nfsMount "proscan-fs", "/export/gfa-epics/epics", "/epics" +nfsMount &sysBootHost, "/home/ioc", "/home/ioc" + +putenv "EPICS_CA_AUTO_ADDR_LIST=NO" +putenv "EPICS_CA_ADDR_LIST=172.25.11.255 172.25.60.255" diff --git a/network.sls b/network.sls index 547b1b3..fb34c84 100644 --- a/network.sls +++ b/network.sls @@ -1,22 +1,22 @@ # Accept SLSBASE or INSTBASE PBASE=0 -symFindByName(sysSymTbl,"INSTBASE",&PBASE,0) -symFindByName(sysSymTbl,"SLSBASE",&PBASE,0) +symFindByName sysSymTbl,"INSTBASE",&PBASE,0 +symFindByName sysSymTbl,"SLSBASE",&PBASE,0 SLSBASE=*PBASE INSTBASE=*PBASE # Router for SLS machine net (fails otherwise but that's ok) -routeAdd ("0.0.0.0","172.20.10.1") +routeAdd "0.0.0.0","172.20.10.1" # setup mount points (try both possible locations for /ioc) -hostAdd ("slsfs","129.129.145.52") -nfsMount (&sysBootHost, "/home/ioc", "/home/ioc") -nfsMount (&sysBootHost, "/ioc", "/ioc") -nfsMount ("slsfs", "/export/csa/releases/ioc", "/ioc") -nfsMount ("slsfs","/export/csa/releases/work","/work") -nfsMount ("slsfs","/export/csa/releases/prod","/prod") -nfsMount ("slsfs","/export/csa/releases/devl","/devl") -nfsMount ("slsfs","/export/exchange","/exchange") +nfsMount &sysBootHost, "/home/ioc", "/home/ioc" +nfsMount "slsfs01", "/export/csa/releases/ioc", "/ioc" +nfsMount "slsfs01", "/export/csa/releases/work", "/work" +nfsMount "slsfs01", "/export/csa/releases/prod", "/prod" +nfsMount "slsfs01", "/export/csa/releases/devl", "/devl" +nfsMount "slsfs01", "/export/exchange", "/exchange" +nfsMount "slsfs01", "/export/gfa-epics/epics", "/epics" +nfsMount &sysBootHost, "/ioc", "/ioc" # overwrite driver module location EPICS_MODULES = "/work/iocBoot/modules" diff --git a/network.trfcb b/network.trfcb index 597f23b..d31df7f 100644 --- a/network.trfcb +++ b/network.trfcb @@ -1,5 +1,5 @@ # setup mount points -hostAdd ("fileserver","129.129.145.56") -nfsMount ("fileserver", "/export/trfcb/ioc", "/ioc") -nfsMount ("fileserver", "/export/trfcb/work", "/trfcb/work") -nfsMount (&sysBootHost, "/home/ioc", "/home/ioc") +nfsMount "gfa-fs-1", "/export/trfcb/ioc", "/ioc" +nfsMount "gfa-fs-1", "/export/trfcb/work", "/trfcb/work" +nfsMount "gfa-fs-1", "/export/gfa-epics/epics","/epics" +nfsMount &sysBootHost, "/home/ioc", "/home/ioc" diff --git a/startup.script_common b/startup.script_common index b1de8ac..5f2724e 100644 --- a/startup.script_common +++ b/startup.script_common @@ -9,7 +9,7 @@ EPICS_MODULES = "/ioc/modules" # find a better way later to know current require version -REQUIRE_VERSION="2.5.2" +REQUIRE_VERSION="2.9.2" #set EPICS_HOST_ARCH according to vxWorks version and cpu type VX6=(*runtimeVersion>>24)&255-'5' @@ -27,8 +27,8 @@ STRINGBUFFER=malloc(256) sprintf STRINGBUFFER, "%s (startup.script aborted) > ", IOC shellPromptSet STRINGBUFFER -# time server -putenv "EPICS_TS_NTP_INET=129.129.190.1" +# Set DNS if necessary +resolvInit "129.129.190.11","psi.ch" # do the NFS mounts and other network dependend stuff < ../../startup/network @@ -42,11 +42,10 @@ putenv STRINGBUFFER sprintf STRINGBUFFER, "EPICS_HOST_ARCH=%s", EPICS_HOST_ARCH putenv STRINGBUFFER -# setup logging to gfa-syslog -putenv "EPICS_IOC_LOG_INET=gfa-syslog" -putenv "EPICS_IOC_LOG_PORT=1514" - # create some path variables +BASEBIN=malloc(80) +sprintf BASEBIN, "/epics/base-%s/bin/%s", EPICS+1, EPICS_HOST_ARCH + HOME=malloc(80) sprintf HOME, "/ioc/%s", IOC sprintf STRINGBUFFER, "HOME=%s", HOME @@ -78,19 +77,35 @@ sprintf TEMPLATES, ".:%s/iocBoot/templates", INSTBASE # at the moment snp24 does not work with this memAddToPool (sysMemTop(),sysPhysMemTop()-sysMemTop()) EXTENDED_MEMORY=0 -#EXTENDED_MEMORY=sysPhysMemTop()-sysMemTop() -# load EPICS system core (different names for 3.13 and 3.14) -sprintf STRINGBUFFER, "%s/iocCore%s", LIB, strncmp(EPICS,"R3.13.",6) ? "Library.munch" : "" +# Setup Time +# 2019: +putenv "EPICS_TIMEZONE=MET::-60:033102:102703" +putenv "EPICS_TS_MIN_WEST=-60" +putenv "EPICS_TS_NTP_INET=129.129.190.1" +putenv "EPICS_TS_FORCE_NTPTIME=YES" + +# Need to branch a few times on EPICS base release +R3_13=strncmp(EPICS,"R3.13.",6)==0 +R3_14=strncmp(EPICS,"R3.14.",6)==0 + +# Load EPICS system core (different names for different EPICS versions) +# Unfortunately we have no 'if' and line length is quite limited +# 3.13: load "iocCore" +# 3.14: load "iocCoreLibrary.munch" +# 3.15+: load "softIoc.munch" (could do this from 3.14.12 on) +sprintf STRINGBUFFER, "%s/%s",BASEBIN,R3_13?"iocCore":R3_14?"iocCoreLibrary.munch":"softIoc.munch" +printf "loading %s\n",STRINGBUFFER ld 0, 0, STRINGBUFFER -# TIMEZONE must be set after loading iocCoreLibrary.munch and before iocInit -# 2017: -putenv "TIMEZONE=MET::-60:032602:102903" -putenv "EPICS_TS_MIN_WEST=-60" -# EPICS 3.13 needs this to not use synchronized timestamps -sprintf STRINGBUFFER,strncmp(EPICS,"R3.13.",6) ? ";" : "TSconfigure(0,10,10,18323,18322,250,1)" -execute STRINGBUFFER +# Start Logging +putenv "EPICS_IOC_LOG_INET=gfa-syslog" +putenv "EPICS_IOC_LOG_PORT=1514" +iocLogInit +errlogPrintf "Starting EPICS %s\n", EPICS + +# Allow backward compatible non-monotonic breaktables for EPICS > 3.14.8 +dbBptNotMonotonic=1 # try for user-defined menus scan and convert dbLoadDatabase "dbd/scan.dbd" @@ -98,6 +113,12 @@ dbLoadDatabase "dbd/convert.dbd" dbLoadDatabase "dbd/slsConvert.dbd" taskDelay sysClkRateGet() +sprintf STRINGBUFFER,R3_13||R3_14?";":"dbLoadDatabase \"/epics/base-%s/dbd/softIoc.dbd\"",EPICS+1 +execute STRINGBUFFER + +sprintf STRINGBUFFER,R3_13||R3_14?";":"softIoc_registerRecordDeviceDriver pdbbase" +execute STRINGBUFFER + # load "require" sprintf STRINGBUFFER, "require_VERSION=%s", getenv("require_VERSION") ? getenv("require_VERSION") : REQUIRE_VERSION putenv STRINGBUFFER @@ -107,16 +128,29 @@ sprintf STRINGBUFFER, "%s/lib/%s/requireLib.munch", getenv("require_DIR"), EPICS ld 0, 0, STRINGBUFFER #load standard drivers (allow user to specify version in environment variable) -require "base", getenv("base_VERSION") +require "base", getenv("base_VERSION") ? getenv("base_VERSION") : "ifexists" registerModule "require", getenv("require_VERSION"), getenv("require_DIR") -sprintf STRINGBUFFER,strncmp(EPICS,"R3.13.",6) ? "require_registerRecordDeviceDriver pdbbase" : ";" +sprintf STRINGBUFFER,R3_13?";":"require_registerRecordDeviceDriver pdbbase" execute STRINGBUFFER require "utilities", getenv("utilities_VERSION") require "misc", getenv("misc_VERSION") -require "seq", getenv("seq_VERSION") ? getenv("seq_VERSION") : "ifexists" + +# caPutLog +#epicsEnvSet "EPICS_CA_PUT_LOG_ADDR", "gfa-syslog:1515 sf-logstash.psi.ch:1515" +epicsEnvSet "EPICS_CA_PUT_LOG_PREFIX", IOC +require "caPutLog", getenv("caPutLog_VERSION")?getenv("caPutLog_VERSION"):"ifexists" # IOC monitoring -require "iocmon", getenv("iocmon_VERSION") +require R3_13||R3_14?"iocmon":"iocStats", getenv(R3_13||R3_14?"iocmon_VERSION":"iocStats_VERSION") + +# Battery monitoring +require "M48T37", "ifexists" + +# Database Upload +require "iocinfo", getenv("iocinfo_VERSION") + +# Sequencer for backward compatibility with missing dependencies +require "seq", R3_13||R3_14?"2.0":"none" # run EPICS only on 1st network port putenv "EPICS_CA_AUTO_ADDR_LIST=NO" @@ -125,7 +159,8 @@ putenv bootInfo("EPICS_CAS_INTF_ADDR_LIST=%e") putenv "EPICS_CAS_AUTO_BEACON_ADDR_LIST=NO" putenv bootInfo("EPICS_CAS_BEACON_ADDR_LIST=%B") -# insert boot infos into database -bootNotify INSTBASE, "sls/bin/iocBootNotify.sh" +# EPICS 3.13 needs this to not use synchronized timestamps +sprintf STRINGBUFFER,R3_13?"TSconfigure(0,10,10,18323,18322,250,1)":";" +execute STRINGBUFFER # end of startup.script_common diff --git a/startup.script_linux b/startup.script_linux index 06ff33d..268cfdc 100644 --- a/startup.script_linux +++ b/startup.script_linux @@ -24,8 +24,11 @@ epicsEnvSet CA_172.21.13,"172.21.10.255 172.21.11.255 172.21.12.255" epicsEnvSet CA_172.26,"172.26.0.255 172.26.2.255 172.26.8.255 172.26.16.255 172.26.24.255 172.26.32.255 172.26.40.255 172.26.110.255 172.26.111.255 172.26.120.255 129.129.242.255 129.129.243.255" epicsEnvSet CA_AUTO_172.26,"NO" # ESA/ESB to machine via gateway -epicsEnvSet CA_129.129.242,"sfes-cagw:5062" -epicsEnvSet CA_129.129.243,"sfes-cagw:5062" +#epicsEnvSet CA_129.129.242,"sfes-cagw:5062" +#epicsEnvSet CA_129.129.243,"sfes-cagw:5062" +# ESA/ESB to machine via directed broadcast +epicsEnvSet CA_129.129.242,"172.26.0.255 172.26.2.255 172.26.8.255 172.26.16.255 172.26.24.255 172.26.32.255 172.26.40.255 172.26.110.255 172.26.111.255 172.26.120.255 129.129.242.255 129.129.243.255" +epicsEnvSet CA_129.129.243,"172.26.0.255 172.26.2.255 172.26.8.255 172.26.16.255 172.26.24.255 172.26.32.255 172.26.40.255 172.26.110.255 172.26.111.255 172.26.120.255 129.129.242.255 129.129.243.255" # HIPA epicsEnvSet CA_172.19,"172.19.10.255 172.19.30.255" @@ -38,9 +41,9 @@ epicsEnvSet CA_AUTO_172.25,"NO" # All others can work with the defaults: automatic # Apply settings dependent on network -system ("/sbin/ifconfig | awk -F '[.: ]+' -v P='epicsEnvSet NET' -v K=, '/192.168/ {next} /Bcast/ {print P 1 K $9; print P 2 K $10; print P 3 K $11; exit}'>/tmp/$(IOC).net") +system "/sbin/ifconfig|awk -F '[.: ]+' -vP=epicsEnvSet -vN=NET -vI=IPADDR -vB=BCADDR -vD=. '/192\.168/{next}/Bcast/{print P,N 1,$9ORS P,N 2,$10ORS P,N 3,$11ORS P,I,$4D$5D$6D$7ORS P,B,$9D$10D$11D$12;exit}/broadcast/{print P,N 1,$13ORS P,N 2,$14ORS P,N 3,$15ORS P,I,$3D$4D$5D$6ORS P,B,$13D$14D$15D$16;exit}'>/tmp/$(IOC).net" < /tmp/$(IOC).net -system ("rm /tmp/$(IOC).net") +system "rm /tmp/$(IOC).net" epicsEnvSet EPICS_CA_ADDR_LIST,"$(CA_$(NET1=).$(NET2=).$(NET3=)=$(CA_$(NET1=).$(NET2=)=))" epicsEnvSet EPICS_CA_AUTO_ADDR_LIST,"$(CA_AUTO_$(NET1=).$(NET2=).$(NET3=)=$(CA_AUTO_$(NET1=).$(NET2=)=YES))" epicsEnvSet EPICS_CAS_BEACON_ADDR_LIST,"$(CA_BEACON_$(NET1=).$(NET2=).$(NET3=)=$(CA_BEACON_$(NET1=).$(NET2=)=$(EPICS_CA_ADDR_LIST)))" @@ -53,6 +56,17 @@ epicsEnvSet CFG, $(PWD)/cfg epicsEnvSet STREAM_PROTOCOL_PATH, .:$(PWD)/cfg # IOC monitoring -require iocStats $(iocStats_VERSION=) +require iocStats $(iocStats_VERSION=ifexists) + +# Database Upload +require iocinfo $(iocinfo_VERSION=ifexists) + +# Logging +epicsEnvSet EPICS_IOC_LOG_INET, gfa-syslog +epicsEnvSet EPICS_IOC_LOG_PORT, 1514 +iocLogInit +epicsEnvSet EPICS_CA_PUT_LOG_ADDR, "gfa-syslog:1515 sf-logstash.psi.ch:1515" +epicsEnvSet EPICS_CA_PUT_LOG_PREFIX, $(IOC) +require caPutLog $(caPutLog_VERSION=ifexists) ! iocBootNotify.sh $(IOC) - \"\${SHELLBOX#*:}\" - $(_) $(PWD)/startup.script - $(EPICS) - diff --git a/startup.script_part3 b/startup.script_part3 index ef2001b..0385467 100644 --- a/startup.script_part3 +++ b/startup.script_part3 @@ -1,15 +1,8 @@ # $Source: /cvs/A/CS/startup/startup.script_part3,v $ -# insert record list into database -sprintf STRINGBUFFER, "/home/ioc/%s.dbl", IOC -listRecords STRINGBUFFER, "RTYP DESC" -sprintf STRINGBUFFER, "%s/sls/bin/dbl2odb.sh", INSTBASE -rsh BOOTPC, "dbl2odb.sh", IOC, bootInfo("%B"), getenv("EPICS_CA_SERVER_PORT") - -# insert library list into database -sprintf STRINGBUFFER, "/home/ioc/%s.libs", IOC -libversionShow STRINGBUFFER -rsh BOOTPC, "upload_libinfo.sh", "-r -i", IOC, "-l", STRINGBUFFER +# EPICS 3.13 needs this to upload iocinfo to database +sprintf STRINGBUFFER,strncmp(EPICS,"R3.13.",6) ? ";" : "iocinfo" +execute STRINGBUFFER # set the prompt sprintf STRINGBUFFER, "%s > ", IOC