Tuesday, September 29, 2020

 def active_stdby_status (uut,stk_count):
    flag = 1
    log.info('Check the stack has elected Active and Standby')
    if stk_count == 1:
        output = uut.execute('show switch')
        match = re.search('Active',output)
        if match:
            log.info('The Active has come up')
        else:
            log.info('The Active has not come up')
            flag = 0
            self.failed('The Active has not come up')
    
    else:
        loop_cnt = 50
        for i in range(1,loop_cnt):
            time.sleep(20)
            output = uut.execute('show switch')
            match = re.search('Standby',output)
            match1 = re.search('Active',output)
            if not match:
                continue
            elif match and match1:
                log.info('The stack has elected Active and Standby')
                log.info('Now Check the stack are in Ready state')
                l_cnt = 15
                for j in range(1,l_cnt):
                    time.sleep(20)
                    out = uut.execute('show switch')
                    match = re.search('HA sync in progress',out)
                    if match:
                        continue
                    else:
                        time.sleep(20)
                        break
                input = uut.execute('show switch')
                regex = re.compile('Ready')
                check = regex.findall(input)
                log.info('Check : %s',check)
                status_count = len(regex.findall(input))
                log.info('Status_count = %s', status_count)
                if status_count!=stk_count:
                    flag = 0
                    log.info('Please Check the switch which is not in Ready state. Test Aborted')
                break

            elif i== 29:
                log.info('Active and Standby Election not done properly')
                flag = 0
            
    return flag

def chk_atv_stdby(uut,stk_count):
    output = uut.execute('show switch')
    match = re.search('Active\s+([a-z0-9.]+)\s+(\d+).*Ready',output)
    active_mac = match.group(1)
    active_priority = match.group(2)
    if stk_count>1:
        match1 = re.search('Standby\s+([a-z0-9.]+)\s+(\d+).*Ready',output)
        stdby_mac = match1.group(1)
        stdby_priority = match1.group(2)
        return (active_mac,active_priority,stdby_mac,stdby_priority)
    else:
        return (active_mac,active_priority)
 
 
def getshowswitchinfo (uut):
    log.info('Entering in to the getshowinfo proc %s' %uut)
    switchinfo = defaultdict(dict)
    uut.execute('enable')
    output=uut.execute('show switch')
    lines = output.splitlines()
    for line in lines:
        
        match = re.search("(\d+)\s+(\w+)\s+(\w+.\w+.\w+)\s+(\d+)\s+(\w+)\s+(\w+)", line)
        '''
        Switch/Stack Mac Address : 007e.9500.3000 - Local Mac Address
        Mac persistency wait time: Indefinite
                                                     H/W   Current
        Switch#   Role    Mac Address     Priority Version  State
        ------------------------------------------------------------
         *1       Active   007e.9500.3000     1      P2B     Ready                
          2       Standby  682c.7bf7.1380     1      P2A     Ready                
          3       Member   682c.7bf7.ce00     1      P2A     Ready                
        '''
        if match:
            number = match.group(1)
            switchinfo[number]['switch_no'] = int(match.group(1))
            switchinfo[number]['role'] = match.group(2)
            switchinfo[number]['mac_address'] = match.group(3)
            switchinfo[number]['priority'] = int(match.group(4))
            switchinfo[number]['version'] = match.group(5)
            switchinfo[number]['state'] = match.group(6)
    print(switchinfo)
    return switchinfo
    
