Beispiel #1
0
    def __get_network_id(self, ip):
        networks = self.info['networks']
        subnet = get_subnet(ip)

        for net in networks.keys():
            if re.search(subnet, networks[net]['ip']):
                return net
        return None
Beispiel #2
0
    def __get_network_id (self, ip):
        networks = self.info['networks']
        subnet = get_subnet(ip)

        for net in networks.keys():
            if re.search(subnet, networks[net]['ip']):
                return net
        return None
Beispiel #3
0
def get_vm_qrouters(info, vm):
    vms = info['vms']
    if not vms.has_key(vm):
        return 'unknown'

    # Get IP of any of the VM's interfaces
    for ip in vms[vm]['interfaces'].keys():
        break

    routers = []
    subnet = get_subnet(ip)
    namespaces = info['namespaces']
    for nms in namespaces.keys():
        if re.search('^qrouter-', nms):
            if not namespaces[nms].has_key('interfaces'):
                continue
            for intf in namespaces[nms]['interfaces'].keys():
                ip = namespaces[nms]['interfaces'][intf]
                if re.search(subnet, ip):
                    routers.append(nms)
    return routers
Beispiel #4
0
def get_vm_qrouters (info, vm):
    vms = info['vms']
    if not vms.has_key(vm):
        return 'unknown'

    # Get IP of any of the VM's interfaces
    for ip in vms[vm]['interfaces'].keys():
        break

    routers = []
    subnet = get_subnet(ip)
    namespaces = info['namespaces']
    for nms in namespaces.keys():
        if re.search('^qrouter-', nms):
            if not namespaces[nms].has_key('interfaces'):
                continue
            for intf in namespaces[nms]['interfaces'].keys():
                ip = namespaces[nms]['interfaces'][intf]
                if re.search(subnet, ip):
                    routers.append(nms)
    return routers