X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ovsdb%2Fovsdbmonitor%2FOVEFlowWindow.py;h=caf6533e95f806e57fc83530efd9482d392115d4;hb=e0edde6fee279cdbbf3c179f5f50adaf0c7c7f1e;hp=ebcf466e878ea2881b4b5e76091eda4288259db0;hpb=436f27dd880bd4e1e1d06ca2744c875b01b9e1c1;p=sliver-openvswitch.git diff --git a/ovsdb/ovsdbmonitor/OVEFlowWindow.py b/ovsdb/ovsdbmonitor/OVEFlowWindow.py index ebcf466e8..caf6533e9 100644 --- a/ovsdb/ovsdbmonitor/OVEFlowWindow.py +++ b/ovsdb/ovsdbmonitor/OVEFlowWindow.py @@ -1,3 +1,4 @@ +# Copyright (c) 2011 Nicira, Inc. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +23,8 @@ from OVECommonWindow import * from Ui_FlowWindow import * +import re + class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): LOAD_KEY = 'FlowWindow/window' COMMAND_OVS_DPCTL='/usr/bin/ovs-dpctl' @@ -231,7 +234,6 @@ class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): colour = Qt.black for colNum, data in enumerate(flow): - item = None try: item = table.takeItem(rowNum, colNum) @@ -245,7 +247,7 @@ class OVEFlowWindow(QtGui.QMainWindow, OVECommonWindow): elif colNum == srcMacColumn or colNum == destMacColumn: cols = [int(x, 16) for x in data.split(':')] item.setBackground(QtGui.QColor(255-cols[2]*cols[3] % 192, 255-cols[3]*cols[4] % 192, 255-cols[4]*cols[5] % 192)) - elif colNum == srcIPColumn or colNum == destIPColumn: + elif re.match(r'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', str(data)): cols = [int(x) for x in data.split('.')] item.setBackground(QtGui.QColor(255-cols[1]*cols[2] % 192, 255-cols[2]*cols[3] % 192, 255-cols[3]*cols[0] % 192)) else: