Update to test scripts to handle all remaining matches 44/4144/1
authorEd Warnicke <eaw@cisco.com>
Fri, 10 Jan 2014 18:22:08 +0000 (12:22 -0600)
committerEd Warnicke <eaw@cisco.com>
Fri, 10 Jan 2014 18:33:22 +0000 (12:33 -0600)
Change-Id: Iaecb7ea51681e50734eadda1af9a1223e3bc42c1
Signed-off-by: Ed Warnicke <eaw@cisco.com>
test-scripts/match-keywords.csv
test-scripts/odl_tests.py
test-scripts/xmls/f24.xml
test-scripts/xmls/f25.xml
test-scripts/xmls/f26.xml
test-scripts/xmls/f27.xml
test-scripts/xmls/f28.xml

index 4c1c627a378a330397ac2dd96aff8657eee20272..7be57e32631174e43fc429b3bcc88d2eca3710c1 100755 (executable)
@@ -8,6 +8,8 @@ ethernet-destination;dl_dst
 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
@@ -26,6 +28,7 @@ sctp-destination-port;tp_dst
 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
index ba12788928111f93753eb83b41da2905fab0e4b3..d967be4696c16f01924bb9562887139311aa10be 100755 (executable)
@@ -178,6 +178,27 @@ def ethernet_address_comparator(child, actual_match, kw):
         '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):
@@ -187,8 +208,13 @@ def proto_match_comparator(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()
@@ -301,6 +327,10 @@ def ip_match_comparator(expected_match, actual_match, kw):
                     (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)), \
@@ -334,16 +364,40 @@ def ip_match_comparator(expected_match, actual_match, kw):
 
 
 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,
@@ -376,7 +430,8 @@ def actions_comparator(actions, switch_flow):
         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):
@@ -401,7 +456,7 @@ def instructions_comparator(instructions_element, switch_flow):
                 continue
 
             comparator = INSTRUCTION_COMPARATORS.get(itype.nodeName,
-                                                     INSTRUCTION_COMPARATORS['default'])
+                                        INSTRUCTION_COMPARATORS['default'])
             comparator(itype, switch_flow)
 
 
index f80ccaa7be03ac8a8cce89b90569a1b60b8e5c07..6818990c223d760e5d0521f6ccafc9ebff933687 100644 (file)
@@ -1,36 +1,30 @@
 <?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>
+
index 3a305683029174b523f666f52596a2a9284b1a87..a82539bc620a5a9fb8ff99bf91b6f41c15d5f705 100644 (file)
@@ -1,36 +1,48 @@
 <?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>
index b2786c3eed29fbe72f8f21fe2b0acf927cebcfb2..105b31e624a33d9d4f1526920216a0156faafe64 100644 (file)
@@ -1,38 +1,46 @@
 <?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>
index 069278261f4ce89525d626c6ddcefc9613f3f78f..134e1c97cb33a4097c306d947b2693e98fcbc149 100644 (file)
@@ -1,34 +1,50 @@
 <?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>
+
index 08e61e9e1306a6f5f4f38b25639d62d3005db407..c0112ef49aa114fe532f2aaf2d83d035a47551d4 100644 (file)
@@ -1,36 +1,43 @@
 <?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>
+