示例#1
0
 def remove(self):
     """
     Remove the dummy interface. This assumes root privileges.
     """
     try:
         linkDel(self.devName)
     except IPRoute2Error as e:
         raise SkipTest("Unable to delete the dummy interface %s: %s" %
                        (self.devName, e))
示例#2
0
 def remove(self):
     """
     Remove the dummy interface. This assumes root privileges.
     """
     try:
         linkDel(self.devName)
     except IPRoute2Error as e:
         raise SkipTest("Unable to delete the dummy interface %s: %s" %
                        (self.devName, e))
示例#3
0
def remove(dummyName):
    """
    Removes dummy interface dummyName. Assumes root privileges.
    """

    try:
        linkDel(dummyName)
    except IPRoute2Error as e:
        raise SkipTest("Unable to delete dummy interface %s because %s" %
                       (dummyName, e))
示例#4
0
def vlan(name, link, vlan_id):
    ipwrapper.linkAdd(name, 'vlan', link=link, args=['id', str(vlan_id)])
    try:
        yield
    finally:
        try:
            ipwrapper.linkDel(name)
        except ipwrapper.IPRoute2Error:
            # faultyGetLinks is expected to have already removed the vlan
            # device.
            pass
示例#5
0
def vlan(name, link, vlan_id):
    ipwrapper.linkAdd(name, 'vlan', link=link, args=['id', str(vlan_id)])
    try:
        yield
    finally:
        try:
            ipwrapper.linkDel(name)
        except ipwrapper.IPRoute2Error:
            # faultyGetLinks is expected to have already removed the vlan
            # device.
            pass
示例#6
0
def veth_pair(prefix='veth_', max_length=15):
    """
    Yield a pair of veth devices. This assumes root privileges (currently
    required by all tests anyway).

    Both sides of the pair have a pseudo-random suffix (e.g. veth_m6Lz7uMK9c).
    """
    left_side = random_iface_name(prefix, max_length)
    right_side = random_iface_name(prefix, max_length)
    try:
        linkAdd(left_side, linkType='veth', args=('peer', 'name', right_side))
        yield left_side, right_side
    except IPRoute2Error:
        raise SkipTest('Failed to create a veth pair.')
    finally:
        # the peer device is removed by the kernel
        linkDel(left_side)
示例#7
0
def veth_pair(prefix='veth_', max_length=15):
    """
    Yield a pair of veth devices. This assumes root privileges (currently
    required by all tests anyway).

    Both sides of the pair have a pseudo-random suffix (e.g. veth_m6Lz7uMK9c).
    """
    left_side = random_iface_name(prefix, max_length)
    right_side = random_iface_name(prefix, max_length)
    try:
        linkAdd(left_side, linkType='veth',
                args=('peer', 'name', right_side))
        yield left_side, right_side
    except IPRoute2Error:
        raise SkipTest('Failed to create a veth pair.')
    finally:
        # the peer device is removed by the kernel
        linkDel(left_side)
示例#8
0
 def faultyGetLinks():
     all_links = list(original_getLinks())
     ipwrapper.linkDel(self.NEW_VLAN)
     return iter(all_links)
示例#9
0
文件: iproute2.py 项目: Caez83/vdsm
 def removeVlan(self, vlan):
     ipwrapper.linkDel(vlan.name)
示例#10
0
 def removeVlan(self, vlan):
     ipwrapper.linkDel(vlan.name)
示例#11
0
 def delDevice(self):
     self._down()
     linkDel(self.devName)
示例#12
0
 def delDevice(self):
     self._down()
     linkDel(self.devName)
示例#13
0
 def faultyGetLinks():
     all_links = list(original_getLinks())
     ipwrapper.linkDel(self.NEW_VLAN)
     return iter(all_links)