loxi-prep: rename uses of match fields
diff --git a/src/python/of10/parse.py b/src/python/of10/parse.py
index e56b69a..5c3ce65 100644
--- a/src/python/of10/parse.py
+++ b/src/python/of10/parse.py
@@ -172,13 +172,13 @@
return hdr
map_wc_field_to_match_member = {
- 'OFPFW_DL_VLAN' : 'dl_vlan',
- 'OFPFW_DL_SRC' : 'dl_src',
- 'OFPFW_DL_DST' : 'dl_dst',
- 'OFPFW_DL_TYPE' : 'dl_type',
- 'OFPFW_NW_PROTO' : 'nw_proto',
- 'OFPFW_TP_SRC' : 'tp_src',
- 'OFPFW_TP_DST' : 'tp_dst',
+ 'OFPFW_DL_VLAN' : 'vlan_vid',
+ 'OFPFW_DL_SRC' : 'eth_src',
+ 'OFPFW_DL_DST' : 'eth_dst',
+ 'OFPFW_DL_TYPE' : 'eth_type',
+ 'OFPFW_NW_PROTO' : 'ip_proto',
+ 'OFPFW_TP_SRC' : 'tcp_src',
+ 'OFPFW_TP_DST' : 'tcp_dst',
'OFPFW_NW_SRC_SHIFT' : 'nw_src_shift',
'OFPFW_NW_SRC_BITS' : 'nw_src_bits',
'OFPFW_NW_SRC_MASK' : 'nw_src_mask',
@@ -187,8 +187,8 @@
'OFPFW_NW_DST_BITS' : 'nw_dst_bits',
'OFPFW_NW_DST_MASK' : 'nw_dst_mask',
'OFPFW_NW_DST_ALL' : 'nw_dst_all',
- 'OFPFW_DL_VLAN_PCP' : 'dl_vlan_pcp',
- 'OFPFW_NW_TOS' : 'nw_tos'
+ 'OFPFW_DL_VLAN_PCP' : 'vlan_pcp',
+ 'OFPFW_NW_TOS' : 'ip_dscp'
}
@@ -287,57 +287,57 @@
match = cstruct.ofp_match()
match.wildcards = cstruct.OFPFW_ALL
#@todo Check if packet is other than L2 format
- match.dl_dst = parse_mac(ether.dst)
+ match.eth_dst = parse_mac(ether.dst)
match.wildcards &= ~cstruct.OFPFW_DL_DST
- match.dl_src = parse_mac(ether.src)
+ match.eth_src = parse_mac(ether.src)
match.wildcards &= ~cstruct.OFPFW_DL_SRC
- match.dl_type = ether.type
+ match.eth_type = ether.type
match.wildcards &= ~cstruct.OFPFW_DL_TYPE
if dot1q:
- match.dl_vlan = dot1q.vlan
- match.dl_vlan_pcp = dot1q.prio
- match.dl_type = dot1q.type
+ match.vlan_vid = dot1q.vlan
+ match.vlan_pcp = dot1q.prio
+ match.eth_type = dot1q.type
else:
- match.dl_vlan = cstruct.OFP_VLAN_NONE
- match.dl_vlan_pcp = 0
+ match.vlan_vid = cstruct.OFP_VLAN_NONE
+ match.vlan_pcp = 0
match.wildcards &= ~cstruct.OFPFW_DL_VLAN
match.wildcards &= ~cstruct.OFPFW_DL_VLAN_PCP
if ip:
- match.nw_src = parse_ip(ip.src)
+ match.ipv4_src = parse_ip(ip.src)
match.wildcards &= ~cstruct.OFPFW_NW_SRC_MASK
- match.nw_dst = parse_ip(ip.dst)
+ match.ipv4_dst = parse_ip(ip.dst)
match.wildcards &= ~cstruct.OFPFW_NW_DST_MASK
- match.nw_tos = ip.tos
+ match.ip_dscp = ip.tos
match.wildcards &= ~cstruct.OFPFW_NW_TOS
if tcp:
- match.nw_proto = 6
+ match.ip_proto = 6
match.wildcards &= ~cstruct.OFPFW_NW_PROTO
elif not tcp and udp:
tcp = udp
- match.nw_proto = 17
+ match.ip_proto = 17
match.wildcards &= ~cstruct.OFPFW_NW_PROTO
if tcp:
- match.tp_src = tcp.sport
+ match.tcp_src = tcp.sport
match.wildcards &= ~cstruct.OFPFW_TP_SRC
- match.tp_dst = tcp.dport
+ match.tcp_dst = tcp.dport
match.wildcards &= ~cstruct.OFPFW_TP_DST
if icmp:
- match.nw_proto = 1
- match.tp_src = icmp.type
- match.tp_dst = icmp.code
+ match.ip_proto = 1
+ match.tcp_src = icmp.type
+ match.tcp_dst = icmp.code
match.wildcards &= ~cstruct.OFPFW_NW_PROTO
if arp:
- match.nw_proto = arp.op
+ match.ip_proto = arp.op
match.wildcards &= ~cstruct.OFPFW_NW_PROTO
- match.nw_src = parse_ip(arp.psrc)
+ match.ipv4_src = parse_ip(arp.psrc)
match.wildcards &= ~cstruct.OFPFW_NW_SRC_MASK
- match.nw_dst = parse_ip(arp.pdst)
+ match.ipv4_dst = parse_ip(arp.pdst)
match.wildcards &= ~cstruct.OFPFW_NW_DST_MASK
return match
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 90d17ef..1aacf63 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -57,11 +57,11 @@
return 0
def simple_tcp_packet(pktlen=100,
- dl_dst='00:01:02:03:04:05',
- dl_src='00:06:07:08:09:0a',
+ eth_dst='00:01:02:03:04:05',
+ eth_src='00:06:07:08:09:0a',
dl_vlan_enable=False,
- dl_vlan=0,
- dl_vlan_pcp=0,
+ vlan_vid=0,
+ vlan_pcp=0,
dl_vlan_cfi=0,
ip_src='192.168.0.1',
ip_dst='192.168.0.2',
@@ -77,11 +77,11 @@
Supports a few parameters:
@param len Length of packet in bytes w/o CRC
- @param dl_dst Destinatino MAC
- @param dl_src Source MAC
+ @param eth_dst Destinatino MAC
+ @param eth_src Source MAC
@param dl_vlan_enable True if the packet is with vlan, False otherwise
- @param dl_vlan VLAN ID
- @param dl_vlan_pcp VLAN priority
+ @param vlan_vid VLAN ID
+ @param vlan_pcp VLAN priority
@param ip_src IP source
@param ip_dst IP destination
@param ip_tos IP ToS
@@ -99,17 +99,17 @@
# Note Dot1Q.id is really CFI
if (dl_vlan_enable):
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
- scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
+ scapy.Dot1Q(prio=vlan_pcp, id=dl_vlan_cfi, vlan=vlan_vid)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport)
else:
if not ip_options:
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport)
else:
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport)
@@ -118,11 +118,11 @@
return pkt
def simple_udp_packet(pktlen=100,
- dl_dst='00:01:02:03:04:05',
- dl_src='00:06:07:08:09:0a',
+ eth_dst='00:01:02:03:04:05',
+ eth_src='00:06:07:08:09:0a',
dl_vlan_enable=False,
- dl_vlan=0,
- dl_vlan_pcp=0,
+ vlan_vid=0,
+ vlan_pcp=0,
dl_vlan_cfi=0,
ip_src='192.168.0.1',
ip_dst='192.168.0.2',
@@ -138,11 +138,11 @@
Supports a few parameters:
@param len Length of packet in bytes w/o CRC
- @param dl_dst Destination MAC
- @param dl_src Source MAC
+ @param eth_dst Destination MAC
+ @param eth_src Source MAC
@param dl_vlan_enable True if the packet is with vlan, False otherwise
- @param dl_vlan VLAN ID
- @param dl_vlan_pcp VLAN priority
+ @param vlan_vid VLAN ID
+ @param vlan_pcp VLAN priority
@param ip_src IP source
@param ip_dst IP destination
@param ip_tos IP ToS
@@ -159,17 +159,17 @@
# Note Dot1Q.id is really CFI
if (dl_vlan_enable):
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
- scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
+ scapy.Dot1Q(prio=vlan_pcp, id=dl_vlan_cfi, vlan=vlan_vid)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.UDP(sport=udp_sport, dport=udp_dport)
else:
if not ip_options:
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.UDP(sport=udp_sport, dport=udp_dport)
else:
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options)/ \
scapy.UDP(sport=udp_sport, dport=udp_dport)
@@ -178,11 +178,11 @@
return pkt
def simple_icmp_packet(pktlen=60,
- dl_dst='00:01:02:03:04:05',
- dl_src='00:06:07:08:09:0a',
+ eth_dst='00:01:02:03:04:05',
+ eth_src='00:06:07:08:09:0a',
dl_vlan_enable=False,
- dl_vlan=0,
- dl_vlan_pcp=0,
+ vlan_vid=0,
+ vlan_pcp=0,
ip_src='192.168.0.1',
ip_dst='192.168.0.2',
ip_tos=0,
@@ -195,11 +195,11 @@
Supports a few parameters:
@param len Length of packet in bytes w/o CRC
- @param dl_dst Destinatino MAC
- @param dl_src Source MAC
+ @param eth_dst Destinatino MAC
+ @param eth_src Source MAC
@param dl_vlan_enable True if the packet is with vlan, False otherwise
- @param dl_vlan VLAN ID
- @param dl_vlan_pcp VLAN priority
+ @param vlan_vid VLAN ID
+ @param vlan_pcp VLAN priority
@param ip_src IP source
@param ip_dst IP destination
@param ip_tos IP ToS
@@ -216,12 +216,12 @@
pktlen = MINSIZE
if (dl_vlan_enable):
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
- scapy.Dot1Q(prio=dl_vlan_pcp, id=0, vlan=dl_vlan)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
+ scapy.Dot1Q(prio=vlan_pcp, id=0, vlan=vlan_vid)/ \
scapy.IP(src=ip_src, dst=ip_dst, ttl=ip_ttl, tos=ip_tos)/ \
scapy.ICMP(type=icmp_type, code=icmp_code)
else:
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, ttl=ip_ttl, tos=ip_tos)/ \
scapy.ICMP(type=icmp_type, code=icmp_code)
@@ -230,8 +230,8 @@
return pkt
def simple_arp_packet(pktlen=60,
- dl_dst='ff:ff:ff:ff:ff:ff',
- dl_src='00:06:07:08:09:0a',
+ eth_dst='ff:ff:ff:ff:ff:ff',
+ eth_src='00:06:07:08:09:0a',
arp_op=1,
ip_snd='192.168.0.1',
ip_tgt='192.168.0.2',
@@ -243,8 +243,8 @@
Supports a few parameters:
@param len Length of packet in bytes w/o CRC
- @param dl_dst Destinatino MAC
- @param dl_src Source MAC
+ @param eth_dst Destinatino MAC
+ @param eth_src Source MAC
@param arp_op Operation (1=request, 2=reply)
@param ip_snd Sender IP
@param ip_tgt Target IP
@@ -259,7 +259,7 @@
if MINSIZE > pktlen:
pktlen = MINSIZE
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.ARP(hwsrc=hw_snd, hwdst=hw_tgt, pdst=ip_tgt, psrc=ip_snd, op=arp_op)
pkt = pkt/("0" * (pktlen - len(pkt)))
@@ -267,27 +267,27 @@
return pkt
def simple_eth_packet(pktlen=60,
- dl_dst='00:01:02:03:04:05',
- dl_src='01:80:c2:00:00:00',
- dl_type=0x88cc):
+ eth_dst='00:01:02:03:04:05',
+ eth_src='01:80:c2:00:00:00',
+ eth_type=0x88cc):
if MINSIZE > pktlen:
pktlen = MINSIZE
- pkt = scapy.Ether(dst=dl_dst, src=dl_src, type=dl_type)
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src, type=eth_type)
pkt = pkt/("0" * (pktlen - len(pkt)))
return pkt
def qinq_tcp_packet(pktlen=100,
- dl_dst='00:01:02:03:04:05',
- dl_src='00:06:07:08:09:0a',
+ eth_dst='00:01:02:03:04:05',
+ eth_src='00:06:07:08:09:0a',
dl_vlan_outer=20,
dl_vlan_pcp_outer=0,
dl_vlan_cfi_outer=0,
- dl_vlan=10,
- dl_vlan_pcp=0,
+ vlan_vid=10,
+ vlan_pcp=0,
dl_vlan_cfi=0,
ip_src='192.168.0.1',
ip_dst='192.168.0.2',
@@ -303,13 +303,13 @@
Supports a few parameters:
@param len Length of packet in bytes w/o CRC
- @param dl_dst Destinatino MAC
- @param dl_src Source MAC
+ @param eth_dst Destinatino MAC
+ @param eth_src Source MAC
@param dl_vlan_outer Outer VLAN ID
@param dl_vlan_pcp_outer Outer VLAN priority
@param dl_vlan_cfi_outer Outer VLAN cfi bit
- @param dl_vlan Inner VLAN ID
- @param dl_vlan_pcp VLAN priority
+ @param vlan_vid Inner VLAN ID
+ @param vlan_pcp VLAN priority
@param dl_vlan_cfi VLAN cfi bit
@param ip_src IP source
@param ip_dst IP destination
@@ -326,9 +326,9 @@
pktlen = MINSIZE
# Note Dot1Q.id is really CFI
- pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=dl_vlan_pcp_outer, id=dl_vlan_cfi_outer, vlan=dl_vlan_outer)/ \
- scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
+ scapy.Dot1Q(prio=vlan_pcp, id=dl_vlan_cfi, vlan=vlan_vid)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport)
@@ -500,49 +500,49 @@
parent.assertEqual(req_match.in_port, res_match.in_port,
'Match failed: in_port: ' + str(req_match.in_port) +
" != " + str(res_match.in_port))
- parent.assertEqual(str(req_match.dl_src), str(res_match.dl_src),
- 'Match failed: dl_src: ' + str(req_match.dl_src) +
- " != " + str(res_match.dl_src))
- parent.assertEqual(str(req_match.dl_dst), str(res_match.dl_dst),
- 'Match failed: dl_dst: ' + str(req_match.dl_dst) +
- " != " + str(res_match.dl_dst))
- parent.assertEqual(req_match.dl_vlan, res_match.dl_vlan,
- 'Match failed: dl_vlan: ' + str(req_match.dl_vlan) +
- " != " + str(res_match.dl_vlan))
- parent.assertEqual(req_match.dl_vlan_pcp, res_match.dl_vlan_pcp,
- 'Match failed: dl_vlan_pcp: ' +
- str(req_match.dl_vlan_pcp) + " != " +
- str(res_match.dl_vlan_pcp))
- parent.assertEqual(req_match.dl_type, res_match.dl_type,
- 'Match failed: dl_type: ' + str(req_match.dl_type) +
- " != " + str(res_match.dl_type))
+ parent.assertEqual(str(req_match.eth_src), str(res_match.eth_src),
+ 'Match failed: eth_src: ' + str(req_match.eth_src) +
+ " != " + str(res_match.eth_src))
+ parent.assertEqual(str(req_match.eth_dst), str(res_match.eth_dst),
+ 'Match failed: eth_dst: ' + str(req_match.eth_dst) +
+ " != " + str(res_match.eth_dst))
+ parent.assertEqual(req_match.vlan_vid, res_match.vlan_vid,
+ 'Match failed: vlan_vid: ' + str(req_match.vlan_vid) +
+ " != " + str(res_match.vlan_vid))
+ parent.assertEqual(req_match.vlan_pcp, res_match.vlan_pcp,
+ 'Match failed: vlan_pcp: ' +
+ str(req_match.vlan_pcp) + " != " +
+ str(res_match.vlan_pcp))
+ parent.assertEqual(req_match.eth_type, res_match.eth_type,
+ 'Match failed: eth_type: ' + str(req_match.eth_type) +
+ " != " + str(res_match.eth_type))
if (not(req_match.wildcards & of10.OFPFW_DL_TYPE)
- and (req_match.dl_type == IP_ETHERTYPE)):
- parent.assertEqual(req_match.nw_tos, res_match.nw_tos,
- 'Match failed: nw_tos: ' + str(req_match.nw_tos) +
- " != " + str(res_match.nw_tos))
- parent.assertEqual(req_match.nw_proto, res_match.nw_proto,
- 'Match failed: nw_proto: ' + str(req_match.nw_proto) +
- " != " + str(res_match.nw_proto))
- parent.assertEqual(req_match.nw_src, res_match.nw_src,
- 'Match failed: nw_src: ' + str(req_match.nw_src) +
- " != " + str(res_match.nw_src))
- parent.assertEqual(req_match.nw_dst, res_match.nw_dst,
- 'Match failed: nw_dst: ' + str(req_match.nw_dst) +
- " != " + str(res_match.nw_dst))
+ and (req_match.eth_type == IP_ETHERTYPE)):
+ parent.assertEqual(req_match.ip_dscp, res_match.ip_dscp,
+ 'Match failed: ip_dscp: ' + str(req_match.ip_dscp) +
+ " != " + str(res_match.ip_dscp))
+ parent.assertEqual(req_match.ip_proto, res_match.ip_proto,
+ 'Match failed: ip_proto: ' + str(req_match.ip_proto) +
+ " != " + str(res_match.ip_proto))
+ parent.assertEqual(req_match.ipv4_src, res_match.ipv4_src,
+ 'Match failed: ipv4_src: ' + str(req_match.ipv4_src) +
+ " != " + str(res_match.ipv4_src))
+ parent.assertEqual(req_match.ipv4_dst, res_match.ipv4_dst,
+ 'Match failed: ipv4_dst: ' + str(req_match.ipv4_dst) +
+ " != " + str(res_match.ipv4_dst))
if (not(req_match.wildcards & of10.OFPFW_NW_PROTO)
- and ((req_match.nw_proto == TCP_PROTOCOL)
- or (req_match.nw_proto == UDP_PROTOCOL))):
- parent.assertEqual(req_match.tp_src, res_match.tp_src,
- 'Match failed: tp_src: ' +
- str(req_match.tp_src) +
- " != " + str(res_match.tp_src))
- parent.assertEqual(req_match.tp_dst, res_match.tp_dst,
- 'Match failed: tp_dst: ' +
- str(req_match.tp_dst) +
- " != " + str(res_match.tp_dst))
+ and ((req_match.ip_proto == TCP_PROTOCOL)
+ or (req_match.ip_proto == UDP_PROTOCOL))):
+ parent.assertEqual(req_match.tcp_src, res_match.tcp_src,
+ 'Match failed: tcp_src: ' +
+ str(req_match.tcp_src) +
+ " != " + str(res_match.tcp_src))
+ parent.assertEqual(req_match.tcp_dst, res_match.tcp_dst,
+ 'Match failed: tcp_dst: ' +
+ str(req_match.tcp_dst) +
+ " != " + str(res_match.tcp_dst))
def packet_to_flow_match(parent, packet):
match = of10.parse.packet_to_flow_match(packet)
@@ -627,7 +627,7 @@
do_barrier(parent.controller)
def flow_match_test_port_pair(parent, ing_port, egr_ports, wildcards=None,
- dl_vlan=-1, pkt=None, exp_pkt=None,
+ vlan_vid=-1, pkt=None, exp_pkt=None,
action_list=None):
"""
Flow match test on single TCP packet
@@ -641,9 +641,9 @@
wildcards = required_wildcards(parent)
logging.info("Pkt match test: " + str(ing_port) + " to " +
str(egr_ports))
- logging.debug(" WC: " + hex(wildcards) + " vlan: " + str(dl_vlan))
+ logging.debug(" WC: " + hex(wildcards) + " vlan: " + str(vlan_vid))
if pkt is None:
- pkt = simple_tcp_packet(dl_vlan_enable=(dl_vlan >= 0), dl_vlan=dl_vlan)
+ pkt = simple_tcp_packet(dl_vlan_enable=(vlan_vid >= 0), vlan_vid=vlan_vid)
request = flow_msg_create(parent, pkt, ing_port=ing_port,
wildcards=wildcards, egr_ports=egr_ports,
@@ -660,7 +660,7 @@
receive_pkt_verify(parent, egr_ports, exp_pkt, ing_port)
def flow_match_test_pktout(parent, ing_port, egr_ports,
- dl_vlan=-1, pkt=None, exp_pkt=None,
+ vlan_vid=-1, pkt=None, exp_pkt=None,
action_list=None):
"""
Packet-out test on single TCP packet
@@ -672,7 +672,7 @@
"""
if pkt is None:
- pkt = simple_tcp_packet(dl_vlan_enable=(dl_vlan >= 0), dl_vlan=dl_vlan)
+ pkt = simple_tcp_packet(dl_vlan_enable=(vlan_vid >= 0), vlan_vid=vlan_vid)
msg = of10.message.packet_out()
msg.in_port = ing_port
@@ -719,7 +719,7 @@
logging.debug("Could not generate enough egress ports for test")
return []
-def flow_match_test(parent, port_map, wildcards=None, dl_vlan=-1, pkt=None,
+def flow_match_test(parent, port_map, wildcards=None, vlan_vid=-1, pkt=None,
exp_pkt=None, action_list=None,
max_test=0, egr_count=1, ing_port=False):
"""
@@ -730,7 +730,7 @@
and logging
@param pkt If not None, use this packet for ingress
@param wildcards For flow match entry
- @param dl_vlan If not -1, and pkt is None, create a pkt w/ VLAN tag
+ @param vlan_vid If not -1, and pkt is None, create a pkt w/ VLAN tag
@param exp_pkt If not None, use this as the expected output pkt; els use pkt
@param action_list Additional actions to add to flow mod
@param egr_count Number of egress ports; -1 means get from config w/ dflt 2
@@ -755,7 +755,7 @@
parent.assertTrue(0, "Failed to generate egress port list")
flow_match_test_port_pair(parent, ingress_port, egr_ports,
- wildcards=wildcards, dl_vlan=dl_vlan,
+ wildcards=wildcards, vlan_vid=vlan_vid,
pkt=pkt, exp_pkt=exp_pkt,
action_list=action_list)
test_count += 1
@@ -772,7 +772,7 @@
if ing_port:
egr_ports.append(of10.OFPP_IN_PORT)
flow_match_test_pktout(parent, ingress_port, egr_ports,
- dl_vlan=dl_vlan,
+ vlan_vid=vlan_vid,
pkt=pkt, exp_pkt=exp_pkt,
action_list=action_list)
@@ -816,23 +816,23 @@
if field_to_mod in ['pktlen']:
return None
- if field_to_mod == 'dl_dst':
+ if field_to_mod == 'eth_dst':
act = of10.action.action_set_dl_dst()
- act.dl_addr = of10.parse.parse_mac(mod_field_vals['dl_dst'])
- elif field_to_mod == 'dl_src':
+ act.dl_addr = of10.parse.parse_mac(mod_field_vals['eth_dst'])
+ elif field_to_mod == 'eth_src':
act = of10.action.action_set_dl_src()
- act.dl_addr = of10.parse.parse_mac(mod_field_vals['dl_src'])
+ act.dl_addr = of10.parse.parse_mac(mod_field_vals['eth_src'])
elif field_to_mod == 'dl_vlan_enable':
if not mod_field_vals['dl_vlan_enable']: # Strip VLAN tag
act = of10.action.action_strip_vlan()
- # Add VLAN tag is handled by dl_vlan field
+ # Add VLAN tag is handled by vlan_vid field
# Will return None in this case
- elif field_to_mod == 'dl_vlan':
+ elif field_to_mod == 'vlan_vid':
act = of10.action.action_set_vlan_vid()
- act.vlan_vid = mod_field_vals['dl_vlan']
- elif field_to_mod == 'dl_vlan_pcp':
+ act.vlan_vid = mod_field_vals['vlan_vid']
+ elif field_to_mod == 'vlan_pcp':
act = of10.action.action_set_vlan_pcp()
- act.vlan_pcp = mod_field_vals['dl_vlan_pcp']
+ act.vlan_pcp = mod_field_vals['vlan_pcp']
elif field_to_mod == 'ip_src':
act = of10.action.action_set_nw_src()
act.nw_addr = of10.parse.parse_ip(mod_field_vals['ip_src'])
@@ -878,11 +878,11 @@
base_pkt_params = {}
base_pkt_params['pktlen'] = 100
- base_pkt_params['dl_dst'] = '00:DE:F0:12:34:56'
- base_pkt_params['dl_src'] = '00:23:45:67:89:AB'
+ base_pkt_params['eth_dst'] = '00:DE:F0:12:34:56'
+ base_pkt_params['eth_src'] = '00:23:45:67:89:AB'
base_pkt_params['dl_vlan_enable'] = False
- base_pkt_params['dl_vlan'] = 2
- base_pkt_params['dl_vlan_pcp'] = 0
+ base_pkt_params['vlan_vid'] = 2
+ base_pkt_params['vlan_pcp'] = 0
base_pkt_params['ip_src'] = '192.168.0.1'
base_pkt_params['ip_dst'] = '192.168.0.2'
base_pkt_params['ip_tos'] = 0
@@ -897,11 +897,11 @@
mod_pkt_params = {}
mod_pkt_params['pktlen'] = 100
- mod_pkt_params['dl_dst'] = '00:21:0F:ED:CB:A9'
- mod_pkt_params['dl_src'] = '00:ED:CB:A9:87:65'
+ mod_pkt_params['eth_dst'] = '00:21:0F:ED:CB:A9'
+ mod_pkt_params['eth_src'] = '00:ED:CB:A9:87:65'
mod_pkt_params['dl_vlan_enable'] = False
- mod_pkt_params['dl_vlan'] = 3
- mod_pkt_params['dl_vlan_pcp'] = 7
+ mod_pkt_params['vlan_vid'] = 3
+ mod_pkt_params['vlan_pcp'] = 7
mod_pkt_params['ip_src'] = '10.20.30.40'
mod_pkt_params['ip_dst'] = '50.60.70.80'
mod_pkt_params['ip_tos'] = 0xf0
@@ -926,9 +926,9 @@
if vid:
base_pkt_params['dl_vlan_enable'] = True
- base_pkt_params['dl_vlan'] = vid
- if 'dl_vlan' in mod_fields:
- mod_pkt_params['dl_vlan'] = vid + 1
+ base_pkt_params['vlan_vid'] = vid
+ if 'vlan_vid' in mod_fields:
+ mod_pkt_params['vlan_vid'] = vid + 1
if add_vlan:
base_pkt_params['dl_vlan_enable'] = False
@@ -936,8 +936,8 @@
mod_pkt_params['pktlen'] = base_pkt_params['pktlen'] + 4
mod_fields.append('pktlen')
mod_fields.append('dl_vlan_enable')
- if 'dl_vlan' not in mod_fields:
- mod_fields.append('dl_vlan')
+ if 'vlan_vid' not in mod_fields:
+ mod_fields.append('vlan_vid')
elif strip_vlan:
base_pkt_params['dl_vlan_enable'] = True
mod_pkt_params['dl_vlan_enable'] = False
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index f090d20..9f5278d 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -40,7 +40,7 @@
match = parse.packet_to_flow_match(pkt_exactflow)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
match.in_port = of_ports[0]
- #match.nw_src = 1
+ #match.ipv4_src = 1
match.wildcards=0
match_send_flowadd(self, match, priority, of_ports[1])
return (pkt_exactflow,match)
@@ -53,7 +53,7 @@
match = parse.packet_to_flow_match(pkt_exactflow)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
match.in_port = of_ports[0]
- #match.nw_src = 1
+ #match.ipv4_src = 1
match.wildcards=0
match_send_flowadd(self, match, priority, of_ports[2])
return (pkt_exactflow,match)
@@ -67,7 +67,7 @@
match1 = parse.packet_to_flow_match(pkt_wildcardsrc)
self.assertTrue(match1 is not None, "Could not generate flow match from pkt")
match1.in_port = of_ports[0]
- #match1.nw_src = 1
+ #match1.ipv4_src = 1
match1.wildcards = ofp.OFPFW_DL_SRC
match_send_flowadd(self, match1, priority, of_ports[1])
return (pkt_wildcardsrc,match1)
@@ -76,7 +76,7 @@
#Generate Match_Ethernet_SrC_Address flow
#Create a simple tcp packet and generate match on ethernet src address flow
- pkt_MatchSrc = simple_eth_packet(dl_src='00:01:01:01:01:01')
+ pkt_MatchSrc = simple_eth_packet(eth_src='00:01:01:01:01:01')
match = parse.packet_to_flow_match(pkt_MatchSrc)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_DL_SRC
@@ -87,7 +87,7 @@
#Generate Match_Ethernet_Dst_Address flow
#Create a simple tcp packet and generate match on ethernet dst address flow
- pkt_matchdst = simple_eth_packet(dl_dst='00:01:01:01:01:01')
+ pkt_matchdst = simple_eth_packet(eth_dst='00:01:01:01:01:01')
match = parse.packet_to_flow_match(pkt_matchdst)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -136,7 +136,7 @@
#Generate Match_Vlan_Id
#Create a simple tcp packet and generate match on ethernet dst address flow
- pkt_matchvlanid = simple_tcp_packet(dl_vlan_enable=True,dl_vlan=1)
+ pkt_matchvlanid = simple_tcp_packet(dl_vlan_enable=True,vlan_vid=1)
match = parse.packet_to_flow_match(pkt_matchvlanid)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -148,7 +148,7 @@
#Generate Match_Vlan_Priority
#Create a simple tcp packet and generate match on ethernet dst address flow
- pkt_matchvlanpcp = simple_tcp_packet(dl_vlan_enable=True,dl_vlan=1,dl_vlan_pcp=5)
+ pkt_matchvlanpcp = simple_tcp_packet(dl_vlan_enable=True,vlan_vid=1,vlan_pcp=5)
match = parse.packet_to_flow_match(pkt_matchvlanpcp)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -161,7 +161,7 @@
#Generate Match_Mul_L2 flow
#Create a simple eth packet and generate match on ethernet protocol flow
- pkt_mulL2 = simple_eth_packet(dl_type=0x88cc,dl_src='00:01:01:01:01:01',dl_dst='00:01:01:01:01:02')
+ pkt_mulL2 = simple_eth_packet(eth_type=0x88cc,eth_src='00:01:01:01:01:01',eth_dst='00:01:01:01:01:02')
match = parse.packet_to_flow_match(pkt_mulL2)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -308,7 +308,7 @@
#Generate a Match_Ethernet_Type flow
#Create a simple tcp packet and generate match on ethernet type flow
- pkt_matchtype = simple_eth_packet(dl_type=0x88cc)
+ pkt_matchtype = simple_eth_packet(eth_type=0x88cc)
match = parse.packet_to_flow_match(pkt_matchtype)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
diff --git a/tests/actions.py b/tests/actions.py
index 5b9828c..68b2e1b 100644
--- a/tests/actions.py
+++ b/tests/actions.py
@@ -439,7 +439,7 @@
len_w_vid = 104
pkt = simple_tcp_packet(pktlen=len_wo_vid)
exp_pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True,
- dl_vlan=new_vid,dl_vlan_pcp=0)
+ vlan_vid=new_vid,vlan_pcp=0)
vid_act = ofp.action.set_vlan_vid()
vid_act.vlan_vid = new_vid
@@ -475,8 +475,8 @@
#Create a tagged packet with old_vid to be sent, and expected packet with new_vid
old_vid = 2
new_vid = 3
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=old_vid)
- exp_pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=new_vid)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=old_vid)
+ exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=new_vid)
vid_act = ofp.action.set_vlan_vid()
vid_act.vlan_vid = new_vid
@@ -514,7 +514,7 @@
vlan_pcp = 1
pktlen = 64 if config["minsize"] < 64 else config["minsize"]
pkt = simple_tcp_packet(pktlen=pktlen)
- exp_pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vlan_id,dl_vlan_pcp=vlan_pcp, pktlen=pktlen + 4)
+ exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vlan_id,vlan_pcp=vlan_pcp, pktlen=pktlen + 4)
act = ofp.action.set_vlan_pcp()
act.vlan_pcp = vlan_pcp
@@ -552,8 +552,8 @@
vid = 123
old_vlan_pcp = 2
new_vlan_pcp = 3
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid, dl_vlan_pcp=old_vlan_pcp)
- exp_pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid, dl_vlan_pcp=new_vlan_pcp)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=old_vlan_pcp)
+ exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=new_vlan_pcp)
vid_act = ofp.action.set_vlan_pcp()
vid_act.vlan_pcp = new_vlan_pcp
@@ -587,8 +587,8 @@
skip_message_emit(self, "modify_l2_src test skipped")
return
- #Create packet to be sent and expected packet with dl_src set to specified value
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_src'],
+ #Create packet to be sent and expected packet with eth_src set to specified value
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_src'],
check_test_params=True)
#Insert flow with action -- set src address, Send packet matching the flow, Verify recieved packet is expected packet
@@ -621,8 +621,8 @@
skip_message_emit(self, "modify_l2_dst test skipped")
return
- #Create packet to be sent and expected packet with dl_src set to specified value
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_dst'],
+ #Create packet to be sent and expected packet with eth_src set to specified value
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'],
check_test_params=True)
#Insert flow with action -- set dst address, Send packet matching the flow, Verify recieved packet is expected packet
@@ -654,7 +654,7 @@
skip_message_emit(self, "modify_l3_src test")
return
- #Create packet to be sent and expected packet with nw_src set to specified value
+ #Create packet to be sent and expected packet with ipv4_src set to specified value
(pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['ip_src'],
check_test_params=True)
@@ -687,7 +687,7 @@
skip_message_emit(self, "modify_l3_dst test skipped")
return
- #Create packet to be sent and expected packet with nw_dst set to specified value
+ #Create packet to be sent and expected packet with ipv4_dst set to specified value
(pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['ip_dst'],
check_test_params=True)
diff --git a/tests/basic.py b/tests/basic.py
index 54aea3a..b2fe483 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -84,7 +84,7 @@
for of_port in config["port_map"].keys():
for pkt, pt in [
(simple_tcp_packet(), "simple TCP packet"),
- (simple_tcp_packet(dl_vlan_enable=True,dl_vlan=vid,pktlen=108),
+ (simple_tcp_packet(dl_vlan_enable=True,vlan_vid=vid,pktlen=108),
"simple tagged TCP packet"),
(simple_eth_packet(), "simple Ethernet packet"),
(simple_eth_packet(pktlen=40), "tiny Ethernet packet")]:
@@ -133,7 +133,7 @@
of_ports = config["port_map"].keys()
d_port = of_ports[0]
- pkt = simple_eth_packet(dl_dst='ff:ff:ff:ff:ff:ff')
+ pkt = simple_eth_packet(eth_dst='ff:ff:ff:ff:ff:ff')
logging.info("BCast Leak Test, send to port %s" % d_port)
self.dataplane.send(d_port, str(pkt))
diff --git a/tests/caps.py b/tests/caps.py
index 8d7779e..76147d7 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -35,7 +35,7 @@
for port in of_ports:
break;
match.in_port = port
- match.nw_src = 1
+ match.ipv4_src = 1
request = ofp.message.flow_mod()
count_check = 101 # fixme: better way to determine this.
if is_exact:
@@ -63,7 +63,7 @@
logging.info("Check every " + str(count_check) + " inserts")
while True:
- request.match.nw_src += 1
+ request.match.ipv4_src += 1
obj.controller.message_send(request)
flow_count += 1
if flow_count % count_check == 0:
diff --git a/tests/flow_matches.py b/tests/flow_matches.py
index 56fd3a7..721d68b 100644
--- a/tests/flow_matches.py
+++ b/tests/flow_matches.py
@@ -50,11 +50,11 @@
wildcard_all(self,of_ports)
#check for different match fields and verify packet implements the action specified in the flow
- pkt1 = simple_tcp_packet(dl_src="00:01:01:01:01:01");
+ pkt1 = simple_tcp_packet(eth_src="00:01:01:01:01:01");
self.dataplane.send(of_ports[0], str(pkt1))
receive_pkt_check(self.dataplane,pkt1,[yes_ports],no_ports,self)
- pkt2 = simple_tcp_packet(dl_dst="00:01:01:01:01:01");
+ pkt2 = simple_tcp_packet(eth_dst="00:01:01:01:01:01");
self.dataplane.send(of_ports[0], str(pkt2))
receive_pkt_check(self.dataplane,pkt2,[yes_ports],no_ports,self)
@@ -113,7 +113,7 @@
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
#Sending non matching packet , verify Packetin event gets triggered.
- pkt2 = simple_eth_packet(dl_src='00:01:01:01:01:02');
+ pkt2 = simple_eth_packet(eth_src='00:01:01:01:01:02');
self.dataplane.send(of_ports[0], str(pkt2))
(response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN,timeout=4)
@@ -152,7 +152,7 @@
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
#Send Non-matching packet
- pkt2 = simple_eth_packet(dl_dst='00:01:01:01:01:02');
+ pkt2 = simple_eth_packet(eth_dst='00:01:01:01:01:02');
self.dataplane.send(of_ports[0], str(pkt2))
#Verify PacketIn event gets triggered
@@ -193,7 +193,7 @@
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
#Sending non matching packet ,
- pkt2 = simple_eth_packet(dl_type=0x0806);
+ pkt2 = simple_eth_packet(eth_type=0x0806);
self.dataplane.send(of_ports[0], str(pkt2))
#verify Packetin event gets triggered.
@@ -271,7 +271,7 @@
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
#Send Non-matching packet, i.e packet with different Vlan Id
- pkt2 = simple_tcp_packet(dl_vlan_enable=True,dl_vlan=4);
+ pkt2 = simple_tcp_packet(dl_vlan_enable=True,vlan_vid=4);
self.dataplane.send(of_ports[0], str(pkt2))
#Verify PacketIn event gets triggered
@@ -311,7 +311,7 @@
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
#Send tagged packet with same vlan_id but different vlan priority
- pkt2 = simple_tcp_packet(dl_vlan_enable=True,dl_vlan=1,dl_vlan_pcp=20);
+ pkt2 = simple_tcp_packet(dl_vlan_enable=True,vlan_vid=1,vlan_pcp=20);
self.dataplane.send(of_ports[0], str(pkt2))
#Verify Packet_In event gets triggered
@@ -343,28 +343,28 @@
(pkt,match) = match_mul_l2(self,of_ports)
- #Send eth packet matching the dl_type field, verify it implements the action
+ #Send eth packet matching the eth_type field, verify it implements the action
self.dataplane.send(of_ports[0], str(pkt))
#Verify packet implements the action specified in the flow
receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
- #Sending non matching packet (only dl_dst is different) , verify Packetin event gets triggered.
- pkt2 = simple_eth_packet(dl_type=0x88cc,dl_src='00:01:01:01:01:01',dl_dst='00:01:01:02:01:01');
+ #Sending non matching packet (only eth_dst is different) , verify Packetin event gets triggered.
+ pkt2 = simple_eth_packet(eth_type=0x88cc,eth_src='00:01:01:01:01:01',eth_dst='00:01:01:02:01:01');
self.dataplane.send(of_ports[0], str(pkt2))
(response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN,timeout=4)
self.assertTrue(response is not None, "PacketIn not received for non matching packet")
- #Sending non matching packet (only dl_src is different) , verify Packetin event gets triggered.
- pkt2 = simple_eth_packet(dl_type=0x88cc,dl_src='00:01:01:01:01:02',dl_dst='00:01:01:01:01:02');
+ #Sending non matching packet (only eth_src is different) , verify Packetin event gets triggered.
+ pkt2 = simple_eth_packet(eth_type=0x88cc,eth_src='00:01:01:01:01:02',eth_dst='00:01:01:01:01:02');
self.dataplane.send(of_ports[0], str(pkt2))
(response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN,timeout=4)
self.assertTrue(response is not None, "PacketIn not received for non matching packet")
#Sending non matching packet (only ether_type is different) , verify Packetin event gets triggered.
- pkt2 = simple_eth_packet(dl_type=0x0806,dl_src='00:01:01:01:01:01',dl_dst='00:01:01:01:01:02');
+ pkt2 = simple_eth_packet(eth_type=0x0806,eth_src='00:01:01:01:01:01',eth_dst='00:01:01:01:01:02');
self.dataplane.send(of_ports[0], str(pkt2))
#Verify packet_in event gets triggered
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 2d5c7b5..0784040 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -353,41 +353,41 @@
and self.match.in_port != x.match.in_port:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_DST) == 0 \
- and self.match.dl_dst != x.match.dl_dst:
+ and self.match.eth_dst != x.match.eth_dst:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_SRC) == 0 \
- and self.match.dl_src != x.match.dl_src:
+ and self.match.eth_src != x.match.eth_src:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN) == 0 \
- and self.match.dl_vlan != x.match.dl_vlan:
+ and self.match.vlan_vid != x.match.vlan_vid:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN_PCP) == 0 \
- and self.match.dl_vlan_pcp != x.match.dl_vlan_pcp:
+ and self.match.vlan_pcp != x.match.vlan_pcp:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_TYPE) == 0 \
- and self.match.dl_type != x.match.dl_type:
+ and self.match.eth_type != x.match.eth_type:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_TOS) == 0 \
- and self.match.nw_tos != x.match.nw_tos:
+ and self.match.ip_dscp != x.match.ip_dscp:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_PROTO) == 0 \
- and self.match.nw_proto != x.match.nw_proto:
+ and self.match.ip_proto != x.match.ip_proto:
return False
n = wildcard_get(self.match.wildcards, ofp.OFPFW_NW_SRC_MASK)
if n < 32:
m = ~((1 << n) - 1)
- if (self.match.nw_src & m) != (x.match.nw_src & m):
+ if (self.match.ipv4_src & m) != (x.match.ipv4_src & m):
return False
n = wildcard_get(self.match.wildcards, ofp.OFPFW_NW_DST_MASK)
if n < 32:
m = ~((1 << n) - 1)
- if (self.match.nw_dst & m) != (x.match.nw_dst & m):
+ if (self.match.ipv4_dst & m) != (x.match.ipv4_dst & m):
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_SRC) == 0 \
- and self.match.tp_src != x.match.tp_src:
+ and self.match.tcp_src != x.match.tcp_src:
return False
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_DST) == 0 \
- and self.match.tp_dst != x.match.tp_dst:
+ and self.match.tcp_dst != x.match.tcp_dst:
return False
return True
@@ -431,37 +431,37 @@
if wildcard_get(self.match.wildcards, ofp.OFPFW_IN_PORT) == 0:
result = result + (", in_port=%d" % (self.match.in_port))
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_DST) == 0:
- result = result + (", dl_dst=%s" \
- % (dl_addr_to_str(self.match.dl_dst)) \
+ result = result + (", eth_dst=%s" \
+ % (dl_addr_to_str(self.match.eth_dst)) \
)
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_SRC) == 0:
- result = result + (", dl_src=%s" \
- % (dl_addr_to_str(self.match.dl_src)) \
+ result = result + (", eth_src=%s" \
+ % (dl_addr_to_str(self.match.eth_src)) \
)
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN) == 0:
- result = result + (", dl_vlan=%d" % (self.match.dl_vlan))
+ result = result + (", vlan_vid=%d" % (self.match.vlan_vid))
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN_PCP) == 0:
- result = result + (", dl_vlan_pcp=%d" % (self.match.dl_vlan_pcp))
+ result = result + (", vlan_pcp=%d" % (self.match.vlan_pcp))
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_TYPE) == 0:
- result = result + (", dl_type=0x%x" % (self.match.dl_type))
+ result = result + (", eth_type=0x%x" % (self.match.eth_type))
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_TOS) == 0:
- result = result + (", nw_tos=0x%x" % (self.match.nw_tos))
+ result = result + (", ip_dscp=0x%x" % (self.match.ip_dscp))
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_PROTO) == 0:
- result = result + (", nw_proto=%d" % (self.match.nw_proto))
+ result = result + (", ip_proto=%d" % (self.match.ip_proto))
n = wildcard_get(self.match.wildcards, ofp.OFPFW_NW_SRC_MASK)
if n < 32:
- result = result + (", nw_src=%s" % \
- (ip_addr_to_str(self.match.nw_src, 32 - n)) \
+ result = result + (", ipv4_src=%s" % \
+ (ip_addr_to_str(self.match.ipv4_src, 32 - n)) \
)
n = wildcard_get(self.match.wildcards, ofp.OFPFW_NW_DST_MASK)
if n < 32:
- result = result + (", nw_dst=%s" % \
- (ip_addr_to_str(self.match.nw_dst, 32 - n)) \
+ result = result + (", ipv4_dst=%s" % \
+ (ip_addr_to_str(self.match.ipv4_dst, 32 - n)) \
)
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_SRC) == 0:
- result = result + (", tp_src=%d" % self.match.tp_src)
+ result = result + (", tcp_src=%d" % self.match.tcp_src)
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_DST) == 0:
- result = result + (", tp_dst=%d" % self.match.tp_dst)
+ result = result + (", tcp_dst=%d" % self.match.tcp_dst)
return result
def __eq__(self, x):
@@ -551,7 +551,7 @@
act.nw_addr = fi.rand_ip_addr()
elif a == ofp.OFPAT_SET_NW_TOS:
act = ofp.action.set_nw_tos()
- act.nw_tos = fi.rand_ip_tos()
+ act.ip_dscp = fi.rand_ip_tos()
elif a == ofp.OFPAT_SET_TP_SRC:
act = ofp.action.set_tp_src()
act.tp_port = fi.rand_l4_port()
@@ -666,7 +666,7 @@
self.actions.append(act)
elif a == ofp.OFPAT_SET_NW_TOS:
act = ofp.action.set_nw_tos()
- act.nw_tos = fi.rand_ip_tos()
+ act.ip_dscp = fi.rand_ip_tos()
self.actions.append(act)
elif a == ofp.OFPAT_SET_TP_SRC:
act = ofp.action.set_tp_src()
@@ -730,7 +730,7 @@
or exact \
or flip_coin() \
):
- self.match.dl_dst = fi.rand_dl_addr()
+ self.match.eth_dst = fi.rand_dl_addr()
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_DST, \
@@ -742,7 +742,7 @@
or exact \
or flip_coin() \
):
- self.match.dl_src = fi.rand_dl_addr()
+ self.match.eth_src = fi.rand_dl_addr()
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_SRC, \
@@ -754,7 +754,7 @@
or exact \
or flip_coin() \
):
- self.match.dl_vlan = fi.rand_vlan()
+ self.match.vlan_vid = fi.rand_vlan()
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_VLAN, \
@@ -766,7 +766,7 @@
or exact \
or flip_coin() \
):
- self.match.dl_vlan_pcp = random.randint(0, (1 << 3) - 1)
+ self.match.vlan_pcp = random.randint(0, (1 << 3) - 1)
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_VLAN_PCP, \
@@ -778,7 +778,7 @@
or exact \
or flip_coin() \
):
- self.match.dl_type = fi.rand_ethertype()
+ self.match.eth_type = fi.rand_ethertype()
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
@@ -799,11 +799,11 @@
n \
)
if n < 32:
- self.match.nw_src = fi.rand_ip_addr() & ~((1 << n) - 1)
+ self.match.ipv4_src = fi.rand_ip_addr() & ~((1 << n) - 1)
# Specifying any IP address match other than all bits
# don't care requires that Ethertype is one of {IP, ARP}
if flip_coin():
- self.match.dl_type = rand_pick([0x0800, 0x0806])
+ self.match.eth_type = rand_pick([0x0800, 0x0806])
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
@@ -823,11 +823,11 @@
n \
)
if n < 32:
- self.match.nw_dst = fi.rand_ip_addr() & ~((1 << n) - 1)
+ self.match.ipv4_dst = fi.rand_ip_addr() & ~((1 << n) - 1)
# Specifying any IP address match other than all bits
# don't care requires that Ethertype is one of {IP, ARP}
if flip_coin():
- self.match.dl_type = rand_pick([0x0800, 0x0806])
+ self.match.eth_type = rand_pick([0x0800, 0x0806])
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
@@ -838,10 +838,10 @@
or exact \
or flip_coin() \
):
- self.match.nw_tos = fi.rand_ip_tos()
+ self.match.ip_dscp = fi.rand_ip_tos()
# Specifying a TOS value requires that Ethertype is IP
if flip_coin():
- self.match.dl_type = 0x0800
+ self.match.eth_type = 0x0800
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
@@ -852,16 +852,16 @@
1 \
)
- # Known issue on OVS with specifying nw_proto w/o dl_type as IP
+ # Known issue on OVS with specifying ip_proto w/o eth_type as IP
if wildcard_get(wildcards_force, ofp.OFPFW_NW_PROTO) == 0 \
and (wildcard_get(valid_wildcards, ofp.OFPFW_NW_PROTO) == 0 \
or exact \
or flip_coin() \
):
- self.match.nw_proto = fi.rand_ip_proto()
+ self.match.ip_proto = fi.rand_ip_proto()
# Specifying an IP protocol requires that Ethertype is IP
if flip_coin():
- self.match.dl_type = 0x0800
+ self.match.eth_type = 0x0800
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
@@ -877,23 +877,23 @@
or exact\
or flip_coin() \
):
- self.match.tp_src = fi.rand_l4_port()
+ self.match.tcp_src = fi.rand_l4_port()
# Specifying a L4 port requires that IP protcol is
# one of {ICMP, TCP, UDP}
if flip_coin():
- self.match.nw_proto = rand_pick([1, 6, 17])
+ self.match.ip_proto = rand_pick([1, 6, 17])
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_NW_PROTO, \
0 \
)
# Specifying a L4 port requirues that Ethertype is IP
- self.match.dl_type = 0x0800
+ self.match.eth_type = 0x0800
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
)
- if self.match.nw_proto == 1:
- self.match.tp_src = self.match.tp_src & 0xff
+ if self.match.ip_proto == 1:
+ self.match.tcp_src = self.match.tcp_src & 0xff
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_TP_SRC, \
@@ -905,23 +905,23 @@
or exact \
or flip_coin() \
):
- self.match.tp_dst = fi.rand_l4_port()
+ self.match.tcp_dst = fi.rand_l4_port()
# Specifying a L4 port requires that IP protcol is
# one of {ICMP, TCP, UDP}
if flip_coin():
- self.match.nw_proto = rand_pick([1, 6, 17])
+ self.match.ip_proto = rand_pick([1, 6, 17])
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_NW_PROTO, \
0 \
)
# Specifying a L4 port requirues that Ethertype is IP
- self.match.dl_type = 0x0800
+ self.match.eth_type = 0x0800
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_DL_TYPE, \
0 \
)
- if self.match.nw_proto == 1:
- self.match.tp_dst = self.match.tp_dst & 0xff
+ if self.match.ip_proto == 1:
+ self.match.tcp_dst = self.match.tcp_dst & 0xff
else:
self.match.wildcards = wildcard_set(self.match.wildcards, \
ofp.OFPFW_TP_DST, \
@@ -947,7 +947,7 @@
# Return flow cfg in canonical form
# - There are dependencies between flow qualifiers, e.g. it only makes
- # sense to qualify nw_proto if dl_type is qualified to be 0x0800 (IP).
+ # sense to qualify ip_proto if eth_type is qualified to be 0x0800 (IP).
# The canonical form of flow match criteria will "wildcard out"
# all such cases.
def canonical(self):
@@ -960,10 +960,10 @@
)
if wildcard_get(result.match.wildcards, ofp.OFPFW_DL_TYPE) != 0 \
- or result.match.dl_type not in [0x0800, 0x0806]:
+ or result.match.eth_type not in [0x0800, 0x0806]:
# dl_tyoe is wildcarded, or specified as something other
# than IP or ARP
- # => nw_src, nw_dst, nw_proto cannot be specified,
+ # => ipv4_src, ipv4_dst, ip_proto cannot be specified,
# must be wildcarded
result.match.wildcards = wildcard_set(result.match.wildcards, \
ofp.OFPFW_NW_SRC_MASK, \
@@ -979,9 +979,9 @@
)
if wildcard_get(result.match.wildcards, ofp.OFPFW_DL_TYPE) != 0 \
- or result.match.dl_type != 0x0800:
- # dl_type is wildcarded, or specified as something other than IP
- # => nw_tos, tp_src and tp_dst cannot be specified,
+ or result.match.eth_type != 0x0800:
+ # eth_type is wildcarded, or specified as something other than IP
+ # => ip_dscp, tcp_src and tcp_dst cannot be specified,
# must be wildcarded
result.match.wildcards = wildcard_set(result.match.wildcards, \
ofp.OFPFW_NW_TOS, \
@@ -1009,10 +1009,10 @@
)
if wildcard_get(result.match.wildcards, ofp.OFPFW_NW_PROTO) != 0 \
- or result.match.nw_proto not in [1, 6, 17]:
- # nw_proto is wildcarded, or specified as something other than ICMP,
+ or result.match.ip_proto not in [1, 6, 17]:
+ # ip_proto is wildcarded, or specified as something other than ICMP,
# TCP or UDP
- # => tp_src and tp_dst cannot be specified, must be wildcarded
+ # => tcp_src and tcp_dst cannot be specified, must be wildcarded
result.match.wildcards = wildcard_set(result.match.wildcards, \
ofp.OFPFW_TP_SRC, \
1 \
@@ -1038,43 +1038,43 @@
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_DL_VLAN) == 0:
- if self.match.dl_vlan != x.match.dl_vlan:
+ if self.match.vlan_vid != x.match.vlan_vid:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_SRC) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_DL_SRC) == 0:
- if self.match.dl_src != x.match.dl_src:
+ if self.match.eth_src != x.match.eth_src:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_DST) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_DL_DST) == 0:
- if self.match.dl_dst != x.match.dl_dst:
+ if self.match.eth_dst != x.match.eth_dst:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_TYPE) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_DL_TYPE) == 0:
- if self.match.dl_type != x.match.dl_type:
+ if self.match.eth_type != x.match.eth_type:
return False # Both specified, and not equal
elif delf:
return False # Recevier more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_PROTO) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_NW_PROTO) == 0:
- if self.match.nw_proto != x.match.nw_proto:
+ if self.match.ip_proto != x.match.ip_proto:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_SRC) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_TP_SRC) == 0:
- if self.match.tp_src != x.match.tp_src:
+ if self.match.tcp_src != x.match.tcp_src:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_TP_DST) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_TP_DST) == 0:
- if self.match.tp_dst != x.match.tp_dst:
+ if self.match.tcp_dst != x.match.tcp_dst:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
@@ -1084,7 +1084,7 @@
return False # Receiver more specific
if (na < 32 and nb < 32):
m = ~((1 << na) - 1) & ~((1 << nb) - 1)
- if (self.match.nw_src & m) != (x.match.nw_src & m):
+ if (self.match.ipv4_src & m) != (x.match.ipv4_src & m):
return False # Overlapping bits not equal
na = wildcard_get(self.match.wildcards, ofp.OFPFW_NW_DST_MASK)
nb = wildcard_get(x.match.wildcards, ofp.OFPFW_NW_DST_MASK)
@@ -1092,17 +1092,17 @@
return False # Receiver more specific
if (na < 32 and nb < 32):
m = ~((1 << na) - 1) & ~((1 << nb) - 1)
- if (self.match.nw_dst & m) != (x.match.nw_dst & m):
+ if (self.match.ipv4_dst & m) != (x.match.ipv4_dst & m):
return False # Overlapping bits not equal
if wildcard_get(self.match.wildcards, ofp.OFPFW_DL_VLAN_PCP) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_DL_VLAN_PCP) == 0:
- if self.match.dl_vlan_pcp != x.match.dl_vlan_pcp:
+ if self.match.vlan_pcp != x.match.vlan_pcp:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
if wildcard_get(self.match.wildcards, ofp.OFPFW_NW_TOS) == 0:
if wildcard_get(x.match.wildcards, ofp.OFPFW_NW_TOS) == 0:
- if self.match.nw_tos != x.match.nw_tos:
+ if self.match.ip_dscp != x.match.ip_dscp:
return False # Both specified, and not equal
elif delf:
return False # Receiver more specific
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index 9f71616..8520638 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -261,7 +261,7 @@
pkt1 = simple_tcp_packet()
flow_mod_msg1 = self.buildFlowModMsg(pkt1, ingress_port, egress_port1)
- pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
+ pkt2 = simple_tcp_packet(eth_src='0:7:7:7:7:7')
flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
logging.info("Inserting flow1")
@@ -372,7 +372,7 @@
pkt1 = simple_tcp_packet()
flow_mod_msg1 = self.buildFlowModMsg(pkt1, ingress_port, egress_port1)
- pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
+ pkt2 = simple_tcp_packet(eth_src='0:7:7:7:7:7')
flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
logging.info("Inserting flow1")
diff --git a/tests/load.py b/tests/load.py
index 76c3f45..7179914 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -211,8 +211,8 @@
for i in range(num_flows):
match = ofp.ofp_match()
match.wildcards = ofp.OFPFW_ALL & ~ofp.OFPFW_DL_VLAN & ~ofp.OFPFW_DL_DST
- match.dl_vlan = ofp.OFP_VLAN_NONE
- match.dl_dst = [0, 1, 2, 3, i / 256, i % 256]
+ match.vlan_vid = ofp.OFP_VLAN_NONE
+ match.eth_dst = [0, 1, 2, 3, i / 256, i % 256]
act = ofp.action.output()
act.port = ofp.OFPP_CONTROLLER
request = ofp.message.flow_mod()
diff --git a/tests/pktact.py b/tests/pktact.py
index bd3e79f..b43c7f6 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -924,7 +924,7 @@
def runTest(self):
vid = test_param_get('vid', default=TEST_VID_DEFAULT)
- flow_match_test(self, config["port_map"], dl_vlan=vid)
+ flow_match_test(self, config["port_map"], vlan_vid=vid)
@disabled
class ExactMatchTaggedMany(BaseMatchCase):
@@ -934,10 +934,10 @@
def runTest(self):
for vid in range(2,100,10):
- flow_match_test(self, config["port_map"], dl_vlan=vid, max_test=5)
+ flow_match_test(self, config["port_map"], vlan_vid=vid, max_test=5)
for vid in range(100,4000,389):
- flow_match_test(self, config["port_map"], dl_vlan=vid, max_test=5)
- flow_match_test(self, config["port_map"], dl_vlan=4094, max_test=5)
+ flow_match_test(self, config["port_map"], vlan_vid=vid, max_test=5)
+ flow_match_test(self, config["port_map"], vlan_vid=4094, max_test=5)
class SingleWildcardMatchPriority(BaseMatchCase):
"""
@@ -1161,11 +1161,11 @@
wc |= required_wildcards(self)
if wc & ofp.OFPFW_DL_VLAN:
# Set nonzero VLAN id to avoid sending priority-tagged packet
- dl_vlan = vid
+ vlan_vid = vid
else:
- dl_vlan = -1
+ vlan_vid = -1
flow_match_test(self, config["port_map"], wildcards=wc,
- dl_vlan=dl_vlan, max_test=10)
+ vlan_vid=vlan_vid, max_test=10)
class SingleWildcardMatchTagged(BaseMatchCase):
"""
@@ -1175,7 +1175,7 @@
vid = test_param_get('vid', default=TEST_VID_DEFAULT)
for wc in WILDCARD_VALUES:
wc |= required_wildcards(self)
- flow_match_test(self, config["port_map"], wildcards=wc, dl_vlan=vid,
+ flow_match_test(self, config["port_map"], wildcards=wc, vlan_vid=vid,
max_test=10)
class AllExceptOneWildcardMatch(BaseMatchCase):
@@ -1195,11 +1195,11 @@
all_exp_one_wildcard |= required_wildcards(self)
if all_exp_one_wildcard & ofp.OFPFW_DL_VLAN:
# Set nonzero VLAN id to avoid sending priority-tagged packet
- dl_vlan = vid
+ vlan_vid = vid
else:
- dl_vlan = -1
+ vlan_vid = -1
flow_match_test(self, config["port_map"], wildcards=all_exp_one_wildcard,
- dl_vlan=dl_vlan)
+ vlan_vid=vlan_vid)
class AllExceptOneWildcardMatchTagged(BaseMatchCase):
"""
@@ -1210,7 +1210,7 @@
for all_exp_one_wildcard in NO_WILDCARD_VALUES:
all_exp_one_wildcard |= required_wildcards(self)
flow_match_test(self, config["port_map"], wildcards=all_exp_one_wildcard,
- dl_vlan=vid)
+ vlan_vid=vid)
class AllWildcardMatch(BaseMatchCase):
"""
@@ -1233,7 +1233,7 @@
def runTest(self):
vid = test_param_get('vid', default=TEST_VID_DEFAULT)
flow_match_test(self, config["port_map"], wildcards=ofp.OFPFW_ALL,
- dl_vlan=vid)
+ vlan_vid=vid)
@group('smoke')
class AddVLANTag(BaseMatchCase):
@@ -1251,7 +1251,7 @@
len_w_vid = 104
pkt = simple_tcp_packet(pktlen=len)
exp_pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True,
- dl_vlan=new_vid)
+ vlan_vid=new_vid)
vid_act = ofp.action.set_vlan_vid()
vid_act.vlan_vid = new_vid
@@ -1281,7 +1281,7 @@
def runTest(self):
vid = test_param_get('vid', default=TEST_VID_DEFAULT)
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid)
of_ports = config["port_map"].keys()
of_ports.sort()
ing_port = of_ports[0]
@@ -1305,8 +1305,8 @@
skip_message_emit(self, "Modify VLAN tag test")
return
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=old_vid)
- exp_pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=new_vid)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=old_vid)
+ exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=new_vid)
vid_act = ofp.action.set_vlan_vid()
vid_act.vlan_vid = new_vid
@@ -1346,9 +1346,9 @@
len_w_vid = 104
untagged_pkt = simple_tcp_packet(pktlen=len_untagged)
tagged_pkt = simple_tcp_packet(pktlen=len_w_vid,
- dl_vlan_enable=True, dl_vlan=old_vid)
+ dl_vlan_enable=True, vlan_vid=old_vid)
exp_pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True,
- dl_vlan=new_vid)
+ vlan_vid=new_vid)
wildcards = (required_wildcards(self) | ofp.OFPFW_DL_VLAN |
ofp.OFPFW_DL_VLAN_PCP)
vid_act = ofp.action.set_vlan_vid()
@@ -1381,8 +1381,8 @@
skip_message_emit(self, "Modify VLAN priority test")
return
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid, dl_vlan_pcp=old_vlan_pcp)
- exp_pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid, dl_vlan_pcp=new_vlan_pcp)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=old_vlan_pcp)
+ exp_pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=vid, vlan_pcp=new_vlan_pcp)
vid_act = ofp.action.set_vlan_pcp()
vid_act.vlan_pcp = new_vlan_pcp
@@ -1403,7 +1403,7 @@
len_w_vid = 104
len = 100
pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True,
- dl_vlan=old_vid)
+ vlan_vid=old_vid)
exp_pkt = simple_tcp_packet(pktlen=len)
vid_act = ofp.action.strip_vlan()
@@ -1425,7 +1425,7 @@
len_w_vid = 104
len_untagged = 100
pkt = simple_tcp_packet(pktlen=len_w_vid, dl_vlan_enable=True,
- dl_vlan=old_vid)
+ vlan_vid=old_vid)
exp_pkt = simple_tcp_packet(pktlen=len_untagged)
wildcards = (required_wildcards(self) | ofp.OFPFW_DL_VLAN |
ofp.OFPFW_DL_VLAN_PCP)
@@ -1441,13 +1441,13 @@
Pass back a dictionary with default packet arguments
"""
args = {}
- args["dl_src"] = '00:23:45:67:89:AB'
+ args["eth_src"] = '00:23:45:67:89:AB'
dl_vlan_enable=False
- dl_vlan=-1
+ vlan_vid=-1
if config["test-params"]["vid"]:
dl_vlan_enable=True
- dl_vlan = config["test-params"]["vid"]
+ vlan_vid = config["test-params"]["vid"]
# Unpack operator is ** on a dictionary
@@ -1463,7 +1463,7 @@
skip_message_emit(self, "ModifyL2Src test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_src'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_src'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2)
@@ -1478,7 +1478,7 @@
skip_message_emit(self, "ModifyL2dst test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_dst'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2)
@@ -1598,7 +1598,7 @@
skip_message_emit(self, "ModifyL2dstMC test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_dst'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2, egr_count=-1)
@@ -1613,7 +1613,7 @@
skip_message_emit(self, "ModifyL2dstIngress test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_dst'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2, egr_count=0,
@@ -1629,7 +1629,7 @@
skip_message_emit(self, "ModifyL2dstMC test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_dst'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_dst'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2, egr_count=-1,
@@ -1645,7 +1645,7 @@
skip_message_emit(self, "ModifyL2SrcMC test")
return
- (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['dl_src'],
+ (pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=['eth_src'],
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
action_list=acts, max_test=2, egr_count=-1)
@@ -1661,7 +1661,7 @@
skip_message_emit(self, "ModifyL2SrcDstMC test")
return
- mod_fields = ['dl_dst', 'dl_src']
+ mod_fields = ['eth_dst', 'eth_src']
(pkt, exp_pkt, acts) = pkt_action_setup(self, mod_fields=mod_fields,
check_test_params=True)
flow_match_test(self, config["port_map"], pkt=pkt, exp_pkt=exp_pkt,
@@ -1678,7 +1678,7 @@
skip_message_emit(self, "ModifyL2DstVIDMC test")
return
- mod_fields = ['dl_dst', 'dl_vlan']
+ mod_fields = ['eth_dst', 'vlan_vid']
(pkt, exp_pkt, acts) = pkt_action_setup(self,
start_field_vals={'dl_vlan_enable':True}, mod_fields=mod_fields,
check_test_params=True)
@@ -1694,11 +1694,11 @@
sup_acts = self.supported_actions
sup_map = {
- "dl_dst" : ofp.OFPAT_SET_DL_DST,
- "dl_src" : ofp.OFPAT_SET_DL_SRC,
+ "eth_dst" : ofp.OFPAT_SET_DL_DST,
+ "eth_src" : ofp.OFPAT_SET_DL_SRC,
"dl_vlan_enable" : ofp.OFPAT_SET_VLAN_VID,
- "dl_vlan" : ofp.OFPAT_SET_VLAN_VID,
- "dl_vlan_pcp" : ofp.OFPAT_SET_VLAN_PCP,
+ "vlan_vid" : ofp.OFPAT_SET_VLAN_VID,
+ "vlan_pcp" : ofp.OFPAT_SET_VLAN_PCP,
"ip_src" : ofp.OFPAT_SET_NW_SRC,
"ip_dst" : ofp.OFPAT_SET_NW_DST,
"ip_tos" : ofp.OFPAT_SET_NW_TOS,
@@ -1910,7 +1910,7 @@
delete_all_flows(self.controller)
- pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=2)
+ pkt = simple_tcp_packet(dl_vlan_enable=True, vlan_vid=2)
ingress_port = of_ports[0]
egress_port = of_ports[1]
@@ -1966,26 +1966,26 @@
wildcards = required_wildcards(self)
# TODO in_port
if not (wildcards & ofp.OFPFW_DL_SRC):
- testField("dl_src", [0xff]*6)
+ testField("eth_src", [0xff]*6)
if not (wildcards & ofp.OFPFW_DL_DST):
- testField("dl_dst", [0xff]*6)
+ testField("eth_dst", [0xff]*6)
if not (wildcards & ofp.OFPFW_DL_TYPE):
- testField("dl_type", 0xffff)
+ testField("eth_type", 0xffff)
if not (wildcards & ofp.OFPFW_DL_VLAN):
- testField("dl_vlan", 0xfff)
- # TODO dl_vlan_pcp
+ testField("vlan_vid", 0xfff)
+ # TODO vlan_pcp
if not (wildcards & ofp.OFPFW_NW_SRC_ALL):
- testField("nw_src", 0xffffffff)
+ testField("ipv4_src", 0xffffffff)
if not (wildcards & ofp.OFPFW_NW_DST_ALL):
- testField("nw_dst", 0xffffffff)
+ testField("ipv4_dst", 0xffffffff)
if not (wildcards & ofp.OFPFW_NW_TOS):
- testField("nw_tos", 0x3f)
+ testField("ip_dscp", 0x3f)
if not (wildcards & ofp.OFPFW_NW_PROTO):
- testField("nw_proto", 0xff)
+ testField("ip_proto", 0xff)
if not (wildcards & ofp.OFPFW_TP_SRC):
- testField("tp_src", 0xffff)
+ testField("tcp_src", 0xffff)
if not (wildcards & ofp.OFPFW_TP_DST):
- testField("tp_dst", 0xffff)
+ testField("tcp_dst", 0xffff)
class DirectBadPacketBase(base_tests.SimpleDataPlane):
"""
@@ -2018,16 +2018,16 @@
match = ofp.ofp_match()
match.wildcards = ofp.OFPFW_ALL
fields = {
- 'dl_dst': ofp.OFPFW_DL_DST,
- 'dl_src': ofp.OFPFW_DL_SRC,
- 'dl_type': ofp.OFPFW_DL_TYPE,
- 'dl_vlan': ofp.OFPFW_DL_VLAN,
- 'nw_src': ofp.OFPFW_NW_SRC_MASK,
- 'nw_dst': ofp.OFPFW_NW_DST_MASK,
- 'nw_tos': ofp.OFPFW_NW_TOS,
- 'nw_proto': ofp.OFPFW_NW_PROTO,
- 'tp_src': ofp.OFPFW_TP_SRC,
- 'tp_dst': ofp.OFPFW_TP_DST,
+ 'eth_dst': ofp.OFPFW_DL_DST,
+ 'eth_src': ofp.OFPFW_DL_SRC,
+ 'eth_type': ofp.OFPFW_DL_TYPE,
+ 'vlan_vid': ofp.OFPFW_DL_VLAN,
+ 'ipv4_src': ofp.OFPFW_NW_SRC_MASK,
+ 'ipv4_dst': ofp.OFPFW_NW_DST_MASK,
+ 'ip_dscp': ofp.OFPFW_NW_TOS,
+ 'ip_proto': ofp.OFPFW_NW_PROTO,
+ 'tcp_src': ofp.OFPFW_TP_SRC,
+ 'tcp_dst': ofp.OFPFW_TP_DST,
}
for key in kwargs:
setattr(match, key, kwargs[key])
@@ -2142,8 +2142,8 @@
pass
def runTestWithProto(self, protoName = 'TCP'):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_tos=0
@@ -2161,7 +2161,7 @@
else:
raise Exception("Passed in unknown proto name")
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
tp(sport=tcp_sport, dport=tcp_dport)
match = packet_to_flow_match(self, match_pkt)
@@ -2178,32 +2178,32 @@
# Try incomplete IP headers
testPacket("Incomplete IP header (1 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:1],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (2 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:2],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (3 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:3],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (12 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:12],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (16 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:16],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (19 bytes)",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto))[0:19],
self.RESULT_NOMATCH,
)
@@ -2213,29 +2213,29 @@
# we initiatlize once with a non-matching full packet and once with a
# matching full packet.
testPacket("Non-Matching TCP packet, warming buffer",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto)/ \
tp(sport=tcp_sport, dport=tcp_dport + 1),
self.RESULT_NOMATCH,
)
testPacket("Missing TCP header, buffer warmed with non-match",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto),
self.RESULT_NOMATCH,
)
testPacket("Matching TCP packet, warming buffer",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto)/ \
tp(sport=tcp_sport, dport=tcp_dport),
self.RESULT_MATCH,
)
testPacket("Missing TCP header, buffer warmed with match",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto),
self.RESULT_NOMATCH,
)
testPacket("Truncated TCP header: 2 bytes",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto)/ \
(str(tp(sport=tcp_sport, dport=tcp_dport))[0:2]),
self.RESULT_NOMATCH,
@@ -2265,27 +2265,27 @@
self.RESULT_NOMATCH,
)
testPacket("Missing TCP header, corrupt ihl",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=0xf, proto=proto),
self.RESULT_NOMATCH,
)
testPacket("Missing TCP header, corrupt total length",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto, len= 100),
self.RESULT_NOMATCH,
)
testPacket("Missing TCP header, corrupt ihl and total length",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=0xf, proto=proto, len=43),
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (12 bytes), corrupt ihl and total length",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto, ihl=10, len=43))[0:12],
self.RESULT_NOMATCH,
)
testPacket("Incomplete IP header (16 bytes), corrupt ihl and total length",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
str(scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto, ihl=10, len=43))[0:16],
self.RESULT_NOMATCH,
)
@@ -2294,7 +2294,7 @@
# destination ports. As that is all we care about during matching, some
# implementations may match and some may drop the packet
testPacket("Incomplete TCP header: src/dst port present",
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, proto=proto)/ \
(str(tp(sport=tcp_sport, dport=tcp_dport))[0:4]),
self.RESULT_ANY,
@@ -2303,7 +2303,7 @@
for i in range(1):
for length in range(40 / 4): # IPv4 options are a maximum of 40 in length
bytes = "".join([("%c" % random.randint(0, 255)) for x in range(length * 4)])
- eth = scapy.Ether(dst=dl_dst, src=dl_src)
+ eth = scapy.Ether(dst=eth_dst, src=eth_src)
ip = scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=5 + length, proto=proto)
tcp = tp(sport=tcp_sport, dport=tcp_dport+1)
pkt = eth / ip
@@ -2314,7 +2314,7 @@
self.RESULT_NOMATCH
)
- eth = scapy.Ether(dst=dl_dst, src=dl_src)
+ eth = scapy.Ether(dst=eth_dst, src=eth_src)
ip = scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=5 + length, proto=proto)
tcp = tp(sport=tcp_sport, dport=tcp_dport)
pkt = eth / ip
@@ -2346,8 +2346,8 @@
Verify LLC/SNAP parsing and matching. Focus on packet corruptions
"""
def runTest(self):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_tos=0
@@ -2359,7 +2359,7 @@
IS_NOT_SNAP_IP = 3
def testPacketTcpMatch(title, llc):
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport)
match = packet_to_flow_match(self, match_pkt)
@@ -2371,7 +2371,7 @@
self.testPktsAgainstFlow(
[[
"TCP match - LLC frame correct length - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=len(llc)) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=len(llc)) / llc,
self.RESULT_ANY,
]],
act, match
@@ -2382,7 +2382,7 @@
self.testPktsAgainstFlow(
[[
"TCP match - LLC frame corrupted length - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=ethLen) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=ethLen) / llc,
self.RESULT_ANY,
]],
act, match
@@ -2390,7 +2390,7 @@
def testPacketEthSrcDstMatch(title, llc):
# Matching based on Ethernet source and destination
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src)
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src)
match = packet_to_flow_match(self, match_pkt)
self.assertTrue(match is not None,
"Could not generate flow match from pkt")
@@ -2399,7 +2399,7 @@
self.testPktsAgainstFlow(
[[
"Eth addr match - LLC frame correct length- %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=len(llc)) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=len(llc)) / llc,
self.RESULT_MATCH,
]],
ofp.action.output(), match
@@ -2410,7 +2410,7 @@
self.testPktsAgainstFlow(
[[
"Eth addr match - LLC frame corrupted length- %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=ethLen) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=ethLen) / llc,
self.RESULT_ANY,
]],
ofp.action.output(), match
@@ -2418,7 +2418,7 @@
def testPacketEthSrcDstTypeMatch(title, llc, is_snap_ip):
# Matching based on Ethernet source, destination and type
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src, type=0x800)
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src, type=0x800)
match = packet_to_flow_match(self, match_pkt)
self.assertTrue(match is not None,
"Could not generate flow match from pkt")
@@ -2432,7 +2432,7 @@
self.testPktsAgainstFlow(
[[
"Eth addr+type match - LLC frame correct length - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=len(llc)) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=len(llc)) / llc,
is_match,
]],
ofp.action.output(), match
@@ -2443,7 +2443,7 @@
self.testPktsAgainstFlow(
[[
"Eth addr+type match - LLC frame corrupted length - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=ethLen) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=ethLen) / llc,
self.RESULT_ANY,
]],
ofp.action.output(), match
@@ -2499,8 +2499,8 @@
Verify LLC/SNAP parsing (valid and corrupted packets) and matching
"""
def runTest(self):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_tos=0
@@ -2513,7 +2513,7 @@
IS_NOT_SNAP = 3
def testPacketEthTypeIP(title, llc, is_snap):
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src, type=0x800)
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src, type=0x800)
match = packet_to_flow_match(self, match_pkt)
self.assertTrue(match is not None,
"Could not generate flow match from pkt")
@@ -2525,14 +2525,14 @@
result = self.RESULT_MATCH
pkts.append([
"Ether type 0x800 match - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=len(llc)) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=len(llc)) / llc,
result,
])
act = ofp.action.output()
self.testPktsAgainstFlow(pkts, act, match)
def testPacketEthTypeNotEth(title, llc, is_snap):
- match_pkt = scapy.Ether(dst = dl_dst, src = dl_src,
+ match_pkt = scapy.Ether(dst = eth_dst, src = eth_src,
type = ofp.OFP_DL_TYPE_NOT_ETH_TYPE)
match = packet_to_flow_match(self, match_pkt)
self.assertTrue(match is not None,
@@ -2545,7 +2545,7 @@
result = self.RESULT_NOMATCH
pkts.append([
"Ether type OFP_DL_TYPE_NOT_ETH_TYPE match - %s" % title,
- scapy.Ether(dst=dl_dst, src=dl_src, type=len(llc)) / llc,
+ scapy.Ether(dst=eth_dst, src=eth_src, type=len(llc)) / llc,
result,
])
act = ofp.action.output()
@@ -2612,8 +2612,8 @@
self.testArpHandling()
def testArpHandling(self):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_src2='192.168.1.1'
@@ -2625,7 +2625,7 @@
def testPacket(title, arp_match, arp_pkt, result):
pkts = []
- match_pkt = scapy.Ether(dst=dl_dst, src=dl_src) / arp_match
+ match_pkt = scapy.Ether(dst=eth_dst, src=eth_src) / arp_match
match = packet_to_flow_match(self, match_pkt)
self.assertTrue(match is not None,
"Could not generate flow match from pkt")
@@ -2633,7 +2633,7 @@
pkts.append([
title,
- scapy.Ether(dst=dl_dst, src=dl_src) / arp_pkt,
+ scapy.Ether(dst=eth_dst, src=eth_src) / arp_pkt,
result,
])
@@ -2642,7 +2642,7 @@
testPacket("Basic ARP",
scapy.ARP(psrc=ip_src, pdst=ip_dst, op = 1),
- scapy.ARP(hwdst = '00:00:00:00:00:00', hwsrc = dl_src,
+ scapy.ARP(hwdst = '00:00:00:00:00:00', hwsrc = eth_src,
psrc = ip_src, pdst = ip_dst, hwlen = 6, plen = 4,
ptype = 0x800, hwtype = 1, op = 1),
self.RESULT_MATCH
@@ -2659,8 +2659,8 @@
Verify VLAN parsing (valid and corrupted packets) and ARP matching
"""
def runTest(self):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_src2='192.168.1.1'
@@ -2686,61 +2686,61 @@
self.testPktsAgainstFlow(pkts, act, match)
testPacket("Basic MAC matching - IPv4 payload",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src)),
- scapy.Ether(dst=dl_dst, src=dl_src, type=0x800) / scapy.IP(),
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src)),
+ scapy.Ether(dst=eth_dst, src=eth_src, type=0x800) / scapy.IP(),
self.RESULT_MATCH
)
testPacket("Basic MAC matching - VMware beacon - no payload",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src)),
- scapy.Ether(dst=dl_dst, src=dl_src, type=0x8922),
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src)),
+ scapy.Ether(dst=eth_dst, src=eth_src, type=0x8922),
self.RESULT_MATCH
)
testPacket("Basic MAC matching - VMware beacon - with payload",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src)),
- scapy.Ether(dst=dl_dst, src=dl_src, type=0x8922)/ ("X" * 1),
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src)),
+ scapy.Ether(dst=eth_dst, src=eth_src, type=0x8922)/ ("X" * 1),
self.RESULT_MATCH
)
testPacket("Basic MAC matching - IPv6 payload",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src)),
- scapy.Ether(dst=dl_dst, src=dl_src) / scapy.IPv6(),
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src)),
+ scapy.Ether(dst=eth_dst, src=eth_src) / scapy.IPv6(),
self.RESULT_MATCH
)
testPacket("Basic MAC matching with VLAN tag present",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src)),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src)),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.IP(),
self.RESULT_MATCH
)
testPacket("Basic MAC matching with VLAN tag present",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x800),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x800),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.IP(),
self.RESULT_MATCH
)
testPacket("Ether matching with VLAN tag present - No type match",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x801),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x801),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.IP(),
self.RESULT_NOMATCH
)
testPacket("Ether matching with VLAN tag present - No type match 0x8100",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x8100),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x8100),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.IP(),
self.RESULT_NOMATCH
)
testPacket("IP matching - VLAN tag",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x0800,
- nw_src=parse_ip(ip_src), nw_dst=parse_ip(ip_dst)),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x0800,
+ ipv4_src=parse_ip(ip_src), ipv4_dst=parse_ip(ip_dst)),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.IP(src=ip_src, dst=ip_dst),
self.RESULT_MATCH
@@ -2756,8 +2756,8 @@
the treatment of these cases, so broken out to be non-standard
"""
def runTest(self):
- dl_dst='00:01:02:03:04:05'
- dl_src='00:06:07:08:09:0a'
+ eth_dst='00:01:02:03:04:05'
+ eth_src='00:06:07:08:09:0a'
ip_src='192.168.0.1'
ip_dst='192.168.0.2'
ip_src2='192.168.1.1'
@@ -2782,18 +2782,18 @@
act = ofp.action.output()
self.testPktsAgainstFlow(pkts, act, match)
testPacket("Ether matching with double VLAN tag - Wrong type match",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x800),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x800),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.Dot1Q(prio=3, vlan=1005)/ \
scapy.IP(),
self.RESULT_NOMATCH
)
testPacket("Ether matching with double VLAN tag - Type match",
- self.createMatch(dl_dst=parse_mac(dl_dst), dl_src=parse_mac(dl_src),
- dl_type=0x8100),
- scapy.Ether(dst=dl_dst, src=dl_src)/ \
+ self.createMatch(eth_dst=parse_mac(eth_dst), eth_src=parse_mac(eth_src),
+ eth_type=0x8100),
+ scapy.Ether(dst=eth_dst, src=eth_src)/ \
scapy.Dot1Q(prio=5, vlan=1000)/ \
scapy.Dot1Q(prio=3, vlan=1005)/ \
scapy.IP(),
diff --git a/tests/port_stats.py b/tests/port_stats.py
index b4815c2..c4eb1a6 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -239,7 +239,7 @@
pkt1 = simple_tcp_packet()
flow_mod_msg1 = self.buildFlowModMsg(pkt1, ingress_port, egress_port1)
- pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
+ pkt2 = simple_tcp_packet(eth_src='0:7:7:7:7:7')
flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
logging.info("Inserting flow1")
@@ -315,7 +315,7 @@
pkt1 = simple_tcp_packet()
flow_mod_msg1 = self.buildFlowModMsg(pkt1, port0, port1)
- pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
+ pkt2 = simple_tcp_packet(eth_src='0:7:7:7:7:7')
flow_mod_msg2 = self.buildFlowModMsg(pkt2, port0, port2)
logging.info("Inserting flow1")
diff --git a/tools/pylibopenflow/pylib/of/msg.py b/tools/pylibopenflow/pylib/of/msg.py
index 8617f56..129bc45 100644
--- a/tools/pylibopenflow/pylib/of/msg.py
+++ b/tools/pylibopenflow/pylib/of/msg.py
@@ -58,17 +58,17 @@
return prefix+"match wildcards:%x" % dic[nameprefix+"wildcards"][0]+\
" inport="+str(dic[nameprefix+"in_port"][0])+\
prefix+" "+\
- " ethertype="+str(dic[nameprefix+"dl_type"][0])+\
- " vlan="+str(dic[nameprefix+"dl_vlan"][0])+\
- " "+self.eth_describe(dic[nameprefix+"dl_src"])+"->"+\
- self.eth_describe(dic[nameprefix+"dl_dst"])+\
+ " ethertype="+str(dic[nameprefix+"eth_type"][0])+\
+ " vlan="+str(dic[nameprefix+"vlan_vid"][0])+\
+ " "+self.eth_describe(dic[nameprefix+"eth_src"])+"->"+\
+ self.eth_describe(dic[nameprefix+"eth_dst"])+\
prefix+" "+\
- " ipproto="+str(dic[nameprefix+"nw_proto"][0])+\
- " "+self.ip_describe(dic[nameprefix+"nw_src"][0])+\
- "->"+self.ip_describe(dic[nameprefix+"nw_src"][0])+\
+ " ipproto="+str(dic[nameprefix+"ip_proto"][0])+\
+ " "+self.ip_describe(dic[nameprefix+"ipv4_src"][0])+\
+ "->"+self.ip_describe(dic[nameprefix+"ipv4_src"][0])+\
prefix+" "+\
- " transport "+str(dic[nameprefix+"tp_src"][0])+\
- "->"+str(dic[nameprefix+"tp_dst"][0])
+ " transport "+str(dic[nameprefix+"tcp_src"][0])+\
+ "->"+str(dic[nameprefix+"tcp_dst"][0])
def switch_config_describe(self, packet):
"""Parse OpenFlow switch config and return description