Skip to content
Snippets Groups Projects
Select Git revision
  • 7b51cfc1b1e2da27c7f054971fc5661e432141db
  • 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 2.62 KiB
    #!/bin/bash
    #
    # Usage: ./generateStationStreams.sh > StationStreams.parset
    #
    # Requires:
    #   RSPConnections_Cobalt.dat
    #   MAC+IP.dat
    #   RSP+IP.dat
    #
    # These files can be found in
    #   MAC/Deployment/data/StaticMetaData
    #
    
    cat RSPConnections_Cobalt.dat | perl -ne '
    
    /^(\w+) RSP_([01]) ([^ \t\n]+)/ || next;
    
    $station = $1;
    $board = $2;
    $host = $3;
    
    $station =~ /^[A-Z][A-Z]([0-9]+)/;
    $nr = $1;
    
    # only parse cobalt nodes
    $host =~ /^cbt/ || next;
    
    if (not $cached) {
      %lookup = {};
      %rlookup = {};
      %ilookup = {};
    
      # MAC+IP.dat resolves hostnames to IPs and MACs
      open $fh, "MAC+IP.dat"
        or die "Cannot open MAC+IP.dat";
    
      while($line = <$fh>) {
        next if $line =~ /^#/;
        ($name, $ip, $mac) = split(/\s+/, $line);
    
        $lookup{$name} = $ip;
        $rlookup{$ip}  = $rlookup{$ip} || $name;
      }
    
      close $fh;
    
      # RSP+IP.dat lists the international station IP addresses
      open $fh, "RSP+IP.dat"
        or die "Cannot open RSP+IP.dat";
    
      while($line = <$fh>) {
        next if $line =~ /^#/;
        ($name, $ip) = split(/\s+/, $line);
    
        $ilookup{$name} = $ip;
      }
    
      close $fh;
    
      $cached = 1;
    }
    
    $dest = $lookup{$host};
    $iface = $rlookup{$dest};
    $baseport = 10000 + $nr * 10;
    
    $ips = {};
    
    foreach $rspNr (0 .. 3) {
      $brdname = sprintf "%s_%02d", $station, $rspNr;
    
      if (exists $ilookup{$brdname}) {
        # international station: IP = src IP, ending in .50
        $ips{$rspNr} = $ilookup{$brdname} =~ s/\.[0-9]+$/.50/r;
      } else {
        $ips{$rspNr} = $iface;
      }
    }
    
    $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;
    $ifnr = $2;
    $receiver = sprintf "%s_%u", $host, ($ifnr - 1)/2;
    
    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.