diff --git a/devapp/dev_types.py b/devapp/dev_types.py index b6e2c37..8a232a5 100644 --- a/devapp/dev_types.py +++ b/devapp/dev_types.py @@ -422,8 +422,7 @@ class Olt_ZTE_C320(OLTDevice): 'firmware_ver': frm_ver, 'loid_passw': loid_passw, 'loid': loid, - 'sn': sn, - 'extra_snmp': '%d.%d' % (fiber_num, int(num)) + 'sn': sn } for frm_ver, loid_passw, loid, (sn, num) in zip( firmware_ver, loid_passws, loids, sn_num_list )) @@ -526,7 +525,11 @@ class ZteOnuDevice(OnuDevice): if login is None or password is None: raise DeviceConfigurationError('For ZTE configuration needed login and' ' password for telnet access in extra_data') - register_onu_ZTE_F660( + stack_num, rack_num, fiber_num, new_onu_port_num = register_onu_ZTE_F660( olt_ip=ip, onu_sn=sn, login_passwd=(login.encode(), password.encode()), onu_mac=mac ) + bin_snmp_fiber_number = "10000{0:08b}{1:08b}00000000".format(rack_num, fiber_num) + snmp_fiber_num = int(bin_snmp_fiber_number, base=2) + device.snmp_extra = "%d.%d" % (snmp_fiber_num, new_onu_port_num) + device.save(update_fields=('snmp_extra',)) diff --git a/devapp/models.py b/devapp/models.py index ca5a4cf..b0a94ee 100644 --- a/devapp/models.py +++ b/devapp/models.py @@ -96,7 +96,8 @@ class Device(models.Model): return "%s: (%s) %s %s" % (self.comment, self.get_devtype_display(), self.ip_address or '', self.mac_addr or '') def update_dhcp(self, remove=False): - if self.devtype not in ('On', 'Dl'): + # FIXME: Remove static list of registrable device types + if self.devtype not in ('On', 'Dl', 'Zo'): return if self.group is None: raise DeviceDBException(_('Device does not have a group, please fix that')) diff --git a/devapp/templates/devapp/custom_dev_page/olt_ztec320_units_uncfg.html b/devapp/templates/devapp/custom_dev_page/olt_ztec320_units_uncfg.html index 4a112b8..4fb45c0 100644 --- a/devapp/templates/devapp/custom_dev_page/olt_ztec320_units_uncfg.html +++ b/devapp/templates/devapp/custom_dev_page/olt_ztec320_units_uncfg.html @@ -45,7 +45,7 @@