def get_reset_reason(uut,stacklen,tot_sw_no):
        
        last_reset_reason = defaultdict(dict)
        
        for sw_no in tot_sw_no:
            cmd_to_execute = 'show logging onboard switch ' + sw_no + ' uptime detail'
            reset_reason = uut.execute(cmd_to_execute)
            reset_reason = reset_reason.splitlines()
            for line in reset_reason:
                if "Current reset reason" in line:
                    cur_reset_reason = line.split(':')[1]
                    cur_reset_reason_update = " ".join(cur_reset_reason.split())
                    log.info("Current Reset Reason is %s"%cur_reset_reason_update)
                    break
            last_reason_line = re.search("([\d/]+)\s([\d:]+)\s+(.*)(\d+\s+\d+\s+\d+\s+\d+\s+\d+\s)",reset_reason[-3])
            last_reason_line = " ".join(last_reason_line.groups()[2].split())
            last_reset_reason[sw_no]['switch_number'] = sw_no
            last_reset_reason[sw_no]['current_reset_reason'] = cur_reset_reason_update
            last_reset_reason[sw_no]['last_reason_line'] = last_reason_line
        return last_reset_reason
    

stack3-nyquist-1#sho logg onboard switch 1 uptime det
--------------------------------------------------------------------------------
UPTIME SUMMARY INFORMATION
--------------------------------------------------------------------------------
First customer power on : 12/21/2018 07:25:42
Total uptime            :  1  years  18 weeks  6  days  20 hours  12 minutes
Total downtime          :  0  years  21 weeks  4  days  4  hours  16 minutes
Number of resets        : 932
Number of slot changes  : 6
Current reset reason    : Image Install
Current reset timestamp : 09/25/2020 14:54:39
Current slot            : 1
Chassis type            : 0
Current uptime          :  0  years  0  weeks  4  days  17 hours  0  minutes
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
UPTIME CONTINUOUS INFORMATION
--------------------------------------------------------------------------------
Time Stamp          | Reset                       | Uptime
MM/DD/YYYY HH:MM:SS | Reason                      | years weeks days hours minutes
--------------------------------------------------------------------------------
09/22/2020 16:39:24   Reload reason not captured    0     0     0     0     10
09/22/2020 16:44:06   Reload Command                0     0     0     0     0  
09/22/2020 16:51:56   Reload reason not captured    0     0     0     0     5  
09/22/2020 17:07:14   Reload reason not captured    0     0     0     0     10
09/25/2020 12:27:14   Image Install                 0     0     0     2     59
09/25/2020 14:54:39   Image Install                 0     0     0     2     0  
--------------------------------------------------------------------------------
def Cycle(uut,ip,power_port,outlet_number,power_unit_username,power_unit_password,pdu_type,telnet_ssh):
        time.sleep(4)
        child = pexpect.spawn(telnet_ssh + " " + ip + " " + power_port,timeout = 300)
        if pdu_type == '':
            child.expect('Username:',timeout = 300)
            child.sendline(power_unit_username)
            child.expect('Password:',timeout = 300)
            child.sendline(power_unit_password)
            child.expect(['#', '>'],timeout = 300)
        else:
            child.expect(['#', '>'],timeout = 300)
        log.info(child)
        try:
            if pdu_type != '':
                outlet_number = outlet_number.replace(',',' ')
                poweroff_cmd = "/OFF " + str(outlet_number) + ',y'
                poweron_cmd = "/ON " + str(outlet_number) + ',y'
            else:
                poweroff_cmd = "power outlets "+outlet_number+" off /y"
                poweron_cmd = "power outlets "+outlet_number+" on /y"
                    
            child.sendline(poweroff_cmd)
            child.sendline('\r')
            log.info('sent off to outlet %s %s'%(ip,outlet_number))
            time.sleep(10)
            child.sendline(poweron_cmd)
            child.sendline('\r')
            log.info('sent on to outlet %s %s'%(ip,outlet_number))
            child.sendline('\r')
            child.expect(['#', '>'],timeout = 300)
            string_op = child.before.decode('utf-8')
            log.info("Power cycle command was issued and executed")
            if(re.search(r"\^",string_op)):
                raise InvalidExcpt
        except InvalidExcpt:
            log.info("Power Cycle command was not executed \n Command to power cycler was invalid")
       
        return
 
 
#sho iox

