Example #1
0
    def setUp(self):
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx1['ip_addr'])
        self.ssx.telnet()
        self.ssx.clear_health_stats()

        # Clear the SSX config
        self.ssx.clear_config()
        # wait for card to come up
        self.ssx.wait4cards()


        """Establish a telnet session to Linux machine ."""
        self.xpress_vpn = Linux(topo.linux["ip_addr"],topo.linux["user_name"],
					topo.linux["password"])
        self.xpress_vpn.telnet()

	# Establish a telnet session to Linux machine (RADIUS servers)
        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],
                                        radius1['password'])
        self.ether_radius1.telnet()

        self.ether_radius2 = Linux(radius2['ip_addr'],radius2['user_name'],
                                        radius2['password'])
        self.ether_radius2.telnet()
Example #2
0
class test_AAA_FUN_011(test_case):

    myLog = getLogger()
    def setUp(self):
        #Establish a telnet session to the SSX box.
        #self.ssx = SSX(topo.ssx1["ip_addr"],topo.ssx1["user_name"],topo.ssx1["password"])
	self.ssx = SSX(topo.ssx1["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        #Establish a telnet session to the linux client box.
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.linux.telnet()
        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):
        # Close the telnet session of SSX
        self.ssx.close()
        # Close the telnet session of linux Client
        self.linux.close()

    def test_AAA_FUN_011(self):
        """
        Test case Id: -  AAA-FUN-011
        """

        self.myLog.output("\n**********start the test**************\n")

        #Push the SSX configuration
        self.ssx.config_from_string(script_var['common_ssx1'])
        self.ssx.config_from_string(script_var['user_add_ssx'])
        self.ssx.config_from_string(script_var['fun_011_ssx'])

        # Enable debug logs for aaad
        self.ssx.cmd("context %s" % script_var['context'])
        self.ssx.cmd("debug module aaad all")
        # Flush the debug logs in SSX, if any
        self.ssx.cmd("clear log debug")

        # Initiate Telnet Session from linux Client with valid user credentials
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
                    username="******"% script_var['context'],password="******")
        self.failUnless(op_telnet,"Telnet not successfull")

        op_debug = verify_in_debug(self.ssx,'METH_FAIL','"(meth = Radius)"')
        self.failUnless(op_debug,'Radius authentication method FAIL did not happen')

        # Checking user Authentication is sucesscuful or not with valid 'user3' credentials
        op_debug =  aaa_verify_authentication(self.ssx,'user3@%s'% script_var['context'],'local')
        self.failUnless(op_debug,"The look up for user3@%s at \
                                local database not occurred"% script_var['context'])

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #3
0
    def setUp(self):

        
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.linux1=Linux(linux1['ip_addr'],linux1['user_name'],linux1['password'])
        self.ssx.telnet()
        self.linux.telnet()
        self.linux1.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
	#self.ssx.configcmd("no context %s"%script_var['context_name'])
       

	# Connection To CISCO
        self.myLog.info("Connecting to the cisco ")
        self.myLog.debug("has the IP of: %s" % cisco["ip_addr"])
        self.cisco = CISCO(cisco["ip_addr"])
        self.cisco.console(cisco["ip_addr"],username="******", password="******")


	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
