blob: db94822d1a280d1cd28f640073230dac23d0c4b3 [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 FVProtoSlicing :
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 the flowspace by using 'removeFlowSpace'")
25 removeflowspace_result = main.FlowVisor.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 the connected devices by USING 'listDevices'")
29 listdevices_result = main.FlowVisor.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("Adding FlowSpace")
33 addflowspace_result_1 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x806,dl_src=9e:f5:8b:78:c3:93,nw_dst=10.128.4.6 Slice:SSH=4")
34 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_1,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
35
36 addflowspace_result_2 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x806,dl_src=d2:df:f1:53:d4:49,nw_dst=10.128.4.5 Slice:SSH=4")
37 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_2,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
38
39 addflowspace_result_3 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_dst=22 Slice:SSH=4")
40 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_3,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
41
42 addflowspace_result_4 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_dst=22 Slice:SSH=4")
43 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_4,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
44
45 addflowspace_result_5 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.6,tp_src=22 Slice:SSH=4")
46 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_5,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
47
48 addflowspace_result_6 = main.FlowVisor.addFlowSpace("any 100 dl_type=0x800,nw_proto=6,nw_src=10.128.4.5,tp_src=22 Slice:SSH=4")
49 utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_6,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
50
51 main.step("Showing the flowSpace USING 'listFlowSpace'")
52 listflowspace_result = main.FlowVisor.listFlowSpace()
53 utilities.assert_equals(expect=main.TRUE,actual=listflowspace_result,onpass="FlowSpace Listed successfully",onfail="Failed to listthe FlowSpace")
54
55 main.step("Verifying the Slice, by checking SSH is happening to the destination or not")
56 ssh_result = main.Pax_DPVM1.SSH(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'], options=main.componentDictionary['Pax_DPVM1']['COMPONENTS'])
57 utilities.assert_equals(expect=main.TRUE,actual=ssh_result,onpass="Remote host connected throgh SSH ",onfail="Failed to connect remote host throgh SSH")
58
59 main.step(" Showcasing the Parsing the response in required format")
60 myOutput = "<ipaddress>10.128.4.2</ipaddress><username>paxterra</username><password>paxterra</password><port>22</port><location>Bangalore</location>"
61 myVar= main.response_parser(myOutput,"table")
62 main.log.info(myVar)
63