IOx Infrastructure Summary:
---------------------------
IOx service (CAF)              : Running
IOx service (HA)               : Running
IOx service (IOxman)           : Running
IOx service (Sec storage)      : Not Running
Libvirtd                       : Running
Dockerd                        : Running
Application DB Sync Info       : Available
Sync status                    : Successful
Last application sync time     : 2020-09-28 20:46:50.069589

    
        out=uut1.execute("show iox-service")

        if((re.search("IOx\s+service\s+\(HA\)\s*\:\s*Running",out)) and (re.search("IOx\s+service\s+\(CAF\)\s*\:\s*Running",out)) and (re.search("IOx\s+service\s+\(IOxman\)\s*\:\s*Running",out
)) and (re.search("Libvirtd\s*\:\s*Running",out))) :
            log.info('PASS : IOX service is running')
        else :
            self.failed('FAIL : IOX service is NOT running')




Friday, September 25, 2020

Questions to ask Interviewer

 

  1. What are the main reasons you work for [Company]?
  2. What is main organizational values and work culture like?
  3. How often do you work on weekends or till late at night?
  4. How is performance review conducted here?
  5. What is the main difference between your previous work environment and [company]?

Thursday, September 3, 2020

Early Retirement !!

So I have finally decided to take the early retirement (ER) package today (Sep 2, 2020).  

 

It was quite a personal roller-coaster ride to come to the final decision as I am still too young to retire, to be honest.


When the ER package was first announced, I was super elated to be qualified.  The magic number is minimum age: 50 years old + minimum 7 years of service > = 62.  Not only do I meet the number 62, my number is 72!!!!  I was so happy to final qualified!  The last time there was an ER package, according to the internet was 2011 and 2009.  There is no way I can work at my position for another 9 years and I definitely can not see myself doing the same thing for the next 3-5 years.  I am all burnt out.  Also, because many of my colleagues are now VP or Senior VP or Director already and that got me seriously thinking what am I doing with my career.  Even though I have no wish to be in their seats, I also would not like to keep doing the same thing as I did for the last 22 years.  It's time for a change and it feels good, not it feels great to be paid to make a change. So I willing clicked Accept for the ER package.

For a week, I was happy and contented with my decision and did nothing except talking to all those I know SHOULD qualify to see what they have decided.  I did a count today and it was 26 people I talked/texted/messaged to outside from my family.  They are all helpful in a way.  Some qualified but have situations that forced them to not take the package, there are a ton of them just missed the age requirement by a few months to a few years and are pulling their hair for not being qualified.  The exit day for ER is Oct 5.  After that, LR - limited restructuring will hit on Oct 7.  Those will be people not taking ER and the low performer, most dispensable folks in the company.  I could very well be in that bucket if I have not chosen to take ER.  Who knows?  I think even the managers or VPs would not know as the top will be tabulating the number of ER folks and then see how many more to hit the bottom line for cost savings. Anyway, I was all set to retire and feel energized to work on my resume.

On the last day of the ER acceptance window, I woke up and panicked and went back to click on DECLINE for ER package.  What happened was the day before, my ex-manager texted me after hearing that I have decided to leave my job.  He told me he could arrange an interview for me with the company he is with.  I thought, WOW, that's GREAT!!  Whoever is so nice to let him know I am open to new job is doing me such a big favor!!  I feel thankful.  Then he told me the minimal requirements for the position (which pay less than my current position as it's a smaller company) and told be to be prepared and send him the resume.  LinkedIn also shows how much that position will pay - approximately.  It will be a 32% pay cut!!  I was sort of shocked.  I think I was given a dose of reality at that point.  I feel I am crazy to give up my well-paid job to go interview for something that pay less and probably have to work as hard if not MORE hard.  What am I doing?  Did I make my decision too hastily?  I am still young, I should work, the pay is good.  I just need to learn to manage my time better and set limits. I can actually make my job less stressful if I just be more focus and better plan out my time. Plus, someone told me since LR is likely, why not work till LR and get extra 1.5 month pay and if impacted will get similar ER package (the enhanced LR package).  So I quickly went to the ER portal and clicked DECLINE.  

