blob: ac723fb9b19f4338eea7f2570069e1b60518b53a [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001'''
2
3 * TestON is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7
8 * TestON is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12
13
14'''
15class MininetSlicing :
16
17 def __init__(self) :
18 self.default = ''
19
20 def CASE1(self,main) :
21
22 main.case("Verifying 'SSH protocol' based slicing")
23
24 main.step("Deleting flowspace using 'removeFlowSpace'")
25 removeflowspace_result = main.FlowVisor1.removeFlowSpace("all")
26 utilities.assert_equals(expect=main.TRUE,actual=removeflowspace_result,onpass="Removed FlowSpace Successfully",onfail="Failed to remove FlowSpace")
27
28 main.step("Showing connected devices using 'listDevices'")
29 listdevices_result = main.FlowVisor1.listDevices()
30 utilities.assert_equals(expect=main.TRUE,actual=listdevices_result,onpass="Listed devices Successfully",onfail="Failed to list the devices")
31
32 main.step("Verifying hosts reachability through ICMP traffic")
33 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
34 utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
35
36 main.step("Showing the flowSpace USING 'listFlowSpace'")
37 listflowspace_result = main.FlowVisor1.listFlowSpace()
38 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
39
40
41 main.step("Adding FlowSpace to create the slice of the Network")
42 main.log.info(" Geeting the IP-Addresses of Hosts")
43 h1_ipaddress = main.Mininet1.getIPAddress('h1')
44 h4_ipaddress = main.Mininet1.getIPAddress('h4')
45
46 main.log.info(" Geeting the MAC-Addresses of Hosts" )
47 h1_macaddress = main.Mininet1.getMacAddress('h1')
48 h4_macaddress = main.Mininet1.getMacAddress('h4')
49
50 addflowspace_result_1 = main.FlowVisor1.addFlowSpace(dl_src=h1_macaddress,nw_dst=h4_ipaddress)
51 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_1,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
52
53 addflowspace_result_2 = main.FlowVisor1.addFlowSpace(dl_src=h4_macaddress,nw_dst=h1_ipaddress)
54 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_2,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
55
56 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress)
57 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress)
58
59 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress, tp_dst='22')
60 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_3,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
61
62 addflowspace_result_4 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_dst='22')
63 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_4,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
64
65 addflowspace_result_5 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress,tp_src='22')
66 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_5,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
67
68 addflowspace_result_6 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_src='22')
69 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_6,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
70
71 main.log.info("Showing the flowSpace USING 'listFlowSpace'")
72 listflowspace_result = main.FlowVisor1.listFlowSpace()
73
74 main.step("Verifying hosts reachability through ICMP traffic and Connectivity through SSH service")
75 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
76 utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
77
78 ssh_result = main.Mininet1.verifySSH(user_name=main.params['CASE1']['destination_username'],ip_address=main.params['CASE1']['destination_host'], pwd=main.params['CASE1']['destination_password'], port=main.params['CASE1']['destination_port'])
79 utilities.assert_equals(expect=main.TRUE,actual=ssh_result,onpass="Failed to connect remote host throgh SSH",onfail="Remote host connected throgh SSH ")
80
81
82
83
84
85