Skip to main content

muon out of sync error codes

import sys
#sys.path.append('../')
#sys.path.append('/online/products/l3ms_util_clients/v00-04-11/Linux/bin')
#sys.path.append('.\widgets')
#from Tkinter import *
from types import *
from guimaker import *
from L2dfCanvas import *
from MonitorClient import *
from StripChart import *
from simpletextbrowser import *
#from l2logparse import *
#import sys
import getopt
#import checkrefcounts
from SEClient import *
from SE_Message import *
import d0online_names
import SETestPorts
from  L2df2 import *
from tkMessageBox import showinfo
from time import sleep


class L2MisInputs(Monitor_Client):

    def __init__(self,parent=None,opts=None):
        Monitor_Client.__init__(self,parent,opts)
        #GUIMaker.__init__(self,parent)
    #L2dfGUI.__init__(self)
    self.missing_inputs={'muc':[],'muf':[], 'muc_slic':[],'muf_slic':[]}


        #weigang: set initial old/current sync error counts to 0
        old_sync_count_ctr = 0
        cur_sync_count_ctr = 0
        old_sync_count_fwd = 0
        cur_sync_count_fwd = 0

       
    #Send the major alarm to SES
    def start_ses(self):
        # !!! uncomment this for running online
        host = string.split(d0online_names.SES_SERVER_ADDR, ':')[0]
    port = string.split(d0online_names.SES_SERVER_ADDR, ':')[1]
    port = int(port)
       
    # !!! for testing purposes only
    #host = '0'  # local host
    #port = SETestPorts.server
       
        self.ses = SESender(port, host, 'ONL_L2DF_GUI')
    #self.ses.debugLevel(1) # for testing purposes only
    self.ses.connect(20)
    self.ses.register()
       
    def stop_ses(self):
        # the sleeps are needed because ITC, the communication protocol,
        # queues messages for sending so the message might not be sent
        # immediately.
        self.ses.cancel()
        time.sleep(1)
        self.ses.disconnect()
        time.sleep(1)
        del self.ses
       
    #MK+JS+IH
   
    def start_monitoring(self):
        #collect data
        d=self.collectData()
        if d:
            #update the display
            try:
                #self.l2display.updateDisplay(d)
                self.send_message(d)
            except(KeyError,NameError):
                pass
        else: pass

        #wait 5 seconds, then do it again.
        #checkrefcounts.print_top_20()
        #sleep(5)
        #print "test"
        #self.start_monitoring()
       
