def debug(cls, _, __, ___): config = load_service_config('pipelined') qos_impl_type = QosImplType(config["qos"]["impl"]) qos_store = QosStore(cls.__name__) for k, v in qos_store.items(): _, imsi, ip_addr, rule_num, d = get_key(k) _, qid, ambr, leaf = get_data(v) print('imsi :', imsi) print('ip_addr :', ip_addr) print('rule_num :', rule_num) print('direction :', d) print('qos_handle:', qid) print('qos_handle_ambr:', ambr) print('qos_handle_ambr_leaf:', leaf) if qos_impl_type == QosImplType.OVS_METER: MeterManager.dump_meter_state(v) else: intf = 'nat_iface' if d == FlowMatch.UPLINK else 'enodeb_iface' print("Dev: ", config[intf]) TrafficClass.dump_class_state(config[intf], qid) if leaf and leaf != qid: print("Leaf:") TrafficClass.dump_class_state(config[intf], leaf) if ambr: print("AMBR (parent):") TrafficClass.dump_class_state(config[intf], ambr)
def debug(cls, _, __, ___): config = load_service_config('pipelined') qos_impl_type = QosImplType(config["qos"]["impl"]) qos_store = QosStore(cls.__name__, client=get_default_client()) for k, v in qos_store.items(): _, imsi, ip_addr, rule_num, d = get_key(k) _, qid, ambr, leaf = get_data(v) print('imsi :', imsi) print('ip_addr :', ip_addr) print('rule_num :', rule_num) print('direction :', d) print('qos_handle:', qid) print('qos_handle_ambr:', ambr) print('qos_handle_ambr_leaf:', leaf) if qos_impl_type == QosImplType.OVS_METER: MeterManager.dump_meter_state(v) else: dev = config[ 'nat_iface'] if d == FlowMatch.UPLINK else 'gtpu_sys_2152' print("Dev: ", dev) TrafficClass.dump_class_state(dev, qid) if leaf and leaf != qid: print("Leaf:") TrafficClass.dump_class_state(dev, leaf) if ambr: print("AMBR (parent):") TrafficClass.dump_class_state(dev, ambr) if qos_impl_type == QosImplType.LINUX_TC: dev = config['nat_iface'] print("Root stats for: ", dev) TrafficClass.dump_root_class_stats(dev) dev = 'gtpu_sys_2152' print("Root stats for: ", dev) TrafficClass.dump_root_class_stats(dev)
def debug(cls, _): config = load_service_config('pipelined') qos_impl_type = QosImplType(config["qos"]["impl"]) qos_store = QosStore(cls.__name__) for k, v in qos_store.items(): _, imsi, rule_num, d = get_key(k) print('imsi :', imsi) print('rule_num :', rule_num) print('direction :', d) print('qos_handle:', v) if qos_impl_type == QosImplType.OVS_METER: MeterManager.dump_meter_state(v) else: intf = 'nat_iface' if d == FlowMatch.UPLINK else 'enodeb_iface' TrafficClass.dump_class_state(config[intf], v)
def get_impl(datapath, loop, config): try: impl_type = QosImplType(config["qos"]["impl"]) except ValueError: LOG.error("%s is not a valid qos impl type", impl_type) raise if impl_type == QosImplType.OVS_METER: return MeterManager(datapath, loop, config) else: return TCManager(datapath, loop, config)
def getqos_impl(datapath, loop, config): try: qos_impl_type = QosImplType(config["qos"]["impl"]) except ValueError: print("{} is not a valid qos implementation type({})".format( qos_impl_type, QosImplType.list())) raise if qos_impl_type == QosImplType.OVS_METER: return MeterManager(datapath, loop, config) else: return TCManager(datapath, loop, config)
def init_impl(self, datapath): """ Takese in datapath, and initializes appropriate QoS manager based on config """ if not self._qos_enabled: return if self._initialized: return try: impl_type = QosImplType(self._config["qos"]["impl"]) if impl_type == QosImplType.OVS_METER: self.impl = MeterManager(datapath, self._loop, self._config) else: self.impl = TCManager(datapath, self._config) self.setup() except ValueError: LOG.error("%s is not a valid qos impl type", impl_type) raise
def testBrokenMeter(self, meter_cls): config = { "redis_enabled": False, "qos": { "enable": True, "max_rate": 10000000, "ovs_meter": {"min_idx": 2, "max_idx": 100000}, }, } m = MeterManager(None, asyncio.new_event_loop(), config) self.assertTrue(meter_cls.dump_meter_features.called) MockSt = namedtuple("MockSt", "max_meter") m.handle_meter_feature_stats([MockSt(0)]) try: m.add_qos(0, QosInfo(100000, 100000), cleanup_rule=None) self.fail("unexpectedly add_qos succeeded") except RuntimeError: pass
def testBrokenMeter(self, meter_cls): config = { 'qos': { 'enable': True, 'max_rate': 10000000, 'ovs_meter': { 'min_idx': 2, 'max_idx': 100000, }, }, } m = MeterManager(None, asyncio.new_event_loop(), config) self.assertTrue(meter_cls.dump_meter_features.called) MockSt = namedtuple("MockSt", "max_meter") m.handle_meter_feature_stats([MockSt(0)]) try: m.add_qos(0, QosInfo(100000, 100000)) self.fail("unexpectedly add_qos succeeded") except RuntimeError: pass