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


Python Linux.telnet方法代码示例

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


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

示例1: test_AAA_FUN_006

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
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,代码行数:61,代码来源:AAA_FUN_006.py

示例2: test_ip_atk_009

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
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,代码行数:55,代码来源:ip_atk_009.py

示例3: test_AAA_FUN_003

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_AAA_FUN_003(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_003(self):

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

	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_003_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 missing domain name at admin level
        op_telnet =generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],"user3","123user3")
        self.failUnless(op_telnet is True,"telnet from client to SSX failed")

	#Verify that the User credentials with missing domain name,
        # are forwarded to default domain name.
        op_debug =  aaa_verify_authentication(self.ssx,"user3","local")
        self.failUnless(op_debug,"Authentication at SSX failed ")

	time.sleep(10)
        # Initiate Telnet Session from linux Client with missing domain name at operator level
        op_telnet =generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],"user4","123user4")
        self.failUnless(op_telnet is True,"telnet from client to SSX failed")

	#Verify that the User credentials with missing domain name,
        # are forwarded to default domain name.
        op_debug =  aaa_verify_authentication(self.ssx,"user4","local")
        self.failUnless(op_debug,"Authentication at SSX failed")

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

示例4: test_RADIUS_FUN_015_1

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
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,代码行数:78,代码来源:RADIUS_FUN_015_1.py

示例5: test_DoCoMo_6_2_1

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
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,代码行数:103,代码来源:DoCoMo_6_2_1.py

示例6: test_RADIUS_NEG_003

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_NEG_003(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 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()

    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
        # Close the telnet session of Xpress VPN Client and radius server
        self.xpress_vpn.close()
        self.ether_radius1.close()


    def test_RADIUS_NEG_003(self):

        """
        Test case Id: -  RADIUS_NEG_003
        Description: - With continuous session requests in the background,
	Delete the interface on the SSX which is connected to the Radius server
	"""

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

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

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_neg_003_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")


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

        self.myLog.output("\nGoing to sleep for 10sec ")
        time.sleep(2)
        self.myLog.output("List of sessions eastablished before deleting the interface,which is connected to radius server")
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count1 =0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count1 = count1+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count1)

        # Delete the interface on ssx
        self.ssx.configcmd("context %s" % script_var['context'])
        self.ssx.configcmd("no interface rad1")

        self.myLog.output("List of sessions eastablished after deleting the interface,which is connected to radius server")
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count1 =0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count1 = count1+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count1)
		
	self.myLog.output("\n Gonig to selp for 50sec for checking any session are coming up,\nEven after deleting radius interface\n")
	time.sleep(50)
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        time.sleep(5)
        i=0
        count2=0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count2=count2+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count2)
        self.failUnless(count1== count2 ,"Mismatch with the no.of sessions before and deleting radius interface")


        #### Start Ethereal capture the Radius
        #self.myLog.output(" Step 1 - removing the file rad_neg_003.pcap")
        #self.ether_radius1.cmd("sudo rm rad_neg_003.pcap -f")
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:103,代码来源:RADIUS_NEG_003.py

示例7: test_DoCoMo_6_2_5

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
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,代码行数:103,代码来源:DoCoMo_6_2_5.py

示例8: test_AAA_FUN_004

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_AAA_FUN_004(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_004(self):

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

	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_004_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 (takama) with missing domain name 
	#and with invalid user name 
        op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],
							"invaliduser","123user4")
        self.failUnless(op_telnet is False,"Authentication succeeded even with invalid\
						 username & without domain name")

        # Checking user authentication is sucesscuful or not with missing domain name
	# And with invalid user name 
        op_debug =  aaa_verify_authentication(self.ssx,"invaliduser","local")
        self.failUnless( not op_debug,"Authentication succeeded even with invalid \
						 username & without domain name")
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:63,代码来源:AAA_FUN_004.py

