当前位置: 首页>>代码示例>>Python>>正文


Python Linux.Linux类代码示例

本文整理汇总了Python中Linux.Linux的典型用法代码示例。如果您正苦于以下问题:Python Linux类的具体用法?Python Linux怎么用?Python Linux使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Linux类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_AAA_FUN_006

class test_AAA_FUN_006(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_006(self):

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

	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_006_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 to SSX from linux Client with valid user-1 credentials and 
	# with  idle timeout 60sec  
        # where user having admin privileges
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
				   username="[email protected]%s"%script_var['context'],password="123user3",timeout='60')
        self.failUnless(op_telnet is True,"Success")

	# Checking user authentication is sucesscuful or not with valid user-1 credentials
        op_debug =  verify_in_debug(self.ssx,"[email protected]%s"%script_var['context'],"DELETE_SESSION")
        self.failUnless(op_debug,"the authentication not success")

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:59,代码来源:AAA_FUN_006.py

示例2: setUp

    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()

        #Establish a telnet session to the xpressvpn1 client box.
        self.xpressvpn1 = Linux(xpressvpn1["ip_addr"],xpressvpn1["user_name"],xpressvpn1["password"])
        self.xpressvpn1.telnet()
	self.linux1 = Linux(linux1["ip_addr"],linux1["user_name"],linux1["password"])
	self.linux1.telnet()
	# wait for card to come up 
	self.ssx.wait4cards()
        self.ssx.clear_health_stats()
开发者ID:muttu2244,项目名称:MyPython,代码行数:16,代码来源:ip_atk_076.py

示例3: setUp

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

	#Establish a telnet session to the Netscreen.
        self.ns5gt = NS(ns['ipaddr'])
        self.ns5gt.telnet()
	# Inserting the code of Linux1 object -- Ashu
	#Establish a telnet session to the linux1 client box.
        self.linux1 = Linux(linux1["ip_addr"],linux1["user_name"],
                                        linux1["password"])
        self.linux1.telnet()

        #clear the configuration on Netscreen
        self.ns5gt.clear_config()


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


	# wait for card to come up 
	self.ssx.wait4cards()
        self.ssx.clear_health_stats()
开发者ID:muttu2244,项目名称:MyPython,代码行数:25,代码来源:ip_atk_078.py

示例4: setUp

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

        # CLear SSX configuration
	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.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.xpress_vpn.telnet()

        # Establish a telnet session to the radius servers
        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
        self.ether_radius1.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:18,代码来源:RADIUS_NEG_003.py

示例5: setUp

    def setUp(self):

        """Establish a telnet session to the SSX box."""
        self.ssx = SSX(ssx_HA['ip_addr'])
	self.ssx.telnet()
        self.ssx.clear_health_stats()

        # CLear SSX configuration
	self.ssx.clear_config()
        self.ssx.wait4cards()

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

        #Establish a telnet session to the RADIUS server box.
	self.radius1=Linux(xpress_vpn2_multi['ip_addr'],xpress_vpn2_multi['user_name'],xpress_vpn2_multi['password'])
        self.radius1.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:19,代码来源:CDR_HA_FUN_002.py

