fixes for mutable default arguments
modify the default argument from list to None, because default value {}/[] as argument is dangerous. Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
7826290ba6
commit
ecfd21e5f9
@ -78,7 +78,7 @@ class BFDSession(object):
|
|||||||
detect_mult=3,
|
detect_mult=3,
|
||||||
desired_min_tx_interval=1000000,
|
desired_min_tx_interval=1000000,
|
||||||
required_min_rx_interval=1000000,
|
required_min_rx_interval=1000000,
|
||||||
auth_type=0, auth_keys={}):
|
auth_type=0, auth_keys=None):
|
||||||
"""
|
"""
|
||||||
Initialize a BFD session.
|
Initialize a BFD session.
|
||||||
|
|
||||||
@ -128,6 +128,7 @@ class BFDSession(object):
|
|||||||
auth_keys={1: "secret key 1",
|
auth_keys={1: "secret key 1",
|
||||||
2: "secret key 2"})
|
2: "secret key 2"})
|
||||||
"""
|
"""
|
||||||
|
auth_keys = auth_keys if auth_keys else {}
|
||||||
assert not (auth_type and len(auth_keys) == 0)
|
assert not (auth_type and len(auth_keys) == 0)
|
||||||
|
|
||||||
# RyuApp reference to BFDLib
|
# RyuApp reference to BFDLib
|
||||||
@ -787,7 +788,7 @@ class BFDLib(app_manager.RyuApp):
|
|||||||
|
|
||||||
def add_bfd_session(self, dpid, ofport, src_mac, src_ip,
|
def add_bfd_session(self, dpid, ofport, src_mac, src_ip,
|
||||||
dst_mac="FF:FF:FF:FF:FF:FF", dst_ip="255.255.255.255",
|
dst_mac="FF:FF:FF:FF:FF:FF", dst_ip="255.255.255.255",
|
||||||
auth_type=0, auth_keys={}):
|
auth_type=0, auth_keys=None):
|
||||||
"""
|
"""
|
||||||
Establish a new BFD session and return My Discriminator of new session.
|
Establish a new BFD session and return My Discriminator of new session.
|
||||||
|
|
||||||
@ -822,6 +823,7 @@ class BFDLib(app_manager.RyuApp):
|
|||||||
auth_keys={1: "secret key 1",
|
auth_keys={1: "secret key 1",
|
||||||
2: "secret key 2"})
|
2: "secret key 2"})
|
||||||
"""
|
"""
|
||||||
|
auth_keys = auth_keys if auth_keys else {}
|
||||||
# Generate a unique discriminator
|
# Generate a unique discriminator
|
||||||
while True:
|
while True:
|
||||||
# Generate My Discriminator
|
# Generate My Discriminator
|
||||||
|
@ -261,7 +261,8 @@ class OVSBridge(object):
|
|||||||
return command.result[0]
|
return command.result[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=[]):
|
def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=None):
|
||||||
|
queues = queues if queues else []
|
||||||
command_qos = ovs_vsctl.VSCtlCommand(
|
command_qos = ovs_vsctl.VSCtlCommand(
|
||||||
'set-qos',
|
'set-qos',
|
||||||
[port_name, type, max_rate])
|
[port_name, type, max_rate])
|
||||||
|
@ -417,7 +417,7 @@ class SimplePassword(BFDAuth):
|
|||||||
return self.serialize_hdr() + \
|
return self.serialize_hdr() + \
|
||||||
struct.pack(self._PACK_STR, self.auth_key_id) + self.password
|
struct.pack(self._PACK_STR, self.auth_key_id) + self.password
|
||||||
|
|
||||||
def authenticate(self, prev=None, auth_keys={}):
|
def authenticate(self, prev=None, auth_keys=None):
|
||||||
"""Authenticate the password for this packet.
|
"""Authenticate the password for this packet.
|
||||||
|
|
||||||
This method can be invoked only when ``self.password`` is defined.
|
This method can be invoked only when ``self.password`` is defined.
|
||||||
@ -431,6 +431,7 @@ class SimplePassword(BFDAuth):
|
|||||||
``auth_keys`` is a dictionary of authentication key chain which
|
``auth_keys`` is a dictionary of authentication key chain which
|
||||||
key is an integer of *Auth Key ID* and value is a string of *Password*.
|
key is an integer of *Auth Key ID* and value is a string of *Password*.
|
||||||
"""
|
"""
|
||||||
|
auth_keys = auth_keys if auth_keys else {}
|
||||||
assert isinstance(prev, bfd)
|
assert isinstance(prev, bfd)
|
||||||
if self.auth_key_id in auth_keys and \
|
if self.auth_key_id in auth_keys and \
|
||||||
self.password == auth_keys[self.auth_key_id]:
|
self.password == auth_keys[self.auth_key_id]:
|
||||||
@ -520,7 +521,7 @@ class KeyedMD5(BFDAuth):
|
|||||||
return auth_hdr_bin + struct.pack(self._PACK_STR, self.auth_key_id, 0,
|
return auth_hdr_bin + struct.pack(self._PACK_STR, self.auth_key_id, 0,
|
||||||
self.seq, self.digest)
|
self.seq, self.digest)
|
||||||
|
|
||||||
def authenticate(self, prev, auth_keys={}):
|
def authenticate(self, prev, auth_keys=None):
|
||||||
"""Authenticate the MD5 digest for this packet.
|
"""Authenticate the MD5 digest for this packet.
|
||||||
|
|
||||||
This method can be invoked only when ``self.digest`` is defined.
|
This method can be invoked only when ``self.digest`` is defined.
|
||||||
@ -536,6 +537,7 @@ class KeyedMD5(BFDAuth):
|
|||||||
``auth_keys`` is a dictionary of authentication key chain which
|
``auth_keys`` is a dictionary of authentication key chain which
|
||||||
key is an integer of *Auth Key ID* and value is a string of *Auth Key*.
|
key is an integer of *Auth Key ID* and value is a string of *Auth Key*.
|
||||||
"""
|
"""
|
||||||
|
auth_keys = auth_keys if auth_keys else {}
|
||||||
assert isinstance(prev, bfd)
|
assert isinstance(prev, bfd)
|
||||||
|
|
||||||
if self.digest is None:
|
if self.digest is None:
|
||||||
@ -670,7 +672,7 @@ class KeyedSHA1(BFDAuth):
|
|||||||
return auth_hdr_bin + struct.pack(self._PACK_STR, self.auth_key_id, 0,
|
return auth_hdr_bin + struct.pack(self._PACK_STR, self.auth_key_id, 0,
|
||||||
self.seq, self.auth_hash)
|
self.seq, self.auth_hash)
|
||||||
|
|
||||||
def authenticate(self, prev, auth_keys={}):
|
def authenticate(self, prev, auth_keys=None):
|
||||||
"""Authenticate the SHA1 hash for this packet.
|
"""Authenticate the SHA1 hash for this packet.
|
||||||
|
|
||||||
This method can be invoked only when ``self.auth_hash`` is defined.
|
This method can be invoked only when ``self.auth_hash`` is defined.
|
||||||
@ -686,6 +688,7 @@ class KeyedSHA1(BFDAuth):
|
|||||||
``auth_keys`` is a dictionary of authentication key chain which
|
``auth_keys`` is a dictionary of authentication key chain which
|
||||||
key is an integer of *Auth Key ID* and value is a string of *Auth Key*.
|
key is an integer of *Auth Key ID* and value is a string of *Auth Key*.
|
||||||
"""
|
"""
|
||||||
|
auth_keys = auth_keys if auth_keys else {}
|
||||||
assert isinstance(prev, bfd)
|
assert isinstance(prev, bfd)
|
||||||
|
|
||||||
if self.auth_hash is None:
|
if self.auth_hash is None:
|
||||||
|
@ -780,7 +780,8 @@ class _LabelledAddrPrefix(_AddrPrefix):
|
|||||||
#
|
#
|
||||||
_WITHDRAW_LABEL = 0x800000
|
_WITHDRAW_LABEL = 0x800000
|
||||||
|
|
||||||
def __init__(self, length, addr, labels=[], **kwargs):
|
def __init__(self, length, addr, labels=None, **kwargs):
|
||||||
|
labels = labels if labels else []
|
||||||
assert isinstance(labels, list)
|
assert isinstance(labels, list)
|
||||||
is_tuple = isinstance(addr, tuple)
|
is_tuple = isinstance(addr, tuple)
|
||||||
if is_tuple:
|
if is_tuple:
|
||||||
@ -2246,8 +2247,9 @@ class BGPOpen(BGPMessage):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, my_as, bgp_identifier, type_=BGP_MSG_OPEN,
|
def __init__(self, my_as, bgp_identifier, type_=BGP_MSG_OPEN,
|
||||||
opt_param_len=0, opt_param=[],
|
opt_param_len=0, opt_param=None,
|
||||||
version=_VERSION, hold_time=0, len_=None, marker=None):
|
version=_VERSION, hold_time=0, len_=None, marker=None):
|
||||||
|
opt_param = opt_param if opt_param else []
|
||||||
super(BGPOpen, self).__init__(marker=marker, len_=len_, type_=type_)
|
super(BGPOpen, self).__init__(marker=marker, len_=len_, type_=type_)
|
||||||
self.version = version
|
self.version = version
|
||||||
self.my_as = my_as
|
self.my_as = my_as
|
||||||
@ -2332,11 +2334,14 @@ class BGPUpdate(BGPMessage):
|
|||||||
|
|
||||||
def __init__(self, type_=BGP_MSG_UPDATE,
|
def __init__(self, type_=BGP_MSG_UPDATE,
|
||||||
withdrawn_routes_len=None,
|
withdrawn_routes_len=None,
|
||||||
withdrawn_routes=[],
|
withdrawn_routes=None,
|
||||||
total_path_attribute_len=None,
|
total_path_attribute_len=None,
|
||||||
path_attributes=[],
|
path_attributes=None,
|
||||||
nlri=[],
|
nlri=None,
|
||||||
len_=None, marker=None):
|
len_=None, marker=None):
|
||||||
|
withdrawn_routes = withdrawn_routes if withdrawn_routes else []
|
||||||
|
path_attributes = path_attributes if path_attributes else []
|
||||||
|
nlri = nlri if nlri else []
|
||||||
super(BGPUpdate, self).__init__(marker=marker, len_=len_, type_=type_)
|
super(BGPUpdate, self).__init__(marker=marker, len_=len_, type_=type_)
|
||||||
self.withdrawn_routes_len = withdrawn_routes_len
|
self.withdrawn_routes_len = withdrawn_routes_len
|
||||||
self.withdrawn_routes = withdrawn_routes
|
self.withdrawn_routes = withdrawn_routes
|
||||||
|
@ -280,7 +280,8 @@ class RouterLSA(LSA):
|
|||||||
|
|
||||||
def __init__(self, ls_age=0, options=0, type_=OSPF_ROUTER_LSA,
|
def __init__(self, ls_age=0, options=0, type_=OSPF_ROUTER_LSA,
|
||||||
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
||||||
checksum=None, length=None, flags=0, links=[]):
|
checksum=None, length=None, flags=0, links=None):
|
||||||
|
links = links if links else []
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.links = links
|
self.links = links
|
||||||
super(RouterLSA, self).__init__(ls_age, options, type_, id_,
|
super(RouterLSA, self).__init__(ls_age, options, type_, id_,
|
||||||
@ -320,7 +321,8 @@ class NetworkLSA(LSA):
|
|||||||
|
|
||||||
def __init__(self, ls_age=0, options=0, type_=OSPF_NETWORK_LSA,
|
def __init__(self, ls_age=0, options=0, type_=OSPF_NETWORK_LSA,
|
||||||
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
||||||
checksum=None, length=None, mask='0.0.0.0', routers=[]):
|
checksum=None, length=None, mask='0.0.0.0', routers=None):
|
||||||
|
routers = routers if routers else []
|
||||||
self.mask = mask
|
self.mask = mask
|
||||||
self.routers = routers
|
self.routers = routers
|
||||||
super(NetworkLSA, self).__init__(ls_age, options, type_, id_,
|
super(NetworkLSA, self).__init__(ls_age, options, type_, id_,
|
||||||
@ -439,7 +441,8 @@ class ASExternalLSA(LSA):
|
|||||||
|
|
||||||
def __init__(self, ls_age=0, options=0, type_=OSPF_AS_EXTERNAL_LSA,
|
def __init__(self, ls_age=0, options=0, type_=OSPF_AS_EXTERNAL_LSA,
|
||||||
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
id_='0.0.0.0', adv_router='0.0.0.0', ls_seqnum=0,
|
||||||
checksum=None, length=None, extnws=[]):
|
checksum=None, length=None, extnws=None):
|
||||||
|
extnws = extnws if extnws else []
|
||||||
self.extnws = extnws
|
self.extnws = extnws
|
||||||
super(ASExternalLSA, self).__init__(ls_age, options, type_, id_,
|
super(ASExternalLSA, self).__init__(ls_age, options, type_, id_,
|
||||||
adv_router, ls_seqnum, checksum,
|
adv_router, ls_seqnum, checksum,
|
||||||
@ -539,7 +542,8 @@ class PrefixSIDSubTLV(ExtendedPrefixTLV):
|
|||||||
|
|
||||||
|
|
||||||
class OpaqueBody(StringifyMixin, _TypeDisp):
|
class OpaqueBody(StringifyMixin, _TypeDisp):
|
||||||
def __init__(self, tlvs=[]):
|
def __init__(self, tlvs=None):
|
||||||
|
tlvs = tlvs if tlvs else []
|
||||||
self.tlvs = tlvs
|
self.tlvs = tlvs
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
@ -718,7 +722,8 @@ class OSPFHello(OSPFMessage):
|
|||||||
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
||||||
mask='0.0.0.0', hello_interval=10, options=0, priority=1,
|
mask='0.0.0.0', hello_interval=10, options=0, priority=1,
|
||||||
dead_interval=40, designated_router='0.0.0.0',
|
dead_interval=40, designated_router='0.0.0.0',
|
||||||
backup_router='0.0.0.0', neighbors=[]):
|
backup_router='0.0.0.0', neighbors=None):
|
||||||
|
neighbors = neighbors if neighbors else []
|
||||||
super(OSPFHello, self).__init__(OSPF_MSG_HELLO, length, router_id,
|
super(OSPFHello, self).__init__(OSPF_MSG_HELLO, length, router_id,
|
||||||
area_id, au_type, authentication,
|
area_id, au_type, authentication,
|
||||||
checksum, version)
|
checksum, version)
|
||||||
@ -782,7 +787,8 @@ class OSPFDBDesc(OSPFMessage):
|
|||||||
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
||||||
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
||||||
mtu=1500, options=0, i_flag=0, m_flag=0, ms_flag=0,
|
mtu=1500, options=0, i_flag=0, m_flag=0, ms_flag=0,
|
||||||
sequence_number=0, lsa_headers=[]):
|
sequence_number=0, lsa_headers=None):
|
||||||
|
lsa_headers = lsa_headers if lsa_headers else []
|
||||||
super(OSPFDBDesc, self).__init__(OSPF_MSG_DB_DESC, length, router_id,
|
super(OSPFDBDesc, self).__init__(OSPF_MSG_DB_DESC, length, router_id,
|
||||||
area_id, au_type, authentication,
|
area_id, au_type, authentication,
|
||||||
checksum, version)
|
checksum, version)
|
||||||
@ -865,7 +871,8 @@ class OSPFLSReq(OSPFMessage):
|
|||||||
|
|
||||||
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
||||||
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
||||||
lsa_requests=[]):
|
lsa_requests=None):
|
||||||
|
lsa_requests = lsa_requests if lsa_requests else []
|
||||||
super(OSPFLSReq, self).__init__(OSPF_MSG_LS_REQ, length, router_id,
|
super(OSPFLSReq, self).__init__(OSPF_MSG_LS_REQ, length, router_id,
|
||||||
area_id, au_type, authentication,
|
area_id, au_type, authentication,
|
||||||
checksum, version)
|
checksum, version)
|
||||||
@ -894,7 +901,8 @@ class OSPFLSUpd(OSPFMessage):
|
|||||||
|
|
||||||
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
||||||
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
||||||
lsas=[]):
|
lsas=None):
|
||||||
|
lsas = lsas if lsas else []
|
||||||
super(OSPFLSUpd, self).__init__(OSPF_MSG_LS_UPD, length, router_id,
|
super(OSPFLSUpd, self).__init__(OSPF_MSG_LS_UPD, length, router_id,
|
||||||
area_id, au_type, authentication,
|
area_id, au_type, authentication,
|
||||||
checksum, version)
|
checksum, version)
|
||||||
@ -930,7 +938,8 @@ class OSPFLSAck(OSPFMessage):
|
|||||||
|
|
||||||
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0',
|
||||||
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
au_type=1, authentication=0, checksum=None, version=_VERSION,
|
||||||
lsa_headers=[]):
|
lsa_headers=None):
|
||||||
|
lsa_headers = lsa_headers if lsa_headers else []
|
||||||
super(OSPFLSAck, self).__init__(OSPF_MSG_LS_ACK, length, router_id,
|
super(OSPFLSAck, self).__init__(OSPF_MSG_LS_ACK, length, router_id,
|
||||||
area_id, au_type, authentication,
|
area_id, au_type, authentication,
|
||||||
checksum, version)
|
checksum, version)
|
||||||
|
@ -931,7 +931,8 @@ class OFPFlowMod(MsgBase):
|
|||||||
buffer_id=ofproto.OFP_NO_BUFFER,
|
buffer_id=ofproto.OFP_NO_BUFFER,
|
||||||
out_port=0, out_group=0, flags=0,
|
out_port=0, out_group=0, flags=0,
|
||||||
match=None,
|
match=None,
|
||||||
instructions=[]):
|
instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowMod, self).__init__(datapath)
|
super(OFPFlowMod, self).__init__(datapath)
|
||||||
self.cookie = cookie
|
self.cookie = cookie
|
||||||
self.cookie_mask = cookie_mask
|
self.cookie_mask = cookie_mask
|
||||||
@ -1725,7 +1726,8 @@ class OFPGroupMod(MsgBase):
|
|||||||
datapath.send_msg(req)
|
datapath.send_msg(req)
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
||||||
type_=ofproto.OFPGT_ALL, group_id=0, buckets=[]):
|
type_=ofproto.OFPGT_ALL, group_id=0, buckets=None):
|
||||||
|
buckets = buckets if buckets else []
|
||||||
super(OFPGroupMod, self).__init__(datapath)
|
super(OFPGroupMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.type = type_
|
self.type = type_
|
||||||
|
@ -99,7 +99,8 @@ class OFPHello(MsgBase):
|
|||||||
elements list of ``OFPHelloElemVersionBitmap`` instance
|
elements list of ``OFPHelloElemVersionBitmap`` instance
|
||||||
========== =========================================================
|
========== =========================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, elements=[]):
|
def __init__(self, datapath, elements=None):
|
||||||
|
elements = elements if elements else []
|
||||||
super(OFPHello, self).__init__(datapath)
|
super(OFPHello, self).__init__(datapath)
|
||||||
self.elements = elements
|
self.elements = elements
|
||||||
|
|
||||||
@ -2607,7 +2608,8 @@ class OFPFlowMod(MsgBase):
|
|||||||
buffer_id=ofproto.OFP_NO_BUFFER,
|
buffer_id=ofproto.OFP_NO_BUFFER,
|
||||||
out_port=0, out_group=0, flags=0,
|
out_port=0, out_group=0, flags=0,
|
||||||
match=None,
|
match=None,
|
||||||
instructions=[]):
|
instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowMod, self).__init__(datapath)
|
super(OFPFlowMod, self).__init__(datapath)
|
||||||
self.cookie = cookie
|
self.cookie = cookie
|
||||||
self.cookie_mask = cookie_mask
|
self.cookie_mask = cookie_mask
|
||||||
@ -3504,7 +3506,8 @@ class OFPGroupMod(MsgBase):
|
|||||||
datapath.send_msg(req)
|
datapath.send_msg(req)
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
||||||
type_=ofproto.OFPGT_ALL, group_id=0, buckets=[]):
|
type_=ofproto.OFPGT_ALL, group_id=0, buckets=None):
|
||||||
|
buckets = buckets if buckets else []
|
||||||
super(OFPGroupMod, self).__init__(datapath)
|
super(OFPGroupMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.type = type_
|
self.type = type_
|
||||||
@ -3635,7 +3638,8 @@ class OFPMeterMod(MsgBase):
|
|||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
||||||
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=[]):
|
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None):
|
||||||
|
bands = bands if bands else []
|
||||||
super(OFPMeterMod, self).__init__(datapath)
|
super(OFPMeterMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
@ -5133,7 +5137,8 @@ class OFPInstructionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
||||||
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, instruction_ids=[]):
|
def __init__(self, type_=None, length=None, instruction_ids=None):
|
||||||
|
instruction_ids = instruction_ids if instruction_ids else []
|
||||||
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
||||||
self.instruction_ids = instruction_ids
|
self.instruction_ids = instruction_ids
|
||||||
|
|
||||||
@ -5159,7 +5164,8 @@ class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
|||||||
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
||||||
_TABLE_ID_PACK_STR = '!B'
|
_TABLE_ID_PACK_STR = '!B'
|
||||||
|
|
||||||
def __init__(self, type_=None, length=None, table_ids=[]):
|
def __init__(self, type_=None, length=None, table_ids=None):
|
||||||
|
table_ids = table_ids if table_ids else []
|
||||||
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
||||||
self.table_ids = table_ids
|
self.table_ids = table_ids
|
||||||
|
|
||||||
@ -5219,7 +5225,8 @@ class OFPActionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
||||||
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, action_ids=[]):
|
def __init__(self, type_=None, length=None, action_ids=None):
|
||||||
|
action_ids = action_ids if action_ids else []
|
||||||
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
||||||
self.action_ids = action_ids
|
self.action_ids = action_ids
|
||||||
|
|
||||||
@ -5327,7 +5334,8 @@ class OFPExperimenterOxmId(OFPOxmId):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD_MISS)
|
||||||
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, oxm_ids=[]):
|
def __init__(self, type_=None, length=None, oxm_ids=None):
|
||||||
|
oxm_ids = oxm_ids if oxm_ids else []
|
||||||
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
||||||
self.oxm_ids = oxm_ids
|
self.oxm_ids = oxm_ids
|
||||||
|
|
||||||
@ -5369,8 +5377,9 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest):
|
|||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, flags=0,
|
def __init__(self, datapath, flags=0,
|
||||||
body=[],
|
body=None,
|
||||||
type_=None):
|
type_=None):
|
||||||
|
body = body if body else []
|
||||||
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
||||||
self.body = body
|
self.body = body
|
||||||
|
|
||||||
@ -5586,8 +5595,9 @@ class ONFFlowMonitorStatsRequest(OFPExperimenterStatsRequestBase):
|
|||||||
body List of ONFFlowMonitorRequest instances
|
body List of ONFFlowMonitorRequest instances
|
||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, flags, body=[],
|
def __init__(self, datapath, flags, body=None,
|
||||||
type_=None, experimenter=None, exp_type=None):
|
type_=None, experimenter=None, exp_type=None):
|
||||||
|
body = body if body else []
|
||||||
super(ONFFlowMonitorStatsRequest,
|
super(ONFFlowMonitorStatsRequest,
|
||||||
self).__init__(datapath, flags,
|
self).__init__(datapath, flags,
|
||||||
experimenter=ofproto_common.ONF_EXPERIMENTER_ID,
|
experimenter=ofproto_common.ONF_EXPERIMENTER_ID,
|
||||||
|
@ -71,7 +71,8 @@ class OFPHello(MsgBase):
|
|||||||
elements list of ``OFPHelloElemVersionBitmap`` instance
|
elements list of ``OFPHelloElemVersionBitmap`` instance
|
||||||
========== =========================================================
|
========== =========================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, elements=[]):
|
def __init__(self, datapath, elements=None):
|
||||||
|
elements = elements if elements else []
|
||||||
super(OFPHello, self).__init__(datapath)
|
super(OFPHello, self).__init__(datapath)
|
||||||
self.elements = elements
|
self.elements = elements
|
||||||
|
|
||||||
@ -1466,7 +1467,8 @@ class OFPMeterMod(MsgBase):
|
|||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
||||||
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=[]):
|
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None):
|
||||||
|
bands = bands if bands else []
|
||||||
super(OFPMeterMod, self).__init__(datapath)
|
super(OFPMeterMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
@ -1786,7 +1788,8 @@ class OFPInstructionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
||||||
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, instruction_ids=[]):
|
def __init__(self, type_=None, length=None, instruction_ids=None):
|
||||||
|
instruction_ids = instruction_ids if instruction_ids else []
|
||||||
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
||||||
self.instruction_ids = instruction_ids
|
self.instruction_ids = instruction_ids
|
||||||
|
|
||||||
@ -1838,7 +1841,8 @@ class OFPActionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
||||||
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, action_ids=[]):
|
def __init__(self, type_=None, length=None, action_ids=None):
|
||||||
|
action_ids = action_ids if action_ids else []
|
||||||
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
||||||
self.action_ids = action_ids
|
self.action_ids = action_ids
|
||||||
|
|
||||||
@ -1864,7 +1868,8 @@ class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
|||||||
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
||||||
_TABLE_ID_PACK_STR = '!B'
|
_TABLE_ID_PACK_STR = '!B'
|
||||||
|
|
||||||
def __init__(self, type_=None, length=None, table_ids=[]):
|
def __init__(self, type_=None, length=None, table_ids=None):
|
||||||
|
table_ids = table_ids if table_ids else []
|
||||||
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
||||||
self.table_ids = table_ids
|
self.table_ids = table_ids
|
||||||
|
|
||||||
@ -1975,7 +1980,8 @@ class OFPExperimenterOxmId(OFPOxmId):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_SETFIELD_MISS)
|
||||||
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, oxm_ids=[]):
|
def __init__(self, type_=None, length=None, oxm_ids=None):
|
||||||
|
oxm_ids = oxm_ids if oxm_ids else []
|
||||||
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
||||||
self.oxm_ids = oxm_ids
|
self.oxm_ids = oxm_ids
|
||||||
|
|
||||||
@ -2016,7 +2022,8 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest):
|
|||||||
The default is [].
|
The default is [].
|
||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, flags=0, body=[], type_=None):
|
def __init__(self, datapath, flags=0, body=None, type_=None):
|
||||||
|
body = body if body else []
|
||||||
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
||||||
self.body = body
|
self.body = body
|
||||||
|
|
||||||
@ -3055,7 +3062,8 @@ class OFPFlowUpdateHeader(OFPFlowUpdate):
|
|||||||
class OFPFlowUpdateFull(OFPFlowUpdateHeader):
|
class OFPFlowUpdateFull(OFPFlowUpdateHeader):
|
||||||
def __init__(self, length=None, event=None, table_id=None, reason=None,
|
def __init__(self, length=None, event=None, table_id=None, reason=None,
|
||||||
idle_timeout=None, hard_timeout=None, priority=None,
|
idle_timeout=None, hard_timeout=None, priority=None,
|
||||||
cookie=None, match=None, instructions=[]):
|
cookie=None, match=None, instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowUpdateFull, self).__init__(length, event)
|
super(OFPFlowUpdateFull, self).__init__(length, event)
|
||||||
self.table_id = table_id
|
self.table_id = table_id
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
@ -4266,7 +4274,8 @@ class OFPFlowMod(MsgBase):
|
|||||||
buffer_id=ofproto.OFP_NO_BUFFER,
|
buffer_id=ofproto.OFP_NO_BUFFER,
|
||||||
out_port=0, out_group=0, flags=0, importance=0,
|
out_port=0, out_group=0, flags=0, importance=0,
|
||||||
match=None,
|
match=None,
|
||||||
instructions=[]):
|
instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowMod, self).__init__(datapath)
|
super(OFPFlowMod, self).__init__(datapath)
|
||||||
self.cookie = cookie
|
self.cookie = cookie
|
||||||
self.cookie_mask = cookie_mask
|
self.cookie_mask = cookie_mask
|
||||||
@ -5036,7 +5045,8 @@ class OFPGroupMod(MsgBase):
|
|||||||
datapath.send_msg(req)
|
datapath.send_msg(req)
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
||||||
type_=ofproto.OFPGT_ALL, group_id=0, buckets=[]):
|
type_=ofproto.OFPGT_ALL, group_id=0, buckets=None):
|
||||||
|
buckets = buckets if buckets else []
|
||||||
super(OFPGroupMod, self).__init__(datapath)
|
super(OFPGroupMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.type = type_
|
self.type = type_
|
||||||
|
@ -73,7 +73,8 @@ class OFPHello(MsgBase):
|
|||||||
elements list of ``OFPHelloElemVersionBitmap`` instance
|
elements list of ``OFPHelloElemVersionBitmap`` instance
|
||||||
========== =========================================================
|
========== =========================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, elements=[]):
|
def __init__(self, datapath, elements=None):
|
||||||
|
elements = elements if elements else []
|
||||||
super(OFPHello, self).__init__(datapath)
|
super(OFPHello, self).__init__(datapath)
|
||||||
self.elements = elements
|
self.elements = elements
|
||||||
|
|
||||||
@ -1135,7 +1136,8 @@ class OFPPortDescPropOptical(OFPPortDescProp):
|
|||||||
@OFPPortDescProp.register_type(ofproto.OFPPDPT_PIPELINE_INPUT)
|
@OFPPortDescProp.register_type(ofproto.OFPPDPT_PIPELINE_INPUT)
|
||||||
@OFPPortDescProp.register_type(ofproto.OFPPDPT_PIPELINE_OUTPUT)
|
@OFPPortDescProp.register_type(ofproto.OFPPDPT_PIPELINE_OUTPUT)
|
||||||
class OFPPortDescPropOxm(OFPPortDescProp):
|
class OFPPortDescPropOxm(OFPPortDescProp):
|
||||||
def __init__(self, type_=None, length=None, oxm_ids=[]):
|
def __init__(self, type_=None, length=None, oxm_ids=None):
|
||||||
|
oxm_ids = oxm_ids if oxm_ids else []
|
||||||
super(OFPPortDescPropOxm, self).__init__(type_, length)
|
super(OFPPortDescPropOxm, self).__init__(type_, length)
|
||||||
self.oxm_ids = oxm_ids
|
self.oxm_ids = oxm_ids
|
||||||
|
|
||||||
@ -1159,7 +1161,8 @@ class OFPPortDescPropOxm(OFPPortDescProp):
|
|||||||
class OFPPortDescPropRecirculate(OFPPortDescProp):
|
class OFPPortDescPropRecirculate(OFPPortDescProp):
|
||||||
_PORT_NO_PACK_STR = '!I'
|
_PORT_NO_PACK_STR = '!I'
|
||||||
|
|
||||||
def __init__(self, type_=None, length=None, port_nos=[]):
|
def __init__(self, type_=None, length=None, port_nos=None):
|
||||||
|
port_nos = port_nos if port_nos else []
|
||||||
super(OFPPortDescPropRecirculate, self).__init__(type_, length)
|
super(OFPPortDescPropRecirculate, self).__init__(type_, length)
|
||||||
self.port_nos = port_nos
|
self.port_nos = port_nos
|
||||||
|
|
||||||
@ -1702,7 +1705,8 @@ class OFPMeterMod(MsgBase):
|
|||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPMC_ADD,
|
||||||
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=[]):
|
flags=ofproto.OFPMF_KBPS, meter_id=1, bands=None):
|
||||||
|
bands = bands if bands else []
|
||||||
super(OFPMeterMod, self).__init__(datapath)
|
super(OFPMeterMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
@ -2023,7 +2027,8 @@ class OFPInstructionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_INSTRUCTIONS_MISS)
|
||||||
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
class OFPTableFeaturePropInstructions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, instruction_ids=[]):
|
def __init__(self, type_=None, length=None, instruction_ids=None):
|
||||||
|
instruction_ids = instruction_ids if instruction_ids else []
|
||||||
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
super(OFPTableFeaturePropInstructions, self).__init__(type_, length)
|
||||||
self.instruction_ids = instruction_ids
|
self.instruction_ids = instruction_ids
|
||||||
|
|
||||||
@ -2075,7 +2080,8 @@ class OFPActionId(StringifyMixin):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_ACTIONS_MISS)
|
||||||
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, action_ids=[]):
|
def __init__(self, type_=None, length=None, action_ids=None):
|
||||||
|
action_ids = action_ids if action_ids else []
|
||||||
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
super(OFPTableFeaturePropActions, self).__init__(type_, length)
|
||||||
self.action_ids = action_ids
|
self.action_ids = action_ids
|
||||||
|
|
||||||
@ -2101,7 +2107,8 @@ class OFPTableFeaturePropActions(OFPTableFeatureProp):
|
|||||||
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
|
||||||
_TABLE_ID_PACK_STR = '!B'
|
_TABLE_ID_PACK_STR = '!B'
|
||||||
|
|
||||||
def __init__(self, type_=None, length=None, table_ids=[]):
|
def __init__(self, type_=None, length=None, table_ids=None):
|
||||||
|
table_ids = table_ids if table_ids else []
|
||||||
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
super(OFPTableFeaturePropNextTables, self).__init__(type_, length)
|
||||||
self.table_ids = table_ids
|
self.table_ids = table_ids
|
||||||
|
|
||||||
@ -2216,7 +2223,8 @@ class OFPExperimenterOxmId(OFPOxmId):
|
|||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_COPYFIELD)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_COPYFIELD)
|
||||||
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_COPYFIELD_MISS)
|
@OFPTableFeatureProp.register_type(ofproto.OFPTFPT_APPLY_COPYFIELD_MISS)
|
||||||
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
class OFPTableFeaturePropOxm(OFPTableFeatureProp):
|
||||||
def __init__(self, type_=None, length=None, oxm_ids=[]):
|
def __init__(self, type_=None, length=None, oxm_ids=None):
|
||||||
|
oxm_ids = oxm_ids if oxm_ids else []
|
||||||
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
super(OFPTableFeaturePropOxm, self).__init__(type_, length)
|
||||||
self.oxm_ids = oxm_ids
|
self.oxm_ids = oxm_ids
|
||||||
|
|
||||||
@ -2338,7 +2346,8 @@ class OFPTableFeaturesStatsRequest(OFPMultipartRequest):
|
|||||||
The default is [].
|
The default is [].
|
||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, flags=0, body=[], type_=None):
|
def __init__(self, datapath, flags=0, body=None, type_=None):
|
||||||
|
body = body if body else []
|
||||||
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
super(OFPTableFeaturesStatsRequest, self).__init__(datapath, flags)
|
||||||
self.body = body
|
self.body = body
|
||||||
|
|
||||||
@ -2789,8 +2798,10 @@ class OFPGroupStatsReply(OFPMultipartReply):
|
|||||||
|
|
||||||
|
|
||||||
class OFPGroupDescStats(StringifyMixin):
|
class OFPGroupDescStats(StringifyMixin):
|
||||||
def __init__(self, type_=None, group_id=None, buckets=[], properties=[],
|
def __init__(self, type_=None, group_id=None, buckets=None, properties=None,
|
||||||
length=None, bucket_array_len=None):
|
length=None, bucket_array_len=None):
|
||||||
|
buckets = buckets if buckets else []
|
||||||
|
properties = properties if properties else []
|
||||||
super(OFPGroupDescStats, self).__init__()
|
super(OFPGroupDescStats, self).__init__()
|
||||||
self.length = length
|
self.length = length
|
||||||
self.type = type_
|
self.type = type_
|
||||||
@ -3405,7 +3416,8 @@ class OFPFlowUpdateHeader(OFPFlowUpdate):
|
|||||||
class OFPFlowUpdateFull(OFPFlowUpdateHeader):
|
class OFPFlowUpdateFull(OFPFlowUpdateHeader):
|
||||||
def __init__(self, length=None, event=None, table_id=None, reason=None,
|
def __init__(self, length=None, event=None, table_id=None, reason=None,
|
||||||
idle_timeout=None, hard_timeout=None, priority=None,
|
idle_timeout=None, hard_timeout=None, priority=None,
|
||||||
cookie=None, match=None, instructions=[]):
|
cookie=None, match=None, instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowUpdateFull, self).__init__(length, event)
|
super(OFPFlowUpdateFull, self).__init__(length, event)
|
||||||
self.table_id = table_id
|
self.table_id = table_id
|
||||||
self.reason = reason
|
self.reason = reason
|
||||||
@ -3716,7 +3728,8 @@ class OFPBundleFeaturesStatsRequest(OFPMultipartRequest):
|
|||||||
datapath.send_msg(req)
|
datapath.send_msg(req)
|
||||||
"""
|
"""
|
||||||
def __init__(self, datapath, flags=0, feature_request_flags=0,
|
def __init__(self, datapath, flags=0, feature_request_flags=0,
|
||||||
properties=[], type_=None):
|
properties=None, type_=None):
|
||||||
|
properties = properties if properties else []
|
||||||
super(OFPBundleFeaturesStatsRequest, self).__init__(datapath, flags)
|
super(OFPBundleFeaturesStatsRequest, self).__init__(datapath, flags)
|
||||||
self.feature_request_flags = feature_request_flags
|
self.feature_request_flags = feature_request_flags
|
||||||
self.properties = properties
|
self.properties = properties
|
||||||
@ -5121,7 +5134,8 @@ class OFPFlowMod(MsgBase):
|
|||||||
buffer_id=ofproto.OFP_NO_BUFFER,
|
buffer_id=ofproto.OFP_NO_BUFFER,
|
||||||
out_port=0, out_group=0, flags=0, importance=0,
|
out_port=0, out_group=0, flags=0, importance=0,
|
||||||
match=None,
|
match=None,
|
||||||
instructions=[]):
|
instructions=None):
|
||||||
|
instructions = instructions if instructions else []
|
||||||
super(OFPFlowMod, self).__init__(datapath)
|
super(OFPFlowMod, self).__init__(datapath)
|
||||||
self.cookie = cookie
|
self.cookie = cookie
|
||||||
self.cookie_mask = cookie_mask
|
self.cookie_mask = cookie_mask
|
||||||
@ -5842,8 +5856,9 @@ class OFPActionCopyField(OFPAction):
|
|||||||
The default is [].
|
The default is [].
|
||||||
================ ======================================================
|
================ ======================================================
|
||||||
"""
|
"""
|
||||||
def __init__(self, n_bits=0, src_offset=0, dst_offset=0, oxm_ids=[],
|
def __init__(self, n_bits=0, src_offset=0, dst_offset=0, oxm_ids=None,
|
||||||
type_=None, len_=None):
|
type_=None, len_=None):
|
||||||
|
oxm_ids = oxm_ids if oxm_ids else []
|
||||||
super(OFPActionCopyField, self).__init__()
|
super(OFPActionCopyField, self).__init__()
|
||||||
self.n_bits = n_bits
|
self.n_bits = n_bits
|
||||||
self.src_offset = src_offset
|
self.src_offset = src_offset
|
||||||
@ -6029,7 +6044,9 @@ class OFPGroupMod(MsgBase):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
def __init__(self, datapath, command=ofproto.OFPGC_ADD,
|
||||||
type_=ofproto.OFPGT_ALL, group_id=0, command_bucket_id=0,
|
type_=ofproto.OFPGT_ALL, group_id=0, command_bucket_id=0,
|
||||||
buckets=[], properties=[], bucket_array_len=None):
|
buckets=None, properties=None, bucket_array_len=None):
|
||||||
|
buckets = buckets if buckets else []
|
||||||
|
properties = properties if properties else []
|
||||||
super(OFPGroupMod, self).__init__(datapath)
|
super(OFPGroupMod, self).__init__(datapath)
|
||||||
self.command = command
|
self.command = command
|
||||||
self.type = type_
|
self.type = type_
|
||||||
@ -6258,8 +6275,10 @@ class OFPGroupBucketPropExperimenter(OFPPropCommonExperimenter4ByteData):
|
|||||||
|
|
||||||
|
|
||||||
class OFPBucket(StringifyMixin):
|
class OFPBucket(StringifyMixin):
|
||||||
def __init__(self, bucket_id=0, actions=[], properties=[],
|
def __init__(self, bucket_id=0, actions=None, properties=None,
|
||||||
len_=None, action_array_len=None):
|
len_=None, action_array_len=None):
|
||||||
|
actions = actions if actions else []
|
||||||
|
properties = properties if properties else []
|
||||||
super(OFPBucket, self).__init__()
|
super(OFPBucket, self).__init__()
|
||||||
self.bucket_id = bucket_id
|
self.bucket_id = bucket_id
|
||||||
self.actions = actions
|
self.actions = actions
|
||||||
|
@ -65,7 +65,8 @@ class OperatorApi(object):
|
|||||||
def clear(self, **kwargs):
|
def clear(self, **kwargs):
|
||||||
return self._run('clear', kw=kwargs)
|
return self._run('clear', kw=kwargs)
|
||||||
|
|
||||||
def _run(self, cmd, kw={}):
|
def _run(self, cmd, kw=None):
|
||||||
|
kw = kw if kw else {}
|
||||||
params = kw.get('params', [])
|
params = kw.get('params', [])
|
||||||
fmt = kw.get('format', 'json')
|
fmt = kw.get('format', 'json')
|
||||||
root = RootCmd(api=self.internal_api, resp_formatter_name=fmt)
|
root = RootCmd(api=self.internal_api, resp_formatter_name=fmt)
|
||||||
|
@ -125,8 +125,9 @@ def get_reqs_from_files(requirements_files):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def parse_requirements(requirements_files=['requirements.txt',
|
def parse_requirements(requirements_files=None):
|
||||||
'tools/pip-requires']):
|
requirements_files = requirements_files if requirements_files else [
|
||||||
|
'requirements.txt', 'tools/pip-requires']
|
||||||
requirements = []
|
requirements = []
|
||||||
for line in get_reqs_from_files(requirements_files):
|
for line in get_reqs_from_files(requirements_files):
|
||||||
# For the requirements list, we need to inject only the portion
|
# For the requirements list, we need to inject only the portion
|
||||||
|
Loading…
Reference in New Issue
Block a user