Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 2 | |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 3 | ''' |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 4 | This driver interacts with ONOS bench, the OSGi platform |
| 5 | that configures the ONOS nodes. (aka ONOS-next) |
| 6 | |
| 7 | Please follow the coding style demonstrated by existing |
| 8 | functions and document properly. |
| 9 | |
| 10 | If you are a contributor to the driver, please |
| 11 | list your email here for future contact: |
| 12 | |
| 13 | jhall@onlab.us |
| 14 | andrew@onlab.us |
| 15 | |
| 16 | OCT 9 2014 |
| 17 | |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 18 | ''' |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 19 | |
andrewonlab | 7735d85 | 2014-10-09 13:02:47 -0400 | [diff] [blame] | 20 | import sys |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 21 | import time |
| 22 | import pexpect |
| 23 | import re |
| 24 | import traceback |
andrewonlab | 7735d85 | 2014-10-09 13:02:47 -0400 | [diff] [blame] | 25 | import os.path |
andrewonlab | 6e20c34 | 2014-10-10 18:08:48 -0400 | [diff] [blame] | 26 | import pydoc |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 27 | sys.path.append("../") |
| 28 | from drivers.common.clidriver import CLI |
| 29 | |
| 30 | class OnosDriver(CLI): |
| 31 | |
| 32 | def __init__(self): |
andrewonlab | 6e20c34 | 2014-10-10 18:08:48 -0400 | [diff] [blame] | 33 | ''' |
| 34 | Initialize client |
| 35 | ''' |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 36 | super(CLI, self).__init__() |
| 37 | |
| 38 | def connect(self,**connectargs): |
| 39 | ''' |
| 40 | Creates ssh handle for ONOS "bench". |
| 41 | ''' |
| 42 | try: |
| 43 | for key in connectargs: |
| 44 | vars(self)[key] = connectargs[key] |
| 45 | self.home = "~/ONOS" |
| 46 | for key in self.options: |
| 47 | if key == "home": |
| 48 | self.home = self.options['home'] |
| 49 | break |
| 50 | |
| 51 | |
| 52 | self.name = self.options['name'] |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 53 | self.handle = super(OnosDriver,self).connect( |
| 54 | user_name = self.user_name, |
| 55 | ip_address = self.ip_address, |
| 56 | port = self.port, |
| 57 | pwd = self.pwd, |
| 58 | home = self.home) |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 59 | |
| 60 | self.handle.sendline("cd "+ self.home) |
| 61 | self.handle.expect("\$") |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 62 | if self.handle: |
| 63 | return self.handle |
| 64 | else : |
| 65 | main.log.info("NO ONOS HANDLE") |
| 66 | return main.FALSE |
| 67 | except pexpect.EOF: |
| 68 | main.log.error(self.name + ": EOF exception found") |
| 69 | main.log.error(self.name + ": " + self.handle.before) |
| 70 | main.cleanup() |
| 71 | main.exit() |
| 72 | except: |
| 73 | main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 74 | main.log.error( traceback.print_exc() ) |
| 75 | main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 76 | main.cleanup() |
| 77 | main.exit() |
| 78 | |
| 79 | def disconnect(self): |
| 80 | ''' |
| 81 | Called when Test is complete to disconnect the ONOS handle. |
| 82 | ''' |
| 83 | response = '' |
| 84 | try: |
Jon Hall | f8d1098 | 2014-10-22 12:23:38 -0400 | [diff] [blame] | 85 | self.handle.sendline("\n") |
| 86 | self.handle.expect("\$") |
Jon Hall | 05b2b43 | 2014-10-08 19:53:25 -0400 | [diff] [blame] | 87 | self.handle.sendline("exit") |
| 88 | self.handle.expect("closed") |
| 89 | except pexpect.EOF: |
| 90 | main.log.error(self.name + ": EOF exception found") |
| 91 | main.log.error(self.name + ": " + self.handle.before) |
| 92 | except: |
| 93 | main.log.error(self.name + ": Connection failed to the host") |
| 94 | response = main.FALSE |
| 95 | return response |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 96 | |
| 97 | def onos_package(self): |
| 98 | ''' |
| 99 | Produce a self-contained tar.gz file that can be deployed |
| 100 | and executed on any platform with Java 7 JRE. |
| 101 | ''' |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 102 | |
| 103 | try: |
| 104 | self.handle.sendline("onos-package") |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 105 | self.handle.expect("onos-package") |
andrewonlab | 0748d2a | 2014-10-09 13:24:17 -0400 | [diff] [blame] | 106 | self.handle.expect("tar.gz",timeout=10) |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 107 | handle = str(self.handle.before) |
| 108 | main.log.info("onos-package command returned: "+ |
| 109 | handle) |
andrewonlab | 0748d2a | 2014-10-09 13:24:17 -0400 | [diff] [blame] | 110 | #As long as the sendline does not time out, |
| 111 | #return true. However, be careful to interpret |
| 112 | #the results of the onos-package command return |
| 113 | return main.TRUE |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 114 | |
andrewonlab | 7735d85 | 2014-10-09 13:02:47 -0400 | [diff] [blame] | 115 | except pexpect.EOF: |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 116 | main.log.error(self.name + ": EOF exception found") |
| 117 | main.log.error(self.name + ": " + self.handle.before) |
| 118 | except: |
| 119 | main.log.error("Failed to package ONOS") |
| 120 | main.cleanup() |
| 121 | main.exit() |
| 122 | |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 123 | def onos_build(self): |
| 124 | ''' |
| 125 | Use the pre defined script to build onos via mvn |
| 126 | ''' |
| 127 | |
| 128 | try: |
| 129 | self.handle.sendline("onos-build") |
| 130 | self.handle.expect("onos-build") |
| 131 | i = self.handle.expect([ |
| 132 | "BUILD SUCCESS", |
| 133 | "ERROR", |
| 134 | "BUILD FAILED"], timeout=120) |
| 135 | handle = str(self.handle.before) |
| 136 | |
| 137 | main.log.info("onos-build command returned: "+ |
| 138 | handle) |
| 139 | |
| 140 | if i == 0: |
| 141 | return main.TRUE |
| 142 | else: |
| 143 | return handle |
| 144 | |
| 145 | except pexpect.EOF: |
| 146 | main.log.error(self.name + ": EOF exception found") |
| 147 | main.log.error(self.name + ": " + self.handle.before) |
| 148 | except: |
| 149 | main.log.error("Failed to build ONOS") |
| 150 | main.cleanup() |
| 151 | main.exit() |
| 152 | |
Jon Hall | de9d9aa | 2014-10-08 20:36:02 -0400 | [diff] [blame] | 153 | def clean_install(self): |
| 154 | ''' |
| 155 | Runs mvn clean install in the root of the ONOS directory. |
| 156 | This will clean all ONOS artifacts then compile each module |
andrew@onlab.us | 9e2cd0f | 2014-10-08 20:32:32 -0400 | [diff] [blame] | 157 | |
Jon Hall | de9d9aa | 2014-10-08 20:36:02 -0400 | [diff] [blame] | 158 | Returns: main.TRUE on success |
| 159 | On Failure, exits the test |
| 160 | ''' |
| 161 | try: |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 162 | main.log.info("Running 'mvn clean install' on " + str(self.name) + |
| 163 | ". This may take some time.") |
| 164 | self.handle.sendline("cd "+ self.home) |
| 165 | self.handle.expect("\$") |
| 166 | |
| 167 | self.handle.sendline("\n") |
| 168 | self.handle.expect("\$") |
Jon Hall | de9d9aa | 2014-10-08 20:36:02 -0400 | [diff] [blame] | 169 | self.handle.sendline("mvn clean install") |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 170 | self.handle.expect("mvn clean install") |
Jon Hall | de9d9aa | 2014-10-08 20:36:02 -0400 | [diff] [blame] | 171 | while 1: |
| 172 | i=self.handle.expect([ |
| 173 | 'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s\ |
| 174 | Runtime\sEnvironment\sto\scontinue', |
| 175 | 'BUILD\sFAILURE', |
| 176 | 'BUILD\sSUCCESS', |
| 177 | 'ONOS\$', |
| 178 | pexpect.TIMEOUT],timeout=600) |
| 179 | if i == 0: |
| 180 | main.log.error(self.name + ":There is insufficient memory \ |
| 181 | for the Java Runtime Environment to continue.") |
| 182 | #return main.FALSE |
| 183 | main.cleanup() |
| 184 | main.exit() |
| 185 | if i == 1: |
| 186 | main.log.error(self.name + ": Build failure!") |
| 187 | #return main.FALSE |
| 188 | main.cleanup() |
| 189 | main.exit() |
| 190 | elif i == 2: |
| 191 | main.log.info(self.name + ": Build success!") |
| 192 | elif i == 3: |
| 193 | main.log.info(self.name + ": Build complete") |
Jon Hall | f8ef52c | 2014-10-09 19:37:33 -0400 | [diff] [blame] | 194 | #Print the build time |
| 195 | for line in self.handle.before.splitlines(): |
| 196 | if "Total time:" in line: |
| 197 | main.log.info(line) |
Jon Hall | ea7818b | 2014-10-09 14:30:59 -0400 | [diff] [blame] | 198 | self.handle.sendline("\n") |
Jon Hall | de9d9aa | 2014-10-08 20:36:02 -0400 | [diff] [blame] | 199 | self.handle.expect("\$", timeout=60) |
| 200 | return main.TRUE |
| 201 | elif i == 4: |
| 202 | main.log.error(self.name + ": mvn clean install TIMEOUT!") |
| 203 | #return main.FALSE |
| 204 | main.cleanup() |
| 205 | main.exit() |
| 206 | else: |
| 207 | main.log.error(self.name + ": unexpected response from \ |
| 208 | mvn clean install") |
| 209 | #return main.FALSE |
| 210 | main.cleanup() |
| 211 | main.exit() |
| 212 | except pexpect.EOF: |
| 213 | main.log.error(self.name + ": EOF exception found") |
| 214 | main.log.error(self.name + ": " + self.handle.before) |
| 215 | main.cleanup() |
| 216 | main.exit() |
| 217 | except: |
| 218 | main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 219 | main.log.error( traceback.print_exc() ) |
| 220 | main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 221 | main.cleanup() |
| 222 | main.exit() |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 223 | |
| 224 | def git_pull(self, comp1=""): |
| 225 | ''' |
| 226 | Assumes that "git pull" works without login |
| 227 | |
| 228 | This function will perform a git pull on the ONOS instance. |
| 229 | If used as git_pull("NODE") it will do git pull + NODE. This is |
| 230 | for the purpose of pulling from other nodes if necessary. |
| 231 | |
| 232 | Otherwise, this function will perform a git pull in the |
| 233 | ONOS repository. If it has any problems, it will return main.ERROR |
Shreya Shah | ee15f6c | 2014-10-28 18:12:30 -0400 | [diff] [blame] | 234 | If it successfully does a git_pull, it will return a 1 (main.TRUE) |
| 235 | If it has no updates, it will return 3. |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 236 | |
| 237 | ''' |
| 238 | try: |
| 239 | # main.log.info(self.name + ": Stopping ONOS") |
| 240 | #self.stop() |
| 241 | self.handle.sendline("cd " + self.home) |
| 242 | self.handle.expect("ONOS\$") |
| 243 | if comp1=="": |
| 244 | self.handle.sendline("git pull") |
| 245 | else: |
| 246 | self.handle.sendline("git pull " + comp1) |
| 247 | |
| 248 | uptodate = 0 |
| 249 | i=self.handle.expect(['fatal', |
| 250 | 'Username\sfor\s(.*):\s', |
| 251 | '\sfile(s*) changed,\s', |
| 252 | 'Already up-to-date', |
| 253 | 'Aborting', |
| 254 | 'You\sare\snot\scurrently\son\sa\sbranch', |
| 255 | 'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\sbranch\syou', |
| 256 | 'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\sfiles', |
| 257 | pexpect.TIMEOUT], |
| 258 | timeout=300) |
| 259 | #debug |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 260 | #main.log.report(self.name +": DEBUG: \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after)) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 261 | if i==0: |
| 262 | main.log.error(self.name + ": Git pull had some issue...") |
| 263 | return main.ERROR |
| 264 | elif i==1: |
| 265 | main.log.error(self.name + ": Git Pull Asking for username. ") |
| 266 | return main.ERROR |
| 267 | elif i==2: |
| 268 | main.log.info(self.name + ": Git Pull - pulling repository now") |
| 269 | self.handle.expect("ONOS\$", 120) |
Shreya Shah | ee15f6c | 2014-10-28 18:12:30 -0400 | [diff] [blame] | 270 | return main.TRUE # So that only when git pull is done, we do mvn clean compile |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 271 | elif i==3: |
| 272 | main.log.info(self.name + ": Git Pull - Already up to date") |
Shreya Shah | ee15f6c | 2014-10-28 18:12:30 -0400 | [diff] [blame] | 273 | return i |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 274 | elif i==4: |
| 275 | main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?") |
| 276 | return main.ERROR |
| 277 | elif i==5: |
| 278 | main.log.info(self.name + ": Git Pull - You are not currently on a branch so git pull failed!") |
| 279 | return main.ERROR |
| 280 | elif i==6: |
| 281 | main.log.info(self.name + ": Git Pull - You have not configured an upstream branch to pull from. Git pull failed!") |
| 282 | return main.ERROR |
| 283 | elif i==7: |
| 284 | main.log.info(self.name + ": Git Pull - Pull is not possible because you have unmerged files.") |
| 285 | return main.ERROR |
| 286 | elif i==8: |
| 287 | main.log.error(self.name + ": Git Pull - TIMEOUT") |
| 288 | main.log.error(self.name + " Response was: " + str(self.handle.before)) |
| 289 | return main.ERROR |
| 290 | else: |
| 291 | main.log.error(self.name + ": Git Pull - Unexpected response, check for pull errors") |
| 292 | return main.ERROR |
| 293 | except pexpect.EOF: |
| 294 | main.log.error(self.name + ": EOF exception found") |
| 295 | main.log.error(self.name + ": " + self.handle.before) |
| 296 | main.cleanup() |
| 297 | main.exit() |
| 298 | except: |
| 299 | main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 300 | main.log.error( traceback.print_exc() ) |
| 301 | main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 302 | main.cleanup() |
| 303 | main.exit() |
| 304 | |
| 305 | def git_checkout(self, branch="master"): |
| 306 | ''' |
| 307 | Assumes that "git pull" works without login |
| 308 | |
| 309 | This function will perform a git git checkout on the ONOS instance. |
| 310 | If used as git_checkout("branch") it will do git checkout of the "branch". |
| 311 | |
| 312 | Otherwise, this function will perform a git checkout of the master |
| 313 | branch of the ONOS repository. If it has any problems, it will return |
| 314 | main.ERROR. |
| 315 | If the branch was already the specified branch, or the git checkout was |
| 316 | successful then the function will return main.TRUE. |
| 317 | |
| 318 | ''' |
| 319 | try: |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 320 | self.handle.sendline("cd " + self.home) |
| 321 | self.handle.expect("ONOS\$") |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 322 | main.log.info(self.name + ": Checking out git branch: " + branch + "...") |
| 323 | cmd = "git checkout "+branch |
| 324 | self.handle.sendline(cmd) |
| 325 | self.handle.expect(cmd) |
| 326 | i=self.handle.expect(['fatal', |
| 327 | 'Username\sfor\s(.*):\s', |
| 328 | 'Already\son\s\'', |
| 329 | 'Switched\sto\sbranch\s\'' + str(branch), |
| 330 | pexpect.TIMEOUT, |
| 331 | 'error: Your local changes to the following files would be overwritten by checkout:', |
| 332 | 'error: you need to resolve your current index first'],timeout=60) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 333 | |
| 334 | if i==0: |
| 335 | main.log.error(self.name + ": Git checkout had some issue...") |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 336 | main.log.error(self.name + ": " + self.handle.before) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 337 | return main.ERROR |
| 338 | elif i==1: |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 339 | main.log.error(self.name + ": Git checkout asking for username."\ |
| 340 | +" Please configure your local git repository to be able "\ |
| 341 | +"to access your remote repository passwordlessly") |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 342 | return main.ERROR |
| 343 | elif i==2: |
| 344 | main.log.info(self.name + ": Git Checkout %s : Already on this branch" %branch) |
| 345 | self.handle.expect("ONOS\$") |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 346 | #main.log.info("DEBUG: after checkout cmd = "+ self.handle.before) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 347 | return main.TRUE |
| 348 | elif i==3: |
| 349 | main.log.info(self.name + ": Git checkout %s - Switched to this branch" %branch) |
| 350 | self.handle.expect("ONOS\$") |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 351 | #main.log.info("DEBUG: after checkout cmd = "+ self.handle.before) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 352 | return main.TRUE |
| 353 | elif i==4: |
| 354 | main.log.error(self.name + ": Git Checkout- TIMEOUT") |
| 355 | main.log.error(self.name + " Response was: " + str(self.handle.before)) |
| 356 | return main.ERROR |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 357 | elif i==5: |
| 358 | self.handle.expect("Aborting") |
| 359 | main.log.error(self.name + ": Git checkout error: \n" + \ |
| 360 | "Your local changes to the following files would be overwritten by checkout:" + \ |
| 361 | str(self.handle.before)) |
| 362 | self.handle.expect("ONOS\$") |
| 363 | return main.ERROR |
| 364 | elif i==6: |
| 365 | main.log.error(self.name + ": Git checkout error: \n" + \ |
| 366 | "You need to resolve your current index first:" + \ |
| 367 | str(self.handle.before)) |
| 368 | self.handle.expect("ONOS\$") |
| 369 | return main.ERROR |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 370 | else: |
| 371 | main.log.error(self.name + ": Git Checkout - Unexpected response, check for pull errors") |
Jon Hall | 81e29af | 2014-11-04 20:41:23 -0500 | [diff] [blame] | 372 | main.log.error(self.name + ": " + self.handle.before) |
Jon Hall | acabffd | 2014-10-09 12:36:53 -0400 | [diff] [blame] | 373 | return main.ERROR |
| 374 | |
| 375 | except pexpect.EOF: |
| 376 | main.log.error(self.name + ": EOF exception found") |
| 377 | main.log.error(self.name + ": " + self.handle.before) |
| 378 | main.cleanup() |
| 379 | main.exit() |
| 380 | except: |
| 381 | main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 382 | main.log.error( traceback.print_exc() ) |
| 383 | main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 384 | main.cleanup() |
| 385 | main.exit() |
andrewonlab | 95ca146 | 2014-10-09 14:04:24 -0400 | [diff] [blame] | 386 | |
Jon Hall | fd19120 | 2014-11-07 18:36:09 -0500 | [diff] [blame] | 387 | def get_version(self, report=False): |
Jon Hall | 45ec092 | 2014-10-10 19:33:49 -0400 | [diff] [blame] | 388 | ''' |
| 389 | Writes the COMMIT number to the report to be parsed by Jenkins data collecter. |
| 390 | ''' |
| 391 | try: |
| 392 | self.handle.sendline("export TERM=xterm-256color") |
| 393 | self.handle.expect("xterm-256color") |
| 394 | self.handle.expect("\$") |
Jon Hall | 42db6dc | 2014-10-24 19:03:48 -0400 | [diff] [blame] | 395 | self.handle.sendline("\n") |
| 396 | self.handle.expect("\$") |
| 397 | self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller --decorate=short | grep -A 6 \"commit\" --color=never") |
| 398 | self.handle.expect("--color=never") |
Jon Hall | 45ec092 | 2014-10-10 19:33:49 -0400 | [diff] [blame] | 399 | self.handle.expect("\$") |
| 400 | response=(self.name +": \n"+ str(self.handle.before + self.handle.after)) |
Jon Hall | 42db6dc | 2014-10-24 19:03:48 -0400 | [diff] [blame] | 401 | self.handle.sendline("cd " + self.home) |
| 402 | self.handle.expect("\$") |
Jon Hall | 45ec092 | 2014-10-10 19:33:49 -0400 | [diff] [blame] | 403 | lines=response.splitlines() |
| 404 | for line in lines: |
Jon Hall | fd19120 | 2014-11-07 18:36:09 -0500 | [diff] [blame] | 405 | print line |
| 406 | if report: |
| 407 | for line in lines[2:-1]: |
| 408 | main.log.report(line) |
| 409 | return lines[2] |
Jon Hall | 45ec092 | 2014-10-10 19:33:49 -0400 | [diff] [blame] | 410 | except pexpect.EOF: |
| 411 | main.log.error(self.name + ": EOF exception found") |
| 412 | main.log.error(self.name + ": " + self.handle.before) |
| 413 | main.cleanup() |
| 414 | main.exit() |
| 415 | except: |
| 416 | main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 417 | main.log.error( traceback.print_exc() ) |
| 418 | main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::") |
| 419 | main.cleanup() |
| 420 | main.exit() |
| 421 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 422 | def create_cell_file(self, bench_ip, file_name, mn_ip_addrs, |
andrewonlab | 3f0a4af | 2014-10-17 12:25:14 -0400 | [diff] [blame] | 423 | extra_feature_string, *onos_ip_addrs): |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 424 | ''' |
| 425 | Creates a cell file based on arguments |
| 426 | Required: |
| 427 | * Bench IP address (bench_ip) |
| 428 | - Needed to copy the cell file over |
| 429 | * File name of the cell file (file_name) |
| 430 | * Mininet IP address (mn_ip_addrs) |
| 431 | - Note that only 1 ip address is |
| 432 | supported currently |
| 433 | * ONOS IP addresses (onos_ip_addrs) |
| 434 | - Must be passed in as last arguments |
| 435 | |
| 436 | NOTE: Assumes cells are located at: |
| 437 | ~/<self.home>/tools/test/cells/ |
| 438 | ''' |
| 439 | |
| 440 | #Variable initialization |
| 441 | cell_directory = self.home + "/tools/test/cells/" |
| 442 | #We want to create the cell file in the dependencies directory |
| 443 | #of TestON first, then copy over to ONOS bench |
| 444 | temp_directory = "/tmp/" |
| 445 | #Create the cell file in the directory for writing (w+) |
| 446 | cell_file = open(temp_directory+file_name , 'w+') |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 447 | |
| 448 | comment = "" |
| 449 | comment_string = "#"+ comment |
andrewonlab | 7e4d2d3 | 2014-10-15 13:23:21 -0400 | [diff] [blame] | 450 | #Feature string is hardcoded environment variables |
| 451 | #That you may wish to use by default on startup. |
| 452 | #Note that you may not want certain features listed |
| 453 | #on here. |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 454 | core_feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\ |
| 455 | "onos-cli,onos-openflow,onos-app-mobility,onos-app-tvue,"+\ |
| 456 | "onos-app-proxyarp,"+extra_feature_string |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 457 | mn_string = "export OCN=" |
| 458 | onos_string = "export OC" |
| 459 | temp_count = 1 |
| 460 | |
| 461 | #Create ONOS_NIC ip address prefix |
| 462 | temp_onos_ip = onos_ip_addrs[0] |
| 463 | temp_list = [] |
| 464 | temp_list = temp_onos_ip.split(".") |
andrewonlab | 7e4d2d3 | 2014-10-15 13:23:21 -0400 | [diff] [blame] | 465 | #Omit last element of list to format for NIC |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 466 | temp_list = temp_list[:-1] |
| 467 | #Structure the nic string ip |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 468 | nic_addr = ".".join(temp_list) + ".*" |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 469 | onos_nic_string = "export ONOS_NIC="+nic_addr |
| 470 | |
| 471 | try: |
| 472 | #Start writing to file |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 473 | cell_file.write(onos_nic_string + "\n") |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 474 | |
| 475 | for arg in onos_ip_addrs: |
| 476 | #For each argument in onos_ip_addrs, write to file |
| 477 | #Output should look like the following: |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 478 | # export OC1="10.128.20.11" |
| 479 | # export OC2="10.128.20.12" |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 480 | cell_file.write(onos_string + str(temp_count) + |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 481 | "=" + "\"" + arg + "\"" + "\n" ) |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 482 | temp_count = temp_count + 1 |
| 483 | |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 484 | cell_file.write(mn_string +"\""+ mn_ip_addrs +"\""+ "\n") |
| 485 | cell_file.write(core_feature_string + "\n") |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 486 | cell_file.close() |
| 487 | |
| 488 | #We use os.system to send the command to TestON cluster |
| 489 | #to account for the case in which TestON is not located |
| 490 | #on the same cluster as the ONOS bench |
| 491 | #Note that even if TestON is located on the same cluster |
| 492 | #as ONOS bench, you must setup passwordless ssh |
andrewonlab | 7e4d2d3 | 2014-10-15 13:23:21 -0400 | [diff] [blame] | 493 | #between TestON and ONOS bench in order to automate the test. |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 494 | os.system("scp "+temp_directory+file_name+ |
| 495 | " admin@"+bench_ip+":"+cell_directory) |
| 496 | |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 497 | return main.TRUE |
| 498 | |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 499 | except pexpect.EOF: |
| 500 | main.log.error(self.name + ": EOF exception found") |
| 501 | main.log.error(self.name + ": " + self.handle.before) |
| 502 | main.cleanup() |
| 503 | main.exit() |
| 504 | except: |
| 505 | main.log.info(self.name + ":::::::::") |
| 506 | main.log.error( traceback.print_exc() ) |
| 507 | main.log.info(":::::::") |
| 508 | main.cleanup() |
| 509 | main.exit() |
| 510 | |
andrewonlab | 95ca146 | 2014-10-09 14:04:24 -0400 | [diff] [blame] | 511 | def set_cell(self, cellname): |
| 512 | ''' |
| 513 | Calls 'cell <name>' to set the environment variables on ONOSbench |
| 514 | ''' |
| 515 | try: |
| 516 | if not cellname: |
| 517 | main.log.error("Must define cellname") |
| 518 | main.cleanup() |
| 519 | main.exit() |
| 520 | else: |
| 521 | self.handle.sendline("cell "+str(cellname)) |
| 522 | #Expect the cellname in the ONOS_CELL variable. |
| 523 | #Note that this variable name is subject to change |
| 524 | # and that this driver will have to change accordingly |
| 525 | self.handle.expect("ONOS_CELL="+str(cellname)) |
| 526 | handle_before = self.handle.before |
| 527 | handle_after = self.handle.after |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 528 | #Get the rest of the handle |
| 529 | self.handle.sendline("") |
| 530 | self.handle.expect("\$") |
| 531 | handle_more = self.handle.before |
andrewonlab | 95ca146 | 2014-10-09 14:04:24 -0400 | [diff] [blame] | 532 | |
| 533 | main.log.info("Cell call returned: "+handle_before+ |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 534 | handle_after + handle_more) |
andrewonlab | 95ca146 | 2014-10-09 14:04:24 -0400 | [diff] [blame] | 535 | |
| 536 | return main.TRUE |
| 537 | |
| 538 | except pexpect.EOF: |
| 539 | main.log.error(self.name + ": EOF exception found") |
| 540 | main.log.error(self.name + ": " + self.handle.before) |
| 541 | main.cleanup() |
| 542 | main.exit() |
| 543 | except: |
| 544 | main.log.info(self.name+" ::::::") |
| 545 | main.log.error( traceback.print_exc()) |
| 546 | main.log.info(self.name+" ::::::") |
| 547 | main.cleanup() |
| 548 | main.exit() |
| 549 | |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 550 | def verify_cell(self): |
| 551 | ''' |
| 552 | Calls 'onos-verify-cell' to check for cell installation |
| 553 | ''' |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 554 | #TODO: Add meaningful expect value |
| 555 | |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 556 | try: |
| 557 | #Clean handle by sending empty and expecting $ |
| 558 | self.handle.sendline("") |
| 559 | self.handle.expect("\$") |
| 560 | self.handle.sendline("onos-verify-cell") |
| 561 | self.handle.expect("\$") |
| 562 | handle_before = self.handle.before |
| 563 | handle_after = self.handle.after |
| 564 | #Get the rest of the handle |
| 565 | self.handle.sendline("") |
| 566 | self.handle.expect("\$") |
| 567 | handle_more = self.handle.before |
| 568 | |
| 569 | main.log.info("Verify cell returned: "+handle_before+ |
| 570 | handle_after + handle_more) |
| 571 | |
| 572 | return main.TRUE |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 573 | except pexpect.EOF: |
| 574 | main.log.error(self.name + ": EOF exception found") |
| 575 | main.log.error(self.name + ": " + self.handle.before) |
| 576 | main.cleanup() |
| 577 | main.exit() |
| 578 | except: |
| 579 | main.log.info(self.name+" ::::::") |
| 580 | main.log.error( traceback.print_exc()) |
| 581 | main.log.info(self.name+" ::::::") |
| 582 | main.cleanup() |
| 583 | main.exit() |
| 584 | |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 585 | def onos_cli(self, ONOS_ip, cmdstr): |
| 586 | ''' |
| 587 | Uses 'onos' command to send various ONOS CLI arguments. |
| 588 | Required: |
| 589 | * ONOS_ip: specify the ip of the cell machine |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 590 | * cmdstr: specify the command string to send |
andrewonlab | 6e20c34 | 2014-10-10 18:08:48 -0400 | [diff] [blame] | 591 | |
| 592 | This function is intended to expose the entire karaf |
| 593 | CLI commands for ONOS. Try to use this function first |
| 594 | before attempting to write a ONOS CLI specific driver |
| 595 | function. |
| 596 | You can see a list of available 'cmdstr' arguments |
| 597 | by starting onos, and typing in 'onos' to enter the |
| 598 | onos> CLI. Then, type 'help' to see the list of |
| 599 | available commands. |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 600 | ''' |
| 601 | try: |
| 602 | if not ONOS_ip: |
| 603 | main.log.error("You must specify the IP address") |
| 604 | return main.FALSE |
| 605 | if not cmdstr: |
| 606 | main.log.error("You must specify the command string") |
| 607 | return main.FALSE |
| 608 | |
| 609 | cmdstr = str(cmdstr) |
| 610 | self.handle.sendline("") |
| 611 | self.handle.expect("\$") |
| 612 | |
| 613 | self.handle.sendline("onos -w " + ONOS_ip + " " + cmdstr) |
| 614 | self.handle.expect("\$") |
| 615 | |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 616 | handle_before = self.handle.before |
| 617 | print "handle_before = ", self.handle.before |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 618 | handle_after = str(self.handle.after) |
| 619 | |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 620 | #self.handle.sendline("") |
| 621 | #self.handle.expect("\$") |
| 622 | #handle_more = str(self.handle.before) |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 623 | |
| 624 | main.log.info("Command sent successfully") |
| 625 | |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 626 | #Obtain return handle that consists of result from |
| 627 | #the onos command. The string may need to be |
| 628 | #configured further. |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 629 | #return_string = handle_before + handle_after |
| 630 | return_string = handle_before |
| 631 | print "return_string = ", return_string |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 632 | return return_string |
| 633 | |
| 634 | except pexpect.EOF: |
| 635 | main.log.error(self.name + ": EOF exception found") |
| 636 | main.log.error(self.name + ": " + self.handle.before) |
| 637 | main.cleanup() |
| 638 | main.exit() |
| 639 | except: |
| 640 | main.log.info(self.name+" ::::::") |
| 641 | main.log.error( traceback.print_exc()) |
| 642 | main.log.info(self.name+" ::::::") |
| 643 | main.cleanup() |
| 644 | main.exit() |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 645 | |
| 646 | def onos_install(self, options="-f", node = ""): |
| 647 | ''' |
| 648 | Installs ONOS bits on the designated cell machine. |
| 649 | If -f option is provided, it also forces an uninstall. |
| 650 | Presently, install also includes onos-push-bits and |
| 651 | onos-config within. |
| 652 | The node option allows you to selectively only push the jar |
| 653 | files to certain onos nodes |
| 654 | |
| 655 | Returns: main.TRUE on success and main.FALSE on failure |
| 656 | ''' |
| 657 | try: |
andrewonlab | 114768a | 2014-11-14 12:44:44 -0500 | [diff] [blame] | 658 | if options: |
| 659 | self.handle.sendline("onos-install " + options + " " + node) |
| 660 | else: |
| 661 | self.handle.sendline("onos-install "+node) |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 662 | self.handle.expect("onos-install ") |
| 663 | #NOTE: this timeout may need to change depending on the network and size of ONOS |
| 664 | i=self.handle.expect(["Network\sis\sunreachable", |
| 665 | "onos\sstart/running,\sprocess", |
andrewonlab | d9a73a7 | 2014-11-14 17:28:21 -0500 | [diff] [blame] | 666 | "ONOS\sis\salready\sinstalled", |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 667 | pexpect.TIMEOUT],timeout=60) |
| 668 | |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 669 | if i == 0: |
| 670 | main.log.warn("Network is unreachable") |
| 671 | return main.FALSE |
| 672 | elif i == 1: |
Jon Hall | 42db6dc | 2014-10-24 19:03:48 -0400 | [diff] [blame] | 673 | main.log.info("ONOS was installed on " + node + " and started") |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 674 | return main.TRUE |
andrewonlab | d9a73a7 | 2014-11-14 17:28:21 -0500 | [diff] [blame] | 675 | elif i == 2: |
| 676 | main.log.info("ONOS is already installed on "+node) |
| 677 | return main.TRUE |
| 678 | elif i == 3: |
Jon Hall | 42db6dc | 2014-10-24 19:03:48 -0400 | [diff] [blame] | 679 | main.log.info("Installation of ONOS on " + node + " timed out") |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 680 | return main.FALSE |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 681 | |
andrewonlab | d9a73a7 | 2014-11-14 17:28:21 -0500 | [diff] [blame] | 682 | |
andrewonlab | c03bf6c | 2014-10-09 14:56:18 -0400 | [diff] [blame] | 683 | except pexpect.EOF: |
| 684 | main.log.error(self.name + ": EOF exception found") |
| 685 | main.log.error(self.name + ": " + self.handle.before) |
| 686 | main.cleanup() |
| 687 | main.exit() |
| 688 | except: |
| 689 | main.log.info(self.name+" ::::::") |
| 690 | main.log.error( traceback.print_exc()) |
| 691 | main.log.info(self.name+" ::::::") |
| 692 | main.cleanup() |
| 693 | main.exit() |
andrewonlab | 95ca146 | 2014-10-09 14:04:24 -0400 | [diff] [blame] | 694 | |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 695 | def onos_start(self, node_ip): |
| 696 | ''' |
| 697 | Calls onos command: 'onos-service [<node-ip>] start' |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 698 | This command is a remote management of the ONOS upstart daemon |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 699 | ''' |
| 700 | |
| 701 | try: |
| 702 | self.handle.sendline("") |
| 703 | self.handle.expect("\$") |
| 704 | self.handle.sendline("onos-service "+str(node_ip)+ |
| 705 | " start") |
| 706 | i = self.handle.expect([ |
| 707 | "Job\sis\salready\srunning", |
| 708 | "start/running", |
| 709 | "Unknown\sinstance", |
Shreya Shah | d01153d | 2014-10-23 15:08:56 -0400 | [diff] [blame] | 710 | pexpect.TIMEOUT],timeout=120) |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 711 | |
| 712 | if i == 0: |
| 713 | main.log.info("Service is already running") |
| 714 | return main.TRUE |
| 715 | elif i == 1: |
| 716 | main.log.info("ONOS service started") |
| 717 | return main.TRUE |
| 718 | else: |
| 719 | main.log.error("ONOS service failed to start") |
| 720 | main.cleanup() |
| 721 | main.exit() |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 722 | except pexpect.EOF: |
| 723 | main.log.error(self.name + ": EOF exception found") |
| 724 | main.log.error(self.name + ": " + self.handle.before) |
| 725 | main.cleanup() |
| 726 | main.exit() |
| 727 | except: |
| 728 | main.log.info(self.name+" ::::::") |
| 729 | main.log.error( traceback.print_exc()) |
| 730 | main.log.info(self.name+" ::::::") |
| 731 | main.cleanup() |
| 732 | main.exit() |
| 733 | |
andrewonlab | 2b30bd3 | 2014-10-09 16:48:55 -0400 | [diff] [blame] | 734 | def onos_stop(self, node_ip): |
| 735 | ''' |
| 736 | Calls onos command: 'onos-service [<node-ip>] stop' |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 737 | This command is a remote management of the ONOS upstart daemon |
andrewonlab | 2b30bd3 | 2014-10-09 16:48:55 -0400 | [diff] [blame] | 738 | ''' |
| 739 | try: |
| 740 | self.handle.sendline("") |
| 741 | self.handle.expect("\$") |
| 742 | self.handle.sendline("onos-service "+str(node_ip)+ |
| 743 | " stop") |
| 744 | i = self.handle.expect([ |
| 745 | "stop/waiting", |
| 746 | "Unknown\sinstance", |
| 747 | pexpect.TIMEOUT],timeout=60) |
| 748 | |
| 749 | if i == 0: |
| 750 | main.log.info("ONOS service stopped") |
| 751 | return main.TRUE |
| 752 | elif i == 1: |
| 753 | main.log.info("Unknown ONOS instance specified: "+ |
| 754 | str(node_ip)) |
| 755 | return main.FALSE |
| 756 | else: |
| 757 | main.log.error("ONOS service failed to stop") |
| 758 | return main.FALSE |
| 759 | |
| 760 | except pexpect.EOF: |
| 761 | main.log.error(self.name + ": EOF exception found") |
| 762 | main.log.error(self.name + ": " + self.handle.before) |
| 763 | main.cleanup() |
| 764 | main.exit() |
| 765 | except: |
| 766 | main.log.info(self.name+" ::::::") |
| 767 | main.log.error( traceback.print_exc()) |
| 768 | main.log.info(self.name+" ::::::") |
| 769 | main.cleanup() |
| 770 | main.exit() |
andrewonlab | 99d3f7f | 2014-11-13 17:45:08 -0500 | [diff] [blame] | 771 | |
andrewonlab | a6f7d88 | 2014-11-13 17:32:24 -0500 | [diff] [blame] | 772 | def onos_uninstall(self, node_ip=""): |
andrewonlab | c8d4797 | 2014-10-09 16:52:36 -0400 | [diff] [blame] | 773 | ''' |
| 774 | Calls the command: 'onos-uninstall' |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 775 | Uninstalls ONOS from the designated cell machine, stopping |
| 776 | if needed |
andrewonlab | c8d4797 | 2014-10-09 16:52:36 -0400 | [diff] [blame] | 777 | ''' |
| 778 | try: |
| 779 | self.handle.sendline("") |
| 780 | self.handle.expect("\$") |
andrewonlab | 85f4ed3 | 2014-11-13 17:31:06 -0500 | [diff] [blame] | 781 | self.handle.sendline("onos-uninstall "+str(node_ip)) |
andrewonlab | c8d4797 | 2014-10-09 16:52:36 -0400 | [diff] [blame] | 782 | self.handle.expect("\$") |
| 783 | |
andrewonlab | 9dfd208 | 2014-11-13 17:44:03 -0500 | [diff] [blame] | 784 | main.log.info("ONOS "+node_ip+" was uninstalled") |
| 785 | |
andrewonlab | c8d4797 | 2014-10-09 16:52:36 -0400 | [diff] [blame] | 786 | #onos-uninstall command does not return any text |
| 787 | return main.TRUE |
| 788 | |
| 789 | except pexpect.EOF: |
| 790 | main.log.error(self.name + ": EOF exception found") |
| 791 | main.log.error(self.name + ": " + self.handle.before) |
| 792 | main.cleanup() |
| 793 | main.exit() |
| 794 | except: |
| 795 | main.log.info(self.name+" ::::::") |
| 796 | main.log.error( traceback.print_exc()) |
| 797 | main.log.info(self.name+" ::::::") |
| 798 | main.cleanup() |
| 799 | main.exit() |
andrewonlab | 2b30bd3 | 2014-10-09 16:48:55 -0400 | [diff] [blame] | 800 | |
andrewonlab | e8e56fd | 2014-10-09 17:12:44 -0400 | [diff] [blame] | 801 | def onos_kill(self, node_ip): |
| 802 | ''' |
| 803 | Calls the command: 'onos-kill [<node-ip>]' |
| 804 | "Remotely, and unceremoniously kills the ONOS instance running on |
| 805 | the specified cell machine" - Tom V |
| 806 | ''' |
| 807 | |
| 808 | try: |
| 809 | self.handle.sendline("") |
| 810 | self.handle.expect("\$") |
| 811 | self.handle.sendline("onos-kill " + str(node_ip)) |
| 812 | i = self.handle.expect([ |
| 813 | "\$", |
| 814 | "No\sroute\sto\shost", |
| 815 | "password:", |
| 816 | pexpect.TIMEOUT], timeout=20) |
| 817 | |
| 818 | if i == 0: |
| 819 | main.log.info("ONOS instance "+str(node_ip)+" was killed") |
| 820 | return main.TRUE |
| 821 | elif i == 1: |
| 822 | main.log.info("No route to host") |
| 823 | return main.FALSE |
| 824 | elif i == 2: |
| 825 | main.log.info("Passwordless login for host: "+str(node_ip)+ |
| 826 | " not configured") |
| 827 | return main.FALSE |
| 828 | else: |
| 829 | main.log.info("ONOS instasnce was not killed") |
| 830 | return main.FALSE |
| 831 | |
| 832 | except pexpect.EOF: |
| 833 | main.log.error(self.name + ": EOF exception found") |
| 834 | main.log.error(self.name + ": " + self.handle.before) |
| 835 | main.cleanup() |
| 836 | main.exit() |
| 837 | except: |
| 838 | main.log.info(self.name+" ::::::") |
| 839 | main.log.error( traceback.print_exc()) |
| 840 | main.log.info(self.name+" ::::::") |
| 841 | main.cleanup() |
| 842 | main.exit() |
| 843 | |
andrewonlab | 19fbdca | 2014-11-14 12:55:59 -0500 | [diff] [blame] | 844 | def onos_remove_raft_logs(self): |
| 845 | ''' |
| 846 | Removes Raft / Copy cat files from ONOS to ensure |
| 847 | a cleaner environment. |
| 848 | |
| 849 | Description: |
| 850 | Stops all ONOS defined in the cell, |
| 851 | wipes the raft / copycat log files |
| 852 | ''' |
| 853 | try: |
| 854 | self.handle.sendline("") |
| 855 | self.handle.expect("\$") |
| 856 | self.handle.sendline("onos-remove-raft-logs") |
| 857 | self.handle.expect("\$") |
| 858 | |
| 859 | return main.TRUE |
| 860 | |
| 861 | except pexpect.EOF: |
| 862 | main.log.error(self.name + ": EOF exception found") |
| 863 | main.log.error(self.name + ": " + self.handle.before) |
| 864 | main.cleanup() |
| 865 | main.exit() |
| 866 | except: |
| 867 | main.log.info(self.name+" ::::::") |
| 868 | main.log.error( traceback.print_exc()) |
| 869 | main.log.info(self.name+" ::::::") |
| 870 | main.cleanup() |
| 871 | main.exit() |
| 872 | |
andrewonlab | 9428209 | 2014-10-10 13:00:11 -0400 | [diff] [blame] | 873 | def onos_start_network(self, mntopo): |
| 874 | ''' |
| 875 | Calls the command 'onos-start-network [<mininet-topo>] |
| 876 | "remotely starts the specified topology on the cell's |
| 877 | mininet machine against all controllers configured in the |
| 878 | cell." |
| 879 | * Specify mininet topology file name for mntopo |
| 880 | * Topo files should be placed at: |
| 881 | ~/<your-onos-directory>/tools/test/topos |
| 882 | |
| 883 | NOTE: This function will take you to the mininet prompt |
| 884 | ''' |
| 885 | try: |
| 886 | if not mntopo: |
| 887 | main.log.error("You must specify a topo file to execute") |
| 888 | return main.FALSE |
| 889 | |
| 890 | mntopo = str(mntopo) |
| 891 | self.handle.sendline("") |
| 892 | self.handle.expect("\$") |
| 893 | |
| 894 | self.handle.sendline("onos-start-network " + mntopo) |
| 895 | self.handle.expect("mininet>") |
| 896 | main.log.info("Network started, entered mininet prompt") |
| 897 | |
| 898 | #TODO: Think about whether return is necessary or not |
| 899 | |
| 900 | except pexpect.EOF: |
| 901 | main.log.error(self.name + ": EOF exception found") |
| 902 | main.log.error(self.name + ": " + self.handle.before) |
| 903 | main.cleanup() |
| 904 | main.exit() |
| 905 | except: |
| 906 | main.log.info(self.name+" ::::::") |
| 907 | main.log.error( traceback.print_exc()) |
| 908 | main.log.info(self.name+" ::::::") |
| 909 | main.cleanup() |
| 910 | main.exit() |
| 911 | |
| 912 | |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 913 | def isup(self, node = ""): |
| 914 | ''' |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 915 | Run's onos-wait-for-start which only returns once ONOS is at run |
| 916 | level 100(ready for use) |
andrewonlab | 8d0d7d7 | 2014-10-09 16:33:15 -0400 | [diff] [blame] | 917 | |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 918 | Returns: main.TRUE if ONOS is running and main.FALSE on timeout |
| 919 | ''' |
| 920 | try: |
| 921 | self.handle.sendline("onos-wait-for-start " + node ) |
| 922 | self.handle.expect("onos-wait-for-start") |
| 923 | #NOTE: this timeout is arbitrary" |
shahshreya | 4d79aab | 2014-11-07 15:20:41 -0800 | [diff] [blame] | 924 | i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout = 300) |
Jon Hall | 7993bfc | 2014-10-09 16:30:14 -0400 | [diff] [blame] | 925 | if i == 0: |
| 926 | main.log.info(self.name + ": " + node + " is up") |
| 927 | return main.TRUE |
| 928 | elif i == 1: |
| 929 | #NOTE: since this function won't return until ONOS is ready, |
| 930 | # we will kill it on timeout |
| 931 | self.handle.sendline("\003") #Control-C |
| 932 | self.handle.expect("\$") |
| 933 | return main.FALSE |
| 934 | except pexpect.EOF: |
| 935 | main.log.error(self.name + ": EOF exception found") |
| 936 | main.log.error(self.name + ": " + self.handle.before) |
| 937 | main.cleanup() |
| 938 | main.exit() |
| 939 | except: |
| 940 | main.log.info(self.name+" ::::::") |
| 941 | main.log.error( traceback.print_exc()) |
| 942 | main.log.info(self.name+" ::::::") |
| 943 | main.cleanup() |
| 944 | main.exit() |
andrewonlab | 05e362f | 2014-10-10 00:40:57 -0400 | [diff] [blame] | 945 | |
| 946 | |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 947 | def get_topology(self,topology_output): |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 948 | ''' |
| 949 | parses the onos:topology output |
| 950 | Returns: a topology dict populated by the key values found in |
| 951 | the cli command. |
| 952 | ''' |
| 953 | |
| 954 | try: |
| 955 | #call the cli to get the topology summary |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 956 | #cmdstr = "onos:topology" |
| 957 | #cli_result = self.onos_cli(ip, cmdstr) |
| 958 | #print "cli_result = ", cli_result |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 959 | |
| 960 | #Parse the output |
| 961 | topology = {} |
| 962 | #for line in cli_result.split("\n"): |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 963 | for line in topology_output.splitlines(): |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 964 | if not line.startswith("time="): |
| 965 | continue |
| 966 | #else |
| 967 | print line |
| 968 | for var in line.split(","): |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 969 | #print "'"+var+"'" |
| 970 | #print "'"+var.strip()+"'" |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 971 | key, value = var.strip().split("=") |
| 972 | topology[key] = value |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 973 | print "topology = ", topology |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 974 | devices = topology.get('devices', False) |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 975 | print "devices = ", devices |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 976 | links = topology.get('links', False) |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 977 | print "links = ", links |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 978 | clusters = topology.get('clusters', False) |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 979 | print "clusters = ", clusters |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 980 | paths = topology.get('paths', False) |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 981 | print "paths = ", paths |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 982 | |
| 983 | return topology |
| 984 | except pexpect.EOF: |
| 985 | main.log.error(self.name + ": EOF exception found") |
| 986 | main.log.error(self.name + ": " + self.handle.before) |
| 987 | main.cleanup() |
| 988 | main.exit() |
| 989 | except: |
| 990 | main.log.info(self.name+" ::::::") |
| 991 | main.log.error( traceback.print_exc()) |
| 992 | main.log.info(self.name+" ::::::") |
| 993 | main.cleanup() |
| 994 | main.exit() |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 995 | |
| 996 | |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 997 | |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 998 | def check_status(self, topology_result, numoswitch, numolink, log_level="info"): |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 999 | ''' |
| 1000 | Checks the number of swithes & links that ONOS sees against the |
| 1001 | supplied values. By default this will report to main.log, but the |
| 1002 | log level can be specifid. |
| 1003 | |
| 1004 | Params: ip = ip used for the onos cli |
| 1005 | numoswitch = expected number of switches |
| 1006 | numlink = expected number of links |
| 1007 | log_level = level to log to. Currently accepts 'info', 'warn' and 'report' |
| 1008 | |
| 1009 | |
| 1010 | log_level can |
| 1011 | |
| 1012 | Returns: main.TRUE if the number of switchs and links are correct, |
| 1013 | main.FALSE if the numer of switches and links is incorrect, |
| 1014 | and main.ERROR otherwise |
| 1015 | ''' |
| 1016 | |
| 1017 | try: |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 1018 | topology = self.get_topology(topology_result) |
Jon Hall | 77f53ce | 2014-10-13 18:02:06 -0400 | [diff] [blame] | 1019 | if topology == {}: |
| 1020 | return main.ERROR |
| 1021 | output = "" |
| 1022 | #Is the number of switches is what we expected |
| 1023 | devices = topology.get('devices',False) |
| 1024 | links = topology.get('links',False) |
| 1025 | if devices == False or links == False: |
| 1026 | return main.ERROR |
| 1027 | switch_check = ( int(devices) == int(numoswitch) ) |
| 1028 | #Is the number of links is what we expected |
| 1029 | link_check = ( int(links) == int(numolink) ) |
| 1030 | if (switch_check and link_check): |
| 1031 | #We expected the correct numbers |
| 1032 | output = output + "The number of links and switches match "\ |
| 1033 | + "what was expected" |
| 1034 | result = main.TRUE |
| 1035 | else: |
| 1036 | output = output + \ |
| 1037 | "The number of links and switches does not match what was expected" |
| 1038 | result = main.FALSE |
| 1039 | output = output + "\n ONOS sees %i devices (%i expected) and %i links (%i expected)"\ |
| 1040 | % ( int(devices), int(numoswitch), int(links), int(numolink) ) |
| 1041 | if log_level == "report": |
| 1042 | main.log.report(output) |
| 1043 | elif log_level == "warn": |
| 1044 | main.log.warn(output) |
| 1045 | else: |
| 1046 | main.log.info(output) |
| 1047 | return result |
| 1048 | except pexpect.EOF: |
| 1049 | main.log.error(self.name + ": EOF exception found") |
| 1050 | main.log.error(self.name + ": " + self.handle.before) |
| 1051 | main.cleanup() |
| 1052 | main.exit() |
| 1053 | except: |
| 1054 | main.log.info(self.name+" ::::::") |
| 1055 | main.log.error( traceback.print_exc()) |
| 1056 | main.log.info(self.name+" ::::::") |
| 1057 | main.cleanup() |
| 1058 | main.exit() |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1059 | |
andrewonlab | 970399c | 2014-11-07 13:09:32 -0500 | [diff] [blame] | 1060 | def tshark_pcap(self, interface, dir_file): |
| 1061 | ''' |
| 1062 | Capture all packet activity and store in specified |
| 1063 | directory/file |
| 1064 | |
| 1065 | Required: |
| 1066 | * interface: interface to capture |
| 1067 | * dir: directory/filename to store pcap |
| 1068 | ''' |
| 1069 | self.handle.sendline("") |
| 1070 | self.handle.expect("\$") |
| 1071 | |
| 1072 | self.handle.sendline("tshark -i "+str(interface)+ |
andrewonlab | 5d7a8f3 | 2014-11-10 13:07:56 -0500 | [diff] [blame] | 1073 | " -t e -w "+str(dir_file)+ " &") |
| 1074 | self.handle.sendline("\r") |
andrewonlab | 970399c | 2014-11-07 13:09:32 -0500 | [diff] [blame] | 1075 | self.handle.expect("Capturing on") |
andrewonlab | 5d7a8f3 | 2014-11-10 13:07:56 -0500 | [diff] [blame] | 1076 | self.handle.sendline("\r") |
| 1077 | self.handle.expect("\$") |
andrewonlab | 970399c | 2014-11-07 13:09:32 -0500 | [diff] [blame] | 1078 | |
| 1079 | main.log.info("Tshark started capturing files on "+ |
| 1080 | str(interface)+ " and saving to directory: "+ |
andrewonlab | 5d7a8f3 | 2014-11-10 13:07:56 -0500 | [diff] [blame] | 1081 | str(dir_file)) |
Shreya Shah | a73aaad | 2014-10-27 18:03:09 -0400 | [diff] [blame] | 1082 | |
shahshreya | 4d79aab | 2014-11-07 15:20:41 -0800 | [diff] [blame] | 1083 | |
| 1084 | def run_onos_topo_cfg(self): |
| 1085 | ''' |
| 1086 | On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg |
| 1087 | which starts the rest and copies the json file to the onos instance |
| 1088 | ''' |
| 1089 | self.handle.sendline("") |
| 1090 | self.handle.expect("\$") |
| 1091 | self.handle.sendline("cd ~/ONOS/tools/test/bin") |
| 1092 | self.handle.expect("/bin$") |
| 1093 | self.handle.sendline("./onos-topo-cfg") |
shahshreya | df73d76 | 2014-11-11 13:58:56 -0800 | [diff] [blame] | 1094 | self.handle.expect("{}") |
shahshreya | 4d79aab | 2014-11-07 15:20:41 -0800 | [diff] [blame] | 1095 | self.handle.sendline("cd ~") |
| 1096 | self.handle.expect("\$") |
| 1097 | |
| 1098 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1099 | def tshark_grep(self, grep, directory, interface='eth0'): |
| 1100 | ''' |
| 1101 | Required: |
| 1102 | * grep string |
| 1103 | * directory to store results |
| 1104 | Optional: |
| 1105 | * interface - default: eth0 |
| 1106 | Description: |
| 1107 | Uses tshark command to grep specific group of packets |
| 1108 | and stores the results to specified directory. |
| 1109 | The timestamp is hardcoded to be in epoch |
| 1110 | ''' |
| 1111 | self.handle.sendline("") |
| 1112 | self.handle.expect("\$") |
andrewonlab | efd7f3d | 2014-10-21 16:02:31 -0400 | [diff] [blame] | 1113 | self.handle.sendline("") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1114 | self.handle.sendline("tshark -i "+str(interface)+ |
andrewonlab | d494049 | 2014-10-24 12:21:27 -0400 | [diff] [blame] | 1115 | " -t e | grep --line-buffered \""+str(grep)+"\" >"+directory+" &") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1116 | self.handle.sendline("\r") |
| 1117 | self.handle.expect("Capturing on") |
| 1118 | self.handle.sendline("\r") |
| 1119 | self.handle.expect("\$") |
| 1120 | |
| 1121 | def tshark_stop(self): |
| 1122 | ''' |
| 1123 | Removes wireshark files from /tmp and kills all tshark processes |
| 1124 | ''' |
andrewonlab | 5ba0d9e | 2014-10-24 13:32:23 -0400 | [diff] [blame] | 1125 | #Remove all pcap from previous captures |
| 1126 | self.execute(cmd="sudo rm /tmp/wireshark*") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1127 | self.handle.sendline("") |
| 1128 | self.handle.sendline("sudo kill -9 `ps -ef | grep \"tshark -i\" |"+ |
| 1129 | " grep -v grep | awk '{print $2}'`") |
| 1130 | self.handle.sendline("") |
| 1131 | main.log.info("Tshark stopped") |
| 1132 | |
andrewonlab | 0c38a4a | 2014-10-28 18:35:35 -0400 | [diff] [blame] | 1133 | def ptpd(self, args): |
| 1134 | ''' |
| 1135 | Initiate ptp with user-specified args. |
| 1136 | Required: |
| 1137 | * args: specify string of args after command |
| 1138 | 'sudo ptpd' |
| 1139 | ''' |
| 1140 | try: |
| 1141 | self.handle.sendline("sudo ptpd "+str(args)) |
andrewonlab | 978dff6 | 2014-10-29 16:53:35 -0400 | [diff] [blame] | 1142 | i = self.handle.expect([ |
andrewonlab | 0c38a4a | 2014-10-28 18:35:35 -0400 | [diff] [blame] | 1143 | "Multiple", |
| 1144 | "Error", |
| 1145 | "\$"]) |
| 1146 | self.handle.expect("\$") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1147 | |
andrewonlab | 0c38a4a | 2014-10-28 18:35:35 -0400 | [diff] [blame] | 1148 | if i == 0: |
| 1149 | handle = self.handle.before |
| 1150 | main.log.info("ptpd returned an error: "+ |
| 1151 | str(handle)) |
| 1152 | return handle |
| 1153 | elif i == 1: |
| 1154 | handle = self.handle.before |
| 1155 | main.log.error("ptpd returned an error: "+ |
| 1156 | str(handle)) |
| 1157 | return handle |
| 1158 | else: |
| 1159 | return main.TRUE |
| 1160 | |
| 1161 | except pexpect.EOF: |
| 1162 | main.log.error(self.name + ": EOF exception found") |
| 1163 | main.log.error(self.name + ": " + self.handle.before) |
| 1164 | main.cleanup() |
| 1165 | main.exit() |
| 1166 | except: |
| 1167 | main.log.info(self.name+" ::::::") |
| 1168 | main.log.error( traceback.print_exc()) |
| 1169 | main.log.info(self.name+" ::::::") |
| 1170 | main.cleanup() |
| 1171 | main.exit() |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1172 | |
andrewonlab | 5d7a8f3 | 2014-11-10 13:07:56 -0500 | [diff] [blame] | 1173 | def cp_logs_to_dir(self, log_to_copy, |
| 1174 | dest_dir, copy_file_name=""): |
| 1175 | ''' |
| 1176 | Copies logs to a desired directory. |
| 1177 | Current implementation of ONOS deletes its karaf |
| 1178 | logs on every iteration. For debugging purposes, |
| 1179 | you may want to use this function to capture |
| 1180 | certain karaf logs. (or any other logs if needed) |
| 1181 | Localtime will be attached to the filename |
| 1182 | |
| 1183 | Required: |
| 1184 | * log_to_copy: specify directory and log name to |
| 1185 | copy. |
| 1186 | ex) /opt/onos/log/karaf.log.1 |
| 1187 | For copying multiple files, leave copy_file_name |
| 1188 | empty and only specify dest_dir - |
| 1189 | ex) /opt/onos/log/karaf* |
| 1190 | * dest_dir: specify directory to copy to. |
| 1191 | ex) /tmp/ |
| 1192 | Optional: |
| 1193 | * copy_file_name: If you want to rename the log |
| 1194 | file, specify copy_file_name. This will not work |
| 1195 | with multiple file copying |
| 1196 | ''' |
| 1197 | try: |
| 1198 | localtime = time.strftime('%x %X') |
| 1199 | localtime = localtime.replace("/","") |
| 1200 | localtime = localtime.replace(" ","_") |
| 1201 | localtime = localtime.replace(":","") |
| 1202 | if dest_dir[-1:] != "/": |
| 1203 | dest_dir += "/" |
| 1204 | |
| 1205 | if copy_file_name: |
| 1206 | self.handle.sendline("cp "+str(log_to_copy)+ |
| 1207 | " "+str(dest_dir)+str(copy_file_name)+ |
| 1208 | localtime) |
| 1209 | self.handle.expect("cp") |
| 1210 | self.handle.expect("\$") |
| 1211 | else: |
| 1212 | self.handle.sendline("cp "+str(log_to_copy)+ |
| 1213 | " "+str(dest_dir)) |
| 1214 | self.handle.expect("cp") |
| 1215 | self.handle.expect("\$") |
| 1216 | |
| 1217 | return self.handle.before |
| 1218 | |
| 1219 | except pexpect.EOF: |
| 1220 | main.log.error("Copying files failed") |
| 1221 | main.log.error(self.name + ": EOF exception found") |
| 1222 | main.log.error(self.name + ": " + self.handle.before) |
| 1223 | except: |
| 1224 | main.log.error("Copying files failed") |
| 1225 | main.log.info(self.name+" ::::::") |
| 1226 | main.log.error( traceback.print_exc()) |
| 1227 | main.log.info(self.name+" ::::::") |
| 1228 | |
| 1229 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 1230 | |