def on_td_modify(self, traffic_disc, update, diffs): from onu_traffic_descriptor import OnuTrafficDescriptor valid_keys = ['fixed-bandwidth', 'assured-bandwidth', 'maximum-bandwidth', 'priority', 'weight', 'additional-bw-eligibility-indicator'] invalid_key = next((key for key in diffs.keys() if key not in valid_keys), None) if invalid_key is not None: raise KeyError("traffic-descriptor leaf '{}' is read-only or write-once".format(invalid_key)) # New traffic descriptor update['object'] = OnuTrafficDescriptor.create(update) td_name = traffic_disc['name'] tconts = {key: val for key, val in self.tconts.iteritems() if val['td-ref'] == td_name and td_name is not None} for tcont in tconts.itervalues(): if self._pon is not None: self._pon.update_tcont_td(tcont['alloc-id'], update['object']) return update
def on_td_modify(self, traffic_disc, update, diffs): from onu_traffic_descriptor import OnuTrafficDescriptor valid_keys = ['fixed-bandwidth', 'assured-bandwidth', 'maximum-bandwidth', 'priority', 'weight', 'additional-bw-eligibility-indicator'] invalid_key = next((key for key in diffs.keys() if key not in valid_keys), None) if invalid_key is not None: raise KeyError("traffic-descriptor leaf '{}' is read-only or write-once".format(invalid_key)) # New traffic descriptor update['object'] = OnuTrafficDescriptor.create(update) td_name = traffic_disc['name'] tconts = {key: val for key, val in self.tconts.iteritems() if val['td-ref'] == td_name and td_name is not None} for tcont in tconts.itervalues(): pon_port = self.pon_ports[0] # Look up any PON port # TODO: Add the vont-ani 'name' to the PON Port and look up that way if pon_port is not None: pon_port.update_tcont_td(tcont['alloc-id'], update['object']) return update
def on_td_create(self, traffic_disc): from onu_traffic_descriptor import OnuTrafficDescriptor traffic_disc['object'] = OnuTrafficDescriptor.create(traffic_disc) return traffic_disc
def on_td_create(self, traffic_disc): from onu_traffic_descriptor import OnuTrafficDescriptor traffic_disc['object'] = OnuTrafficDescriptor.create(traffic_disc) return traffic_disc