#MR:  decides when to send the message
    def send_message(self,d):
       if d['trgfr']['l1_accept_rate'] <0.5:
           if d['muc_missing_inputs'].has_key('channel'):
               used=[]
               if type(d['muc_missing_inputs']['channel'])==ListType:
            #more than one missing input
                   for item in d['muc_missing_inputs']['channel']:
                       #loop over channels
                       intro='Missing Input: L2MUC,'
                       mbt=' MBT '+str(item['mbt_index'])
                       channel=', Channel '+str(item['channel_index'])
                       alpha=', Alpha Index '+str(item['alpha_index'])
                       message=intro+mbt+channel+alpha
                       if message not in self.missing_inputs['muc']:
                           self.missing_inputs['muc'].append(message)
                           used.append(message)
                           #self.error_log.add_text(text=message)
                       else:
                            used.append(message)
                       for message in self.missing_inputs['muc']:
                           if message not in used:
                               fixed=message+' *FIXED*'
                               #self.error_log.add_text(text=fixed)
                               self.missing_inputs['muc'].remove(message)
                    #end loop over channels
               else:
                    #one input sent
                    intro='Missing Input: L2MUC,'
                    mbt=' MBT '+str(d['muc_missing_inputs']['channel']['mbt_index'])
                    channel=', Channel '+str(d['muc_missing_inputs']['channel']['channel_index'])
                    alpha=', Alpha Index '+str(d['muc_missing_inputs']['channel']['alpha_index'])
                    message=intro+mbt+channel+alpha
                    if message not in self.missing_inputs['muc']:
                        self.missing_inputs['muc'].append(message)
                        used.append(message)
                        #self.error_log.add_text(text=message)
                    else:
                        used.append(message)
                    for message in self.missing_inputs['muc']:
                        if message not in used:
                            fixed=message+' *FIXED*'
                            #self.error_log.add_text(text=fixed)
                            self.missing_inputs['muc'].remove(message)
           else:
               for message in self.missing_inputs['muc']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muc'].remove(message)
                                   

           if d['muf_missing_inputs'].has_key('channel'):
                used=[]
                if type(d['muf_missing_inputs']['channel'])==ListType:
                    #more than one missing input
                    for item in d['muf_missing_inputs']['channel']:
                        #loop over channels
                        intro='Missing Input: L2MUF,'
                        mbt=' MBT '+str(item['mbt_index'])
                        channel=', Channel '+str(item['channel_index'])
                        alpha=', Alpha Index '+str(item['alpha_index'])
                        message=intro+mbt+channel+alpha
                        if message not in self.missing_inputs['muf']:
                            self.missing_inputs['muf'].append(message)
                            used.append(message)
                            #self.error_log.add_text(text=message)
                        else:
                            used.append(message)
                    for message in self.missing_inputs['muf']:
                        if message not in used:
                            fixed=message+' *FIXED*'
                            #self.error_log.add_text(text=fixed)
                            self.missing_inputs['muf'].remove(message)
                    #end loop over channels
                else:
                    #one input sent
                    intro='Missing Input: L2MUF,'
                    mbt=' MBT '+str(d['muf_missing_inputs']['channel']['mbt_index'])
                    channel=', Channel '+str(d['muf_missing_inputs']['channel']['channel_index'])
                    alpha=', Alpha Index '+str(d['muf_missing_inputs']['channel']['alpha_index'])
                    message=intro+mbt+channel+alpha
                    if message not in self.missing_inputs['muf']:
                        self.missing_inputs['muf'].append(message)
                        used.append(message)
                        #self.error_log.add_text(text=message)
                    else:
                        used.append(message)
                    for message in self.missing_inputs['muf']:
                        if message not in used:
                            fixed=message+' *FIXED*'
                            #self.error_log.add_text(text=fixed)
                            self.missing_inputs['muf'].remove(message)
           else:
               for message in self.missing_inputs['muf']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muf'].remove(message)

             #MK
            #For testing purposes only
            #Copied from L2df2.py - MR
            # This is for 1
           #d['muc_slic_missing_inputs']['channel'] = {}
           #d['muc_slic_missing_inputs']['channel']['slic_name'] = 'SLIC MK'
           #d['muc_slic_missing_inputs']['channel']['channel_id'] = int(0xFFF) # or x212
           #d['muc_slic_missing_inputs']['channel']['readout_crate'] = int(0xAAA) # or x34
           #d['muc_slic_missing_inputs']['channel']['channel_index'] = int(0xEEE)
           #d['muc_slic_missing_inputs']['channel']['slic_index'] = int(0xBBB)
                   
   #MK, MR, copied from L2df2.py
          ##missing input alarm code     
           if d['muc_slic_missing_inputs'].has_key('channel'):
              used=[]
              if type(d['muc_slic_missing_inputs']['channel'])==ListType:
                  #more than one missing input
                  for item in d['muc_slic_missing_inputs']['channel']:
                      #loop over channels
                      intro='Missing Input: '+str(item['slic_name'])
                      mbt=', SLIC Index '+str(item['slic_index'])
                      channel=', Channel Index'+str(item['channel_index'])
                      chanID=', Channel ID x'+str(hex(item['channel_id']))[2:]
                      RO=', Readout Crate x'+str(hex(item['readout_crate']))[2:]
                      message=intro+mbt+channel+chanID+RO
                      if message not in self.missing_inputs['muc_slic']:
                          used.append(message)
                          self.missing_inputs['muc_slic'].append(message)
                          #print the error message
                          #self.error_log.add_text(text=message)
                          #MK+JS+IH
                          #send the alarm to SES
                          Mu_RC = str(hex(item['readout_crate']))[2:]
                          Mu_ChannelID = str(hex(item['channel_id']))[2:]
                          loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                          name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                          transition = SE_Message.transient
                          severity = SE_Message.major
                          comment = message
                          priority = 0
                          se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                          self.ses.send(se_msg)
                          #print "test mu inputs"
                          #MK+JS+IH
                      else:
                            used.append(message)
                  for message in self.missing_inputs['muc_slic']:
                      if message not in used:
                          fixed=message+' *FIXED*'
                          #self.error_log.add_text(text=fixed)
                          self.missing_inputs['muc_slic'].remove(message)
                      #end loop over channels
              else:
                    #one input sent
                  intro='Missing Input: '+str(d['muc_slic_missing_inputs']['channel']['slic_name'])
                  mbt=', SLIC Index '+str(d['muc_slic_missing_inputs']['channel']['slic_index'])
                  channel=', Channel Index'+str(d['muc_slic_missing_inputs']['channel']['channel_index'])
                  chanID=', Channel ID x'+str(hex(d['muc_slic_missing_inputs']['channel']['channel_id']))[2:]
                  RO=', Readout Crate x'+str(hex(d['muc_slic_missing_inputs']['channel']['readout_crate']))[2:]
                  message=intro+mbt+channel+chanID+RO
                  if message not in self.missing_inputs['muc_slic']:
                      self.missing_inputs['muc_slic'].append(message)
                      used.append(message)
                      #print the error message
                      #self.error_log.add_text(text=message)
                      #MK+JS+IH
                      #send the alarm to SES
                      Mu_RC = str(hex(d['muc_slic_missing_inputs']['channel']['readout_crate']))[2:]
                      Mu_ChannelID = str(hex(d['muc_slic_missing_inputs']['channel']['channel_id']))[2:]
                      loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                      name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                      transition = SE_Message.transient
                      severity = SE_Message.major
                      comment = message
                      priority = 0
                      se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                      self.ses.send(se_msg)
                      #print "mu mis input"
                      #MK+JS+IH
                  else:
                      used.append(message)
                  for message in self.missing_inputs['muc_slic']:
                      if message not in used:
                          fixed=message+' *FIXED*'
                          #self.error_log.add_text(text=fixed)
                          self.missing_inputs['muc_slic'].remove(message)
                   
           else:
               for message in self.missing_inputs['muc_slic']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muc_slic'].remove(message)



          ## weigang central muon out of sync
                  
           # weigang: check conditions.
           if d['l2muc_slic_inputs'].has_key('sync_error_count'):
               cur_sync_count_ctr = sync_error_count_ctr
           if (cur_sync_count_ctr - old_sync_count_ctr > 0):
                  
              used=[]
              if type(d['l2muc_slic_inputs']['sync_error_count'])==ListType:
                  #more than one missing input
                  for item in d['l2muc_slic_inputs']['sync_error_count']:
                      #loop over sync_error_counts
                      intro='Missing Input: '+str(item['slic_name'])
                      mbt=', SLIC Index '+str(item['slic_index'])
                      channel=', Channel Index'+str(item['channel_index'])
                      chanID=', Channel ID x'+str(hex(item['channel_id']))[2:]
                      RO=', Readout Crate x'+str(hex(item['readout_crate']))[2:]
                      message=intro+mbt+channel+chanID+RO
                      if message not in self.missing_inputs['muc_slic']:
                          used.append(message)
                          self.missing_inputs['muc_slic'].append(message)
                          #print the error message
                          #self.error_log.add_text(text=message)
                          #MK+JS+IH
                          #send the alarm to SES
                          Mu_RC = str(hex(item['readout_crate']))[2:]
                          Mu_ChannelID = str(hex(item['channel_id']))[2:]
                          loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                          name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                          transition = SE_Message.transient
                          severity = SE_Message.major
                          comment = message
                          priority = 0
                          se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                          self.ses.send(se_msg)
                          #print "test mu inputs"
                          #MK+JS+IH
                      else:
                            used.append(message)
                  for message in self.missing_inputs['muc_slic']:
                      if message not in used:
                          fixed=message+' *FIXED*'
                          #self.error_log.add_text(text=fixed)
                          self.missing_inputs['muc_slic'].remove(message)
                      #end loop over channels
              else:
                    #one input sent
                  intro='Missing Input: '+str(d['l2muc_slic_inputs']['sync_error_count']['slic_name'])
                  mbt=', SLIC Index '+str(d['l2muc_slic_inputs']['sync_error_count']['slic_index'])
                  channel=', Sync_error_count Index'+str(d['l2muc_slic_inputs']['sync_error_count']['channel_index'])
                  chanID=', Channel ID x'+str(hex(d['l2muc_slic_inputs']['sync_error_count']['channel_id']))[2:]
                  RO=', Readout Crate x'+str(hex(d['l2muc_slic_inputs']['sync_error_count']['readout_crate']))[2:]
                  message=intro+mbt+channel+chanID+RO
                  if message not in self.missing_inputs['muc_slic']:
                      self.missing_inputs['muc_slic'].append(message)
                      used.append(message)
                      #print the error message
                      #self.error_log.add_text(text=message)
                      #MK+JS+IH
                      #send the alarm to SES
                      Mu_RC = str(hex(d['l2muc_slic_inputs']['sync_error_count']['readout_crate']))[2:]
                      Mu_ChannelID = str(hex(d['l2muc_slic_inputs']['sync_error_count']['channel_id']))[2:]
                      loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                      name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                      transition = SE_Message.transient
                      severity = SE_Message.minor
                      comment = message
                      priority = 0
                      se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                      self.ses.send(se_msg)
                      #print "mu mis input"
                      #MK+JS+IH
                  else:
                      used.append(message)
                  for message in self.missing_inputs['muc_slic']:
                      if message not in used:
                          fixed=message+' *FIXED*'
                          #self.error_log.add_text(text=fixed)
                          self.missing_inputs['muc_slic'].remove(message)
                   
           else:
               for message in self.missing_inputs['muc_slic']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muc_slic'].remove(message)

                   #weigang: store current sync error count to previous one.
                   old_sync_count_ctr = cur_sync_count_ctr



                   ## weigang: forward muon
           if d['muf_slic_missing_inputs'].has_key('channel'):
               used=[]
               if type(d['muf_slic_missing_inputs']['channel'])==ListType:
                   #more than one missing input
                   for item in d['muf_slic_missing_inputs']['channel']:
                       #loop over channels
                       intro='Missing Input: '+str(item['slic_name'])
                       mbt=', SLIC Index '+str(item['slic_index'])
                       channel=', Channel Index'+str(item['channel_index'])
                       chanID=', Channel ID x'+str(hex(item['channel_id']))[2:]
                       RO=', Readout Crate x'+str(hex(item['readout_crate']))[2:]
                       message=intro+mbt+channel+chanID+RO
                       if message not in self.missing_inputs['muf_slic']:
                           self.missing_inputs['muf_slic'].append(message)
                           used.append(message)
                           #print the error message
                           #self.error_log.add_text(text=message)
                           #MK+JS+IH
                           #send the alarm to SES
                           Mu_RC = str(hex(item['readout_crate']))[2:]
                           Mu_ChannelID = str(hex(item['channel_id']))[2:]
                           loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                           name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                           transition = SE_Message.transient
                           severity = SE_Message.major
                           comment = message
                           priority = 0
                           se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                           self.ses.send(se_msg)
                           #print "test mu inputs"
                            #MK+JS+IH
                       else:
                           used.append(message)
                   for message in self.missing_inputs['muf_slic']:
                       if message not in used:
                           fixed=message+' *FIXED*'
                           #self.error_log.add_text(text=fixed)
                           self.missing_inputs['muf_slic'].remove(message)
                           #end loop over channels
               else:
                   #one input sent
                   intro='Missing Input: '+str(d['muf_slic_missing_inputs']['channel']['slic_name'])
                   mbt=', SLIC Index '+str(d['muf_slic_missing_inputs']['channel']['slic_index'])
                   channel=', Channel Index'+str(d['muf_slic_missing_inputs']['channel']['channel_index'])
                   chanID=', Channel ID x'+str(hex(d['muf_slic_missing_inputs']['channel']['channel_id']))[2:]
                   RO=', Readout Crate x'+str(hex(d['muf_slic_missing_inputs']['channel']['readout_crate']))[2:]
                   message=intro+mbt+channel+chanID+RO
                   if message not in self.missing_inputs['muf_slic']:
                       self.missing_inputs['muf_slic'].append(message)
                       used.append(message)
                       #print the error message
                       #self.error_log.add_text(text=message)
                       #MK+JS+IH
                       #send the alarm to SES
                       Mu_RC = str(hex(d['muf_slic_missing_inputs']['channel']['readout_crate']))[2:]
                       Mu_ChannelID = str(hex(d['muf_slic_missing_inputs']['channel']['channel_id']))[2:]
                       loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                       name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                       transition = SE_Message.transient
                       severity = SE_Message.major
                       comment = message
                       priority = 0
                       se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                       self.ses.send(se_msg)
                       #print "test mu inputs"
                        #MK+JS+IH
                   else:
                       used.append(message)
                   for message in self.missing_inputs['muf_slic']:
                       if message not in used:
                           fixed=message+' *FIXED*'
                           #self.error_log.add_text(text=fixed)
                           self.missing_inputs['muf_slic'].remove(message)
           else:
               for message in self.missing_inputs['muf_slic']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muf_slic'].remove(message)

