VOL-184 ONU software upgrade based on OpenOMCI framework

    ** Implement OMCI download software procedure with two state machine:
    1. Software OMCI downloading state machine
    2. Activate software image state machine, which includes OMCI software download and OMCI software activation
    3. Add OMCI message/frames for Start/End/DownloadSection/ActiveImage/CommitImage

    ** Change OMCI_CC.send to support:
    1. Send OMCI messages without waiting for response (Download Section)
    2. Add timeout handler to support retry max 3 times on timeout
    3. Add a clock(reactor) in contructor to support automation test with robotframwork
       RobotFramework use global reactor to loop run all test cases.
       It will conflict with the reactor in VOLTHA classes.
       The solution is to assign a reactor when create VOLTHA classes so that they will share
       the same reactor and make RobotFramework works.
       If reactor is not assigned VOLTHA classes will use default global reactor.
       So it is back-compitable and won't have impact on other code

    ** OMCI download/activate task are exclusive True to avoid blocking by OMCI PM/Alarm STM/tasks

    ** Log is detailed for debug at current stage; and will improve after functions are fully verified

    ** Add test cases based on RobotFramework
    1. Test cases for Software download
    2. Mock Adapter/Mock ONU are used in the test cases

    ** Implement relative commands:
         img_dnld_request
         img_dnld_status
         img_dnld_cancel
         img_activate

Change-Id: I1796fd694f312378facbcd441bfc15ee7c093d91
diff --git a/cli/device.py b/cli/device.py
index 3f02dcd..44407e2 100644
--- a/cli/device.py
+++ b/cli/device.py
@@ -374,6 +374,8 @@
                     help="CRC code to verify with", default=0),
         make_option('-v', '--version', action='store', dest='version',
                     help="Image version", default=0),
+        make_option('-d', '--dir', action='store', dest='dir',
+                    help="local directory"),
     ])
     def do_img_dnld_request(self, line, opts):
         """
@@ -385,6 +387,7 @@
         self.poutput('url {}'.format(opts.url))
         self.poutput('crc {}'.format(opts.crc))
         self.poutput('version {}'.format(opts.version))
+        self.poutput('local dir {}'.format(opts.dir))
         try:
             device_id = device.id
             if device_id and opts.name and opts.url:
@@ -394,6 +397,8 @@
             else:
                 self.poutput('Device ID and URL are needed')
                 raise Exception('Device ID and URL are needed')
+            if opts.dir:
+                kw['local_dir'] = opts.dir
         except Exception as e:
             self.poutput('Error request img dnld {}.  Error:{}'.format(device_id, e))
             return