admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | ''' |
| 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 | ''' |
| 15 | |
| 16 | class VyattaTest : |
| 17 | |
| 18 | def __init__(self) : |
| 19 | self.default = '' |
| 20 | |
| 21 | def CASE1(self,main) : |
| 22 | |
| 23 | main.case("VyattaTest Sample Test") |
| 24 | main.step("VyattaTest Sample Test") |
| 25 | config_result = main.Vyatta.configure() |
| 26 | main.log.info(config_result) |
| 27 | |
| 28 | command_details = main.Vyatta.get_details("show") |
| 29 | main.log.info("show \n command_details\n\t"+ str(command_details)) |
| 30 | |
| 31 | command_details = main.Vyatta.get_details("show interfaces") |
| 32 | main.log.info("show interfaces \n command_details\n\t"+ str(command_details)) |
| 33 | |
| 34 | command_details = main.Vyatta.get_details("show interfaces ethernet") |
| 35 | main.log.info("show interfaces ethernet \n command_details\n\t"+ str(command_details)) |
| 36 | |
| 37 | command_details = main.Vyatta.get_details("show interfaces ethernet eth1") |
| 38 | main.log.info("show interfaces ethernet eth1 \n command_details\n\t"+ str(command_details)) |
| 39 | |
| 40 | command_details = main.Vyatta.get_details("show interfaces ethernet eth1 address") |
| 41 | main.log.info("show interfaces ethernet eth1 address \n command_details\n\t"+ str(command_details)) |
| 42 | |
| 43 | |
| 44 | ''' |
| 45 | main.Vyatta.handle.expect("\$") |
| 46 | |
| 47 | resultCommand = main.Vyatta.execute(cmd="configure",prompt='\#',timeout=10) |
| 48 | |
| 49 | resultCommand = main.Vyatta.execute(cmd="show interfaces ?",prompt='\#',timeout=10) |
| 50 | |
| 51 | print "Possible Options \t\t" |
| 52 | print main.last_response |
| 53 | print " ->"*10+"\n"*4 |
| 54 | import re |
| 55 | match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0) |
| 56 | print match |
| 57 | |
| 58 | resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10) |
| 59 | |
| 60 | print "Command result Upto here \t\t" |
| 61 | print main.last_response |
| 62 | print " ->"*10+"\n"*4 |
| 63 | import re |
| 64 | match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0) |
| 65 | print match |
| 66 | |
| 67 | |
| 68 | resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10) |
| 69 | |
| 70 | print "Command result Upto here \t\t" |
| 71 | print main.last_response |
| 72 | print " ->"*10+"\n"*4 |
| 73 | import re |
| 74 | match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0) |
| 75 | print match |
| 76 | |
| 77 | |
| 78 | resultCommand = main.Vyatta.execute(cmd="show interfaces ethernet ?",prompt='\#',timeout=10) |
| 79 | |
| 80 | print "Possible Options \t\t" |
| 81 | print main.last_response |
| 82 | print " ->"*10+"\n"*4 |
| 83 | import re |
| 84 | match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0) |
| 85 | print match |
| 86 | |
| 87 | resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10) |
| 88 | |
| 89 | print "Command result Upto here \t\t" |
| 90 | print main.last_response |
| 91 | print " ->"*10+"\n"*4 |
| 92 | import re |
| 93 | match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0) |
| 94 | print match |
| 95 | ''' |