I was sitting nervously at my desk ready to begin my day to work.  I took PTO yesterday.  I couldn't focus.  I ran upstairs to tell my husband about my latest decision.  He smiled and said really?  What changed your mind.  He is supportive either way so the decision is entirely on me. I told him my line of thinking.  He smiled again and think it's good that I got some other perspectives.  Then he went back to his work, again "integrated" with his chair as one.  I could not sit still.  I quickly talk to (texted) my confidants at work on my latest decision so they don't feel I lied to them and share my reasons.  First one I talked to, Tom, told me I should Accept and try the new position that has landed on my lap.  He thinks I should not be so short-sighted on the pay.  Doing something new and challenging and maybe the startup will go IPO and I would be (more) rich.  But I told him I don't really want to do similar thing.  He told me to inquire more about the startup position but hearing how unwilling I sounded, he told me "good luck, whatever you decide, so be it".  

Then 2 people pinged me.  John and Michael.  They are both taking the ER package and they are not wavering with their decision.  They are surprised to hear my latest decision.  I told him about the lower pay job that has approached me.  He also thinks that's a good opportunity to try since it will be double pay - why not?  And he thinks there will be other opportunities so no need to limit myself to just this one.  He himself already have phone screening lined up.  He told me our job has flexibility so that's one good thing we all enjoy.  He thinks it's up to me, no right or wrong.  Then John, he is the one who gave me the case # that shows LR will get ER package so no harm decline now and later get LR.  I felt better choosing DECLINE and told him more about the startup position.  He reminded me the many roles one has to play working for a startup.... He also reminded me on how outside opportunities (AWS requirement) can broaden my skill set which will be a good thing.  So, the key is not to get hang up on the pay.  He said taking ER, we are in control, LR is a big IF that no one knows for sure, is that something I can live with?  I told him I felt I am the most dispensable person in the team with low IPF as well.  So LR for me is very likely.  And he assured me that I will get the ER like package if I get LR and choose to exit by 11/23.  So I am still good with choosing DECLINE.

After lunch and market close.  I decided to ping my friend, Robin, who always have the bigger picture on things, to help me reality check my decision.  I told him everything that have transpired and he told me this ER package is so stingy.  it sucks.  But even so, he would have taken it in a heart beat, it's a no brainer.  He said too bad he does not qualify age-wise.  He said since my husband will continue to work, so why don't I just take it, take a break and spend more time with the kids.  I told him with the COVID lock down, we are already spending time everyday at home.  He said I am not getting the point.  When I work, I am not spending quality time with the kids and they grow up in a blink of an eye.  I am missing out.  ***Yes, I am totally missing out.  COVID work from home and remote learning had made me more irritable and stressed and short-tempered.  The relationship can use some improvement, that's for sure.**. He is right.  He told me not to focus on the money and take this opportunity to start doing something I truly enjoy.  No need to work so hard, life is short.  *** He is so right again.  I know all this but just not taking any action about it. ***.   He reminded me that as long as one is working, both will have insurance so nothing to worry about.  He then decided to call me and we chatted more.  Finally he convinced me with this horrid scenario, what if I did not get LR but instead got transferred to the worst place within the company, then what?  I will be quitting on my own without any package.  Wouldn't I be so upset and have this regret for the rest of my life?  With this vivid but likely horrendous image in mind, I am quickly back to Accepting ER and this time is final.  I know there is indeed this possibility that I will get moved out to the other team under some terrible dictator style manager.  That would really be some nightmare comes true.  No way would I ever want to be in that situation.  No way would I let something that I can control becomes out of my control and be stuck.  With that worst case scenario, the final decision is set in stone.  

I informed my other friend Albert and Charles and Michael and then the clock shows 5:02pm.  The window for ER acceptance has closed.  I have made my choice to ACCEPT.  What a sigh of relief!

Now things will start spinning and we should know what happen next.  Stay tuned....