#weigang: seems this 'else' should be at the very end.
    #   else: pass
      ##end l2muf missing inputs 



                   ## weigang: forward muon out of sync


           # weigang: check conditions.
           if d['l2muf_slic_inputs'].has_key('sync_error_count'):
               cur_sync_count_fwd = sync_error_count_fwd
           if (cur_sync_count_fwd - old_sync_count_fwd > 0):

               used=[]
               if type(d['l2muf_slic_inputs']['sync_error_count'])==ListType:
                   #more than one missing input
                   for item in d['l2muf_slic_inputs']['sync_error_count']:
                       #loop over sync_error_counts
                       intro='Missing Input: '+str(item['slic_name'])
                       mbt=', SLIC Index '+str(item['slic_index'])
                       channel=', Channel Index'+str(item['channel_index'])
                       chanID=', Channel ID x'+str(hex(item['channel_id']))[2:]
                       RO=', Readout Crate x'+str(hex(item['readout_crate']))[2:]
                       message=intro+mbt+channel+chanID+RO
                       if message not in self.missing_inputs['muf_slic']:
                           self.missing_inputs['muf_slic'].append(message)
                           used.append(message)
                           #print the error message
                           #self.error_log.add_text(text=message)
                           #MK+JS+IH
                           #send the alarm to SES
                           Mu_RC = str(hex(item['readout_crate']))[2:]
                           Mu_ChannelID = str(hex(item['channel_id']))[2:]
                           loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                           name = 'MUO_'+'CHNL_'+loc+'/MISSINGINPUT'
                           transition = SE_Message.transient
                           severity = SE_Message.major
                           comment = message
                           priority = 0
                           se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                           self.ses.send(se_msg)
                           #print "test mu inputs"
                            #MK+JS+IH
                       else:
                           used.append(message)
                   for message in self.missing_inputs['muf_slic']:
                       if message not in used:
                           fixed=message+' *FIXED*'
                           #self.error_log.add_text(text=fixed)
                           self.missing_inputs['muf_slic'].remove(message)
                           #end loop over channels
               else:
                   #one input sent
                   intro='Missing Input: '+str(d['l2muf_slic_inputs']['sync_error_count']['slic_name'])
                   mbt=', SLIC Index '+str(d['l2muf_slic_inputs']['sync_error_count']['slic_index'])
                   channel=', Channel Index'+str(d['l2muf_slic_inputs']['sync_error_count']['channel_index'])
                   chanID=', Channel ID x'+str(hex(d['l2muf_slic_inputs']['sync_error_count']['channel_id']))[2:]
                   RO=', Readout Crate x'+str(hex(d['l2muf_slic_inputs']['sync_error_count']['readout_crate']))[2:]
                   message=intro+mbt+channel+chanID+RO
                   if message not in self.missing_inputs['muf_slic']:
                       self.missing_inputs['muf_slic'].append(message)
                       used.append(message)
                       #print the error message
                       #self.error_log.add_text(text=message)
                       #MK+JS+IH
                       #send the alarm to SES
                       Mu_RC = str(hex(d['l2muf_slic_inputs']['sync_error_count']['readout_crate']))[2:]
                       Mu_ChannelID = str(hex(d['l2muf_slic_inputs']['sync_error_count']['channel_id']))[2:]
                       loc = 'IDx'+Mu_ChannelID+'RCx'+Mu_RC#'RCx'+Mu_RC+'IDx'+Mu_ChannelID
                       name = 'MUO_'+'CHNL_'+loc+'/OUTOFSYNCINPUT' #weigang: changed to OUTOFSYNC
                       transition = SE_Message.transient
                       severity = SE_Message.minor #weigang: changed from major to minor
                       comment = message
                       priority = 0
                       se_msg = SE_Comment_Alarm_Message(name, transition, severity, comment, priority)
                       self.ses.send(se_msg)
                       #print "test mu inputs"
                        #MK+JS+IH
                   else:
                       used.append(message)
                   for message in self.missing_inputs['muf_slic']:
                       if message not in used:
                           fixed=message+' *FIXED*'
                           #self.error_log.add_text(text=fixed)
                           self.missing_inputs['muf_slic'].remove(message)
           else:
               for message in self.missing_inputs['muf_slic']:
                   fixed=message+' *FIXED*'
                   #self.error_log.add_text(text=fixed)
                   self.missing_inputs['muf_slic'].remove(message)

                   #weigang: store current sync error count to previous one.
                   old_sync_count_fwd = cur_sync_count_fwd
      
           ##end l2muf out of sync
       # weigang
       else: pass
              


