ethernet-type;dl_type
icmpv4-type;icmp_type
icmpv4-code;icmp_code
+icmpv6-type;icmp_type
+icmpv6-code;icmp_code
in-port;in_port
in-phy-port;in_phy_port
ip-dscp;nw_tos
sctp-source-port;tp_src
tcp-destination-port;tp_dst
tcp-source-port;tp_src
+tunnel-id;tun_id
udp-destination-port;tp_dst
udp-source-port;tp_src
vlan-id;dl_vlan
'xml address: %s && actual address %s=%s' % data
+def masked_value_hex_comparator(child, actual_match, kw, vname, kname):
+ print 'masked_value_hex_comparator', child.toxml(), actual_match, \
+ vname, kname, child.nodeName
+
+ emd = int(child.getElementsByTagName(vname)[0].childNodes[0].data)
+
+ name = kw.get(vname)
+ data = child.toxml(), name, actual_match
+ print 'masked_value_hex_comparator', name
+
+ amd = int(actual_match[name], 16)
+
+ emasks = child.getElementsByTagName(kname)
+ if len(emasks) != 0:
+ print 'masked_value_hex_comparator - mask present:', \
+ emasks[0].childNodes[0].data
+
+ assert emd == amd, 'metadata: expected %s && actual %s=%s' % data
+
+
+
def proto_match_comparator(expected_match, actual_match, kw):
def compare_base10_integer(expected_match, actual_match, kw):
integer_comparator(expected_match.getElementsByTagName('vlan-id')[0], \
actual_match, kw, 10)
+ def compare_pbb(expected, actual, kw):
+ masked_value_hex_comparator(expected, actual, kw, \
+ 'pbb-isid', 'pbb-mask')
+
PROTO_COMPARATORS = {
'vlan-id': compare_vlan_id,
+ 'pbb': compare_pbb
}
# print 'ethernet_match_comparator-expected_match:', expected_match.toxml()
(actual_match.get('udp6', 'UDP6 Not-present') is None)), \
'ip protocol type: expected %s, actual %s=%s' % data
+ elif expected_proto == 58: # ICMP
+ assert actual_match.get('icmp6', 'ICMP6 Not-present') is None, \
+ 'ip protocol type: expected %s, actual %s=%s' % data
+
elif expected_proto == 132: #SCTP
assert ((actual_match.get('sctp', 'SCTP Not-present') is None) or \
(actual_match.get('sctp6', 'SCTP6 Not-present') is None)), \
def match_comparator(expected_match, switch_flow):
+
+ def compare_metadata(expected, actual, kw):
+ masked_value_hex_comparator(expected, actual, kw, \
+ 'metadata', 'metadata-mask')
+
+ def compare_ipv6_label(expected, actual, kw):
+ print 'compare_ipv6_label', expected.toxml(), actual
+ masked_value_hex_comparator(expected, actual, kw, \
+ 'ipv6-flabel', 'flabel-mask')
+
+
+ def compare_tunnel_id(expected, actual, kw):
+ masked_value_hex_comparator(expected, actual, kw, \
+ 'tunnel-id', 'tunnel-mask')
+
+
+ def compare_ipv6_ext_header(expected, actual, kw):
+ masked_value_hex_comparator(expected, actual, kw, \
+ 'ipv6-exthdr', 'ipv6-exthdr-mask')
+
+
MATCH_COMPARATORS = {
'arp-source-hardware-address': ethernet_address_comparator,
'arp-target-hardware-address': ethernet_address_comparator,
- 'metadata': masked_value_hex_comparator,
- 'ipv6-label': masked_value_hex_comparator,
+ 'metadata': compare_metadata,
+ 'ipv6-label': compare_ipv6_label,
+ 'ipv6-ext-header': compare_ipv6_ext_header,
+ 'tunnel': compare_tunnel_id,
'protocol-match-fields': proto_match_comparator,
'vlan-match': proto_match_comparator,
'ethernet-match': ethernet_match_comparator,
'ip-match': ip_match_comparator,
'icmpv4-match': ip_match_comparator,
+ 'icmpv6-match': ip_match_comparator,
'ipv4-destination': ip_subnet_comparator,
'ipv4-source': ip_subnet_comparator,
'ipv6-destination': ip_subnet_comparator,
data = action.toxml(), expected_action
# print 'actions_comparator:', data
- assert expected_action in actual_actions, 'xml part:\n%s\n expected action: %s' % data
+ assert expected_action in actual_actions, \
+ 'xml part:\n%s\n expected action: %s' % data
def null_comparator(element, switch_flow):
continue
comparator = INSTRUCTION_COMPARATORS.get(itype.nodeName,
- INSTRUCTION_COMPARATORS['default'])
+ INSTRUCTION_COMPARATORS['default'])
comparator(itype, switch_flow)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
+ <flow-name>FooXf24</flow-name>
+ <id>147</id>
+ <cookie_mask>255</cookie_mask>
+ <cookie>24</cookie>
+ <table_id>2</table_id>
+ <priority>2</priority>
+ <hard-timeout>1200</hard-timeout>
+ <idle-timeout>3400</idle-timeout>
+ <installHw>false</installHw>
<instructions>
<instruction>
- <order>0</order>
+ <order>0</order>
<apply-actions>
<action>
<order>0</order>
- <hw-path-action/>
+ <dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
- <table_id>2</table_id>
- <id>147</id>
- <cookie_mask>10</cookie_mask>
- <out_port>10</out_port>
- <installHw>false</installHw>
- <out_group>2</out_group>
<match>
- <ethernet-match>
- <ethernet-type>
- <type>2048</type>
- </ethernet-type>
- </ethernet-match>
- <ipv4-destination>10.0.0.1/24</ipv4-destination>
+ <tunnel>
+ <tunnel-id>2591</tunnel-id>
+ </tunnel>
</match>
- <hard-timeout>12</hard-timeout>
- <flags>FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false]</flags>
- <cookie>10</cookie>
- <idle-timeout>34</idle-timeout>
- <flow-name>FooXf24</flow-name>
- <priority>2</priority>
- <barrier>false</barrier>
</flow>
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
+ <flow-name>FooXf25</flow-name>
+ <id>148</id>
+ <cookie_mask>255</cookie_mask>
+ <cookie>25</cookie>
+ <table_id>2</table_id>
+ <priority>2</priority>
+ <hard-timeout>1200</hard-timeout>
+ <idle-timeout>3400</idle-timeout>
+ <installHw>false</installHw>
<instructions>
<instruction>
- <order>0</order>
+ <order>0</order>
<apply-actions>
<action>
<order>0</order>
- <loopback-action/>
+ <dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
- <table_id>2</table_id>
- <id>148</id>
- <cookie_mask>10</cookie_mask>
- <out_port>10</out_port>
- <installHw>false</installHw>
- <out_group>2</out_group>
<match>
<ethernet-match>
<ethernet-type>
- <type>2048</type>
+ <type>34525</type>
</ethernet-type>
</ethernet-match>
- <ipv4-destination>10.0.0.1/24</ipv4-destination>
+ <ipv6-source>1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76</ipv6-source>
+ <ipv6-destination>fe80:2acf:e9ff:fe21::6431/94</ipv6-destination>
+ <metadata>
+ <metadata>12345</metadata>
+ </metadata>
+ <ipv6-label>
+ <ipv6-flabel>33</ipv6-flabel>
+ </ipv6-label>
+ <ip-match>
+ <ip-protocol>58</ip-protocol>
+ <ip-dscp>60</ip-dscp>
+ <ip-ecn>3</ip-ecn>
+ </ip-match>
+ <icmpv6-match>
+ <icmpv6-type>6</icmpv6-type>
+ <icmpv6-code>3</icmpv6-code>
+ </icmpv6-match>
</match>
- <hard-timeout>12</hard-timeout>
- <flags>FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false]</flags>
- <cookie>10</cookie>
- <idle-timeout>34</idle-timeout>
- <flow-name>FooXf25</flow-name>
- <priority>2</priority>
- <barrier>false</barrier>
</flow>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
+ <flow-name>FooXf26</flow-name>
+ <id>149</id>
+ <cookie_mask>255</cookie_mask>
+ <cookie>26</cookie>
+ <table_id>2</table_id>
+ <priority>2</priority>
+ <hard-timeout>1200</hard-timeout>
+ <idle-timeout>3400</idle-timeout>
+ <installHw>false</installHw>
<instructions>
<instruction>
- <order>0</order>
+ <order>0</order>
<apply-actions>
<action>
<order>0</order>
- <pop-mpls-action>
- <ethernet-type>11</ethernet-type>
- </pop-mpls-action>
+ <dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
- <table_id>2</table_id>
- <id>149</id>
- <cookie_mask>10</cookie_mask>
- <out_port>10</out_port>
- <installHw>false</installHw>
- <out_group>2</out_group>
<match>
<ethernet-match>
<ethernet-type>
- <type>2048</type>
+ <type>34525</type>
</ethernet-type>
</ethernet-match>
- <ipv4-destination>10.0.0.1/24</ipv4-destination>
+ <ipv6-source>1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76</ipv6-source>
+ <ipv6-destination>fe80:2acf:e9ff:fe21::6431/94</ipv6-destination>
+ <ipv6-nd-target>fe80:3456:789A:fe21::6431</ipv6-nd-target>
+ <ipv6-nd-sll>12:34:56:78:9A:BC</ipv6-nd-sll>
+ <ipv6-nd-tll>FE:DC:BA:98:76:54</ipv6-nd-tll>
+ <metadata>
+ <metadata>12345</metadata>
+ </metadata>
+ <ip-match>
+ <ip-protocol>6</ip-protocol>
+ <ip-dscp>60</ip-dscp>
+ <ip-ecn>3</ip-ecn>
+ </ip-match>
+ <tcp-source-port>183</tcp-source-port>
+ <tcp-destination-port>8080</tcp-destination-port>
</match>
- <hard-timeout>12</hard-timeout>
- <flags>FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false]</flags>
- <cookie>10</cookie>
- <idle-timeout>34</idle-timeout>
- <flow-name>FooXf26</flow-name>
- <priority>2</priority>
- <barrier>false</barrier>
</flow>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<strict>false</strict>
+ <flow-name>FooXf27</flow-name>
+ <id>150</id>
+ <cookie_mask>255</cookie_mask>
+ <cookie>27</cookie>
+ <table_id>2</table_id>
+ <priority>2</priority>
+ <hard-timeout>1200</hard-timeout>
+ <idle-timeout>3400</idle-timeout>
+ <installHw>false</installHw>
<instructions>
<instruction>
+ <order>0</order>
+ <apply-actions>
+ <action>
<order>0</order>
- <write-metadata>
- <metadata-mask>12</metadata-mask>
- <metadata>10</metadata>
- </write-metadata>
+ <dec-nw-ttl/>
+ </action>
+ </apply-actions>
</instruction>
</instructions>
- <table_id>2</table_id>
- <id>150</id>
- <cookie_mask>10</cookie_mask>
- <out_port>10</out_port>
- <installHw>false</installHw>
- <out_group>2</out_group>
<match>
<ethernet-match>
<ethernet-type>
- <type>2048</type>
+ <type>34525</type>
</ethernet-type>
</ethernet-match>
- <ipv4-destination>10.0.0.1/24</ipv4-destination>
+ <ipv6-source>1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76</ipv6-source>
+ <ipv6-destination>fe80:2acf:e9ff:fe21::6431/94</ipv6-destination>
+ <metadata>
+ <metadata>12345</metadata>
+ </metadata>
+ <ipv6-label>
+ <ipv6-flabel>33</ipv6-flabel>
+ </ipv6-label>
+ <ipv6-ext-header>
+ <ipv6-exthdr>0</ipv6-exthdr>
+ </ipv6-ext-header>
+ <ip-match>
+ <ip-protocol>6</ip-protocol>
+ <ip-dscp>60</ip-dscp>
+ <ip-ecn>3</ip-ecn>
+ </ip-match>
+ <tcp-source-port>183</tcp-source-port>
+ <tcp-destination-port>8080</tcp-destination-port>
</match>
- <hard-timeout>12</hard-timeout>
- <flags>FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false]</flags>
- <cookie>10</cookie>
- <idle-timeout>34</idle-timeout>
- <flow-name>FooXf27</flow-name>
- <priority>2</priority>
- <barrier>false</barrier>
</flow>
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
+ <flow-name>FooXf28</flow-name>
+ <id>151</id>
+ <cookie_mask>255</cookie_mask>
+ <cookie>28</cookie>
+ <hard-timeout>1200</hard-timeout>
+ <idle-timeout>3400</idle-timeout>
+ <priority>2</priority>
+ <table_id>2</table_id>
<strict>false</strict>
<instructions>
<instruction>
- <order>0</order>
+ <order>0</order>
<apply-actions>
<action>
<order>0</order>
- <pop-pbb-action/>
+ <dec-nw-ttl/>
</action>
</apply-actions>
</instruction>
</instructions>
- <table_id>2</table_id>
- <id>151</id>
- <cookie_mask>10</cookie_mask>
- <out_port>10</out_port>
- <installHw>false</installHw>
- <out_group>2</out_group>
<match>
<ethernet-match>
<ethernet-type>
- <type>2048</type>
+ <type>34887</type>
</ethernet-type>
+ <ethernet-destination>
+ <address>ff:ff:29:01:19:61</address>
+ </ethernet-destination>
+ <ethernet-source>
+ <address>00:00:00:11:23:ae</address>
+ </ethernet-source>
</ethernet-match>
- <ipv4-destination>10.0.0.1/24</ipv4-destination>
+ <protocol-match-fields>
+ <pbb>
+ <pbb-isid>45</pbb-isid>
+ </pbb>
+ </protocol-match-fields>
</match>
- <hard-timeout>12</hard-timeout>
<flags>FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false]</flags>
- <cookie>10</cookie>
- <idle-timeout>34</idle-timeout>
- <flow-name>FooXf28</flow-name>
- <priority>2</priority>
- <barrier>false</barrier>
</flow>
+