Commit 2211a823 authored by Peter V. Saveliev's avatar Peter V. Saveliev

common: fix pep8 and compat issues on RHEL6.5

parent d0481488
from pyroute2.common import map_namespace
## ARP protocol HARDWARE identifiers.
# ARP protocol HARDWARE identifiers.
ARPHRD_NETROM = 0 # from KA9Q: NET/ROM pseudo
ARPHRD_ETHER = 1 # Ethernet 10Mbps
ARPHRD_EETHER = 2 # Experimental Ethernet
......@@ -17,7 +17,7 @@ ARPHRD_IEEE1394 = 24 # IEEE 1394 IPv4 - RFC 2734
ARPHRD_EUI64 = 27 # EUI-64
ARPHRD_INFINIBAND = 32 # InfiniBand
## Dummy types for non ARP hardware
# Dummy types for non ARP hardware
ARPHRD_SLIP = 256
ARPHRD_CSLIP = 257
ARPHRD_SLIP6 = 258
......@@ -50,12 +50,12 @@ ARPHRD_HIPPI = 780 # High Performance Parallel Interface
ARPHRD_ASH = 781 # Nexus 64Mbps Ash
ARPHRD_ECONET = 782 # Acorn Econet
ARPHRD_IRDA = 783 # Linux-IrDA
## ARP works differently on different FC media .. so
# ARP works differently on different FC media .. so
ARPHRD_FCPP = 784 # Point to point fibrechannel
ARPHRD_FCAL = 785 # Fibrechannel arbitrated loop
ARPHRD_FCPL = 786 # Fibrechannel public loop
ARPHRD_FCFABRIC = 787 # Fibrechannel fabric
## 787->799 reserved for fibrechannel media types
# 787->799 reserved for fibrechannel media types
ARPHRD_IEEE802_TR = 800 # Magic type ident for TR
ARPHRD_IEEE80211 = 801 # IEEE 802.11
ARPHRD_IEEE80211_PRISM = 802 # IEEE 802.11 + Prism2 header
......
......@@ -21,7 +21,7 @@ class NetlinkError(Exception):
self.code = code
## Netlink message flags values (nlmsghdr.flags)
# Netlink message flags values (nlmsghdr.flags)
#
NLM_F_REQUEST = 1 # It is request message.
NLM_F_MULTI = 2 # Multipart message, terminated by NLMSG_DONE
......
......@@ -13,7 +13,7 @@ from pyroute2.common import basestring
_letters = re.compile('[A-Za-z]')
_fmt_letters = re.compile('[^!><@=][!><@=]')
## Netlink family
# Netlink family
#
NETLINK_ROUTE = 0 # Routing/device hook
NETLINK_UNUSED = 1 # Unused number
......
......@@ -32,7 +32,8 @@ from pyroute2.netlink.rtnl.tcmsg import tcmsg
tc_fields = [tcmsg.nla2name(i[0]) for i in tcmsg.nla_map]
_ANCIENT_PLATFORM = platform.dist()[:2] == ('redhat', '6.4')
_ANCIENT_PLATFORM = (platform.dist()[0] in ('redhat', 'centos') and
platform.dist()[1].startswith('6.'))
# How long should we wait on EACH commit() checkpoint: for ipaddr,
# ports etc. That's not total commit() timeout.
_SYNC_TIMEOUT = 3
......@@ -367,8 +368,8 @@ class Transactional(Dotkeys):
added = self.last() - self
removed = self - self.last()
for key in self._linked_sets:
added['-{}'.format(key)] = removed[key]
added['+{}'.format(key)] = added[key]
added['-%s' % (key)] = removed[key]
added['+%s' % (key)] = added[key]
del added[key]
return added
......@@ -698,7 +699,7 @@ class Interface(Transactional):
request[key] = added[key]
# apply changes only if there is something to apply
if any([request[x] is not None for x in request]):
if any([request[item] is not None for item in request]):
self.nl.link('set', index=self['index'], **request)
# 8<---------------------------------------------
......
......@@ -64,7 +64,7 @@ from pyroute2.common import basestring
from pyroute2.common import map_namespace
## RTnetlink multicast groups
# RTnetlink multicast groups
RTNLGRP_NONE = 0x0
RTNLGRP_LINK = 0x1
RTNLGRP_NOTIFY = 0x2
......@@ -86,8 +86,8 @@ RTNLGRP_NOP4 = 0x10000
RTNLGRP_IPV6_PREFIX = 0x20000
RTNLGRP_IPV6_RULE = 0x40000
## Types of messages
#RTM_BASE = 16
# Types of messages
# RTM_BASE = 16
RTM_NEWLINK = 16
RTM_DELLINK = 17
RTM_GETLINK = 18
......
......@@ -2,7 +2,7 @@
from pyroute2.netlink.generic import nlmsg
from pyroute2.netlink.generic import nla
## address attributes
# address attributes
#
# Important comment:
# IFA_ADDRESS is prefix address, rather than local interface address.
......
......@@ -192,7 +192,8 @@ def get_fw_parameters(kwarg):
attrs_map = (
('classid', 'TCA_FW_CLASSID'),
('act', 'TCA_FW_ACT'),
#('police', 'TCA_FW_POLICE'), # Handled in _get_filter_police_parameter
# ('police', 'TCA_FW_POLICE'),
# Handled in _get_filter_police_parameter
('indev', 'TCA_FW_INDEV'),
('mask', 'TCA_FW_MASK'),
)
......
......@@ -21,7 +21,7 @@ ETH_P_IP = 0x0800 # Internet Protocol packet
ETH_P_X25 = 0x0805 # CCITT X.25
ETH_P_ARP = 0x0806 # Address Resolution packet
ETH_P_BPQ = 0x08FF # G8BPQ AX.25 Ethernet Packet
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
ETH_P_IEEEPUP = 0x0a00 # Xerox IEEE802.3 PUP packet
ETH_P_IEEEPUPAT = 0x0a01 # Xerox IEEE802.3 PUP Addr Trans packet
ETH_P_DEC = 0x6000 # DEC Assigned proto
......@@ -42,15 +42,14 @@ ETH_P_IPV6 = 0x86DD # IPv6 over bluebook
ETH_P_PAUSE = 0x8808 # IEEE Pause frames. See = 802.3 = 31B
ETH_P_SLOW = 0x8809 # Slow Protocol. See = 802.3ad = 43B
ETH_P_WCCP = 0x883E # Web-cache coordination protocol
# defined in draft-wilson-wrec-wccp-v2-00.txt
# defined in draft-wilson-wrec-wccp-v2-00.txt
ETH_P_PPP_DISC = 0x8863 # PPPoE discovery messages
ETH_P_PPP_SES = 0x8864 # PPPoE session messages
ETH_P_MPLS_UC = 0x8847 # MPLS Unicast traffic
ETH_P_MPLS_MC = 0x8848 # MPLS Multicast traffic
ETH_P_ATMMPOA = 0x884c # MultiProtocol Over ATM
ETH_P_LINK_CTL = 0x886c # HPNA, wlan link local tunnel
ETH_P_ATMFATE = 0x8884 # Frame-based ATM Transport
# over Ethernet
ETH_P_ATMFATE = 0x8884 # Frame-based ATM Transport over Ethernet
ETH_P_PAE = 0x888E # Port Access Entity (IEEE = 802.1X)
ETH_P_AOE = 0x88A2 # ATA over Ethernet
......@@ -63,15 +62,15 @@ ETH_P_FCOE = 0x8906 # Fibre Channel over Ethernet
ETH_P_TDLS = 0x890D # TDLS
ETH_P_FIP = 0x8914 # FCoE Initialization Protocol
ETH_P_QINQ1 = 0x9100 # deprecated QinQ VLAN
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
ETH_P_QINQ2 = 0x9200 # deprecated QinQ VLAN
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
ETH_P_QINQ3 = 0x9300 # deprecated QinQ VLAN
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
ETH_P_EDSA = 0xDADA # Ethertype DSA
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
ETH_P_AF_IUCV = 0xFBFB # IBM af_iucv
# [ NOT AN OFFICIALLY REGISTERED ID ]
# ^^^ [ NOT AN OFFICIALLY REGISTERED ID ]
#
# Non DIX types. Won't clash for = 1500 types.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment