Esempio n. 1
0
    def __plot_vms(self):
        col_span = self.__get_total_vm_port_count()
        row_span = 1
        self.__cluster_open('VMs')
        self.__cluster_name('VMs', col_span)

        # Plot each VM at a time
        self.__html_row_open()
        for vm in sorted(self.info['vms'].keys()):
            col_span = len(self.info['vms'][vm]['src_bridge'])
            if self.info['floating_ips'].get(self.info['vms'][vm]['uuid']):
                col_span = col_span + 1
            self.__html_row(vm, row_span, col_span, self.__get_color('vms'))
        self.__html_row_close()

        # Plot the networks for each port
        self.__html_row_open()
        col_span = 1
        for vm in sorted(self.info['vms'].keys()):
            floating_ip_info = self.info['floating_ips'].get(
                self.info['vms'][vm]['uuid'])
            if floating_ip_info:
                network = floating_ip_info.get('pool')
                self.__html_row('Floating -' + network, row_span, col_span,
                                self.colors['floating_ip'])
            for bridge in sorted(self.info['vms'][vm]['src_bridge']):
                tag = get_vlan_tag(self.info, bridge)
                ip = get_intf_ip(self.info, bridge)
                network = get_ip_network(self.info, vm, ip)
                color = self.__get_vlan_color(tag)
                if re.search('unknown', network):
                    color = self.__get_color('error')
                self.__html_row(network, row_span, col_span, color)
        self.__html_row_close()

        # Plot the IPs for each port
        self.__html_row_open()
        for vm in sorted(self.info['vms'].keys()):
            floating_ip_info = self.info['floating_ips'].get(
                self.info['vms'][vm]['uuid'])
            if floating_ip_info:
                ip = floating_ip_info.get('floating_ip')
                self.__html_row(ip, row_span,
                                col_span, self.colors['floating_ip'],
                                ip.replace('.', ''))
            for bridge in sorted(self.info['vms'][vm]['src_bridge']):
                tag = get_vlan_tag(self.info, bridge)
                ip = get_intf_ip(self.info, bridge)
                color = self.__get_vlan_color(tag, ip)
                if re.search('x.x.x.x', ip):
                    color = self.__get_color('error')
                self.__html_row(ip, row_span, col_span, color,
                                ip.replace('.', ''))
        self.__html_row_close()

        self.__cluster_close()
        pass
Esempio n. 2
0
    def __plot_vms(self):
        col_span = self.__get_total_vm_port_count()
        row_span = 1
        self.__cluster_open('VMs')
        self.__cluster_name('VMs', col_span)

        # Plot each VM at a time
        self.__html_row_open()
        for vm in sorted(self.info['vms'].keys()):
            col_span = len(self.info['vms'][vm]['src_bridge'])
            if self.info['floating_ips'].get(self.info['vms'][vm]['uuid']):
                col_span = col_span + 1
            self.__html_row(vm, row_span, col_span, self.__get_color('vms'))
        self.__html_row_close()

        # Plot the networks for each port
        self.__html_row_open()
        col_span = 1
        for vm in sorted(self.info['vms'].keys()):
            floating_ip_info = self.info['floating_ips'].get(
                self.info['vms'][vm]['uuid'])
            if floating_ip_info:
                network = floating_ip_info.get('pool')
                self.__html_row('Floating -' + network, row_span,
                                col_span, self.colors['floating_ip'])
            for bridge in sorted(self.info['vms'][vm]['src_bridge']):
                tag = get_vlan_tag(self.info, bridge)
                ip = get_intf_ip(self.info, bridge)
                network = get_ip_network(self.info, vm, ip)
                color = self.__get_vlan_color(tag)
                if re.search('unknown', network):
                    color = self.__get_color('error')
                self.__html_row(network, row_span, col_span, color)
        self.__html_row_close()

        # Plot the IPs for each port
        self.__html_row_open()
        for vm in sorted(self.info['vms'].keys()):
            floating_ip_info = self.info['floating_ips'].get(
                self.info['vms'][vm]['uuid'])
            if floating_ip_info:
                ip = floating_ip_info.get('floating_ip')
                self.__html_row(ip, row_span, col_span, self.colors[
                                'floating_ip'], ip.replace('.', ''))
            for bridge in sorted(self.info['vms'][vm]['src_bridge']):
                tag = get_vlan_tag(self.info, bridge)
                ip = get_intf_ip(self.info, bridge)
                color = self.__get_vlan_color(tag, ip)
                if re.search('x.x.x.x', ip):
                    color = self.__get_color('error')
                self.__html_row(ip, row_span, col_span,
                                color, ip.replace('.', ''))
        self.__html_row_close()

        self.__cluster_close()
        pass
Esempio n. 3
0
 def __plot_vms_to_linuxbridge(self):
     brctl = self.info['brctl']
     for vm in sorted(self.info['vms'].keys()):
         for bridge in sorted(self.info['vms'][vm]['src_bridge']):
             ip = get_intf_ip(self.info, bridge)
             if brctl.has_key(bridge):
                 for dev in brctl[bridge]['interfaces']:
                     if re.search('^tap', dev):
                         src_tag = 'VMs:' + ip.replace('.', '')
                         dst_tag = 'LinuxBridge:' + dev
                         color = self.__get_edge_color(src_tag, dst_tag)
                         self.__html_edge(src_tag, dst_tag, color)
                         break
     pass
Esempio n. 4
0
File: plot.py Progetto: amsaha/don
 def __plot_vms_to_linuxbridge (self):
     brctl = self.info['brctl']
     for vm in sorted(self.info['vms'].keys()):
         for bridge in sorted(self.info['vms'][vm]['src_bridge']):
             ip = get_intf_ip(self.info, bridge)
             if brctl.has_key(bridge):
                 for dev in brctl[bridge]['interfaces']:
                     if re.search('^tap', dev):
                         src_tag = 'VMs:' + ip.replace('.', '')
                         dst_tag = 'LinuxBridge:' + dev
                         color = self.__get_edge_color(src_tag, dst_tag)
                         self.__html_edge(src_tag, dst_tag, color)
                         break
     pass