Beispiel #1
0
 def do_preprovision_olt(self, line, opts):
     """Preprovision a new OLT with given device type"""
     stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
     kw = dict(type=opts.device_type)
     if opts.host_and_port:
         kw['host_and_port'] = opts.host_and_port
     elif opts.ip_address:
         kw['ipv4_address'] = opts.ip_address
     elif opts.mac_address:
         kw['mac_address'] = opts.mac_address
     else:
         raise Exception('Either IP address or Mac Address is needed')
     device = voltha_pb2.Device(**kw)
     device = stub.CreateDevice(device)
     self.poutput('success (device id = {})'.format(device.id))
     self.default_device_id = device.id
Beispiel #2
0
    def do_preprovision_olt(self, line, opts):
        """Preprovision a new OLT with given device type"""
        stub = self.get_stub()
        kw = dict(type=opts.device_type)
        if opts.host_and_port:
            kw['host_and_port'] = opts.host_and_port
        elif opts.ip_address:
            kw['ipv4_address'] = opts.ip_address
        elif opts.mac_address:
            kw['mac_address'] = opts.mac_address.lower()
        else:
            raise Exception('Either IP address or Mac Address is needed')
        # Pass any extra arguments past '--' to the device as custom arguments
        kw['extra_args'] = line

        device = voltha_pb2.Device(**kw)
        device = stub.CreateDevice(device)
        self.poutput('success (device id = {})'.format(device.id))
        self.default_device_id = device.id