本文整理汇总了Python中NS.NS.telnet方法的典型用法代码示例。如果您正苦于以下问题:Python NS.telnet方法的具体用法?Python NS.telnet怎么用?Python NS.telnet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NS.NS
的用法示例。
在下文中一共展示了NS.telnet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_AAA_FUN_023
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_023(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_FUN_023(self):
"""
Test case Id: - AAA-FUN-023
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['fun_023_ssx'])
#Push the Netscreen configuration
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['fun_023_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")
# Initiate IKEv1 session from a Netscreen to the SSX
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.failUnless(not ping_output, "session authentication with Radius \
succeeded even with INVALID session credentials")
#Verify IKEv1 session authentication
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"radius")
self.failUnless(not op_debug, "session authentication successful even with invalid authentication crentials")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
示例2: test_AAA_FUN_026
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_026(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_FUN_026(self):
"""
Test case Id: - AAA-FUN-026
"""
#On SSX configure an AAA profile with the session authentication set to query local database
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['fun_026_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['fun_026_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")
# Initiate IKEv1 session from a client to the SSX with valid session credentials.
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.failUnless(not ping_output, "session authentication succeeded with the primary database(RADIUS)")
#Verify IKEv1 Session authentication
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"local")
self.failUnless(not op_debug, "X-auth not successful")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
示例3: test_AAA_NEG_003
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_NEG_003(test_case):
myLog = getLogger()
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 SSX configuration
self.ssx.clear_config()
# wait for card to come up
self.ssx.wait4cards()
"""Establish a telnet session to the Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_NEG_003(self):
"""
Test case Id: - AAA-NEG-003
"""
#On SSX configure an AAA profile with the session authentication set to query local database..
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['neg_003_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['neg_003_ns5gt'])
# Enable the iked & aaad debug on the SSX to verify the results
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 IKEv1 session from the client to the SSX .
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.failUnless(not ping_output, "SSX didnot drop all the session requests though the radius profile is not configured in the context")
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"radius")
self.failUnless(not op_debug,"Session authentication from client to SSX did not fail")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
示例4: test_ip_atk_078
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_ip_atk_078(test_case):
myLog = getLogger()
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()
def tearDown(self):
# Close the telnet session of SSX
self.ssx.close()
# Close the telnet session of Netscreen
self.ns5gt.close()
#Inserting code of linux1 -- Ashu
# Close the telnet session of linux1 Client
self.linux1.close()
def test_ip_atk_078(self):
self.myLog.output("\n**********start the test**************\n")
#vgroup b/w SSX and linux
vgroup_new(vgroup_cfg_dos)
#vgroup b/w SSX and NS5.
vgroup_new(vgroup_cfg_dos2)
#Get the configuration from a string in a config file config.py and Load it in SSX.
self.ssx.config_from_string(script_var['common_ssx_for_ikev1'])
self.ssx.config_from_string(script_var['ikev1_fun_019_ssx'])
#Push the SSX configuration
self.ssx.config_from_string(script_var['DOS_FUN_017'])
#Configure interface on linux.
self.linux1.configure_ip_interface(p1_ssx_linux1[1],script_var['linux1_ip_addr/m'])
#Ping operation.
self.ssx.cmd("context %s"%script_var['context_name'])
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")
#Capturing slot from port
p1_ssx_linux1_slot = p1_ssx_linux1[0].split("/")[0]
#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['ikev1_fun_019_ns5gt'])
# Enable debug logs for iked
self.ssx.cmd("context %s" %script_var['context_name'])
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']))
self.ssx.cmd("debug module iked all")
#Flush the debug logs in SSX, if any
self.ssx.cmd("clear log debug")
#Give Ping from ns5gt to SSX.
ping_output=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, "PINGING IS FAILED")
time.sleep(10)
#.........这里部分代码省略.........
示例5: test_RADIUS_FUN_030
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_RADIUS_FUN_030(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()
# 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()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
self.linux.close()
self.ether_radius1.close()
def test_RADIUS_FUN_030(self):
"""
Test case Id: - RADIUS-FUN-030
Description: - Verify that the correct terminate cause type is reflected
in the Accounting-request (stop) when the session is terminated.
"""
self.myLog.output("\n**********start the test**************\n")
# Configure SSX to forward session authentication & session accounting
# credentials to radius server for authentication.
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['rad_fun_030_ssx'])
# Configure the IKEv1 Phase1 & Phase2 Polices on the SSX.
# Ensure that the client is also configured with matching policies.
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['rad_fun_030_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_030.pcap")
self.ether_radius1.cmd("sudo rm rad_fun_030.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_030.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")
time.sleep(5)
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")
#Clear the sessions
self.ssx.cmd("context %s" %script_var['context'])
self.ssx.cmd("clear session all")
self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
time.sleep(10)
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_030.pcap" in ll_output,"Testcase FAILED because pcap file has not created ")
# Read the contents of the pcap file
self.myLog.output (" Step 4 - read the content of the file rad_fun_030.pcap")
output=self.ether_radius1.cmd('sudo /usr/sbin/tethereal -r rad_fun_030.pcap -R "radius.Acct_Terminate_Cause == 6"',timeout = 30)
# Checking SSX Health
hs = self.ssx.get_health_stats()
#.........这里部分代码省略.........
示例6: test_AAA_FUN_031
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_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()
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()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_FUN_031(self):
"""
Test case Id: - AAA-FUN-031
"""
#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['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['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")
# Initiate IKEv1 session from a client (which have valid authorization attribute binded to improroper session)
# to the SSX with valid session credentials.
ping_output=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, "client not having authorized IPSEC policy")
#Verify successful Phase1 authentication and IKEv1 session establishment
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"local")
self.failUnless(op_debug, "phase-1 session authentication and establishment is not successful")
#Verify successful Phase2 authentication and session establishment
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"local")
self.failUnless(op_debug, "X-auth not successful")
#Check 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")
示例7: test_RADIUS_FUN_007
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_RADIUS_FUN_007(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
self.ether_linux = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
self.ether_linux.telnet()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
# Start the (killed) Radius daemon
self.ether_linux.cmd("sudo /etc/init.d/radiusd start")
self.ether_linux.close()
def test_RADIUS_FUN_007(self):
"""
Test case Id: - RADIUS-FUN-007
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx'])
self.ssx.config_from_string(script_var['rad_fun_006_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_007_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")
# Kill the Radius daemon
self.ether_linux.cmd("sudo /etc/init.d/radiusd stop")
#### Ethereal cap
self.myLog.output(" Step 1 - removing the file rad_fun_007.pcap")
self.ether_linux.cmd("sudo rm rad_fun_007.pcap -f")
self.myLog.output("Step 2 -Start tethereal to capture the packets and store the result in a pcap file")
#self.ether_linux.cmd('sudo /usr/sbin/tethereal -h')
self.ether_linux.cmd('sudo /usr/sbin/tethereal -i %s -q -w rad_fun_007.pcap -R "radius" & '% topo.port_ssx_radius1[1])
# Initiate IKEv1 session from a client to the SSX with valid X-auth credentials.
self.ssx.ping('%s'% script_var['ns_phy_ip'])
time.sleep(5)
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
self.myLog.output (" Going to sleep for 60 secs untill ssx retrys ")
time.sleep(25)
self.ether_linux.cmd("sudo pkill tethereal")
time.sleep(8)
self.myLog.output (" Step 4 - read the content of the file rad_fun_007.pcap ")
output=self.ether_linux.cmd('sudo /usr/sbin/tethereal -r rad_fun_007.pcap -R "radius.code == 1 && radius.id ==0 && ! icmp" ',timeout = 100)
#checking retry timeouts and no.of retrys
self.myLog.output(output)
ether_op=output.split('\n')
count = 0
for line in ether_op:
if "RADIUS" in line:
count = count+1
self.failUnless(count in [3,4], """ Expected - packet with radius.code == 1; not found in 3 times Actual = %d"""% count)
time_stamps = []
for line in ether_op:
x=re.search('\d+.\d{6}',line)
if x!=None :
time_stamps.append(x.group(0))
# check the time diff between each packet
diff_time_stamps = 0
for i in range(0,len(time_stamps)-1):
temp = float(time_stamps[i+1])-float(time_stamps[i])
diff_time_stamps = diff_time_stamps+temp
avg_time_stamp = diff_time_stamps/(len(time_stamps)-1)
# verifying the time intervels
#.........这里部分代码省略.........
示例8: test_AAA_FUN_030
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_030(test_case):
def setUp(self):
"""Establish a telnet session to the SSX box."""
self.ssx = SSX(ssx1['ip_addr'])
self.ssx.telnet()
self.ssx.clear_config()
"""Establish a telnet session to the Netscreen."""
self.ns5gt = NS(ns1['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
"""Establish a telnet session to the Xpress VPN client box."""
linux1 = Linux(topo.linux_client["ip_addr"],topo.linux_client["user_name"],topo.linux_client["password"])
self.linux_client.telnet()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
linux1.close()
def test_AAA_FUN_030(self):
"""
Test case Id: - AAA-FUN-030
Description: - Verify the SSX behavior when session authentication database is changed from local to radius
"""
#On SSX configure an AAA profile with the session authentication set to Radius and
#user authentication set to query local database.
self.ssx.config_from_string(script_var['common_ssx'])
self.ssx.config_from_string(script_var['fun_030_ssx'])
self.ssx.config_from_string(script_var['user_add_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['fun_030_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")
# Initiate IKEv1 session from a client to the SSX with valid session credentials.
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 radius authentication and establishment with local database is not successful")
#Verify successful Phase1 authentication and IKEv1 session establishedment
op_debug = self.ssx.aaa_verify_authentication("[email protected]%s"%script_var['context'],"local")
self.failUnless(op_debug, "Verifying in debugs:session radius authentication and establishment with local database\
is not successful")
#Deleting old configuration
self.cfg_from_str('''"context%s"script_var['context']\
clear session all
''')
#change the session authentication from local to Radius
self.cfg_from_str("aaa profile\
session authentication radius\
service authorization radius
")
#Re-Initiate IKEv1 session from a client to the SSX with valid session credentials.
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, "PING FAILED")
#Verify successful Phase1 authentication and IKEv1 session establishedment
op_debug = self.ssx.aaa_verify_authentication("[email protected]%s"%script_var['context'],"radius")
self.failUnless(op_debug, "session Radius authentication and establishment is not successful")
###################repeat this same case for user authentication also###########################################
# Initiate Telnet Session from Xpress VPN Client where user has adminstrator privileages
op_telnet = self.linux1.generic_verify_telnet_2_ssx(script_var['ssx_phy_iface1_ip'],"[email protected]%s"%script_var['context'],"user1")
self.failUnless(op_telnet is True,"telnet to SSX as a user was not success")
# Check whether SSX queries the Radius database for user authentication
op_debug = self.ssx.aaa_verify_authentication("[email protected]","local")
self.failUnless(op_debug,"the user authentication with local database was not successful ")
#chage the session authentication from local to Radius
self.cfg_from_str("context %s\
aaa profile\
session authentication radius\
service authorization radius" %script_var['context'])
#Re-Initiate Telnet Session from Xpress VPN Client where user has adminstrator privileages
op_telnet = self.linux1.generic_verify_telnet_2_ssx(script_var['ssx_phy_iface1_ip'],"[email protected]%s"%script_var['context'],"user1")
self.failUnless(op_telnet is True,"telnet to SSX as a user was not success")
# Check whether SSX quiries the local database for user authentication
op_debug = self.ssx.aaa_verify_authentication("[email protected]","radius")
self.failUnless(op_debug,"the user authentication with Radius not success ")
示例9: test_RADIUS_FUN_005
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_RADIUS_FUN_005(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ssx.clear_health_stats()
# Estabish a telnet sessin to Radius server 1
self.ether_linux = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
self.ether_linux.telnet()
# Clear SSX configuration
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
self.ether_linux.close()
def test_RADIUS_FUN_005(self):
"""
Test case Id: - RADIUS_FUN_005
"""
self.myLog.output("\n**********start the test**************\n")
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx'])
self.ssx.config_from_string(script_var['rad_fun_005_ssx'])
#Push the Netscreen configuration
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['rad_fun_005_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")
#### Ethereal cap
self.myLog.output("Step 1 - removing the file rad_fun_005.pcap")
self.ether_linux.cmd("sudo rm rad_fun_005.pcap -f")
self.myLog.output("Step 2 -Start tethereal to capture the packets and store the result in file ")
#self.ether_linux.cmd('sudo /usr/sbin/tethereal -h')
self.ether_linux.cmd('sudo /usr/sbin/tethereal -i %s -q -w rad_fun_005.pcap -R "radius" &'% topo.port_ssx_radius1[1])
# Initiate IKEv1 session from a netscreen to the SSX with valid session credentials.
ping_ot =self.ssx.ping('%s'% script_var['ns_phy_ip'])
self.myLog.output(ping_ot)
time.sleep(5)
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
time.sleep(10)
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.failUnless(ping_output,"session authentication ")
self.myLog.output(" Step 3 - stop tethereal by killing the tethereal application.")
time.sleep(10)
self.ether_linux.cmd("sudo pkill tethereal")
# Check whether the pcap file is created or not
ll_output = self.ether_linux.cmd("ls -lrt *.pcap")
self.failUnless( "rad_fun_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_fun_005.pcap and if it has Frame then pass else fail")
output=self.ether_linux.cmd('sudo /usr/sbin/tethereal -r rad_fun_005.pcap -R "radius.NAS_IP_Address == %s"'%script_var['ssx_nas_ip_address'],timeout = 100)
self.failUnless("RADIUS" in output, " Expected - packet with radius.NAS_IP_Address ")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
示例10: test_RADIUS_FUN_031
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS 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")
示例11: test_AAA_FUN_024
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_024(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 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_AAA_FUN_024(self):
"""
Test case Id: - AAA-FUN-024
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['fun_024_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['fun_024_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")
#### Ethereal cap
self.myLog.output(" Step 1 - removing the file aaa_fun_024.pcap")
self.ether_radius1.cmd("sudo rm aaa_fun_024.pcap -f")
self.myLog.output (" Step 2 -Start tethereal to capture the packets and store the result in file ")
#self.ether_radius1.cmd('sudo /usr/sbin/tethereal -h')
self.ether_radius1.cmd('sudo /usr/sbin/tethereal -i %s -q -w aaa_fun_024.pcap -R "radius" & '% topo.port_ssx_radius1[1])
self.ether_radius1.cmd(' sudo ls -lrt *.pcap')
# Initiate IKEv1 session from a client to the SSX with invalid X-auth credentials.
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
self.failUnless(not ping_output, "Session established even with invalid X-auth credentials")
self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
time.sleep(8)
self.ether_radius1.cmd("sudo pkill tethereal")
# Check whether the pcap file is created or not
#ll_output = self.ether_radius1.cmd("ll")
#self.failUnless( 'aaa_fun_024.pcap' in ll_output,"Testcase FAILED because pcap file has not created ")
self.myLog.output (" Step 4 - read the content of the file aaa_fun_024.pcap ")
output=self.ether_radius1.cmd('sudo /usr/sbin/tethereal -r aaa_fun_024.pcap -R "radius.code == 3" ',timeout = 30)
self.failUnless(output, """ Expected - packet with radius.code == 3 Actual = %s"""% output)
#In debug messages verify whether the X-auth authentication is succeeded or not.
# With in-valid X-auth credentials
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s" %script_var['context'],"radius")
self.failUnless(not op_debug, "X-auth passed even with invalid credentials")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
示例12: test_RADIUS_FUN_032
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_RADIUS_FUN_032(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()
# 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()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
self.linux.close()
self.ether_radius1.close()
def test_RADIUS_FUN_032(self):
"""
Test case Id: - RADIUS-FUN-032
"""
self.myLog.output("\n**********start the test**************\n")
# Configure SSX to forward session authentication credentials to
# radius server for authentication.
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['rad_fun_032_ssx'])
# Configure the IKEv1 Phase1 & Phase2 Polices on the SSX.
# Ensure that the client is also configured with matching policies.
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['rad_fun_032_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_032.pcap")
self.ether_radius1.cmd("sudo rm rad_fun_032.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_032.pcap & '% topo.port_ssx_radius1[1])
# Initiate IKEv1 session from a Netscreen to the SSX
self.ssx.ping('%s'% script_var['ns_phy_ip'])
time.sleep(5)
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=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")
# Get session handle(ID)
session_op = self.ssx.cmd("show session detail username [email protected]%s" % script_var['context'])
session_id = re.search("session_handle:(\s+)(\w+)(\s+)",session_op,re.I)
#Clear the sessions
self.ssx.cmd("context %s" %script_var['context'])
self.ssx.cmd("clear session all")
self.myLog.output (" Step 3 - stop tethereal by killing the tethereal application.")
time.sleep(15)
self.ether_radius1.cmd("sudo pkill tethereal")
# Check whether the pcap file is created or not
ll_output = self.ether_radius1.cmd("ls")
self.failUnless("rad_fun_032.pcap" in ll_output,"Testcase FAILED because pcap file has not created ")
# Read the contents of the pcap file
self.myLog.output (" Step 4 - read the content of the file rad_fun_032.pcap")
output=self.ether_radius1.cmd("""sudo /usr/sbin/tethereal -r rad_fun_032.pcap -R 'radius.Acct_Status_Type == 1 && radius.Acct_Session_Id == "%s"'""" %session_id.group(2),timeout = 30)
self.failUnless( "RADIUS" in output, " Expected - packet with stop and session ID")
output=self.ether_radius1.cmd("""sudo /usr/sbin/tethereal -r rad_fun_032.pcap -R 'radius.Acct_Status_Type == 2 && radius.Acct_Session_Id == "%s"'""" %session_id.group(2),timeout = 30)
#.........这里部分代码省略.........
示例13: test_AAA_HA_004
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_HA_004(test_case):
myLog = getLogger()
def setUp(self):
"""Establish a telnet session to the SSX box."""
self.ssx = SSX(ssx2_ha['ip_addr'])
self.ssx.telnet()
self.ssx.clear_health_stats()
# Clear SSX configuration
self.ssx.clear_config()
"""Establish a telnet session to the Netscreen."""
self.ns5gt = NS(ns1['ip_addr'])
self.ns5gt.telnet()
self.ssx.clear_health_stats()
# Clear SSX configuration
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_HA_004(self):
"""
Test case Id: - AAA-HA-004
Description: - Verify session authentication with local database using valid credentials.
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['aaa_ha_004_ssx'])
#Push the Netscreen configuration
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['aaa_ha_004_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")
# Initiate IKEv1 session from a netscreen to the SSX with valid session credentials.
# 1st ping used to get rid of any arp learnings
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 and establishment is not successful")
#Verify successful Phase1 authentication and IKEv1 session establishedment
#op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"local")
#self.failUnless(op_debug,"verifying in debug:session authentication and establishment is not successful")
#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")
示例14: test_AAA_FUN_020
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_020(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_FUN_020(self):
"""
Test case Id: - AAA-FUN-020
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['fun_020_ssx'])
#Push the NS configuration
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['fun_020_ns5gt'])
# Enable debug logs for aaad
# self.ssx.config_from_string(script_var['deb_ena_ssx'])
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 IKEv1 session from a client to the SSX with valid session credentials.
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 is not successful")
#checking session authentication successful or not with missing domain name
op_debug = aaa_verify_authentication(self.ssx,"aggr","local")
self.failUnless(op_debug, "Verifying in debug:session authentication is not successful")
#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")
示例15: test_AAA_FUN_017
# 需要导入模块: from NS import NS [as 别名]
# 或者: from NS.NS import telnet [as 别名]
class test_AAA_FUN_017(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 Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
def test_AAA_FUN_017(self):
"""
Test case Id: - AAA-FUN-017
"""
#Push the SSX configuration
self.ssx.config_from_string(script_var['common_ssx1'])
self.ssx.config_from_string(script_var['fun_017_ssx'])
#Push the Netscreen configuration
self.ns5gt.config_from_string(script_var['common_ns5gt'])
self.ns5gt.config_from_string(script_var['fun_017_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")
# Initiate IKEv1 session from a client to the SSX with in-valid X-auth credentials.
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
ping_output=self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
# Verify the IKEv1 phase-1 authentication
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"local")
self.failUnless(op_debug,"Phase-1 authentication is not successful")
#In debug messages verify whether the X-auth authentication is succeeded or not.
# With in-valid X-auth credentials
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"local")
self.failUnless(not op_debug,"session established even with invalid X-auth credentials")
#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(not sa_output,"SA loaded even with invailed xauth user")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs),"Platform is not healthy")