blob: 86b3ddcb96957e49a00dd65b901e62923a3853c3 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001
adminbae64d82013-08-01 10:50:15 -07002class MininetSlicing :
3
4 def __init__(self) :
5 self.default = ''
6
7 def CASE1(self,main) :
8
9 main.case("Verifying 'SSH protocol' based slicing")
10
11 main.step("Deleting flowspace using 'removeFlowSpace'")
12 removeflowspace_result = main.FlowVisor1.removeFlowSpace("all")
13 utilities.assert_equals(expect=main.TRUE,actual=removeflowspace_result,onpass="Removed FlowSpace Successfully",onfail="Failed to remove FlowSpace")
14
15 main.step("Showing connected devices using 'listDevices'")
16 listdevices_result = main.FlowVisor1.listDevices()
17 utilities.assert_equals(expect=main.TRUE,actual=listdevices_result,onpass="Listed devices Successfully",onfail="Failed to list the devices")
18
19 main.step("Verifying hosts reachability through ICMP traffic")
20 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
21 utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
22
23 main.step("Showing the flowSpace USING 'listFlowSpace'")
24 listflowspace_result = main.FlowVisor1.listFlowSpace()
25 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
26
27
28 main.step("Adding FlowSpace to create the slice of the Network")
29 main.log.info(" Geeting the IP-Addresses of Hosts")
30 h1_ipaddress = main.Mininet1.getIPAddress('h1')
31 h4_ipaddress = main.Mininet1.getIPAddress('h4')
32
33 main.log.info(" Geeting the MAC-Addresses of Hosts" )
34 h1_macaddress = main.Mininet1.getMacAddress('h1')
35 h4_macaddress = main.Mininet1.getMacAddress('h4')
36
37 addflowspace_result_1 = main.FlowVisor1.addFlowSpace(dl_src=h1_macaddress,nw_dst=h4_ipaddress)
38 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_1,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
39
40 addflowspace_result_2 = main.FlowVisor1.addFlowSpace(dl_src=h4_macaddress,nw_dst=h1_ipaddress)
41 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_2,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
42
43 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress)
44 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress)
45
46 addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress, tp_dst='22')
47 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_3,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
48
49 addflowspace_result_4 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_dst='22')
50 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_4,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
51
52 addflowspace_result_5 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress,tp_src='22')
53 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_5,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
54
55 addflowspace_result_6 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_src='22')
56 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_6,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
57
58 main.log.info("Showing the flowSpace USING 'listFlowSpace'")
59 listflowspace_result = main.FlowVisor1.listFlowSpace()
60
61 main.step("Verifying hosts reachability through ICMP traffic and Connectivity through SSH service")
62 ping_result = main.Mininet1.pingHost(src='h1',target='h4')
63 utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
64
65 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'])
66 utilities.assert_equals(expect=main.TRUE,actual=ssh_result,onpass="Failed to connect remote host throgh SSH",onfail="Remote host connected throgh SSH ")
67
68
69
70
andrewonlab8790abb2014-11-06 13:51:54 -050071