示例9: test_ip_atk_050

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_ip_atk_050(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_050(self):

	#vgroup code
	vgroup_new(vgroup_cfg_dos)

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

	
	#clearing ip,sys and port counters
	self.ssx.cmd("context test")
        self.ssx.cmd("clear ip counters")
        Cou_out = self.ssx.cmd("show ip counters ")
        self.myLog.output(Cou_out)
        self.ssx.cmd("clear syscount")
        Syscount_out = self.ssx.cmd("show syscount")
        self.myLog.output(Syscount_out)
        self.ssx.cmd("clear port %s counters drop"%script_var['ssx_port'])
        Portcou_out = self.ssx.cmd("show port %s counters drop"%script_var['ssx_port'])
        self.myLog.output(Portcou_out)
	
	#Sending invalid IP fragment 

	#hping -1 -I bge0 -a 30.1.1.1 30.1.1.2 -p 23 -i u1

	out = self.linux1.cmd("sudo ./jolt %s %s 10 &"%(script_var['ssx_ip_addr'],script_var['linux1_ip_addr']),timeout = 150)
        time.sleep(30)
	#killing jolt process
        #self.linux1.cmd("sudo kill -9 jolt") 

	# displaying ip,sys and port counters And process Cpu utilization
	Cou_out = self.ssx.cmd("show ip counters ")
        self.myLog.output(Cou_out)
        Syscount_out = self.ssx.cmd("show syscount")
        self.myLog.output(Syscount_out)
        Portcou_out = self.ssx.cmd("show port %s counters drop"%script_var['ssx_port'])
        self.myLog.output(Portcou_out)
	Cpu_out = self.ssx.cmd("show process cpu slot %s"%((p1_ssx_linux1[0].split("/"))[0]))
	self.failIf("100.00%"in Cpu_out)
	self.myLog.output(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,代码行数:73,代码来源:ip_atk_050.py

示例10: test_RADIUS_FUN_031

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_FUN_031(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 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()


    def tearDown(self):
 	"""Clear the config and Close down the telnet session."""
        self.ssx.close()
        self.ns5gt.close()
        self.ether_radius1.close()

    def test_RADIUS_FUN_031(self):

        """
        Test case Id: -  RADIUS-FUN-031
        """

	# Configure SSX to forward session authentication-requests 
	# to radius server for authentication.
        self.ssx.config_from_string(script_var['common_ssx'])
        self.ssx.config_from_string(script_var['rad_fun_031_ssx'])

        #Get the configuration from a string in a config file config.py and Load it in NS-5GT.
        self.ns5gt.config_from_string(script_var['common_ns5gt'])
        self.ns5gt.config_from_string(script_var['rad_fun_031_ns5gt'])

        # 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")

        self.myLog.output(" Step 1 - removing the file rad_fun_031.pcap")
        self.ether_radius1.cmd("sudo rm rad_fun_031.pcap -f")

        self.myLog.output (" Step 2 -Start tethereal to capture the packets and store the result in file x")
        #self.ether_radius1.cmd('sudo /usr/sbin/tethereal -h')
        self.ether_radius1.cmd('sudo /usr/sbin/tethereal -i %s -q  -w rad_fun_031.pcap  & '% topo.port_ssx_radius1[1])

        # Initiate IKEv1 session from a Netscreen to the SSX
        # ping ikev1 clent from ssx
        self.ssx.ping('%s'% script_var['ns_phy_ip'])
        time.sleep(5)
        self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")

        self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
        ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
        self.failUnless(ping_output, "session authentication with Radius is not\
                        successed even with valid session credentials")

        #### terminate tethereal & read the pcap file contents
        self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
        time.sleep(5)
        self.ether_radius1.cmd("sudo pkill tethereal")

        # Check whether the pcap file is created or not
        ll_output = self.ether_radius1.cmd("ls -lrt *.pcap")
        self.failUnless( "rad_fun_031.pcap" in ll_output,"Testcase FAILED because pcap file has not created ")

        self.myLog.output  (" Step 4 - read the content of the file rad_fun_031.pcap ")
        output=self.ether_radius1.cmd('sudo /usr/sbin/tethereal -r rad_fun_031.pcap -R "radius.code  == 2"',timeout = 30)
        self.failUnless( "RADIUS" in output, " Expected - packet with radius.code == 2 ")


        #Check out the SA status in SSX.
        self.ssx.cmd("context %s" %script_var['context'])
        sa_output= sa_check(self.ssx,script_var['ns_phy_ip'])
        self.failUnless(sa_output,"SA not loaded")
					
        # Checking SSX Health
        hs = self.ssx.get_health_stats()
        self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:92,代码来源:RADIUS_FUN_031.py

示例11: test_RADIUS_FUN_016

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_FUN_016(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 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()

    def tearDown(self):

        # Start The (stopped) radius process
        self.ether_radius1.cmd("sudo /etc/init.d/radiusd start")
        self.ether_radius1.cmd("sudo pkill tethereal")

	# close the telnet session of the  radius server
        self.ether_radius1.telnet()

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

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


    def test_RADIUS_FUN_016(self):
        """
        Test case Id: -  RADIUS_FUN_016
	"""

        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_016_ssx'])

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_fun_016_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")

        #### Start Ethereal capture on both the Radius servers
        self.myLog.output(" Step 1 - removing the file rad_fun_016.pcap")
        self.ether_radius1.cmd("sudo rm rad_fun_016.pcap -f")
        self.myLog.output("Step 2 -Start tethereal to capture the packets and store the result in a pcap file")
#        self.ether_radius1.cmd('sudo /usr/sbin/tethereal   -h')
        self.ether_radius1.cmd('sudo /usr/sbin/tethereal -i %s -q  -w rad_fun_016.pcap -R "radius" & '% topo.port_ssx_radius1[1])


        # 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 == 2,"Expected 'ike-sessions = 2',Actual is ike-sessions = %d "%count)

        #### terminate tethereal & read the pcap file contents
        self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
        time.sleep(5)
        self.ether_radius1.cmd("sudo pkill tethereal")

        # Check whether the pcap file is created
        ll_output = self.ether_radius1.cmd("ls")
        self.failUnless( "rad_fun_016.pcap" in ll_output,"Testcase FAILED because pcap file has not created ")

        self.myLog.output  (" Step 4 - read the content of the file rad_fun_016.pcap ")
        output=self.ether_radius1.cmd('sudo /usr/sbin/tethereal -r rad_fun_016.pcap -R "radius.code == 1" ',timeout = 30)
        self.failUnless("RADIUS" in output, """ Expected - packet with radius.code == 2,  Actual = %s"""% output)


        # Checking SSX Health
        hs = self.ssx.get_health_stats()
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:103,代码来源:RADIUS_FUN_016.py

示例12: test_ip_atk_076

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_ip_atk_076(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 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()


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

	time.sleep(60)
	time.sleep(60)
    def test_ip_atk_076(self):



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

	#vgroup b/w SSX and XPRESSVPN.
	vgroup_new(vgroup_cfg_dos1)	
        #vgroup code
        vgroup_new(vgroup_cfg_dos)


	#Push the SSX configuration     
        self.ssx.config_from_string(script_var['common_ssx_ikev2'])
        self.ssx.config_from_string(script_var['DOS_FUN_076'])
        self.xpressvpn1.configure_ip_interface(p1_ssx1_xpressvpn1[1],script_var['xpressvpn1_phy_iface1_ip_mask'])


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


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

	ssx_ph2_life = 60

	 #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 xpress vpn config on linux
        self.xpressvpn1.write_to_file(script_var['fun_014_xpressvpn'],"autoexec.cfg","/xpm/")

        #clearing sessions on ssx
        self.ssx.cmd("clear session all")

        # Initiate IKE Session from Xpress VPN Client (takama)
        self.xpressvpn1.cmd("cd /xpm")
	self.xpressvpn1.cmd("sudo ./add_ip_takama_qos-ashu") #copy this file from takama box to xpressvpn1 if not existing
        op_client_cmd = self.xpressvpn1.cmd("sudo ./start_ike",timeout = 200)


	 # Check SA in SSX with the remote 
        ssx_show_op = parse_show_ike_session_detail(self.ssx,script_var['xpress_phy_iface1_ip'])

        self.failUnless("ESTABLISHED" in ssx_show_op["session_state"],"failed to find SA")

        # Wait for SSX ph2 life-time

        time_diff = 0
        time.sleep(1)
        self.linux1.cmd("sudo /usr/sbin/hping3 -2 -p 22 %s --flood &"%(script_var['ssx_phy_iface1_ip_mask']),timeout = 150)
        while time_diff <= ssx_ph2_life:
          show_clock_op = self.ssx.cmd("show clock")
          time_diff = diff_in_time_ssx(ssx_show_op['child_sa_time_established'],show_clock_op)

        time.sleep(10)
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:103,代码来源:ip_atk_076.py

示例13: test_RADIUS_NEG_002

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_NEG_002(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 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()

    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
        # Close the telnet session of Xpress VPN Client
        self.xpress_vpn.close()
	self.ether_radius1.close()
    def test_RADIUS_NEG_002(self):

        """
        Test case Id: -  RADIUS_NEG_002
        Description: - With continuous session requests in the background,
		delete the existing Radius session authentication profile.
	"""

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

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

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_neg_002_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")


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

        time.sleep(9)
        self.myLog.output("List of sessions eastablished before deleting the session authentication profile")
        #Consider 9 client
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count1 =0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count1 = count1+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count1)

        #Delete the session authentication profile
        self.ssx.configcmd("context %s" % script_var['context'])
        self.ssx.configcmd("no radius session authentication profile")

	time.sleep(2)
        self.myLog.output("List of sessions eastablished after deleting the session authentication profile")
        #Checking wheather sessions are establishing even after deleting  the profile
	op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count1 =0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count1 = count1+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count1)

        self.myLog.output("\nGoing to sleep for 20sec after deleting the session auth profile\n")
	time.sleep(20)
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count2 =0
        for i in range(0,len(clnt_ips)):
          if clnt_ips[i] in op_ssx_sa:
            count2 = count2+1
        self.myLog.output("\n\n************* the no. of ike sessions:%d\n\n"%count2)
	self.failUnless(count1 == count2,"Sessions established even afterdeleting the session")


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

示例14: test_RADIUS_NEG_005

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_NEG_005(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 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()

    def tearDown(self):

        # Close the telnet session of SSX
        self.ssx.close()
        # Close the telnet session of Xpress VPN Client
        self.xpress_vpn.close()
        # Close the telnet session of Radius (tethereal capture machine)
        self.ether_radius1.close()

    def test_RADIUS_NEG_005(self):

        """
        Test case Id: -  RADIUS_NEG_005
        Description: - With continuous session requests in the background,
                                Reload the Device.
	"""

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

        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_neg_005_xpressvpn'],"autoexec.cfg","/xpm/")
        self.xpress_vpn.write_to_file(script_var['add_ip_takama'],"add_ip_takama","/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")

        #### Start Ethereal capture the Radius-1
        self.myLog.output(" Step 1 - removing the file rad_neg_005.pcap")
        self.ether_radius1.cmd("sudo rm rad_neg_005.pcap -f")
        self.myLog.output("Step 2 -Start tethereal to capture the packets and store the result in a pcap file")
        #self.ether_radius1.cmd('sudo /usr/sbin/tethereal   -h')
        self.ether_radius1.cmd('sudo /usr/sbin/tethereal -i %s -q  -w rad_neg_005.pcap -R "radius" & '% topo.port_ssx_radius1[1])


        # Initiate IKE Session from Xpress VPN Client (takama)
        self.xpress_vpn.cmd("cd /xpm/")
        self.xpress_vpn.cmd("sudo chmod 777 add_ip_takama")
        self.xpress_vpn.cmd("sudo ./add_ip_takama")
	time.sleep(3)
        op_client_cmd = self.xpress_vpn.cmd("sudo ./start_ike")
        time.sleep(15)
        op1 = self.ssx.configcmd("show session")
        self.ssx.configcmd("exit")
        self.failUnless("IPSEC" in op1,"Failed because there is no session of IPSEC")
        self.xpress_vpn.cmd("quit")



        #Saving the cofiguration
        self.ssx.save_config(location='/cfint/stoke.cfg')
        self.ssx.boot_config("/cfint/stoke.cfg")
        # Reload the SSX
        self.ssx.reload_device(timeout=500)

        #### terminate tethereal & read the pcap file contents
        self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
        self.myLog.output (" \nGoing to sleep for 150sec ,to cath session requests sent by SSX to RASIUS server\n")
        time.sleep(15)
        self.ether_radius1.cmd("sudo pkill tethereal")

        # Check whether the pcap file is created
        ll_output = self.ether_radius1.cmd("ls -lrt *.pcap")
        self.failUnless( "rad_neg_005.pcap" in ll_output,"Testcase FAILED because pcap file has not created ")

        self.myLog.output  (" Step 4 - read the content of the file rad_neg_005.pcap ")
        output = self.ether_radius1.cmd('sudo /usr/sbin/tethereal -r rad_neg_005.pcap -R "radius.code == 2" ',timeout = 30)
        #self.failUnless("RADIUS" in output, " Expected - packet with radius.code == 2 ")
        #Consider 9 client
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
	'''
        i=0
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:103,代码来源:RADIUS_NEG_005.py

示例15: test_RADIUS_FUN_034

# 需要导入模块: from Linux import Linux [as 别名]
# 或者: from Linux.Linux import telnet [as 别名]
class test_RADIUS_FUN_034(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 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()


    def tearDown(self):
 	"""Clear the config and Close down the telnet session."""
        self.ssx.close()
	self.xpress_vpn.close()

    def test_RADIUS_FUN_034(self):

        """
        Test case Id: -  RADIUS-FUN-034
        """

        #On SSX configure an AAA profile with the session authentication set to Radius
        self.ssx.config_from_string(script_var['common_ssx1'])
        self.ssx.config_from_string(script_var['rad_fun_034_ssx'])
        # Push xpress vpn config
        self.xpress_vpn.write_to_file(script_var['rad_fun_034_xpressvpn'],"autoexec.cfg","/xpm/")

        # Enable debug logs for aaad
        self.ssx.cmd("context %s" % script_var['context'])
        self.ssx.cmd("debug module aaad all")
        self.ssx.cmd("debug module iked 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("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=1
        #for i in range(0,len(clnt_ips)):
        for i in range(0,1):
          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==ssx_max_ses,"IKEv2 multiclient SA Formation Failed")

        op_debug =  aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"radius")
        self.failUnless(op_debug, "Verifying in debug:X-auth not successful")

	# Change the RADIUS key under session authentication profile
	self.ssx.configcmd("context %s" %script_var['context'])
	self.ssx.configcmd("radius session authentication profile")
	self.ssx.configcmd("server %s port 1812 key xyz" %script_var['radius1_ip'])
					
	# Clear the sessions and re-initiate new sessions
	self.ssx.cmd("context %s" %script_var['context'])
	self.ssx.cmd("clear session all")	
	self.ssx.cmd("clear session all")	
        self.xpress_vpn.cmd("exit")
        self.xpress_vpn.cmd("cd /xpm/")
        op_client_cmd = self.xpress_vpn.cmd("sudo ./start_ike")
	time.sleep(10)
        self.xpress_vpn.cmd("exit")

        #Consider 9 client
	
        op_ssx_sa = self.ssx.configcmd("show ike-session brief")
        i=0
        count=0
        ssx_max_ses=1
        #for i in range(0,len(clnt_ips)):
        for i in range(0,1):
          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(not count,"Sessions established even after changing the RADIUS key")


	#time.sleep(5)
	#op_debug = verify_in_debug(self.ssx,"XAUTH","fail")
	#self.failUnless(op_debug,"In debug logs: No X-Auth Fail messgae ")


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


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