Example #4
0
class test_AAA_FUN_010(test_case):

    myLog = getLogger()
    def setUp(self):
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(topo.ssx1["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        #Establish a telnet session to the linux client box.
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.linux.telnet()
        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):
	# Close the telnet session of SSX
	self.ssx.close()    
	# Close the telnet session of linux Client
	self.linux.close()             

    def test_AAA_FUN_010(self):

        """
        Test case Id: -  AAA-FUN-010
        """

	self.myLog.output("\n**********start the test**************\n")

        #Push the SSX configuration
	self.ssx.config_from_string(script_var['common_ssx1'])
	self.ssx.config_from_string(script_var['fun_010_ssx'])
	
        # Enable debug logs for aaad
        self.ssx.cmd("context %s" % script_var['context'])
        self.ssx.cmd("debug module aaad all")
	# Flush the debug logs in SSX, if any
        self.ssx.cmd("clear log debug")

        # Initiate Telnet Session from linux Client with in-valid 'user3' credentials 
	# where user is having admin privileges 
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
				"user3@%s"%script_var['context'],"invalidpassword")
        self.failUnless(not op_telnet,"Authentication succeeded even with invalid user credentials")

        # Checking user Authentication is sucesscuful or not with in-valid 'user3' credentials
        op_debug =  aaa_verify_authentication(self.ssx,"user3@%s"%script_var['context'],"radius")
        self.failUnless(not op_debug,"Authentication succeeded even with invalid user credentials")

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #5
0
class test_AAA_FUN_012(test_case):

    myLog = getLogger()

    def setUp(self):
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(topo.ssx1["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        #Establish a telnet session to the linux client box.
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.linux.telnet()

        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
    
    def tearDown(self):
	# Close the telnet session of SSX
	self.ssx.close()    
	# Close the telnet session of linux Client
	self.linux.close()             

    def test_AAA_FUN_012(self):
        """
        Test case Id: -  AAA-FUN-012
        """

	self.myLog.output("\n**********start the test**************\n")

        #Push the SSX configuration
	self.ssx.config_from_string(script_var['common_ssx1'])
	self.ssx.config_from_string(script_var['fun_012_ssx'])
	
        # Enable debug logs for aaad
        self.ssx.cmd("context %s" % script_var['context'])
        self.ssx.cmd("debug module aaad all")
	# Flush the debug logs in SSX, if any
        self.ssx.cmd("clear log debug")

        # Initiate Telnet Session from linux Client with in-valid user credentials 
	# which are not configured in radius server  
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
					username="******"%script_var['context'],password="******")
        self.failUnless(not op_telnet,"Telnet happened even with the user which is not present in the Radius db")

        # Verify that SSX should initially relay the authentication information to the RADIUS.
        op_debug =  aaa_verify_authentication(self.ssx,"user3@%s"% script_var['context'],"radius","FAIL")
        self.failUnless(op_debug,"Expected user authentication FAIL but not occurred")

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #6
0
class test_AAA_FUN_008(test_case):

    myLog = getLogger()

    def setUp(self):
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(topo.ssx1["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        #Establish a telnet session to the linux client box.
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.linux.telnet()
        # wait for card to come up
        self.ssx.wait4cards()

        self.ssx.clear_health_stats()
    def tearDown(self):
	# Close the telnet session of SSX
	self.ssx.close()    
	# Close the telnet session of linux Client
	self.linux.close()             

    def test_AAA_FUN_008(self):

        """
        Test case Id: -  AAA-FUN-008
        """

	self.myLog.output("\n**********start the test**************\n")

        #Push the SSX configuration	
	self.ssx.config_from_string(script_var['common_ssx1'])
	self.ssx.config_from_string(script_var['fun_008_ssx'])
	
        # Enable debug logs for aaad
        self.ssx.cmd("context %s" % script_var['context'])
        self.ssx.cmd("debug module aaad all")
	# Flush the debug logs in SSX, if any
        self.ssx.cmd("clear log debug")

        # Initiate Telnet Session from linux Client with anonymous login 
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
				      username="******" %script_var['context'],password="******")
        self.failUnless(op_telnet is True,"Telnet not succesfull")

        # Checking user authentication is sucesscuful or not with anonymous login
        op_debug =  verify_in_debug(self.ssx,"anonymous","PASS")
        self.failUnless(op_debug,"The authentication not succesfull")

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #7
0
class test_ACL_FUN_012(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_012(self):

	#vgroup b/w SSX and LINUX.
        #vg_output1 = vgroup_new(topo2[:])
        #self.failUnless(vg_output1 == None,"vgroup FAILED")



	#configuring interface on linux machine.
	#self.linux.configure_ip_interface(p1_ssx_linux1[1], script_var['linux_phy_iface1_ip_mask'])

        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_012'])

	currconfig=self.ssx.cmd("show configuration")
	confexpected="ipv6 access-list subacl"

	if confexpected in currconfig:
		output='1'
	else :
		output='0'

	#print output
	self.failUnless(output=='0' ,"ACL name duplication for IPv4 and IPv6 ACLs")

        # Checking SSX Health
	hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #8
0
class test_NTP_FUN_013(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_NTP_FUN_013(self):

	# Push NTP configuration on NTP client 
	self.ssx.config_from_string(script_var['NTP_FUN_012'])

	#Setting time on SSX (YYYY:MM:DD:HH:MIN:SS).
	Clock_out = self.ssx.cmd("show clock ")

	Clock_out=  Clock_out.split()[4].split(":")[0]
	Clock_out = int(Clock_out) +1

	self.ssx.cmd("clock set 2008:01:21:%s:50:34"%Clock_out)
	self.ssx.cmd("show clock")
	
	#Reload SSX
	self.ssx.cmd("reload")
	self.ssx.cmd("yes")
	Clock_out_reload = self.ssx.cmd("show version")
	Clock_out_in_hour =int(Clock_out_reload.split("\n")[9].split()[6].split(":")[0])
	Clock_out_in_minu =int(Clock_out_reload.split("\n")[9].split()[6].split(":")[1])

	if Clock_out_in_minu in range(57,60):
		Clock_out_in_hour = Clock_out_in_hour +1

	self.failUnless(Clock_out == Clock_out_in_hour , "TEST FAILED")
 
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #9
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux1 = Linux(linux1["ip_addr"])
	self.linux2 = Linux(linux2["ip_addr"])
	self.linux1.telnet()
	self.linux2.telnet()
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
Example #10
0
def tui():
    import os
    x = 0
    while (x != 3):
        os.system("clear")
        os.system("tput setaf 1")
        os.system("tput bold")
        print('''
\t\t ########  ##     ##  ####
\t\t    ##     ##     ##   ##
\t\t    ##     ##     ##   ##
\t\t    ##     ##     ##   ##
\t\t    ##     ##     ##   ##
\t\t    ##     ##     ##   ##
\t\t    ##      ##   ##    ##
\t\t    ##       #####    ####
\t\t _________________________
\t\t  SERVICES AVAILABLE FOR 
\t\t _________________________
\t\t \  #  \  ________________
\t\t  \  #  \ #              #                 
\t\t   \  #  \#  DOCKER TUI  #  
\t\t    \  #  ----------------
\t\t     \  ##################
\t\t      \  _________________
\t\t       \ #               #
\t\t        \#   LINUX TUI   #  
\t\t         -----------------   
\n''')
        os.system("tput rmul")
        os.system("tput setaf 1")
        print('''
Press 1 : TO SWITCH INTO DOCKER TUI
Press 2 : TO SWITCH INTO LINUX TUI
press 3 : TO EXIT \n''')
        os.system("tput setaf 1")
        x = int(input("Enter your choices : "))
        os.system("tput setaf 15")
        if (x == 1):
            import p_docker_menu
            p_docker_menu.docker()
        elif (x == 2):
            import Linux
            Linux.linux()
        elif (x == 3):
            exit()
    else:
        print("invalid option plz press either 1 or 2")
Example #11
0
class test_ACL_FUN_034(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_034(self):

	 #vgroup b/w SSX and LINUX.
        vg_output1 = vgroup_new(topo2[:])
        self.failUnless(vg_output1 == None,"vgroup FAILED")

	#configuring tunnel on linux machine
	self.linux.configure_ip_interface(p1_ssx_linux[1], script_var['linux_phy_iface1_ip_mask'])

        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_034'])

	#changing context and clearing ip counters
	self.ssx.cmd("context %s" %(script_var['context_name']))

	#ping operation   
	time.sleep(5)
	ping_op=self.linux.ping("script_var['linux_phy_iface1_ip']")
	self.failUnless(ping_op == 1,"Ping through interface failed when acl applied")
	
	#SSX prompt change to standbymode
	self.ssx.cmd("system imc-switchover")
	time.sleep(5)
	#SSX prompt change to active mode.
	self.ssx.cmd("system imc-switchover")

	self.ssx.cmd("context %s" %(script_var['context_name']))

	#ping operation
	ping_op=self.linux.ping("script_var['linux_phy_iface1_ip']")
        self.failIfUnless(ping_op == 1,"Ping through interface failed when acl applied")
Example #12
0
class test_ACL_FUN_008(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()
    def test_ACL_FUN_008(self):

	#configuring tunnel on linux machine
	#self.linux.configure_ip_interface(p1_ssx_xpressvpn[1], script_var['xpress_phy_iface1_ip_mask'])

        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_008'])

	#changing context and clearing ip counters
	self.ssx.cmd("context %s" %(script_var['context_name']))
	self.ssx.cmd("clear port counters")
	
        #ftp  operation
        ping_op=self.ssx.cmd("copy ftp://ankit:primesoft@%s/lashmi  /hd/lashmi"%(script_var['xpress_phy_iface1_ip']))
#       self.mylog.output("the output of ftp is %s"%(ping_op))
        out=self.ssx.cmd("show ip counters tcp")
        self.myLog.output("the output of ftp is %s"%(out))
        self.failIf("3"  in  out.split()[21]  ,"ftp through interface failed when acl applied")
        # Checking SSX Health
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #13
0
class test_ACL_FUN_003(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])

        self.ssx.telnet()
        self.linux.telnet()
        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()
    def test_ACL_FUN_003(self):

	#configuring tunnel on linux machine
	self.linux.configure_ip_interface(p1_ssx_xpressvpn[1],script_var['xpress_phy_iface1_ip_mask'])
	
        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_003'])

	#changing context and clear port counters
	self.ssx.cmd("context %s" %(script_var['context_name']))
	self.ssx.cmd("clear ip access-list name subacl counters")
	time.sleep(5)

	#applying nemesis tool for generating igmp packets
	i = 0
	while i < 5 :
		self.linux.cmd("sudo /usr/local/bin/nemesis igmp -S %s -D %s -d %s "%( script_var['xpress_phy_iface1_ip'], script_var['ssx_phy_iface1_ip'],p1_ssx_xpressvpn[1]))
		time.sleep(5)
		i = i + 1

	#verifying port counters
        #md_op = self.ssx.cmd("show  port %s counters "%(p1_ssx_xpressvpn1[0]))
	#portcounters = self.ssx.cmd("show port counters | grep %s"%(ssx2_port))
	#self.Mylog.output("port counters exist in SSX:%s"%(portcounters))
	#output = verify_port_counters(self.ssx,cmd_op,1)

	output = verify_access_list_counters(self.ssx,permit_in="5")
	self.failUnless(output,"IGMP Traffic Did Not Pass Through PERMIT ICMP ACL")
	
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #14
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.linux1=Linux(linux1['ip_addr'],linux1['user_name'],linux1['password'])
	self.ssx.telnet()
        self.linux.telnet()
	self.linux1.telnet()
	
        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
Example #15
0
class test_ACL_FUN_023(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_023(self):

          #vgroup b/w SSX and LINUX.
        vg_output1 = vgroup_new(topo2[:])
        self.failUnless(vg_output1 == None,"vgroup FAILED")

	#configure interface on linux machine
	self.linux.configure_ip_interface(p1_ssx_linux1[1],script_var['linux_phy_iface1_ip_mask'])
	
        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_023'])

	#changing context and clear port counters
	self.ssx.cmd("context %s" %(script_var['context_name']))
	self.ssx.cmd("clear port %s counters "%(p1_ssx_linux1[0]))

	 #nemesis tool for generating igmp packets on linux.
        self.linux.cmd("sudo nemesis igmp -D %s -S %s -d %s"%(script_var['ssx_phy_iface1_ip'],script_var['linux_phy_iface1_ip'],p1_ssx_linux1[1]))

        #Verifying port counters.
	time.sleep(10)	
        cmd_op=self.ssx.cmd("show  port %s counters "%(p1_ssx_linux1[0]))
        self.myLog.output("displaying port counters after sending igmp traffic : %s"%cmd_op)
        output = verify_port_counters(self.ssx,cmd_op,1)

        self.failUnless(output == 1,"igmp through interface passed when acl applied")
	
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
class test_SAN_ACL_PERMITIGMP(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])

        self.ssx.telnet()
        self.linux.telnet()
        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()
    def test_SAN_ACL_PERMITIGMP(self):
	#vgroup b/w ssx and host
        out = ssx["ip_addr"].split("-mc")[0]
        os.system("vgroup %s:%s  %s:%s"%(out,ssx1_port,linux['ip_addr'],linux['interface']))


	#configuring tunnel on linux machine
	self.linux.configure_ip_interface(p1_ssx_xpressvpn[1],script_var['xpress_phy_iface1_ip_mask'])
	
        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['SAN_ACL_11-PERMITIGMP'])

	#changing context and clear port counters
	self.ssx.cmd("context %s" %(script_var['context_name']))
	self.ssx.cmd("clear port counters")

	#applying nemesis tool for generating igmp packets
	self.linux.cmd("sudo /usr/local/bin/nemesis igmp -S %s -D %s -d %s "%( script_var['xpress_phy_iface1_ip'], script_var['ssx_phy_iface1_ip'],p1_ssx_xpressvpn[1]))
	time.sleep(20)

	#verifying port counters
        cmd_op = self.ssx.cmd("show  port %s counters "%(p1_ssx_xpressvpn1[0]))
	portcounters = self.ssx.cmd("show port counters | grep %s"%(ssx2_port))
	print portcounters
	#self.Mylog.output("port counters exist in SSX:%s"%(portcounters))
	output = verify_port_counters(self.ssx,cmd_op,1)
	self.failIfEqual(output,0,"igmp through interface passed when acl applied")
	
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #17
0
class test_ACL_FUN_054(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_054(self):

	# Checking memory Before Applying Config
	memstat=self.ssx.cmd("show memory")
	

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_054'])

	#Checking Memory after Applying Config
	confmemstat=self.ssx.cmd("show memory")

	if memstat == confmemstat :
		output = '1'
	else :
		output = '0'
	
	self.failIfEqual(output,0,"Memory Changed When Ipv4 Config Was Applied")
	
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #18
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux2['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()
	'''
Example #19
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
        self.client = Linux(ike_clnt["ip_addr"])
        self.server = Linux(radius["ip_addr"])
        #self.linux5 = Linux(linux5["ip_addr"])
        self.client.telnet()
        self.server.telnet()
        #self.linux5.telnet()
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
Example #20
0
    def setUp(self):
	global ssxfdList, getPath, scriptServer
        #Establish a telnet session
        self.myLog.info(__doc__)
	self.myLog.info("Establish a telnet session to Console")
	self.ssx_con = SSX(ssx["ip_addr"])
	ssxfdList.append(self.ssx_con)
	for i in xrange(2):
		self.ssx = SSX(ssx["hostname"])
		ssxfdList.append(self.ssx)
	ssxfdList = tuple(ssxfdList)

        #Establish a telnet session to the Xpress VPN client box.
        self.xpress_vpn = Linux(topo.linux1["ip_addr"])
        self.xpress_vpn.telnet()

	# Telnet session to radisu server
	self.rad = Linux(topo.radius1["ip_addr"])
	self.rad.telnet()

	# Sniffer.
        self.sniffer = Linux(topo.linux1["ip_addr"])
        self.sniffer.telnet()

	ssxfdList[0].telnet()
	# Clear the running config
	ssxfdList[0].wait4cards()
	ssxfdList[0].clear_config()

	# Load minimum configuration
	ssxfdList[0].load_min_config(ssx["hostname"])
	ssxfdList[0].cmd("end")
	ssxfdList[0].cmd("context local")
	ssxfdList[0].ftppasswd ("copy sftp://regress@%s:%s/DoCoMo_7_6_1.cfg /hd/DoCoMo_7_6_1.cfg noconfirm"%(scriptServer,getPath),Pword="gleep7")


	# Enable the debug logs
	ssxfdList[0].cmd("debug module aaad all")	
	ssxfdList[0].cmd("debug module iked all")	
	ssxfdList[0].cmd("debug module tunmgr all")	

	# Establish a telnet session.
	for fdIndex in xrange(1,3):
		ssxfdList[fdIndex].telnet()
Example #21
0
    def setUp(self):
        #Establish a telnet session to the SSX box.
        self.ssx = SSX(topo.ssx1["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()

        #Establish a telnet session to the linux client box.
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],
				topo.linux["password"])
        self.linux.telnet()

        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],
					radius1['password'])
        self.ether_radius1.telnet()
        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
Example #22
0
class test_ACL_FUN_002(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(xpress_vpn['ip_addr'],xpress_vpn['user_name'],xpress_vpn['password'])

        self.ssx.telnet()
        self.linux.telnet()
        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()
    def test_ACL_FUN_002(self):
	        #vgroup b/w ssx and host
        #out = ssx["ip_addr"].split("-mc")[0]
        #os.system("vgroup %s:%s  %s:%s"%(out,ssx1_port,xpress_vpn['ip_addr'],xpress_vpn['interface']))


	#configuring tunnel on linux machine
	self.linux.configure_ip_interface(p1_ssx_xpressvpn[1], script_var['xpress_phy_iface1_ip_mask'])

        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_002'])

	#changing context and clearing ip counters
	self.ssx.cmd("context %s" %(script_var['context_name']))
	self.ssx.cmd("clear ip counters")
	time.sleep(5)
	#ping operation   
        ping_op=self.linux.cmd("ping -c 5 %s"%(script_var['ssx_phy_iface1_ip']),timeout=30)
        self.failIfEqual(ping_op,0,"Ping through interface failed when acl applied")

	# this api will check whether the icmp stats are getting incremented or not
	icmpCounters=self.ssx.cmd("show ip counters icmp")
        self.myLog.output("icmpCounters exists in SSX:%s" %(icmpCounters))

        output=ip_verify_ip_counters_icmp(self.ssx,total_tx='5',total='5',echo_request='5', echo_reply='5', unreachable='0', \
        mask_request='0', mask_reply='0', source_quench= '0' , param_problem='0', timestamp='0',\
        redirects='0', info_reply='0', ttl_expired='0', other='0')
        self.failUnlessEqual(output,0,"ip_counters_icmp failed")

       # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #23
0
class test_DHCP_NEG_002(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux1 = Linux(linux1["ip_addr"])
	self.linux2 = Linux(linux2["ip_addr"])
	self.linux1.telnet()
	self.linux2.telnet()
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
        # Close the telnet session of Xpress VPN Client
        self.linux1.close()
	self.linux2.close()

    def test_DHCP_NEG_002(self):

        self.myLog.output("\n**********start the test**************\n")

	# Push SSX config
        self.ssx.config_from_string(script_var['DHCP_NEG_002'])

	#Record which shows DHCP servers in SSX before deleating context in which DHCP servers configured
	self.ssx.configcmd("end")
	self.ssx.configcmd("context dhcp")
	self.myLog.output("\n\n")
	Servers_out = self.ssx.cmd("show dhcp server all")
	self.myLog.output("\n\nRecord which shows DHCP servers in SSX before deleating context in which DHCP servers configured %s"%Servers_out)
	
	#Record which shows DHCP servers in SSX after deleating context in which DHCP servers configured
	self.ssx.configcmd("no context %s"%script_var['context_name'])
	Servers_out = self.ssx.cmd("show dhcp server all")
	self.myLog.output("\n\n")
	self.myLog.output("\n\nRecord which shows DHCP servers in SSX after deleating context in which DHCP servers configured \n%s\n"%Servers_out)
 	self.failIf("Reserved" in Servers_out)																										

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #24
0
class test_ACL_CLI_002(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_CLI_002(self):
        
	# SSX config
        ip_cmd_arr = script_var['ACL_CLI_002'].split('\n')
        for i in range(0,len(ip_cmd_arr)):
           op_cmd = self.ssx.configcmd(ip_cmd_arr[i])
           self.failIf("ERROR" in op_cmd )

        # Store the show cofnig output in ssx_show_op
        ssx_show_op = self.ssx.configcmd("show configuration")

        # Verify each of the enterd commands with show config output present in "op_cmd_str"
        for entry in ip_cmd_arr:
           self.failUnless(entry.strip() in ssx_show_op,"Error while matching the cmd->%s with show oputput"% entry)
	
	# checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #25
0
    def setUp(self):
        """Establish a telnet session to the SSX box."""
        self.ssx = SSX(topo.ssx1['ip_addr'])
	self.ssx.telnet()
        self.ssx.clear_health_stats()
        # CLear SSX configuration
	self.ssx.clear_config()
        # wait for card to come up
        self.ssx.wait4cards()

        #Establish a telnet session to the Xpress VPN client box.
        self.xpress_vpn = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.xpress_vpn.telnet()

        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
        self.ether_radius1.telnet()

        self.ether_radius2 = Linux(radius2['ip_addr'],radius2['user_name'],radius2['password'])
        self.ether_radius2.telnet()
Example #26
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(xpress_vpn1['ip_addr'],xpress_vpn1['user_name'],xpress_vpn1['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Establish a telnet session to the radius servers
        self.radclient_radius1 = Linux(xpress_vpn2_multi['ip_addr'],xpress_vpn2_multi['user_name'],
                                xpress_vpn2_multi['password'])
        self.radclient_radius1.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()
    def setUp(self):

        #Establish a telnet session
        self.ssx = SSX(ssx["ip_addr"])
        self.sst = SSX(sst["ip_addr"])
        self.cisco = CISCO(cisco["ip_addr"])
        self.radius = Linux(rad_srvr["ip_addr"])

        #Initiate the telnet session
        self.ssx.telnet()
        self.sst.telnet()
        self.cisco.console(cisco["ip_addr"])
        self.radius.telnet()

        #Clear config
        self.ssx.clear_context_all()
        self.ssx.clear_ports()
        self.ssx.clear_health_stats()
        self.sst.clear_context_all()
        self.sst.clear_ports()
Example #28
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(topo.ssx["ip_addr"])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()

        #Establish a telnet session to the Xpress VPN client box.
	self.xpress_vpn = Linux(topo.xpressvpn1["ip_addr"],topo.xpressvpn1["user_name"],
				topo.xpressvpn1["password"])
        self.xpress_vpn.telnet()	

	self.radius = Linux(topo.radius["ip_addr"],topo.radius["user_name"],
				topo.radius["password"])
        self.radius.telnet()	
Example #29
0
    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx1 = SSX(ssx1["ip_addr"])
        self.ssx2 = SSX(ssx2["ip_addr"])
        self.cisco = CISCO(cisco["ip_addr"])
        self.linux = Linux(linux['ip_addr'])
        self.ssx1.telnet()
        self.ssx2.telnet()
        self.linux.telnet()
        self.cisco.console(cisco["ip_addr"])

        # Clear the SSX config
        self.ssx1.clear_config()
        self.ssx2.clear_config()

        # wait for card to come up
        self.ssx1.wait4cards()
        self.ssx1.clear_health_stats()
        self.ssx2.wait4cards()
        self.ssx2.clear_health_stats()
Example #30
0
class test_ACL_FUN_027(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(xpress_vpn['ip_addr'],xpress_vpn['user_name'],xpress_vpn['password'])
        self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):
        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_027(self):
	# Push SSX config
        self.ssx.config_from_string(script_var['ACL_FUN_027'])
	result=self.ssx.cmd("show configuration")
	pattern="ip access-group in name pubacl"
	errstat=re.search(pattern,result,0)
	if errstat is not None :
		flag=1
	else :
		flag=0
        
	self.failIfEqual(flag,1,"SSX failed to disallow to apply an non-existantacl to Port interface")
	
	# Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #31
0
class test_ACL_FUN_021(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx = SSX(ssx["ip_addr"])
	self.linux=Linux(linux['ip_addr'],linux['user_name'],linux['password'])
	self.ssx.telnet()
        self.linux.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        
	# wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()


    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
	self.linux.close()

    def test_ACL_FUN_021(self):


        self.myLog.output("==================Starting The Test====================")

	# Push SSX config
	self.ssx.config_from_string(script_var['ACL_FUN_021'])

	#Configuring non existing acl to port interface.
	Out = self.ssx.configcmd("ip access-group in name subacl")
	self.failUnless("ERROR" in Out,"Test case failed")

	   # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy( hs), "Platform is not healthy")
Example #32
0
    def setUp(self):
        #Establish a telnet session
        self.myLog.info(__doc__)
	self.myLog.info("Establish a telnet session to Console")
	self.ssx = SSX(ssx["ip_addr"])
	self.ssx.telnet()
        #Establish a telnet session to the Xpress VPN client box.
        self.xpress_vpn = Linux(topo.linux1["ip_addr"])
        self.xpress_vpn.telnet()

	# Telnet session to radisu server
	self.rad = Linux(topo.radius1["ip_addr"])
	self.rad.telnet()

	# Sniffer.
        self.sniffer = Linux(topo.linux1["ip_addr"])
        self.sniffer.telnet()

	# Enable the debug logs
	self.ssx.cmd("debug module aaad all")	
	self.ssx.cmd("debug module iked all")	
	self.ssx.cmd("debug module tunmgr all")	
Example #33
0
    def setUp(self):
        #Establish a telnet session to the SSX box.
	self.ssx = SSX(ssx1['ip_addr'])
        self.ssx.telnet()

        # Clear the SSX config
        self.ssx.clear_config()
        # wait for card to come up
        self.ssx.wait4cards()
        self.ssx.clear_health_stats()

        """Establish a telnet session to the Netscreen."""
        self.ns5gt = NS(ns['ip_addr'])
        self.ns5gt.telnet()
        self.ns5gt.clear_config()

        """Establish a telnet session to Linux machine ."""
        self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.linux.telnet()

        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
        self.ether_radius1.telnet()
Example #34
0
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import os
import Windows
import Linux


#获取dns列表
dnslist = open('dns.txt', 'r', encoding='utf-8')
dns_list = dnslist.read().split('\n')
dnslist.close()

#获取测试网址
htmllist=open('html.txt', 'r', encoding='utf-8')
html_list=htmllist.read().split('\n')
htmllist.close()

#判断系统
local_systeam=os.name
if local_systeam == 'nt':
    Windows.run(dns_list,html_list)
if local_systeam=='posix':
    Linux.run(dns_list, html_list)
Example #35
0
    def createVolumesList(self,
                          config,
                          configfile,
                          imagedir,
                          imagetype,
                          upload_prefix=""):
        """creates volume list"""
        volumes = list()
        if config.has_section('Volumes'):

            #check what volumes to migrate
            letters = ""
            letterslist = list()
            if config.has_option('Volumes', 'letters'):
                letters = config.get('Volumes', 'letters')
            letterslist = letters.split(',')

            # if system is set , add autolocated system volume by default
            if config.has_option('Volumes', 'system'):
                addsys = config.getboolean('Volumes', 'system')
                if addsys:
                    logging.debug("system is set in volumes config")
                    sysvol = os.environ['windir'].split(
                        ':'
                    )[0]  #todo: change to cross-platform way. windir is set artificially at the program start for linux
                    if not sysvol in letterslist:
                        letterslist.append(sysvol)
                        logging.debug("appending system volume " + sysvol +
                                      " to the volume list")
                    else:
                        logging.debug("skipping  " + sysvol +
                                      " - it is already in the list")

            logging.debug("Volume letters to process are: " + str(letterslist))
            for letter in letterslist:
                letter = str(letter).strip()  #remove spaces between commas
                if not letter:
                    continue
                letter = str(letter).strip()
                if os.name == 'nt':
                    devicepath = '\\\\.\\' + letter + ':'
                    sys.path.append('./Windows')
                    try:
                        import Windows
                        size = Windows.Windows().getSystemInfo().getVolumeInfo(
                            letter + ":").getSize()
                    except Exception as e:
                        logging.debug("Cannot get local data on volume " +
                                      letter + " " + str(e))
                        size = 0
                else:
                    if not "/dev/" in letter:
                        devicepath = "/dev/" + letter
                    else:
                        devicepath = letter
                    sys.path.append('./Linux')
                    try:
                        import Linux
                        size = Linux.Linux().getSystemInfo().getVolumeInfo(
                            devicepath).getSize()
                    except Exception as e:
                        logging.debug("Cannot get local data on volume " +
                                      letter + " " + str(e))
                        size = 0
                volume = VolumeMigrateIniConfig(config, configfile, letter,
                                                devicepath)
                if volume.getImagePath() == '':
                    volume.setImagePath(imagedir + "/" + letter + "." +
                                        imagetype)
                if volume.getImageSize() == 0:
                    volume.setImageSize(size)
                if volume.getUploadPath() == '':
                    volume.setUploadPath(upload_prefix +
                                         os.environ['COMPUTERNAME'] + "-" +
                                         letter)
                volumes.append(volume)
        return volumes
class test_GLCR_SES_IKEv2_FUN_001(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session
        self.ssx = SSX(ssx["ip_addr"])
        self.sst = SSX(sst["ip_addr"])
        self.cisco = CISCO(cisco["ip_addr"])
        self.radius = Linux(rad_srvr["ip_addr"])

        #Initiate the telnet session
        self.ssx.telnet()
        self.sst.telnet()
        self.cisco.console(cisco["ip_addr"])
        self.radius.telnet()

        #Clear config
        self.ssx.clear_context_all()
        self.ssx.clear_ports()
        self.ssx.clear_health_stats()
        self.sst.clear_context_all()
        self.sst.clear_ports()

    def tearDown(self):

        # Bring down the sessions
        self.sst.cmd(
            "sst %s count - 1 rate 1 ike-protocol ikev2 transport ipv4" %
            ipsec_var['port_sst_slot2'])

        # Close the telnet sessions
        self.ssx.close()
        self.sst.close()
        self.radius.close()

    def test_GLCR_SES_IKEv2_FUN_001(self):

        self.myLog.output("\n**********starting the test**************\n")

        self.myLog.info("Verifying the SSX, GLC-R enabled or not")
        op = verify_glcr_status(self.ssx)
        if op == 1:
            self.myLog.output(
                "Device is not configured for GLC Redundancy\nConfiguring the System for GLC-R, needs reboot\n"
            )
            set_device_to_glcr(self.ssx)

#Getting the GLCR Status
        self.myLog.info("Getting the GLCR Status")
        op = get_glcr_status(self.ssx)
        if int(op['standby']) != 4:
            self.myLog.error(
                "4th card is not Standby card - reloading the Box")
            self.ssx.reload_device(timeout=200)

        #Push the config to SSX
        self.myLog.info("\n\nConfiguring the SSX and SST\n\n")
        self.ssx.config_from_string(ipsec_var['GLCR_SES_IKEv2_FUN_001'])
        self.sst.config_from_string(ipsec_var['SST_GLCR_SES_IKEv2_FUN_001'])

        #clear prev logs and Enable the logs
        self.ssx.cmd("no debug all")
        self.ssx.cmd("clear log debug")
        self.ssx.cmd("debug module iked all")
        self.ssx.cmd("debug module aaad all")

        #Configuring the radius server
        self.myLog.info("Configuring the radius server")
        self.radius.configure_ip_interface(p_cisco_rad[1],
                                           ipsec_var['card2_rad_server1/mask'])

        #Configure Cisco
        self.myLog.info("Configuring Cisco")
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_sst_slot2_ip/mask'],
            intf=p_sst_cisco_slot2[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_sst_slot3_ip/mask'],
            intf=p_sst_cisco_slot3[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_card2_active_ip/mask'],
            intf=p_active_ssx_cisco_slot2[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_card2_standby_ip/mask'],
            intf=p_standby_ssx_cisco_slot2[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_to_rad_ip/mask'],
            intf=p_to_rad_active_ssx_cisco_slot2[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_card2_rad_server_ip/mask'],
            intf=p_cisco_rad[0])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_service_bkp_ip/mask'],
            intf=p_to_rad_standby_ssx_cisco_slot2[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_active_slot3_ip_mask'],
            intf=p_active_ssx_cisco_slot3[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_standby_4slot3_ip_mask'],
            intf=p_standby_ssx_cisco_slot3[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_rad_intf_4slot3_ip/mask'],
            intf=p_to_rad_active_ssx_cisco_slot3[1])
        self.cisco.configure_ipv4_interface(
            ip_addr=ipsec_var['cisco_bkp_rad_intf_4slot3_ip/mask'],
            intf=p_to_rad_standby_ssx_cisco_slot3[1])

        #Configring the radius and adding routes
        self.myLog.info("Configring the radius and adding routes")
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['card2_route_active_rad'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['card2_route_backup_rad'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['card2_ses_route'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['route_sst_ixia'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['route_to_cisco_active_rad'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))
        self.radius.cmd(
            "sudo /sbin/route add -net %s gw %s dev %s" %
            (ipsec_var['route_to_cisco_standby_rad'],
             ipsec_var['cisco_card2_rad_server_ip'], p_cisco_rad[1]))

        self.radius.cmd("sudo pkill radius")
        self.radius.cmd("sudo /usr/local/sbin/radiusd")
        self.radius.cmd("sudo /a/radius1/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius2/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius3/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius4/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius5/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius6/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius7/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius8/sbin/radiusd")
        #self.radius.cmd("sudo /a/radius9/sbin/radiusd")

        self.cisco.cmd("conf t")
        self.cisco.cmd("no ip sla 100")
        self.cisco.cmd("ip sla 100")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['ssx_card2_active'],
                        ipsec_var['cisco_card2_active_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 100 life forever start-time now")
        self.cisco.cmd("no ip sla 101")
        self.cisco.cmd("ip sla 101")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['ssx_card2_standby_ip'],
                        ipsec_var['cisco_card2_standby_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 101 life forever start-time now")
        self.cisco.cmd("no ip sla 200")
        self.cisco.cmd("ip sla 200")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['to_rad_ip'], ipsec_var['cisco_to_rad_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 200 life forever start-time now")
        self.cisco.cmd("no ip sla 201")
        self.cisco.cmd("ip sla 201")
        self.cisco.cmd(
            "icmp-echo %s source-ip %s" %
            (ipsec_var['service_bkp_ip'], ipsec_var['cisco_service_bkp_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 201 life forever start-time now")
        self.cisco.cmd("no ip sla 300")
        self.cisco.cmd("ip sla 300")
        self.cisco.cmd(
            "icmp-echo %s source-ip %s" %
            (ipsec_var['active_slot3_ip'], ipsec_var['cisco_active_slot3_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 300 life forever start-time now")
        self.cisco.cmd("no ip sla 301")
        self.cisco.cmd("ip sla 301")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['standby_4slot3_ip'],
                        ipsec_var['cisco_standby_4slot3_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 301 life forever start-time now")
        self.cisco.cmd("no ip sla 400")
        self.cisco.cmd("ip sla 400")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['rad_intf_4slot3_ip'],
                        ipsec_var['cisco_rad_intf_4slot3_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 400 life forever start-time now")
        self.cisco.cmd("no ip sla 401")
        self.cisco.cmd("ip sla 401")
        self.cisco.cmd("icmp-echo %s source-ip %s" %
                       (ipsec_var['bkp_rad_intf_4slot3_ip'],
                        ipsec_var['cisco_bkp_rad_intf_4slot3_ip']))
        self.cisco.cmd("exit")
        self.cisco.cmd("ip sla schedule 401 life forever start-time now")
        self.cisco.cmd("track 11 rtr 100 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 12 rtr 101 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 13 rtr 200 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 14 rtr 201 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 15 rtr 300 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 16 rtr 301 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 17 rtr 400 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("track 18 rtr 401 reachability")
        self.cisco.cmd("exit")
        self.cisco.cmd("end")
        self.cisco.cmd("")
        self.cisco.cmd("")

        #Configuring the route at Cisco
        self.myLog.info("Configuring the route at Cisco")
        self.cisco.cmd("conf t")
        self.cisco.cmd("ip route %s %s track 11" %
                       (ipsec_var['cisco_rt_card2_lpbk_ip'],
                        ipsec_var['ssx_card2_active']))
        self.cisco.cmd(
            "ip route %s %s track 11" %
            (ipsec_var['ikev2_lpbk_ip_mask'], ipsec_var['ssx_card2_active']))
        self.cisco.cmd("ip route %s %s 20 track 12" %
                       (ipsec_var['cisco_rt_card2_lpbk_ip'],
                        ipsec_var['ssx_card2_standby_ip']))
        self.cisco.cmd("ip route %s %s 20 track 12" %
                       (ipsec_var['ikev2_lpbk_ip_mask'],
                        ipsec_var['ssx_card2_standby_ip']))
        self.cisco.cmd(
            "ip route %s %s track 13" %
            (ipsec_var['cisco_card2_ses_route'], ipsec_var['to_rad_ip']))
        self.cisco.cmd(
            "ip route %s %s track 13" %
            (ipsec_var['cisco_card2_ses_route1'], ipsec_var['to_rad_ip']))
        self.cisco.cmd(
            "ip route %s %s 20 track 14" %
            (ipsec_var['cisco_card2_ses_route'], ipsec_var['service_bkp_ip']))
        self.cisco.cmd(
            "ip route %s %s 20 track 14" %
            (ipsec_var['cisco_card2_ses_route1'], ipsec_var['service_bkp_ip']))
        self.cisco.cmd(
            "ip route %s %s track 15" %
            (ipsec_var['card2_lpbk_ip1_mask'], ipsec_var['active_slot3_ip']))
        self.cisco.cmd(
            "ip route %s %s track 15" %
            (ipsec_var['lpbk_3rCard_ip_mask'], ipsec_var['active_slot3_ip']))
        self.cisco.cmd(
            "ip route %s %s 20 track 16" %
            (ipsec_var['card2_lpbk_ip1_mask'], ipsec_var['standby_4slot3_ip']))
        self.cisco.cmd(
            "ip route %s %s 20 track 16" %
            (ipsec_var['lpbk_3rCard_ip_mask'], ipsec_var['standby_4slot3_ip']))
        self.cisco.cmd("ip route %s %s track 17" %
                       (ipsec_var['cisco_route_sst_ixia'],
                        ipsec_var['rad_intf_4slot3_ip']))
        self.cisco.cmd("ip route %s %s 20 track 18" %
                       (ipsec_var['cisco_route_sst_ixia'],
                        ipsec_var['bkp_rad_intf_4slot3_ip']))
        self.cisco.cmd("ip route %s %s" % (ipsec_var['cisco_route_to_sst_ses'],
                                           ipsec_var['sst_cisco_slot2_ip']))
        self.cisco.cmd("ip route %s %s" % (ipsec_var['cisco_route_sst_slot3'],
                                           ipsec_var['sst_cisco_slot3_ip']))
        self.cisco.cmd(
            "ip route %s %s" %
            (ipsec_var['route_to_card2_ses'], ipsec_var['card2_ip']))
        self.cisco.cmd(
            "ip route %s %s" %
            (ipsec_var['route_to_card2_ses'], ipsec_var['card2_ip1']))

        #Initiate the ikev2 sessions from SST
        self.myLog.info("Initiate the ikev2 sessions from SST")
        self.sst.cmd("context local")
        op = self.sst.cmd(
            "sst %s count - 60000 ike-protocol ikev2 transport ipv4" %
            ipsec_var['port_sst_slot2'])
        if (op and (int(op.split()[-1]) != 0)):
            self.sst.cmd(
                "sst %s count - %s ike-protocol ikev2 transport ipv4" %
                (ipsec_var['port_sst_slot2'], op.split()[-1]))

        self.sst.cmd(
            "sst %s count 1 rate 1 ike-protocol ikev2 transport ipv4" %
            ipsec_var['port_sst_slot2'])

        # Moving to context
        self.ssx.cmd("context %s" % ipsec_var['context_card2'])
        time.sleep(60)

        # Verify the session
        self.myLog.info("Verifying the session parameters")
        ses_yn = self.ssx.cmd("show ike-session 2 brief")
        self.myLog.output("show ike-session 2 brief : %s" % ses_yn)
        if ses_yn.splitlines()[-1].split()[2] != 'Y':
            self.fail("FAIL : ipv4 session is not establised in 2nd card")

        op1 = self.ssx.cmd("show session") + self.ssx.cmd(
            "show ike-session 2 brief") + self.ssx.cmd(
                "show ike-session 2 list") + self.ssx.cmd(
                    "show ike-session detail handle %s" %
                    ses_yn.splitlines()[-1].split()[1])
        self.myLog.output("Session Details before GLC Failover: %s" % op1)

        #GLC Failover
        self.myLog.info("GLC Failover - 2nd Card ")
        self.ssx.cmd("reload card 2")
        self.cisco.cmd("conf t")
        self.cisco.cmd("int gig %s" % ipsec_var['port_cisco_active_4slot2'])
        self.cisco.cmd("shutdown")
        self.cisco.cmd("exit")
        self.cisco.cmd("int gig %s" % ipsec_var['port_cisco_rad_intf_4slot2'])
        self.cisco.cmd("shutdown")
        self.cisco.cmd("end")
        time.sleep(10)

        #Verifying the sessions after GLC Failover
        self.myLog.info("Verifying the session after GLC Failover at 4th card")
        ses_yn = self.ssx.cmd("show ike-session 4 brief")
        self.myLog.output("show ike-session 4 brief : %s" % ses_yn)
        if ses_yn.splitlines()[-1].split()[2] != 'Y':
            self.fail("FAIL : ipv4 session is not backed up in 4th card")

        op1 = self.ssx.cmd("show session") + self.ssx.cmd(
            "show ike-session 4 brief") + self.ssx.cmd(
                "show ike-session 4 list") + self.ssx.cmd(
                    "show ike-session detail handle %s" %
                    ses_yn.splitlines()[-1].split()[1])
        self.myLog.output("Session Details on 4th card: %s" % op1)

        #Giving some delay
        self.myLog.info("Giving some delay to card 2 to come up")
        time.sleep(30)
        self.ssx.wait4cards()
        time.sleep(5)

        #Doing GLC Switchback
        self.ssx.wait4cards()
        self.ssx.cmd("system glc-switchback")
        self.cisco.cmd("conf t")
        self.cisco.cmd("int gig %s" % ipsec_var['port_cisco_active_4slot2'])
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("exit")
        self.cisco.cmd("int gig %s" % ipsec_var['port_cisco_rad_intf_4slot2'])
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("end")
        time.sleep(10)
        self.ssx.wait4cards()

        #Verifying the sessions after glc-switchback
        self.myLog.info("Verifying the session after glc-switchback")
        ses_yn = self.ssx.cmd("show ike-session 2 brief")
        self.myLog.output("show ike-session 2 brief : %s" % ses_yn)
        if ses_yn.splitlines()[-1].split()[2] != 'Y':
            self.fail("FAIL : ipv4 session is not establised in 2nd card")

        op1 = self.ssx.cmd("show session") + self.ssx.cmd(
            "show ike-session 2 brief") + self.ssx.cmd(
                "show ike-session 2 list") + self.ssx.cmd(
                    "show ike-session detail handle %s" %
                    ses_yn.splitlines()[-1].split()[1])
        self.myLog.output("Session Details after glc-switchback: %s" % op1)

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
Example #37
0
class test_ECMP_FUN_001(test_case):
    myLog = getLogger()

    def setUp(self):

        #Establish a telnet session to the SSX box.
        self.ssx1 = SSX(ssx1["ip_addr"])
        self.ssx2 = SSX(ssx2["ip_addr"])
        self.cisco = CISCO(cisco["ip_addr"])
        self.linux = Linux(linux['ip_addr'])
        self.ssx1.telnet()
        self.ssx2.telnet()
        self.linux.telnet()
        self.cisco.console(cisco["ip_addr"])

        # Clear the SSX config
        self.ssx1.clear_config()
        self.ssx2.clear_config()

        # wait for card to come up
        self.ssx1.wait4cards()
        self.ssx1.clear_health_stats()
        self.ssx2.wait4cards()
        self.ssx2.clear_health_stats()

    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx1.close()
        self.ssx2.close()
        self.linux.close()

    def test_ECMP_FUN_001(self):

        self.myLog.output(
            "==================Starting The Test====================")

        # Push SSX config
        self.ssx1.config_from_string(ecmp_var['ECMP_FUN_001_SSX1'])
        self.ssx2.config_from_string(ecmp_var['ECMP_FUN_001_SSX2'])
        self.myLog.info(
            "Configured the OSPF, BGP in the SSX\nConfiguring in the Cisco")

        self.cisco.clear_interface_config(intf=p_ssx1_cisco[1])
        self.cisco.clear_interface_config(intf=p_cisco_ssx2[0])
        self.myLog.info("Adding required vlans to database")
        self.cisco.cmd("vlan database")
        self.cisco.cmd("vlan %s" % ecmp_var['ospf_vlan1'])
        self.cisco.cmd("vlan %s" % ecmp_var['ospf_vlan2'])
        self.cisco.cmd("vlan %s" % ecmp_var['ospf_vlan3'])
        self.cisco.cmd("vlan %s" % ecmp_var['ospf_vlan4'])
        self.cisco.cmd("vlan %s" % ecmp_var['ospf_vlan5'])
        self.cisco.cmd("vlan %s" % ecmp_var['bgp_vlan1'])
        self.cisco.cmd("vlan %s" % ecmp_var['bgp_vlan1'])
        self.cisco.cmd("vlan 700")
        self.cisco.cmd("vlan 800")
        self.cisco.cmd("exit")
        self.cisco.cmd("conf t")
        self.cisco.cmd("no interface vlan %s" % ecmp_var['ospf_vlan1'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['ospf_vlan2'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['ospf_vlan3'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['ospf_vlan4'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['ospf_vlan5'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['bgp_vlan1'])
        self.cisco.cmd("no interface vlan %s" % ecmp_var['bgp_vlan2'])
        self.cisco.cmd("no interface vlan 700")
        self.cisco.cmd("no interface vlan 800")
        self.cisco.cmd("interface vlan %s" % ecmp_var['ospf_vlan1'])
        self.cisco.cmd("no ip address")
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("ip address %s" % ecmp_var['cisco_ospf_intf1_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['ospf_vlan2'])
        self.cisco.cmd("no ip address")
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("ip address %s" % ecmp_var['cisco_ospf_intf2_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['ospf_vlan3'])
        self.cisco.cmd("no ip address")
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("ip address %s" % ecmp_var['cisco_ospf_intf3_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['ospf_vlan4'])
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("no ip address")
        self.cisco.cmd("ip address %s" % ecmp_var['cisco_ospf_intf4_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['ospf_vlan5'])
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("no ip address")
        self.cisco.cmd("ip address %s" %
                       ecmp_var['cisco_ssx2_ospf_intf1_ip/mask'])
        self.cisco.cmd("ip ospf mtu-ignore")
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['bgp_vlan1'])
        self.cisco.cmd("no ip address")
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("ip address %s" %
                       ecmp_var['bgp_intf_cisco_ssx1_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface vlan %s" % ecmp_var['bgp_vlan2'])
        self.cisco.cmd("no ip address")
        self.cisco.cmd("no shutdown")
        self.cisco.cmd("ip address %s" %
                       ecmp_var['bgp_intf_cisco_ssx2_ip/mask'])
        self.cisco.cmd("exit")
        self.cisco.cmd("interface giga %s" % p_ssx1_cisco[1])
        self.cisco.cmd("switchport")
        self.cisco.cmd("switchport access vlan %s" % ecmp_var['ospf_vlan1'])
        self.cisco.cmd("switchport trunk encapsulation dot1q")
        self.cisco.cmd("switchport trunk allowed vlan %s-%s" %
                       (ecmp_var['ospf_vlan1'], ecmp_var['ospf_vlan4']))
        self.cisco.cmd("switchport mode trunk")
        self.cisco.cmd("no ip address")
        self.cisco.cmd("exit")
        self.cisco.cmd("interface giga %s" % p_cisco_ssx2[0])
        self.cisco.cmd("switchport")
        self.cisco.cmd("switchport access vlan %s" % ecmp_var['bgp_vlan2'])
        self.cisco.cmd("switchport trunk encapsulation dot1q")
        self.cisco.cmd("switchport trunk allowed vlan %s-800" %
                       ecmp_var['bgp_vlan2'])
        self.cisco.cmd("switchport mode trunk")
        self.cisco.cmd("no ip address")
        self.cisco.cmd("exit")
        self.cisco.cmd("no router ospf 123")
        self.cisco.cmd("router ospf 123")
        self.cisco.cmd("router-id 56.1.2.2")
        self.cisco.cmd("log-adjacency-changes")
        self.cisco.cmd("redistribute connected subnets")
        self.cisco.cmd("redistribute static subnets")
        self.cisco.cmd("network %s area 0" % ecmp_var['ospf_route1'])
        self.cisco.cmd("network %s area 0" % ecmp_var['ospf_route2'])
        self.cisco.cmd("network %s area 0" % ecmp_var['ospf_route3'])
        self.cisco.cmd("network %s area 0" % ecmp_var['ospf_route4'])
        self.cisco.cmd("exit")
        self.cisco.cmd("no router ospf 111")
        self.cisco.cmd("router ospf 111")
        self.cisco.cmd("router-id 11.11.11.11")
        self.cisco.cmd("log-adjacency-changes")
        self.cisco.cmd("redistribute connected subnets")
        self.cisco.cmd("redistribute static subnets")
        self.cisco.cmd("network %s area 0" % ecmp_var['ospf_route5'])
        self.cisco.cmd("end")

        time.sleep(60)

        #Moving to context
        self.ssx1.cmd("context %s" % ecmp_var['context_name1'])

        #Verify the all ospf's are up with the neighbor
        self.myLog.info("Verifying the ospf states at router - %s" %
                        ecmp_var['context_name1'])
        ospf_op1 = self.ssx1.cmd('show ip ospf neighbor | grep "%s"' %
                                 ecmp_var['cisco_ospf_intf4_ip'])
        if not "Full" in ospf_op1:
            self.fail(
                "OSPF Router is not established with the adjacent interface %s"
                % ecmp_var['cisco_ospf_intf4_ip'])
        ospf_op1 = self.ssx1.cmd('show ip ospf neighbor | grep "%s"' %
                                 ecmp_var['cisco_ospf_intf3_ip'])
        if not "Full" in ospf_op1:
            self.fail(
                "OSPF Router is not established with the adjacent interface %s"
                % ecmp_var['cisco_ospf_intf3_ip'])
        ospf_op1 = self.ssx1.cmd('show ip ospf neighbor | grep "%s"' %
                                 ecmp_var['cisco_ospf_intf2_ip'])
        if not "Full" in ospf_op1:
            self.fail(
                "OSPF Router is not established with the adjacent interface %s"
                % ecmp_var['cisco_ospf_intf2_ip'])
        ospf_op1 = self.ssx1.cmd('show ip ospf neighbor | grep "%s"' %
                                 ecmp_var['ospf_intf1_ip'])
        if not "Full" in ospf_op1:
            self.fail(
                "OSPF Router is not established with the adjacent interface %s"
                % ecmp_var['cisco_ospf_intf1_ip'])
        self.myLog.output(
            "OSPF Adjacency withh all the 4 L3 interfaces are fine")

        #Verifying the OSPF state at other router
        self.myLog.info("Verifying the OSPF state at other router")
        self.ssx2.cmd("context %s" % ecmp_var['context_name2'])
        ospf_op1 = self.ssx1.cmd("show ip ospf neighbor")
        if not "Full" in ospf_op1:
            self.fail(
                "OSPF Router is not established with the adjacent interface")

        self.ssx1.cmd("context %s" % ecmp_var['context_name1'])
        self.ssx2.cmd("context %s" % ecmp_var['context_name2'])

        #Verify the MAX ECMP should be 4
        self.myLog.info("Verify the MAX ECMP should be 4")
        self.myLog.info("output of 'show ip ospf': %s" %
                        self.ssx1.cmd("show ip ospf "))
        ecmp_op = self.ssx1.cmd("show ip ospf | grep -i ecmp")
        op = re.search("\s+Maximum\s+paths\s+\(ECMP\)\s+(\d+)", ecmp_op)
        op = op.group(1)
        if int(op) != 4:
            self.fail("ECMP path is not 4")
        self.myLog.output("Maximum Paths are: %s" % op)

        #Verifying that routes are distributed evenly among all next 4 hops
        self.myLog.info(
            "Verifying that routes are distributed evenly among all next 4 hops"
        )
        route_op = self.ssx1.cmd("show ip route ospf")
        self.myLog.info("output of 'show ip route ospf': %s" % route_op)
        self.failIf(
            int(len(route_op.split("*>")[-1].splitlines())) != 4,
            "routes are not distributed evenly among all next 4 hops")
        self.failIf(
            int(len(route_op.split("*>")[-1].splitlines())) != 4,
            "routes are not distributed evenly among all next 4 hops")

        #Verifying the External BGP
        self.ssx2.cmd("context %s" % ecmp_var['context_name3'])
        op = self.ssx2.cmd("show ip bgp neighbors")
        op = re.search("\s+Connections\s+established\s+(\d+)", op)
        op = op.group(1)
        if int(op) != 1:
            self.fail(
                "External BGP connection not established with the neighbor")

        # Checking SSX Health
        hs1 = self.ssx1.get_health_stats()
        self.failUnless(is_healthy(hs1), "Platform is not healthy at SSX1")
        hs2 = self.ssx2.get_health_stats()
        self.failUnless(is_healthy(hs2), "Platform is not healthy at SSX2")
Example #38
0
    def __init__(self , cloud_options , migrate_options, sys_adjust_overrides , skip_imaging=False, resume_upload=False, skip_upload=False ,\
        self_checks=False , limits = None , insert_vitio = False , insert_xen = False, backup_mode = False):
        """
        Inits the Migrator mega-class. 

        Args:
            cloud_options: CloudConfig.CloudConfig - options specifiying cloud parameters. These options are passed to cloud instance generators and upload channels
            migrate_options: MigrateConfig.MigrateConfig - options specifiying how the image should be migrated. These options alters the Migrator behaviour
            sys_adjust_overrides: dict - dict-like class overriding default options specifying how the resulting system should be adjusted
            skip_imaging: bool - flag to skip imaging activities. Needed primarily for resume-upload scenarios
            resume_upload: bool - flag to resume upload instead of starting new one. Needed primarily for resume-upload scenarios
            skip_upload: bool - flag to skip upload at all. Needed primarily in case when the upload is already done but cloud server is not created yet
            self_checks: bool - some self-checks on images\registry during the Migrator work (doesn't work for now!)
            limits: ? (currently long) - the limitation of data to be transfered
            insert_vitio : bool - inserts virtio drivers to the running system. Note, this option can be overriden with migrate_options.insertVirtIo()
            insert_xen : bool - inserts xen drivers to the running system. Note, this option can be overriden with migrate_options.insertXen()
            backup_mode : bool - doesn't create a VM inside the cloud. Just stores image there
        """
        self.__adjustedSystemBackupSource = None
        self.__systemBackupSource = None
        self.__systemTransferTarget = None
        self.__systemAdjustOptions = None
        # the channel is underlying connection to transfer the data for system target
        self.__systemTransferChannel = None
        self.__systemMedia = None

        self.__limitUpload = limits

        self.__adjustOption = None
        self.__migrateOptions = migrate_options
        self.__cloudOptions = cloud_options

        self.__dataBackupSourceList = dict(
        )  # the key is data volume device path
        self.__dataTransferTargetList = dict()
        self.__dataChannelList = dict()
        self.__dataMediaList = dict()

        self.__runOnWindows = False

        self.__selfChecks = self_checks
        self.__skipImaging = skip_imaging
        self.__skipUpload = skip_upload
        self.__resumeUpload = resume_upload
        self.__backupMode = backup_mode

        self.__resultingInstance = None

        self.__cloudName = self.__cloudOptions.getTargetCloud()

        #extra megabyte of additional size to store mbr, etc on the image
        self.__additionalMediaSize = 0x800 * 0x200
        self.__os = None

        self.__fileBackup = False
        self.__insertVirtio = insert_vitio or migrate_options.insertVirtIo()
        self.__insertXen = insert_xen or migrate_options.insertXen()

        self.__error = False

        #TODO: pass this parm somehow. Thru migrate\adjust overrides?
        self.__linuxGC = True

        #TODO: analyze both host and source systems
        if self.__migrateOptions.getHostOs() == "Windows":
            import Windows
            self.__windows = Windows.Windows(self.__insertVirtio,
                                             self.__insertXen)
            self.__runOnWindows = True
            self.__winSystemAdjustOptions = self.__windows.createSystemAdjustOptions(
                sys_adjust_overrides)
            self.__systemAdjustOptions = self.__winSystemAdjustOptions
            self.__os = self.__windows
            #self.__winSystemAdjustOptions
        else:
            if self.__linuxGC:
                import Linux_GC
                self.__linux = Linux_GC.Linux()
            else:
                import Linux
                self.__linux = Linux.Linux()
            self.__systemAdjustOptions = self.__linux.createSystemAdjustOptions(
            )
            self.__os = self.__linux