本文整理汇总了Python中NS.NS类的典型用法代码示例。如果您正苦于以下问题:Python NS类的具体用法?Python NS怎么用?Python NS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
#Establish a telnet session to the SSX box.
self.ssx = SSX(ssx1["ip_addr"])
self.ssx.telnet()
#Establish a telnet session to the Netscreen.
self.ns5gt = NS(ns['ipaddr'])
self.ns5gt.telnet()
# Inserting the code of Linux1 object -- Ashu
#Establish a telnet session to the linux1 client box.
self.linux1 = Linux(linux1["ip_addr"],linux1["user_name"],
linux1["password"])
self.linux1.telnet()
#clear the configuration on Netscreen
self.ns5gt.clear_config()
# Clear the SSX config
# self.ssx.clear_config()
# wait for card to come up
self.ssx.wait4cards()
self.ssx.clear_health_stats()
开发者ID:muttu2244,项目名称:MyPython,代码行数:25,代码来源:ip_atk_078.py
示例2: setUp
def setUp(self):
#Establish a telnet session to the SSX box.
self.ssx = SSX(ssx1['ip_addr'])
self.ssx.telnet()
# Clear the SSX config
self.ssx.clear_config()
# 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()
self.ether_radius2 = Linux(radius2['ip_addr'],radius2['user_name'],radius2['password'])
self.ether_radius2.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:25,代码来源:RADIUS_FUN_023.py
示例3: setUp
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()
开发者ID:muttu2244,项目名称:MyPython,代码行数:13,代码来源:AAA_FUN_031.py
示例4: setUp
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()
开发者ID:muttu2244,项目名称:MyPython,代码行数:14,代码来源:AAA_FUN_030_backup.py
示例5: setUp
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()
开发者ID:muttu2244,项目名称:MyPython,代码行数:16,代码来源:AAA_HA_004.py
示例6: setUp
def setUp(self):
"""Establish a telnet session to the SSX box."""
self.ssx = SSX(ssx1['ip_addr'])
self.ssx.telnet()
# Clear SSX configuration
self.ssx.clear_config()
# wait for card to come up and clear syscount
self.ssx.wait4cards()
self.ssx.clear_health_stats()
"""Establish a telnet session to the Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
self.ether_radius1.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:17,代码来源:RADIUS_FUN_031.py
示例7: setUp
def setUp(self):
"""Establish a telnet session to the SSX box."""
self.ssx = SSX(ssx1['ip_addr'])
self.ssx.telnet()
# Clear SSX configuration
self.ssx.clear_config()
# wait for card to come up
self.ssx.wait4cards()
self.ssx.clear_health_stats()
#Establish a telnet session to the Xpress VPN client box.
self.xpress_vpn = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
self.xpress_vpn.telnet()
"""Establish a telnet session to the Netscreen."""
self.ns5gt = NS(ns['ip_addr'])
self.ns5gt.telnet()
self.ns5gt.clear_config()
开发者ID:muttu2244,项目名称:MyPython,代码行数:18,代码来源:RADIUS_FUN_033.py
示例8: setUp
def setUp(self):
#Establish a telnet session to the SSX box.
self.ssx = SSX(ssx1['ip_addr'])
self.ssx.telnet()
# Clear the SSX config
self.ssx.clear_config()
# 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 Radius server 1."""
self.ether_linux = Linux(radius1['ip_addr'],radius1['user_name'],
radius1['password'])
self.ether_linux.telnet()
开发者ID:muttu2244,项目名称:MyPython,代码行数:20,代码来源:RADIUS_FUN_001.py
示例9: test_RADIUS_FUN_033
class test_RADIUS_FUN_033(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()
"""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()
self.xpress_vpn.close()
def test_RADIUS_FUN_033(self):
"""
Test case Id: - RADIUS-FUN-033
"""
#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_033_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_033_ns5gt'])
# Push xpress vpn config
self.xpress_vpn.write_to_file(script_var['fun_007_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 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")
#Verify IKEv1 session authentication
#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")
#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")
#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")
# 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")
time.sleep(5)
#Consider 9 client
op_ssx_sa = self.ssx.cmd("show session detail")
i=0
count=0
ssx_max_ses=2
for i in range(0,len(clnt_ips)):
if clnt_ips2[i] in op_ssx_sa:
count=count+1
self.myLog.output("\n\n************* the no. of ikev2 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")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:98,代码来源:RADIUS_FUN_033.py
示例10: test_ip_atk_078
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)
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:ip_atk_078.py
示例11: test_RADIUS_FUN_012
class test_RADIUS_FUN_012(test_case):
myLog = getLogger()
def setUp(self):
"""Establish a telnet session to the SSX box."""
self.ssx = SSX(topo.ssx1['ip_addr'])
self.ssx.telnet()
# CLear 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()
# Establish a telnet session to the radius servers
self.ether_radius1 = Linux(radius1['ip_addr'],radius1['user_name'],radius1['password'])
self.ether_radius1.telnet()
self.ether_radius2 = Linux(radius2['ip_addr'],radius2['user_name'],radius2['password'])
self.ether_radius2.telnet()
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")
self.ether_radius2.cmd("sudo pkill tethereal")
# Close the telnet session of SSX
self.ssx.close()
# Close the telnet session of ns5gt client .
self.ns5gt.close()
# Close the telnet session of Radius (tethereal capture machine)
self.ether_radius1.close()
self.ether_radius2.close()
def test_RADIUS_FUN_012(self):
"""
Test case Id: - RADIUS_FUN_012
"""
self.myLog.output("\n**********start the test**************\n")
#Configure SSX to forward session authentication credentials to radius server for authentication.
#Configure two radius servers primary & secondary in the session authentication profile.
self.ssx.config_from_string(script_var['common_ssx'])
self.ssx.config_from_string(script_var['rad_fun_012_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_012_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")
# 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_012.pcap")
self.ether_radius1.cmd("sudo rm rad_fun_012.pcap -f")
self.ether_radius2.cmd("sudo rm rad_fun_012.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_radius2.cmd('sudo /usr/sbin/tethereal -h')
self.ether_radius1.cmd('sudo /usr/sbin/tethereal -i %s -q -w rad_fun_012.pcap -R "radius" & '% topo.port_ssx_radius1[1])
self.ether_radius2.cmd('sudo /usr/sbin/tethereal -i %s -q -w rad_fun_012.pcap -R "radius" & '% topo.port_ssx_radius2[1])
# Initiate IKEv1 session from a Netscreen to the SSX
self.ssx.ping('%s'% script_var['ns_phy_ip'])
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")
self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
time.sleep(45)
#self.ns5gt.ping(script_var['ssx_ses_ip'],source="untrust")
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.")
self.ether_radius1.cmd("sudo pkill tethereal")
self.ether_radius2.cmd("sudo pkill tethereal")
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:RADIUS_FUN_012.py
示例12: test_AAA_FUN_031
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")
开发者ID:muttu2244,项目名称:MyPython,代码行数:65,代码来源:AAA_FUN_031.py
示例13: test_AAA_FUN_028
class test_AAA_FUN_028(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()
"""Establish a telnet session to Linux machine ."""
self.linux = Linux(topo.linux["ip_addr"],topo.linux["user_name"],topo.linux["password"])
self.linux.telnet()
def tearDown(self):
"""Clear the config and Close down the telnet session."""
self.ssx.close()
self.ns5gt.close()
self.linux.close()
def test_AAA_FUN_028(self):
"""
Test case Id: - AAA-FUN-028
"""
#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_ssx1'])
self.ssx.config_from_string(script_var['fun_028_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_028_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 authentication and establishment is not successful")
#Verify IKEv1 session authentication
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"radius")
self.failUnless(op_debug, "Verifying in debugs: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")
# Flush the debug logs in SSX, if any
self.ssx.cmd("clear log debug")
# Initiate Telnet Session from Xpress VPN Client where user has adminstrator privileages
op_telnet = generic_verify_telnet_2_ssx(self.linux,script_var['ssx_phy_ip2'],"[email protected]%s"%script_var['context'],"123user3")
self.failUnless(op_telnet,"telnet to SSX as a user was not success")
# Check whether SSX quiries the local database for user authentication
op_debug = aaa_verify_authentication(self.ssx,"[email protected]%s"%script_var['context'],"local")
self.failUnless(op_debug,"Verifying in debugs:the user authentication not success ")
# Checking SSX Health
hs = self.ssx.get_health_stats()
self.failUnless(is_healthy(hs), "Platform is not healthy")
开发者ID:muttu2244,项目名称:MyPython,代码行数:79,代码来源:AAA_FUN_028.py
示例14: test_AAA_FUN_017
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")
开发者ID:muttu2244,项目名称:MyPython,代码行数:64,代码来源:AAA_FUN_017.py
示例15: test_RADIUS_FUN_030
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()
#.........这里部分代码省略.........
开发者ID:muttu2244,项目名称:MyPython,代码行数:101,代码来源:RADIUS_FUN_030.py
示例16: test_RADIUS_FUN_031
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,代码行数:90,代码来源:RADIUS_FUN_031.py
示例17: test_AAA_FUN_030
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 autho
|
请发表评论