Esempio n. 1
0
def remove_outbound(device, vlan_tag, net_info):
    """Removes the qosOutbound configuration from the device and restores
    pfifo_fast if it was the last QoSed network on the device. vlan_tag
    can be None"""
    class_id = '%x' % (_NON_VLANNED_ID if vlan_tag is None else vlan_tag)
    MISSING_OBJ_ERR_CODES = (errno.EINVAL, errno.ENOENT, errno.EOPNOTSUPP)

    try:
        tc.filter.delete(
            device, pref=_NON_VLANNED_ID if vlan_tag is None else vlan_tag)
    except tc.TrafficControlException as tce:
        if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No filter exists
            raise

    device_qdiscs = list(tc.qdiscs(device))
    if not device_qdiscs:
        return
    root_qdisc_handle = netinfo_qos.get_root_qdisc(device_qdiscs)['handle']
    try:
        tc.cls.delete(device, classid=root_qdisc_handle + class_id)
    except tc.TrafficControlException as tce:
        if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No class exists
            raise

    if not _uses_classes(device, net_info,
                         root_qdisc_handle=root_qdisc_handle):
        try:
            tc._qdisc_del(device)
            tc._qdisc_del(device, kind='ingress')
        except tc.TrafficControlException as tce:
            if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No qdisc
                raise
Esempio n. 2
0
def remove_outbound(device, vlan_tag):
    """Removes the qosOutbound configuration from the device and restores
    pfifo_fast if it was the last QoSed network on the device. vlan_tag
    can be None"""
    class_id = '%x' % (_NON_VLANNED_ID if vlan_tag is None else vlan_tag)
    MISSING_OBJ_ERR_CODES = (errno.EINVAL, errno.ENOENT, errno.EOPNOTSUPP)

    try:
        tc.filter.delete(
            device, pref=_NON_VLANNED_ID if vlan_tag is None else vlan_tag)
    except tc.TrafficControlException as tce:
        if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No filter exists
            raise

    device_qdiscs = list(tc.qdiscs(device))
    if not device_qdiscs:
        return
    root_qdisc_handle = netinfo_qos.get_root_qdisc(device_qdiscs)['handle']
    try:
        tc.cls.delete(device, classid=root_qdisc_handle + class_id)
    except tc.TrafficControlException as tce:
        if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No class exists
            raise

    if not _uses_classes(device, root_qdisc_handle=root_qdisc_handle):
        try:
            tc._qdisc_del(device)
            tc._qdisc_del(device, kind='ingress')
        except tc.TrafficControlException as tce:
            if tce.errCode not in MISSING_OBJ_ERR_CODES:  # No qdisc
                raise
Esempio n. 3
0
 def testToggleIngress(self):
     self._addIngress()
     tc._qdisc_del(self._bridge.devName, 'ingress')
     self.assertNotIn("qdisc ingress", self._showQdisc())
Esempio n. 4
0
 def testToggleIngress(self):
     self._addIngress()
     tc._qdisc_del(self._bridge.devName, 'ingress')
     self.assertNotIn("qdisc ingress", self._showQdisc())
Esempio n. 5
0
 def testToggleIngress(self, bridge_dev):
     self._addIngress(bridge_dev)
     tc._qdisc_del(bridge_dev.devName, 'ingress')
     assert 'qdisc ingress' not in self._showQdisc(bridge_dev)
Esempio n. 6
0
 def test_toggle_ingress(self, bridge_dev):
     self._add_ingress(bridge_dev)
     tc._qdisc_del(bridge_dev, 'ingress')
     assert 'qdisc ingress' not in self._show_qdisc(bridge_dev)