# weigang: main function calls some of the above functions.
if __name__=='__main__':
    opts, args = getopt.getopt (sys.argv[1:], "srl:", ["silent", "relay", "loop"])
    #master=Tk()
    mainW=L2MisInputs(opts=opts)

    while 1:
        #print "while loop"
        mainW.start_ses()
        mainW.start_monitoring()
        mainW.stop_ses()
        time.sleep(5)
   


Comments

Popular posts from this blog

CKA Simulator Kubernetes 1.22

  https://killer.sh Pre Setup Once you've gained access to your terminal it might be wise to spend ~1 minute to setup your environment. You could set these: alias k = kubectl                         # will already be pre-configured export do = "--dry-run=client -o yaml"     # k get pod x $do export now = "--force --grace-period 0"   # k delete pod x $now Vim To make vim use 2 spaces for a tab edit ~/.vimrc to contain: set tabstop=2 set expandtab set shiftwidth=2 More setup suggestions are in the tips section .     Question 1 | Contexts Task weight: 1%   You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts . Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh , the command should use kubectl . Finally write a second command doing the same thing into ...

OWASP Top 10 Threats and Mitigations Exam - Single Select

Last updated 4 Aug 11 Course Title: OWASP Top 10 Threats and Mitigation Exam Questions - Single Select 1) Which of the following consequences is most likely to occur due to an injection attack? Spoofing Cross-site request forgery Denial of service   Correct Insecure direct object references 2) Your application is created using a language that does not support a clear distinction between code and data. Which vulnerability is most likely to occur in your application? Injection   Correct Insecure direct object references Failure to restrict URL access Insufficient transport layer protection 3) Which of the following scenarios is most likely to cause an injection attack? Unvalidated input is embedded in an instruction stream.   Correct Unvalidated input can be distinguished from valid instructions. A Web application does not validate a client’s access to a resource. A Web action performs an operation on behalf of the user without checkin...