示例6: setUp

    def setUp(self):
	self.myLog.info(__doc__)
        """Establish a telnet session to the SSX box."""
        self.ssx = SSX(topo.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()

        # wait for card to come up
        self.ssx.wait4cards()

        # CLear SSX configuration
	self.ssx.clear_config()
	self.ssx.clear_health_stats()
开发者ID:muttu2244,项目名称:MyPython,代码行数:20,代码来源:DoCoMo_6_2_1.py

示例7: setUp

    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()
开发者ID:muttu2244,项目名称:MyPython,代码行数:13,代码来源:AAA_FUN_003.py

示例8: setUp

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

        # Clear SSX configuration
        self.ssx.clear_config()
 	# wait for card to come up and clear syscount
	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()

        self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
        self.ether_radius1.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:17,代码来源:RADIUS_FUN_031.py

示例9: setUp

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

        # Clear SSX configuration
        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.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
        self.xpress_vpn.telnet()
        """Establish a telnet session to the Netscreen."""
        self.ns5gt = NS(ns['ip_addr'])
        self.ns5gt.telnet()
        self.ns5gt.clear_config()
开发者ID:muttu2244,项目名称:MyPython,代码行数:18,代码来源:RADIUS_FUN_033.py

示例10: test_DoCoMo_6_2_1

class test_DoCoMo_6_2_1(test_case):
    myLog = getLogger()
    global pskFlag
    pskFlag = 0

    def setUp(self):
	self.myLog.info(__doc__)
        """Establish a telnet session to the SSX box."""
        self.ssx = SSX(topo.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()

        # wait for card to come up
        self.ssx.wait4cards()

        # CLear SSX configuration
	self.ssx.clear_config()
	self.ssx.clear_health_stats()

    def tearDown(self):

	self.ssx.wait4cards()
	self.ssx.cmd("system glc-switchback")
	time.sleep(10)
	self.ssx.wait4cards()
        # Close the telnet session of SSX
        self.ssx.close()

        # Close the telnet session of Xpress VPN Client
	if pskFlag:
		self.xpress_vpn.cmd("ike reset")
	        time.sleep(10)
 	        self.xpress_vpn.cmd("quit")
        self.xpress_vpn.close()
	self.rad.close()

    def test_DoCoMo_6_2_1(self):
        """
        Test case Id: -  DoCoMo_6_2_1
	"""

        self.myLog.output("\n**********start the test**************\n")
	self.myLog.info("Running vgroup")
	ssx_name= ssx["ip_addr"].split("-mc")[0]
        vportssx1 = port_ssx_linux1[0].replace('/',':')
        vportssx2 = port_ssx_radius1[0].replace('/',':')
	vportl1   = port_ssx_linux1[1].replace('eth','e')
	vportl2   = port_ssx_radius1[1].replace('eth','e')

	vgroup_new("%s:%s %s:%s"%(ssx_name,vportssx1,linux1['ip_addr'],vportl1))
	vgroup_new("%s:%s %s:%s"%(ssx_name,vportssx2,radius1['ip_addr'],vportl2))
	
        # Push SSX config
        self.ssx.config_from_string(docomo_var['DoCoMo_6_2_1'])
	
	#configuring tunnel on linux machine
        self.xpress_vpn.configure_ip_interface(port_ssx_linux1[1], docomo_var['xpress_phy_iface1_ip_mask'])
        self.rad.configure_ip_interface(port_ssx_radius1[1], docomo_var['radius1_ip_mask'])
	self.rad.cmd("sudo /sbin/route add -host %s gw %s"%(docomo_var['ip_pool_mask'],docomo_var['ssx_rad1_ip']))
	
	# start the radius, if not started
	self.myLog.output("Start the radius, if not started")
	self.rad.cmd("sudo pkill radius")
	self.rad.cmd("sudo /a/radius1/sbin/radiusd xX")

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(docomo_var['xpm_autoexec'],"autoexec.cfg","/xpm/")


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

        # Initiate IKE Session from Xpress VPN Client (takama)
	self.xpress_vpn.cmd("sudo /sbin/ip addr add dev %s %s/16 brd +"%(port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ip route add %s via %s dev %s src %s"%(docomo_var['ses_lo_ip'],docomo_var['ssx_clnt_ip'],port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ip route add %s via %s dev %s src %s"%(docomo_var['radius1_route'],docomo_var['ssx_clnt_ip'],port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ifconfig %s:1 %s netmask 255.255.0.0"%(port_ssx_linux1[1],docomo_var['xpress_phy_iface1_ip']))
	time.sleep(3)
	self.xpress_vpn.cmd("cd /xpm")
        op_client_cmd = self.xpress_vpn.cmd("sudo ./start_ike")
	time.sleep(30)

        ses_yn = self.ssx.cmd("show ike-session brief")
        self.myLog.output("show ike-session brief : %s"%ses_yn)
        if ses_yn.splitlines()[-1].split()[2] != 'Y':
                self.fail("FAIL : ipv4 session is not establised")

	op1 = self.ssx.cmd("show session") + self.ssx.cmd("show ike-session brief") + self.ssx.cmd("show ike-session list") + self.ssx.cmd("show ike-session detail remote %s"%docomo_var['xpress_phy_iface1_ip'])
        self.myLog.output("Session Details: %s"%op1)
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:DoCoMo_6_2_1.py

示例11: test_main

 def test_main(self):
#def main(self):			#Venkat
    #log.exception("exception")
    global ssx, linux1, linux2, ns1, ns2
    global ssx_name, linux1, linux2, ns1_name, ns2_name, linux1_name, linux2_name, cfgPath
    
    #cedar 
    #encaps =['v4', 'v6', 'ipsec v44', 'ipsec v46', 'pppoe', ]
    #modifiers = ['raw', 'dot1q', 'dot1q untagged']
    #portservice = [['none'], ['service ipsec'], ['service dot1q'], ['service ipsec', 'service dot1q']]
    #portcfgs = ['same port', 'same card', 'different card']

    #pre-cedar encap/forwarding set
    encaps =['v4', 'v6', 'ipsec v44', 'ipsec v46', 'pppoe','ipip']
    #encaps =['v6']    
    modifiers = ['raw', 'dot1q', 'dot1q untagged']
    cctservices = [['none'], ['service ipsec'], ['service pppoe']]
    portcfgs = ['same vlan', 'same port', 'same card', 'different card', ]
    cfgPath = "/volume/labtools/systest/tests/encaps"

    log.info("Generating test matrix...")
    test_list = enum.gen_tests(cctservices, modifiers, encaps, cctservices, modifiers, encaps, portcfgs)




    #Printing All combinations of encaps script

    #enum.pretty_print_list(test_list)


#    sys.exit(0)
#get our boxes
#    lock_resources()

    # alter the top level naming scheme for test output files.  having date and time makes
    # it easier to locate the last test run quickly.
    logdir = ""
    for i in time.localtime()[:-5]:
        logdir += str(i)
    #logdir = str(os.getpid())

    setup_logdir = "%s/setup" % logdir
    if not os.path.isdir(setup_logdir):
        os.makedirs(setup_logdir)
#get console on ssx
#     ssx_name =  locks["ssx"][0]


    ssx_name = ssx['name']
    #ssx = SSX(ssx['name'])		#Venkat
    ssx = SSX(ssx['name']+"-mc-con")		#Venkat
    ssx.telnet()		#Venkat
    saveCfgSsx = False
    #ssx = SSX(ssx_name + "-mc-con")
    #ssx = SSX.SSXConsole(ssx_name + "-mc-con")
    ssx.ses.logfile=open("%s/ssx.log" % setup_logdir,"w+")
    
#get connections to linux boxes
#     linux1 = locks["linux"][0]
#     linux2 = locks["linux"][1]
    #linux1 = "tahiti"
    #linux2 = "ebini"
    #linux1_name = host1['name']
    linux1_name = "tahiti"
    log.info("linux1 :%s" % linux1_name)
    #linux2_name = host2['name']
    linux2_name = "ebini"
    linux1 =  Linux(host1['name'])		#Venkat
    linux1.telnet()		#Venkat
    #linux1 = Linux.LinuxTelnet(linux1)
    linux2 =  Linux(host2['name'])		#Venkat
    linux2.telnet()		#Venkat
    #linux2 = Linux.LinuxTelnet(linux2)
    linux1.ses.logfile=open("%s/linux1.log" % setup_logdir,"w+")
    linux2.ses.logfile=open("%s/linux2.log" % setup_logdir,"w+")    

#get consoles on netscreens
#     ns1_name = locks["netscreen"][0]
#     ns2_name = locks["netscreen"][1]
    ns1_name = "qa-ns1"
    ns2_name = "qa-ns2"
    
    #ns1 = NS.NSConsole(ns1_name + "-con")
    ns1 = NS(ns1_name + "-con")         	#Venkat
    #ns1 = NS2(ns1_name + "-con")
    #ns2 = NS.NSConsole(ns2_name + "-con")
    ns2 = NS(ns2_name + "-con")			#Venkat
    #ns2 = NS2(ns2_name + "-con")
    ns1.telnet()
    ns2.telnet()

 #   ns1.ses.logfile=open("%s/ns1.log" % setup_logdir,"w+")
 #   ns2.ses.logfile=open("%s/ns2.log" % setup_logdir,"w+")    

 
    #configure the context on the ssx:
    ssx.cmd("clear conf")
    cache_cfg_file = "testtemp.cfg"
    #ssx.cfg_from_file("encaps.cfg")
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:encaps1.py

示例12: test_DoCoMo_6_2_5

class test_DoCoMo_6_2_5(test_case):
    myLog = getLogger()
    global pskFlag
    pskFlag = 1

    def setUp(self):
	self.myLog.info(__doc__)
        """Establish a telnet session to the SSX box."""
        self.ssx = SSX(topo.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()

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

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

        # wait for card to come up
        self.ssx.wait4cards()

        # CLear SSX configuration
	self.ssx.clear_config()
	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
	if pskFlag:
		self.xpress_vpn.cmd("ike reset")
	        time.sleep(10)
 	        self.xpress_vpn.cmd("quit")
        self.xpress_vpn.close()
	self.rad.close()

    def test_DoCoMo_6_2_5(self):
        """
        Test case Id: -  DoCoMo_6_2_5
	"""

        self.myLog.output("\n**********start the test**************\n")
	self.myLog.info("Running vgroup")
	ssx_name= ssx["ip_addr"].split("-mc")[0]
        vportssx1 = port_ssx_linux1[0].replace('/',':')
        vportssx2 = port_ssx_radius1[0].replace('/',':')
	vportl1   = port_ssx_linux1[1].replace('eth','e')
	vportl2   = port_ssx_radius1[1].replace('eth','e')

	vgroup_new("%s:%s %s:%s"%(ssx_name,vportssx1,linux1['ip_addr'],vportl1))
	vgroup_new("%s:%s %s:%s"%(ssx_name,vportssx2,radius1['ip_addr'],vportl2))
	
        # Push SSX config
        self.ssx.config_from_string(docomo_var['DoCoMo_6_2_5'])
	
	#configuring tunnel on linux machine
        self.xpress_vpn.configure_ip_interface(port_ssx_linux1[1], docomo_var['xpress_phy_iface1_ip_mask'])
        self.rad.configure_ip_interface(port_ssx_radius1[1], docomo_var['radius1_ip_mask'])
	self.rad.cmd("sudo /sbin/route add -host %s gw %s"%(docomo_var['ip_pool_mask'],docomo_var['ssx_rad1_ip']))
	
	# start the radius, if not started
	self.myLog.output("Start the radius, if not started")
	radOp = self.rad.cmd("sudo /sbin/service radiusd status")
	if ("stop" or "dead" or "not running" in radOp):
		self.rad.cmd("sudo /sbin/service radiusd start")

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(docomo_var['xpm_autoexec'],"autoexec.cfg","/xpm/")


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

        # Initiate IKE Session from Xpress VPN Client (takama)
	self.xpress_vpn.cmd("sudo /sbin/ip addr add dev %s %s/16 brd +"%(port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ip route add %s via %s dev %s src %s"%(docomo_var['ses_lo_ip'],docomo_var['ssx_clnt_ip'],port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ip route add %s via %s dev %s src %s"%(docomo_var['radius1_route'],docomo_var['ssx_clnt_ip'],port_ssx_linux1[1],docomo_var['ip_pool']))
	self.xpress_vpn.cmd("sudo /sbin/ifconfig %s:1 %s netmask 255.255.0.0"%(port_ssx_linux1[1],docomo_var['xpress_phy_iface1_ip']))
	time.sleep(3)
	self.xpress_vpn.cmd("cd /xpm")
        op_client_cmd = self.xpress_vpn.cmd("sudo ./start_ike")
	time.sleep(10)

        ses_yn = self.ssx.cmd("show ike-session brief")
        self.myLog.output("show ike-session brief : %s"%ses_yn)
        if ses_yn.splitlines()[-1].split()[2] != 'Y':
                self.fail("FAIL : ipv4 session is not establised")

	op1 = self.ssx.cmd("show session") + self.ssx.cmd("show ike-session brief") + self.ssx.cmd("show ike-session list") + self.ssx.cmd("show ike-session detail remote %s"%docomo_var['xpress_phy_iface1_ip'])
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:DoCoMo_6_2_5.py

示例13: test_ip_atk_080

class test_ip_atk_080(test_case):
    myLog = getLogger()	

    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()

        #Establish a telnet session to the linux1 client box.
        self.linux1 = Linux(linux1["ip_addr"],linux1["user_name"],linux1["password"])
        self.linux1.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 linux1 Client
	self.linux1.close() 

    def test_ip_atk_080(self):


	self.myLog.output("\n**********start the test**************\n")
       #vgroup b/w SSX and linux
        vgroup_new(vgroup_cfg_dos)


        #Push the SSX configuration	
        self.ssx.config_from_string(script_var['common_ssx'])
        self.ssx.config_from_string(script_var['pppoe_fun_001_ssx'])

	#Configuring interface on linux.
	self.linux1.configure_ip_interface(p1_ssx_linux1[1],script_var['linux1_ip_addr/m'])

        #Capturing slot from port
        p1_ssx_linux1_slot = p1_ssx_linux1[0].split("/")[0]

         #Ping operation.
        self.ssx.cmd("context %s"%script_var['context_name'])
        time.sleep(5)
        Ping_out = self.ssx.ping(script_var['linux1_ip_addr'])
        time.sleep(5)
        Ping_out = self.ssx.ping(script_var['linux1_ip_addr'])
        self.failUnless(Ping_out == 1,"no connectivity b/w ssx and linux")


         #clearing ip,sys and port counters and displaying ip,sys and port counters 
        self.ssx.cmd("context test")

        self.ssx.cmd("clear ip counters ")
        self.myLog.output("IP counters exist on SSX:%s"%self.ssx.cmd("show ip counters"))

        self.ssx.cmd("clear syscount")
        self.myLog.output("System counters exist on SSX:%s"%self.ssx.cmd("show syscount"))

        self.ssx.cmd("clear port %s counters drop"%script_var['ssx_port'])
        self.myLog.output("Port counters exist on SSX:%s"%self.ssx.cmd("show port %s counters drop"%script_var['ssx_port']))

        #Push the Linux(PPPoE)client configuration

        self.linux1.write_to_file(script_var['pppoe_cnf_032_linux1'],"pppoe.conf"," /rp-pppoe-3.8/configs/")

        self.linux1.cmd("sudo cp  /rp-pppoe-3.8/configs/pppoe.conf /etc/ppp/")

        self.linux1.cmd("cd /usr/rp-pppoe-3.8/scripts")

        self.linux1.cmd("sudo pkill pppoe-connect")

        pppoe_output=self.linux1.cmd("sudo ./pppoe-start")

        self.failUnless( 'Connected!' in  pppoe_output,'testcase FAILED due to pppoe session has not established')

	#Flooding of UDP traffic.	
	self.linux1.cmd("sudo /usr/sbin/hping3 -2 -p 22 %s --flood "%(script_var['ssx1_ip_addr']),timeout = 150)
	time.sleep(40)
	self.linux1.cmd("sudo pkill -9 hping")

	# displaying ip,sys and port counters And process Cpu utilization
        self.myLog.output("IP counters exist on SSX after flooding traffic:%s"%self.ssx.cmd("show ip counters"))

        self.myLog.output("System counters exist on SSX after flooding traffic:%s"%self.ssx.cmd("show syscount"))

        self.myLog.output("Port counters exist on SSX after flooding traffic:%s"%self.ssx.cmd("show port %s counters drop"%script_var['ssx_port']))

        Cpu_out = self.ssx.cmd("show process cpu slot %s"%((p1_ssx_linux1[0].split("/"))[0]))
        self.myLog.output(Cpu_out)

        self.failUnless("100.00%" not in Cpu_out)

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs,Warn_logs = 100), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:99,代码来源:ip_atk_080.py

示例14: test_RADIUS_FUN_015_1

class test_RADIUS_FUN_015_1(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()
        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()

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

    def tearDown(self):

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

        # Close the telnet session of Xpress VPN Client
        self.xpress_vpn.close()

        # Start the radius process
        self.ether_radius1.cmd("sudo /etc/init.d/radiusd start")
        self.ether_radius1.close()

    def test_RADIUS_FUN_015_1(self):
        """
        Test case Id: -  RADIUS_FUN_015_1
	"""

        self.myLog.output("\n**********start the test**************\n")
        # Push SSX config
        self.ssx.config_from_string(script_var['common_ssx1'])
        self.ssx.config_from_string(script_var['rad_fun_015_1_ssx'])

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_fun_015_1_xpressvpn'],"autoexec.cfg","/xpm/")

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

        # Stop the radius process
        self.ether_radius1.cmd("sudo /etc/init.d/radiusd stop")

        # Initiate IKE Session from Xpress VPN Client (takama)
        self.xpress_vpn.cmd("cd /xpm/")
        op_client_cmd = self.xpress_vpn.cmd("sudo ./start_ike")

        #Consider 9 client
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count=0
        ssx_max_ses=5
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count=count+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count)
        self.failUnless(count == 0,"ike-session eastablish even radius server is  unreachable")


        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:76,代码来源:RADIUS_FUN_015_1.py

示例15: test_ip_atk_009

class test_ip_atk_009(test_case):
    myLog = getLogger()	

    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()

        #Establish a telnet session to the linux1 client box.
        self.linux1 = Linux(linux1["ip_addr"],linux1["user_name"],linux1["password"])
        self.linux1.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 linux1 Client
	self.linux1.close()             

    def test_ip_atk_009(self):


	#vgroup code
        vgroup_new(vgroup_cfg_dos)

	self.myLog.output("\n**********start the test**************\n")
	self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
	self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
	self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
	self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
	self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")
        self.linux1.cmd("konsole -T multiTelnet -e telnet 10.10.0.3")

        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:53,代码来源:ip_atk_009.py


注:本文中的Linux.Linux类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。