Skip to content
Snippets Groups Projects
Select Git revision
  • 4f0f2ef8fb413b4bd82f3f7009df6828b5851eda
  • master default protected
  • L2SS-1914-fix_job_dispatch
  • TMSS-3170
  • TMSS-3167
  • TMSS-3161
  • TMSS-3158-Front-End-Only-Allow-Changing-Again
  • TMSS-3133
  • TMSS-3319-Fix-Templates
  • test-fix-deploy
  • TMSS-3134
  • TMSS-2872
  • defer-state
  • add-custom-monitoring-points
  • TMSS-3101-Front-End-Only
  • TMSS-984-choices
  • SDC-1400-Front-End-Only
  • TMSS-3079-PII
  • TMSS-2936
  • check-for-max-244-subbands
  • TMSS-2927---Front-End-Only-PXII
  • Before-Remove-TMSS
  • LOFAR-Release-4_4_318 protected
  • LOFAR-Release-4_4_317 protected
  • LOFAR-Release-4_4_316 protected
  • LOFAR-Release-4_4_315 protected
  • LOFAR-Release-4_4_314 protected
  • LOFAR-Release-4_4_313 protected
  • LOFAR-Release-4_4_312 protected
  • LOFAR-Release-4_4_311 protected
  • LOFAR-Release-4_4_310 protected
  • LOFAR-Release-4_4_309 protected
  • LOFAR-Release-4_4_308 protected
  • LOFAR-Release-4_4_307 protected
  • LOFAR-Release-4_4_306 protected
  • LOFAR-Release-4_4_304 protected
  • LOFAR-Release-4_4_303 protected
  • LOFAR-Release-4_4_302 protected
  • LOFAR-Release-4_4_301 protected
  • LOFAR-Release-4_4_300 protected
  • LOFAR-Release-4_4_299 protected
41 results

generateStationStreams.sh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    generateStationStreams.sh 3.26 KiB
    #!/bin/bash
    #
    # Usage (to commit new StationStreams.parset):
    #   ./generateStationStreams.sh > StationStreams.parset
    #
    # Usage (post-rollout on live test system):
    #   export LOFARROOT=/path/to/lofarroot
    #   "$LOFARROOT/sbin/generateStationStreams.sh" > "$LOFARROOT/etc/parset-additions.d/default/StationStreams.parset"
    #
    # Thus if $LOFARROOT is set, the 3 required files below will be accessed under:
    #   $LOFARROOT/etc/StaticMetaData/
    #
    # Requires:
    #   RSPConnections_Cobalt.dat
    #
    # These files are symlinks under GPUProc, but can be found in:
    #   MAC/Deployment/data/StaticMetaData
    #
    # $Id$
    
    if [ "$LOFARROOT" != "" ]; then
      export in_prefix="$LOFARROOT/etc/StaticMetaData/"  # must have trailing slash
    fi
    
    # always generate/sort entries in the same order for equality testing
    export LC_ALL=C
    
    echo "# StationStreams.parset  This file is generated by generateStationStreams.sh"
    
    cat "${in_prefix}RSPConnections_Cobalt.dat" | sort | awk '
    #
    # Make sure that for each antenna field, there is one line
    # per RSP board. We do this by repeating the same line for
    # each station that has fewer than 4 (typically 1) line.
    #
    
    BEGIN {
      prevstat = "";
      prevboard = "";
      prevline = "";
      rsp_seen = 0;
    }
    
    /RSP/ {
      stat = $1;
      board = $2;
      line = $0;
      
      if (stat == prevstat && board == prevboard) {
        rsp_seen++;
      } else {
        for (i = 0; i < 4 - rsp_seen; ++i)
          print prevline;
    
        rsp_seen = 1;
      };
    
      print line;
    
      prevline = line;
      prevstat = stat;
      prevboard = board;
    }' | perl -ne '
    /^(\w+) RSP_([01])\s+([^ \t\n]+)\s+([^ \t\n]+)/ || next;
    
    # Each station is represented by 4 lines, one for each
    # RSP board. We parse 4 lines, collect the destination
    # IPs, and continue based on the last line for the
    # rest of the information.
    
    $station = $1;
    $board = $2;
    $iface = $3;
    $ip = $4;
    
    $station =~ /^[A-Z][A-Z]([0-9]+)/;
    $stationnr = $1;
    $intl = $stationnr >= 600;
    
    if ($rspNr <= 0 || $rspNr >= 4) {
      # new station
      $ips = {};
      $rspNr = 0;
    }
    
    $ips{$rspNr} = $intl ? $ip : $iface;
    
    next if ++$rspNr < 4;
    
    $baseport = 10000 + $stationnr * 10;
    
    $portstr = sprintf "[udp:%s:%d, udp:%s:%d, udp:%s:%d, udp:%s:%d]",
      $ips{0}, $baseport + ($board * 6) + 0,
      $ips{1}, $baseport + ($board * 6) + 1,
      $ips{2}, $baseport + ($board * 6) + 2,
      $ips{3}, $baseport + ($board * 6) + 3;
    
    $iface =~ /(cbt[0-9]+)-10GB0([1234])/;
    $host = $1;
    $socket = ($2 - 1)/2; # 10GB01, 10GB02 = socket 0, 10GB03, 10GB04 = socket 1
    $receiver = sprintf "%s_%u", $host, $socket;
    
    if ($board == 0) {
      printf "PIC.Core.%sLBA.RSP.receiver  = %s\n",$station,$receiver;
      printf "PIC.Core.%sLBA.RSP.ports     = %s\n",$station,$portstr;
    
      printf "PIC.Core.%sHBA.RSP.receiver  = %s\n",$station,$receiver;
      printf "PIC.Core.%sHBA.RSP.ports     = %s\n",$station,$portstr;
    
      if ($station =~ /^CS/) {
        printf "PIC.Core.%sHBA0.RSP.receiver = %s\n",$station,$receiver;
        printf "PIC.Core.%sHBA0.RSP.ports    = %s\n",$station,$portstr;
      } else {
    #    print "\n";
      }
    }
    
    if ($board == 1) {
      printf "PIC.Core.%sHBA1.RSP.receiver = %s\n",$station,$receiver;
      printf "PIC.Core.%sHBA1.RSP.ports    = %s\n",$station,$portstr;
    #  print "\n";
    }
    
    ' | sort | uniq
    
    # Remove duplicate entries, because RSPConnections_Cobalt.dat now can have
    # multiple lines per station (one for each RSP board), which contains
    # information that we already obtain from RSP+IP.dat