Added SXP filtering tests 95/27795/21
authorMartin Mihálek <mamihale@cisco.com>
Fri, 2 Oct 2015 08:49:14 +0000 (10:49 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 27 Jan 2016 10:26:24 +0000 (10:26 +0000)
Change-Id: Id627fc8b9c8480f4cf8563d88e7870f7ebd129cb
Signed-off-by: Martin Mihálek <mamihale@cisco.com>
csit/libraries/Sxp.py
csit/libraries/SxpLib.robot
csit/scriptplans/sxp-filtering.txt [new file with mode: 0644]
csit/suites/sxp/basic/030_Connectivity.robot
csit/suites/sxp/filtering/010_Inbound_Filtering.robot [new file with mode: 0644]
csit/suites/sxp/filtering/020_Outbound_Filtering.robot [new file with mode: 0644]
csit/suites/sxp/filtering/030_Inbound_Filtering_Discarding.robot [new file with mode: 0644]
csit/suites/sxp/filtering/22-sxp-controller-one-node.xml [new file with mode: 0644]
csit/suites/sxp/scripts/filtering_node_setup.sh [new file with mode: 0644]
csit/suites/sxp/topology/010_Topology_Features.robot
csit/testplans/sxp-filtering.txt [new file with mode: 0644]

index 9701cbc794e64d7630653152cebc68dbf7611320..93a51b85f408c1256cf86767f5321a9745678233 100644 (file)
@@ -4,15 +4,40 @@ from string import Template
 
 
 def mod(num, base):
+    """Gets modulo of number
+
+    :param num: Number to be used
+    :type num: string
+    :param base: Base used
+    :type base: string
+    :returns: Int representing modulo of specified numbers.
+
+    """
     return int(num) % int(base)
 
 
 def get_ip_from_number(n):
+    """Generate string representing Ipv4 from specified number that is added number 2130706432
+
+    :param n: Number to be converted
+    :type n: int
+    :returns: String containing Ipv4.
+
+    """
     ip = IPAddress(2130706432 + n)
     return str(ip)
 
 
 def lower_version(ver1, ver2):
+    """Generate xml containing SGT mach data
+
+    :param ver1: Version of SXP protocol for compare
+    :type ver1: string
+    :param ver2: Version of SXP protocol for compare
+    :type ver2: string
+    :returns: String containing lower from those two specified versions.
+
+    """
     v1 = int(ver1[-1:])
     v2 = int(ver2[-1:])
     if v1 <= v2:
@@ -21,17 +46,279 @@ def lower_version(ver1, ver2):
         return ver2
 
 
-def parse_connections(input):
-    data = json.loads(input)
+def get_filter_entry(seq, entry_type, sgt="", esgt="", acl="", eacl="", pl="", epl=""):
+    """Generate xml containing FilterEntry data
+
+    :param seq: Sequence of entry
+    :type seq: string
+    :param entry_type: Type of entry (permit/deny)
+    :type entry_type: string
+    :param sgt: SGT matches to be added to entry
+    :type sgt: string
+    :param esgt: SGT ranges match to be added to entry
+    :type esgt: string
+    :param acl: ACL matches to be added to entry
+    :type acl: string
+    :param eacl: EACL matches to be added to entry
+    :type eacl: string
+    :param pl: PrefixList matches to be added to entry
+    :type pl: string
+    :param epl: ExtendedPrefixList matches to be added to entry
+    :type epl: string
+    :returns: String containing xml data for request
+
+    """
+    entries = ""
+    # Generate XML request containing combination of Matches of different types
+    if sgt:
+        args = sgt.split(',')
+        entries += add_sgt_matches_xml(args)
+    elif esgt:
+        args = esgt.split(',')
+        entries += add_sgt_range_xml(args[0], args[1])
+    if pl:
+        entries += add_pl_entry_xml(pl)
+    elif epl:
+        args = epl.split(',')
+        entries += add_epl_entry_xml(args[0], args[1], args[2])
+    if acl:
+        args = acl.split(',')
+        entries += add_acl_entry_xml(args[0], args[1])
+    elif eacl:
+        args = eacl.split(',')
+        entries += add_eacl_entry_xml(args[0], args[1], args[2], args[3])
+    # Wrap entries in ACL/PrefixList according to specified values
+    if pl or epl:
+        return add_pl_entry_default_xml(seq, entry_type, entries)
+    return add_acl_entry_default_xml(seq, entry_type, entries)
+
+
+def add_peers(*args):
+    """Generate xml containing Peer mach data
+
+    :param args: Peers data
+    :type args: dict
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <sxp-peer>
+            <peer-address>$ip</peer-address>
+        </sxp-peer>''')
+    peers = ""
+    for count, value in enumerate(args):
+        peers += templ.substitute({'ip': value})
+    return peers
+
+
+def add_sgt_matches_xml(sgt_entries):
+    """Generate xml containing SGT mach data
+
+    :param sgt_entries: SGT matches
+    :type sgt_entries: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <matches>$sgt</matches>''')
+    matches = ""
+    for sgt in sgt_entries:
+        matches += templ.substitute({'sgt': sgt})
+    return matches
+
+
+def add_sgt_range_xml(start, end):
+    """Generate xml containing SGT RangeMach data
+
+    :param start: Start range of SGT
+    :type start: string
+    :param end: End range of SGT
+    :type end: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <sgt-start>$start</sgt-start>
+        <sgt-end>$end</sgt-end>''')
+    match = templ.substitute({'start': start, 'end': end})
+    return match
+
+
+def add_acl_entry_default_xml(seq, entry_type, acl_entries):
+    """Generate xml containing AccessList data
+
+    :param seq: Sequence of PrefixList entry
+    :type seq: string
+    :param entry_type: Entry type (permit/deny)
+    :type entry_type: string
+    :param acl_entries: XML data containing AccessList entries
+    :type acl_entries: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <acl-entry>
+            <entry-type>$entry_type</entry-type>
+            <entry-seq>$seq</entry-seq>$acl_entries
+        </acl-entry>''')
+    matches = templ.substitute(
+        {'seq': seq, 'entry_type': entry_type, 'acl_entries': acl_entries})
+    return matches
+
+
+def add_acl_entry_xml(ip, mask):
+    """Generate xml containing AccessList data
+
+    :param ip: Ipv4/6 address
+    :type ip: string
+    :param mask: Ipv4/6 wildcard mask
+    :type mask: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <acl-match>
+            <ip-address>$ip</ip-address>
+            <wildcard-mask>$mask</wildcard-mask>
+        </acl-match>''')
+    return templ.substitute({'ip': ip, 'mask': mask})
+
+
+def add_eacl_entry_xml(ip, mask, amask, wmask):
+    """Generate xml containing ExtendedAccessList data
+
+    :param ip: Ipv4/6 address
+    :type ip: string
+    :param mask: Ipv4/6 wildcard mask
+    :type mask: string
+    :param amask: Ipv4/6 address mask
+    :type amask: string
+    :param wmask: Ipv4/6 address wildcard mask
+    :type wmask: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <acl-match>
+            <ip-address>$ip</ip-address>
+            <wildcard-mask>$mask</wildcard-mask>
+            <mask>
+              <address-mask>$amask</address-mask>
+              <wildcard-mask>$wmask</wildcard-mask>
+            </mask>
+        </acl-match>''')
+    return templ.substitute({'ip': ip, 'mask': mask, 'amask': amask, 'wmask': wmask})
+
+
+def add_pl_entry_default_xml(seq, entry_type, pl_entries):
+    """Generate xml containing PrefixList data
+
+    :param seq: Sequence of PrefixList entry
+    :type seq: string
+    :param entry_type: Entry type (permit/deny)
+    :type entry_type: string
+    :param pl_entries: XML data containing PrefixList entries
+    :type pl_entries: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+    <prefix-list-entry xmlns="urn:opendaylight:sxp:controller">
+          <entry-type>$entry_type</entry-type>
+          <entry-seq>$seq</entry-seq>$pl_entries
+    </prefix-list-entry>''')
+    return templ.substitute({'seq': seq, 'entry_type': entry_type, 'pl_entries': pl_entries})
+
+
+def add_pl_entry_xml(prefix):
+    """Generate xml containing PrefixList data
+
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <prefix-list-match>
+            <ip-prefix>$prefix</ip-prefix>
+        </prefix-list-match>''')
+    return templ.substitute({'prefix': prefix})
+
+
+def add_epl_entry_xml(prefix, op, mask):
+    """Generate xml containing Extended PrefixList data
+
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :param op: PrefixList option (ge/le/eq)
+    :type op: string
+    :param mask: Ipv4/6 Mask
+    :type mask: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''
+        <prefix-list-match>
+            <ip-prefix>$prefix</ip-prefix>
+            <mask>
+                <mask-range>$op</mask-range>
+                <mask-value>$mask</mask-value>
+            </mask>
+        </prefix-list-match>''')
+    return templ.substitute({'prefix': prefix, 'mask': mask, 'op': op})
+
+
+def parse_peer_groups(groups_json):
+    """Parse JSON string into Array of PeerGroups
+
+    :param groups_json: JSON containing PeerGroups
+    :type groups_json: string
+    :returns: Array containing PeerGroups.
+
+    """
+    data = json.loads(groups_json)
+    groups = data['output']
+    output = []
+    for group in groups.values():
+        output += group
+    return output
+
+
+def parse_connections(connections_json):
+    """Parse JSON string into Array of Connections
+
+    :param connections_json: JSON containing Connections
+    :type connections_json: string
+    :returns: Array containing Connections.
+
+    """
+    data = json.loads(connections_json)
     connections = data['output']['connections']
     output = []
-    for list in connections.values():
-        output = output + list
+    for connection in connections.values():
+        output += connection
     return output
 
 
-def find_connection(input, version, mode, ip, port, state):
-    for connection in parse_connections(input):
+def find_connection(connections_json, version, mode, ip, port, state):
+    """Test if Connection with specified values is contained in JSON
+
+    :param connections_json: JSON containing Connections
+    :type connections_json: string
+    :param version: Version of SXP protocol (version1/2/3/4)
+    :type version: string
+    :param mode: Mode of SXP peer (speaker/listener/both)
+    :type mode: string
+    :param ip: Ipv4/6 address of remote peer
+    :type ip: string
+    :param port: Port on with remote peer listens
+    :type port: string
+    :param state: State of connection (on/off/pendingOn/deleteHoldDown)
+    :type state: string
+    :returns: True if Connection with specified params was found, otherwise False.
+
+    """
+    for connection in parse_connections(connections_json):
         if (connection['peer-address'] == ip and connection['tcp-port'] == int(port) and connection['mode'] == mode and
                 connection['version'] == version):
             if state == 'none':
@@ -41,8 +328,17 @@ def find_connection(input, version, mode, ip, port, state):
     return False
 
 
-def parse_prefix_groups(input, source_):
-    data = json.loads(input)
+def parse_prefix_groups(prefix_groups_json, source_):
+    """Parse JSON string into Array of PrefixGroups
+
+    :param prefix_groups_json: JSON containing PrefixGroups
+    :type prefix_groups_json: string
+    :param source_: Source of PrefixGroups (sxp/local)
+    :type source_: string
+    :returns: Array containing PrefixGroups.
+
+    """
+    data = json.loads(prefix_groups_json)
     bindings = data['sxp-node:master-database']
     output = []
     for binding in bindings.values():
@@ -53,9 +349,24 @@ def parse_prefix_groups(input, source_):
     return output
 
 
-def find_binding(input, sgt, prefix, source_, action):
+def find_binding(prefix_groups_json, sgt, prefix, source_, action):
+    """Test if Binding with specified values is contained in JSON
+
+    :param prefix_groups_json: JSON containing Bindings and PrefixGroups
+    :type prefix_groups_json: string
+    :param sgt: Source Group Tag
+    :type sgt: string
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :param source_: Source of binding (local/sxp)
+    :type source_: string
+    :param action: Action for binding (add/delete)
+    :type action: string
+    :returns: True if Binding with specified params was found, otherwise False.
+
+    """
     found = False
-    for prefixgroup in parse_prefix_groups(input, source_):
+    for prefixgroup in parse_prefix_groups(prefix_groups_json, source_):
         if prefixgroup['sgt'] == int(sgt):
             for binding in prefixgroup['binding']:
                 if binding['ip-prefix'] == prefix and binding['action'] == action:
@@ -63,10 +374,29 @@ def find_binding(input, sgt, prefix, source_, action):
     return found
 
 
-def find_binding_with_peer_sequence(input, sgt, prefix, source_, action, node_id, peer_seq):
+def find_binding_with_peer_sequence(prefix_groups_json, sgt, prefix, source_, action, node_id, peer_seq):
+    """Test if Binding with specified values is contained in JSON
+
+    :param prefix_groups_json: JSON containing Bindings and PrefixGroups
+    :type prefix_groups_json: string
+    :param sgt: Source Group Tag
+    :type sgt: string
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :param source_: Source of binding (local/sxp)
+    :type source_: string
+    :param action: Action for binding (add/delete)
+    :type action: string
+    :param node_id: NodeId of from where Binding came from
+    :type node_id: string
+    :param peer_seq: Hop of specified NodeId from where Binding came from
+    :type peer_seq: string
+    :returns: True if Binding with specified params was found, otherwise False.
+
+    """
     correct_sequence = False
     found_source = False
-    for prefixgroup in parse_prefix_groups(input, source_):
+    for prefixgroup in parse_prefix_groups(prefix_groups_json, source_):
         if prefixgroup['sgt'] == int(sgt):
             for binding in prefixgroup['binding']:
                 if binding['ip-prefix'] == prefix and binding['action'] == action:
@@ -80,6 +410,17 @@ def find_binding_with_peer_sequence(input, sgt, prefix, source_, action, node_id
 
 
 def add_entry_xml(sgt, prefix, ip):
+    """Generate xml for Add Bindings request
+
+    :param sgt: Source Group Tag
+    :type sgt: string
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
   <sgt xmlns="urn:opendaylight:sxp:controller">$sgt</sgt>
@@ -89,9 +430,26 @@ def add_entry_xml(sgt, prefix, ip):
     return data
 
 
-def add_connection_xml(version, mode, ip, port, ip_, password_):
+def add_connection_xml(version, mode, ip, port, node, password_):
+    """Generate xml for Add Connection request
+
+    :param version: Version of SXP protocol (version1/2/3/4)
+    :type version: string
+    :param mode: Mode of SXP peer (speaker/listener/both)
+    :type mode: string
+    :param ip: Ipv4/6 address of remote peer
+    :type ip: string
+    :param port: Port on with remote peer listens
+    :type port: string
+    :param node: Ipv4 address of node
+    :type node: string
+    :param password_: Password type (none/default)
+    :type password_: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
-   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip_</requested-node>
+   <requested-node xmlns="urn:opendaylight:sxp:controller">$node</requested-node>
    <connections xmlns="urn:opendaylight:sxp:controller">
       <connection>
          <peer-address>$ip</peer-address>
@@ -110,11 +468,22 @@ def add_connection_xml(version, mode, ip, port, ip_, password_):
 </input>
 ''')
     data = templ.substitute(
-        {'ip': ip, 'port': port, 'mode': mode, 'version': version, 'ip_': ip_, 'password_': password_})
+        {'ip': ip, 'port': port, 'mode': mode, 'version': version, 'node': node, 'password_': password_})
     return data
 
 
 def delete_connections_xml(address, port, node):
+    """Generate xml for Delete Connection request
+
+    :param address: Ipv4/6 address of remote peer
+    :type address: string
+    :param port: Port on with remote peer listens
+    :type port: string
+    :param node: Ipv4 address of node
+    :type node: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
    <requested-node xmlns="urn:opendaylight:sxp:controller">$node</requested-node>
    <peer-address xmlns="urn:opendaylight:sxp:controller">$address</peer-address>
@@ -125,6 +494,21 @@ def delete_connections_xml(address, port, node):
 
 
 def update_binding_xml(sgt0, prefix0, sgt1, prefix1, ip):
+    """Generate xml for Update Binding request
+
+    :param sgt0: Original Source Group Tag
+    :type sgt0: string
+    :param prefix0: Original Ipv4/6 prefix
+    :type prefix0: string
+    :param sgt1: New Source Group Tag
+    :type sgt1: string
+    :param prefix1: New Ipv4/6 prefix
+    :type prefix1: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
   <original-binding xmlns="urn:opendaylight:sxp:controller">
@@ -142,6 +526,17 @@ def update_binding_xml(sgt0, prefix0, sgt1, prefix1, ip):
 
 
 def delete_binding_xml(sgt, prefix, ip):
+    """Generate xml for Delete Binding request
+
+    :param sgt: Source Group Tag
+    :type sgt: string
+    :param prefix: Ipv4/6 prefix
+    :type prefix: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
   <sgt xmlns="urn:opendaylight:sxp:controller">$sgt</sgt>
@@ -151,7 +546,119 @@ def delete_binding_xml(sgt, prefix, ip):
     return data
 
 
+def add_peer_group_xml(name, peers, ip):
+    """Generate xml for Add PeerGroups request
+
+    :param name: Name of PeerGroup
+    :type name: string
+    :param peers: XML formatted peers that will be added to group
+    :type peers: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''<input>
+  <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
+  <sxp-peer-group xmlns="urn:opendaylight:sxp:controller">
+    <name xmlns="urn:opendaylight:sxp:controller">$name</name>
+    <sxp-peers xmlns="urn:opendaylight:sxp:controller">$peers</sxp-peers>
+    </sxp-peer-group>
+</input>''')
+    data = templ.substitute({'name': name, 'peers': peers, 'ip': ip})
+    return data
+
+
+def delete_peer_group_xml(name, ip):
+    """Generate xml for Delete PeerGroup request
+
+    :param name: Name of PeerGroup
+    :type name: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''<input>
+  <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
+  <peer-group-name xmlns="urn:opendaylight:sxp:controller">$name</peer-group-name>
+</input>''')
+    data = templ.substitute({'name': name, 'ip': ip})
+    return data
+
+
+def get_peer_groups_from_node_xml(ip):
+    """Generate xml for Get PeerGroups request
+
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''<input>
+   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
+</input>''')
+    data = templ.substitute({'ip': ip})
+    return data
+
+
+def add_filter_xml(group, filter_type, entries, ip):
+    """Generate xml for Add Filter request
+
+    :param group: Name of group containing filter
+    :type group: string
+    :param filter_type: Type of filter
+    :type filter_type: string
+    :param entries: XML formatted entries that will be added in filter
+    :type entries: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+
+    """
+    templ = Template('''<input>
+  <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
+  <peer-group-name xmlns="urn:opendaylight:sxp:controller">$group</peer-group-name>
+  <sxp-filter xmlns="urn:opendaylight:sxp:controller">
+    <filter-type>$filter_type</filter-type>$entries
+  </sxp-filter>
+</input>''')
+    data = templ.substitute(
+        {'group': group, 'filter_type': filter_type, 'ip': ip, 'entries': entries})
+    return data
+
+
+def delete_filter_xml(group, filter_type, ip):
+    """Generate xml for Delete Filter request
+
+    :param group: Name of group containing filter
+    :type group: string
+    :param filter_type: Type of filter
+    :type filter_type: string
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
+    templ = Template('''<input>
+  <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
+  <peer-group-name xmlns="urn:opendaylight:sxp:controller">$group</peer-group-name>
+  <filter-type xmlns="urn:opendaylight:sxp:controller">$filter_type</filter-type>
+</input>''')
+    data = templ.substitute(
+        {'group': group, 'filter_type': filter_type, 'ip': ip})
+    return data
+
+
 def get_connections_from_node_xml(ip):
+    """Generate xml for Get Connections request
+
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
    <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
 </input>''')
@@ -160,6 +667,13 @@ def get_connections_from_node_xml(ip):
 
 
 def get_bindings_from_node_xml(ip):
+    """Generate xml for Get Bindings request
+
+    :param ip: Ipv4 address of node
+    :type ip: string
+    :returns: String containing xml data for request
+
+    """
     templ = Template('''<input>
   <requested-node xmlns="urn:opendaylight:sxp:controller">$ip</requested-node>
 </input>''')
index 20d68315e1201a5649c5608a27871bdbffbbebdf..193613ab133f4882ad0b332e7f8955937d3748a6 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Library containing Keywords used for SXP testing
+Library           Collections
 Library           RequestsLibrary
 Library           SSHLibrary
 Library           String
@@ -14,17 +15,18 @@ ${REST_CONTEXT}    /restconf/operations/sxp-controller
 Add Connection
     [Arguments]    ${version}    ${mode}    ${ip}    ${port}    ${node}=127.0.0.1    ${password}=none
     ...    ${session}=session
-    [Documentation]    Add connection via RCP to node
+    [Documentation]    Add connection via RPC to node
     ${DATA}    Add Connection Xml    ${version}    ${mode}    ${ip}    ${port}    ${node}
     ...    ${password}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:add-connection    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:add-connection    data=${DATA}    headers=${HEADERS_XML}
+    LOG     ${resp}
     Should be Equal As Strings    ${resp.status_code}    200
 
 Get Connections
     [Arguments]    ${node}=127.0.0.1    ${session}=session
-    [Documentation]    Gets all connections vie RPC from node
+    [Documentation]    Gets all connections via RPC from node
     ${DATA}    Get Connections From Node Xml    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:get-connections    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:get-connections    data=${DATA}    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
     [Return]    ${resp.content}
 
@@ -32,7 +34,7 @@ Delete Connections
     [Arguments]    ${ip}    ${port}    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Delete connection via RPC from node
     ${DATA}    Delete Connections Xml    ${ip}    ${port}    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:delete-connection    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:delete-connection    data=${DATA}    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
 
 Clean Connections
@@ -43,18 +45,25 @@ Clean Connections
     : FOR    ${connection}    IN    @{connections}
     \    delete connections    ${connection['peer-address']}    ${connection['tcp-port']}    ${node}    ${session}
 
+Verify Connection
+    [Arguments]    ${version}    ${mode}    ${ip}    ${port}=64999    ${node}=127.0.0.1    ${state}=on
+    [Documentation]    Verify that connection is ON
+    ${resp}    Get Connections    ${node}
+    Should Contain Connection    ${resp}    ${ip}    ${port}    ${mode}    ${version}    ${state}
+
 Add Binding
     [Arguments]    ${sgt}    ${prefix}    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Add binding via RPC to Master DB of node
     ${DATA}    Add Entry Xml    ${sgt}    ${prefix}    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:add-entry    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:add-entry    data=${DATA}    headers=${HEADERS_XML}
+    LOG     ${resp.content}
     Should be Equal As Strings    ${resp.status_code}    200
 
 Get Bindings
     [Arguments]    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Gets all binding via RPC from Master DB of node
     ${DATA}    Get Bindings From Node Xml    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:get-node-bindings    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:get-node-bindings    data=${DATA}    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
     [Return]    ${resp.content}
 
@@ -75,7 +84,7 @@ Clean Binding
 Get Bindings Master Database
     [Arguments]    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Gets content of Master DB from node
-    ${resp}    RequestsLibrary.Get    ${session}    /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/master-database/    headers=${HEADERS_XML}
+    ${resp}    Get Request    ${session}    /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/master-database/    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
     [Return]    ${resp.content}
 
@@ -83,14 +92,59 @@ Update Binding
     [Arguments]    ${sgtOld}    ${prefixOld}    ${sgtNew}    ${prefixNew}    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Updates value of binding via RPC in Master DB of node
     ${DATA}    Update Binding Xml    ${sgtOld}    ${prefixOld}    ${sgtNew}    ${prefixNew}    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:update-entry    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:update-entry    data=${DATA}    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
 
 Delete Binding
     [Arguments]    ${sgt}    ${prefix}    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Delete binding via RPC from Master DB of node
     ${DATA}    Delete Binding Xml    ${sgt}    ${prefix}    ${node}
-    ${resp}    RequestsLibrary.Post    ${session}    ${REST_CONTEXT}:delete-entry    data=${DATA}    headers=${HEADERS_XML}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:delete-entry    data=${DATA}    headers=${HEADERS_XML}
+    Should be Equal As Strings    ${resp.status_code}    200
+
+Add PeerGroup
+    [Documentation]    Adds new PeerGroup via RPC to Node
+    [Arguments]     ${name}     ${peers}=    ${node}=127.0.0.1       ${session}=session
+    ${DATA}    Add Peer Group Xml        ${name}        ${peers}         ${node}
+    LOG     ${DATA}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:add-peer-group    data=${DATA}    headers=${HEADERS_XML}
+    Should be Equal As Strings    ${resp.status_code}    200
+
+Delete Peer Group
+    [Arguments]    ${name}    ${node}=127.0.0.1       ${session}=session
+    [Documentation]    Delete PeerGroup via RPC from Node
+    ${DATA}    Delete Peer Group Xml        ${name}    ${node}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:delete-peer-group    data=${DATA}    headers=${HEADERS_XML}
+    Should be Equal As Strings    ${resp.status_code}    200
+
+Get Peer Groups
+    [Arguments]    ${node}=127.0.0.1    ${session}=session
+    [Documentation]    Gets all PeerGroups via RPC from node
+    ${DATA}    Get Peer Groups From Node Xml    ${node}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:get-peer-groups    data=${DATA}    headers=${HEADERS_XML}
+    Should be Equal As Strings    ${resp.status_code}    200
+    [Return]    ${resp.content}
+
+Clean Peer Groups
+    [Arguments]    ${node}=127.0.0.1       ${session}=session
+    [Documentation]    Delete all PeerGroups via RPC from node
+    ${resp}    Get Peer Groups    ${node}   ${session}
+    @{prefixes}    Parse Peer Groups    ${resp}
+    : FOR    ${group}    IN    @{prefixes}
+    \    Delete Peer Group      ${group['name']}    ${node}     ${session}
+
+Add Filter
+    [Arguments]    ${name}    ${type}      ${entries}       ${node}=127.0.0.1       ${session}=session
+    [Documentation]    Add Filter via RPC from Node
+    ${DATA}    Add Filter Xml        ${name}    ${type}    ${entries}   ${node}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:add-filter    data=${DATA}    headers=${HEADERS_XML}
+    Should be Equal As Strings    ${resp.status_code}    200
+
+Delete Filter
+    [Arguments]    ${name}    ${type}      ${node}=127.0.0.1       ${session}=session
+    [Documentation]    Delete Filter via RPC from Node
+    ${DATA}    Delete Filter Xml        ${name}    ${type}    ${node}
+    ${resp}    Post Request    ${session}    ${REST_CONTEXT}:delete-filter    data=${DATA}    headers=${HEADERS_XML}
     Should be Equal As Strings    ${resp.status_code}    200
 
 Should Contain Binding
@@ -135,6 +189,22 @@ Should Not Contain Connection
     ...    ${state}
     Should Not Be True    ${out}    Shouldn't have ${ip}:${port} ${mode} ${version}
 
+Setup Topology Complex
+    [Arguments]     ${version}=version4     ${PASSWORD}=none
+    : FOR    ${node}    IN RANGE    2    6
+    \   Add Connection    ${version}    both    127.0.0.1    64999    127.0.0.${node}    ${PASSWORD}
+    \   Add Connection    ${version}    both    127.0.0.${node}    64999    127.0.0.1    ${PASSWORD}
+    \   Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    both    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.${node}0.0/24     127.0.0.${node}
+    \   Add Binding    ${node}0   10.${node}0.0.0/16      127.0.0.${node}
+    \   Add Binding    ${node}0    ${node}0.0.0.0/8        127.0.0.${node}
+
+    Add Binding    10    10.10.10.10/32    127.0.0.1
+    Add Binding    10    10.10.10.0/24     127.0.0.1
+    Add Binding    10    10.10.0.0/16      127.0.0.1
+    Add Binding    10    10.0.0.0/8        127.0.0.1
+
 Setup SXP Environment
     [Documentation]    Create session to Controller
     Verify Feature Is Installed    odl-sxp-all
diff --git a/csit/scriptplans/sxp-filtering.txt b/csit/scriptplans/sxp-filtering.txt
new file mode 100644 (file)
index 0000000..aa220c1
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the scripts in run order:
+integration/test/csit/suites/sxp/scripts/filtering_node_setup.sh
index 24c7f5f83bca815e0c9013f79fcc8a87d5259b62..a4074f71de51438880dacb0b5519e61bb3acbb2e 100644 (file)
@@ -98,12 +98,6 @@ Test Both
     ...    64999    127.0.0.3
     Log    OK ${r_version}:both ${version}:both
 
-Verify Connection
-    [Arguments]    ${version}    ${mode}    ${ip}    ${port}    ${node}    ${state}=on
-    [Documentation]    Verify that connection is ON
-    ${resp}    Get Connections    ${node}
-    Should Contain Connection    ${resp}    ${ip}    ${port}    ${mode}    ${version}    ${state}
-
 Clean Nodes
     Clean Connections    127.0.0.1
     Clean Connections    127.0.0.2
diff --git a/csit/suites/sxp/filtering/010_Inbound_Filtering.robot b/csit/suites/sxp/filtering/010_Inbound_Filtering.robot
new file mode 100644 (file)
index 0000000..5a3ed58
--- /dev/null
@@ -0,0 +1,241 @@
+*** Settings ***
+Documentation     Test suite to verify Inbound filtering functionality
+Suite Setup       Setup SXP Environment
+Suite Teardown    Clean SXP Environment
+Test Setup        Setup Topology Complex
+Test Teardown     Clean Nodes
+Library           RequestsLibrary
+Library           SSHLibrary
+Library           ../../../libraries/Sxp.py
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/SxpLib.robot
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../variables/Variables.py
+
+*** Variables ***
+
+*** Test Cases ***
+Access List Filtering
+    [Documentation]     Test ACL filter behaviour during filter update
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+
+    ${entry1}       Get Filter Entry    10  permit      acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check One Group 4-2
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry    10    permit      acl=10.0.0.0,0.255.255.255
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Two Group 4-2
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry    10    deny      acl=10.0.0.0,0.255.255.255
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Three Group 4-2
+
+Access List Sgt Filtering
+    [Documentation]     Test ACL and SGT filter behaviour during filter update
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      sgt=50  acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check One Group 5-3
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry    10    permit      esgt=20,40   acl=10.0.0.0,0.255.255.255
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Two Group 5-3
+
+Prefix List Filtering
+    [Documentation]     Test Prefix List filter behaviour during filter update
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+
+    ${entry1}       Get Filter Entry    10  permit      pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      epl=10.0.0.0/8,le,16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check One Group 4-2
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry    10    permit      pl=10.0.0.0/8
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Two Group 4-2
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry    10    deny      pl=10.0.0.0/8
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Three Group 4-2
+
+Prefix List Sgt Filtering
+    [Documentation]     Test Prefix List and SGT filter behaviour during filter update
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      pl=10.50.0.0/16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check One Group 5-3
+    Delete Filter   GROUP    inbound
+    ${entries}       Get Filter Entry   10  permit      esgt=20,40  pl=10.0.0.0/8
+    Add Filter    GROUP    inbound      ${entries}
+    Wait Until Keyword Succeeds  4   1   Check Two Group 5-3
+
+
+*** Keywords ***
+Check One Group 4-2
+    [Documentation]     Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ACL 10.10.10.0 0.0.0.255
+    ...                 permit ACL 10.0.0.0 0.254.0.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.5
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    20    10.10.10.20/32    sxp
+    Should Not Contain Binding  ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding      ${resp}    20    10.20.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding      ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding      ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding      ${resp}    30    30.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    40    10.10.10.40/32    sxp
+    Should Not Contain Binding  ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding      ${resp}    40    10.40.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    40    40.0.0.0/8    sxp
+
+    ${resp}    Get Bindings Master Database    127.0.0.3
+    Should Contain Binding      ${resp}    50    10.10.10.50/32    sxp
+    Should Contain Binding      ${resp}    50    10.10.50.0/24    sxp
+    Should Contain Binding      ${resp}    50    10.50.0.0/16    sxp
+    Should Contain Binding      ${resp}    50    50.0.0.0/8    sxp
+
+Check Two Group 4-2
+    [Documentation]     Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ACL 10.0.0.0 0.255.255.255
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.5
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    20    10.10.10.20/32    sxp
+    Should Contain Binding      ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding      ${resp}    20    10.20.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding      ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding      ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding      ${resp}    30    30.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    40    10.10.10.40/32    sxp
+    Should Contain Binding      ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding      ${resp}    40    10.40.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    40    40.0.0.0/8    sxp
+
+    ${resp}    Get Bindings Master Database    127.0.0.3
+    Should Contain Binding      ${resp}    50    10.10.10.50/32    sxp
+    Should Contain Binding      ${resp}    50    10.10.50.0/24    sxp
+    Should Contain Binding      ${resp}    50    10.50.0.0/16    sxp
+    Should Contain Binding      ${resp}    50    50.0.0.0/8    sxp
+
+Check Three Group 4-2
+    [Documentation]     Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 deny ACL 10.0.0.0 0.255.255.255
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.5
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Not Contain Binding  ${resp}    20    10.10.10.20/32    sxp
+    Should Not Contain Binding  ${resp}    20    10.10.20.0/24    sxp
+    Should Not Contain Binding  ${resp}    20    10.20.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding      ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding      ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding      ${resp}    30    30.0.0.0/8    sxp
+    Should Not Contain Binding  ${resp}    40    10.10.10.40/32    sxp
+    Should Not Contain Binding  ${resp}    40    10.10.40.0/24    sxp
+    Should Not Contain Binding  ${resp}    40    10.40.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    40    40.0.0.0/8    sxp
+
+Check One Group 5-3
+    [Documentation]     Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit SGT 30 ACL 10.10.10.0 0.0.0.255
+    ...                 permit SGT 50 ACL 10.0.0.0 0.254.0.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.4
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    20    10.10.10.20/32    sxp
+    Should Contain Binding      ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding      ${resp}    20    10.20.0.0/16    sxp
+    Should Contain Binding      ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Not Contain Binding  ${resp}    30    10.10.30.0/24    sxp
+    Should Not Contain Binding  ${resp}    30    10.30.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    30    30.0.0.0/8    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.10.50/32    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.50.0/24    sxp
+    Should Contain Binding      ${resp}    50    10.50.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    50    50.0.0.0/8    sxp
+
+    ${resp}    Get Bindings Master Database    127.0.0.2
+    Should Contain Binding      ${resp}    40    10.10.10.40/32    sxp
+    Should Contain Binding      ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding      ${resp}    40    10.40.0.0/16    sxp
+    Should Contain Binding      ${resp}    40    40.0.0.0/8    sxp
+
+
+Check Two Group 5-3
+    [Documentation]     Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ESGT 20,40 ACL 10.0.0.0 0.255.255.255
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.4
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    20    10.10.10.20/32    sxp
+    Should Contain Binding      ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding      ${resp}    20    10.20.0.0/16    sxp
+    Should Contain Binding      ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding      ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding      ${resp}    30    10.30.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    30    30.0.0.0/8    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.10.50/32    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.50.0/24    sxp
+    Should Not Contain Binding  ${resp}    50    10.50.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    50    50.0.0.0/8    sxp
+
+    ${resp}    Get Bindings Master Database    127.0.0.2
+    Should Contain Binding      ${resp}    40    10.10.10.40/32    sxp
+    Should Contain Binding      ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding      ${resp}    40    10.40.0.0/16    sxp
+    Should Contain Binding      ${resp}    40    40.0.0.0/8    sxp
+
+Clean Nodes
+    Clean Connections    127.0.0.1
+    Clean Connections    127.0.0.2
+    Clean Connections    127.0.0.3
+    Clean Connections    127.0.0.4
+    Clean Connections    127.0.0.5
+    Clean Peer Groups    127.0.0.1
+    Clean Bindings       127.0.0.1
+    Clean Bindings       127.0.0.2
+    Clean Bindings       127.0.0.3
+    Clean Bindings       127.0.0.4
+    Clean Bindings       127.0.0.5
diff --git a/csit/suites/sxp/filtering/020_Outbound_Filtering.robot b/csit/suites/sxp/filtering/020_Outbound_Filtering.robot
new file mode 100644 (file)
index 0000000..dc89a8f
--- /dev/null
@@ -0,0 +1,254 @@
+*** Settings ***
+Documentation     Test suite to verify Outbound filtering functionality
+Suite Setup       Setup SXP Environment
+Suite Teardown    Clean SXP Environment
+Test Setup        Setup Nodes
+Test Teardown     Clean Nodes
+Library           RequestsLibrary
+Library           SSHLibrary
+Library           ../../../libraries/Sxp.py
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/SxpLib.robot
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../variables/Variables.py
+
+*** Variables ***
+
+*** Test Cases ***
+Access List Filtering
+    [Documentation]    Test ACL filter behaviour during filter update
+    ${peers}    Add Peers    127.0.0.4    127.0.0.5
+    Add PeerGroup    GROUP    ${peers}
+    ${entry1}    Get Filter Entry    10    permit    acl=10.10.10.0,0.0.0.255
+    ${entry2}    Get Filter Entry    20    deny    acl=10.10.0.0,0.0.255.0
+    ${entry3}    Get Filter Entry    30    permit    acl=10.0.0.0,0.255.255.0
+    ${entries}    Combine Strings    ${entry1}    ${entry2}    ${entry3}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-5
+    Delete Filter    GROUP    outbound
+    ${entry1}    Get Filter Entry    10    permit    acl=10.20.0.0,0.0.255.255
+    ${entry2}    Get Filter Entry    20    permit    acl=10.10.0.0,0.0.255.0
+    ${entries}    Combine Strings    ${entry1}    ${entry2}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check Two Group 4-5
+
+Access List Sgt Filtering
+    [Documentation]    Test ACL and SGT filter behaviour during filter update
+    ${peers}    Add Peers    127.0.0.2    127.0.0.5
+    Add PeerGroup    GROUP    ${peers}
+    ${entry1}    Get Filter Entry    10    deny    acl=10.10.20.0,0.0.0.255
+    ${entry2}    Get Filter Entry    20    permit    acl=10.10.0.0,0.0.255.0
+    ${entry3}    Get Filter Entry    30    permit    sgt=30    acl=10.10.10.0,0.0.0.255
+    ${entries}    Combine Strings    ${entry1}    ${entry2}    ${entry3}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 2-5
+    Delete Filter    GROUP    outbound
+    ${entries}    Get Filter Entry    10    permit    esgt=20,40    acl=10.10.0.0,0.0.255.255
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check Two Group 2-5
+
+Prefix List Filtering
+    [Documentation]    Test Prefix List filter behaviour during filter update
+    ${peers}    Add Peers    127.0.0.4    127.0.0.5
+    Add PeerGroup    GROUP    ${peers}
+    ${entry1}    Get Filter Entry    10    permit    pl=10.10.10.0/24
+    ${entry2}    Get Filter Entry    20    deny    epl=10.10.0.0/16,le,24
+    ${entry3}    Get Filter Entry    30    permit    epl=10.0.0.0/8,le,24
+    ${entries}    Combine Strings    ${entry1}    ${entry2}    ${entry3}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-5
+    Delete Filter    GROUP    outbound
+    ${entry1}    Get Filter Entry    10    permit    pl=10.20.0.0/16
+    ${entry2}    Get Filter Entry    20    permit    epl=10.10.0.0/16,le,24
+    ${entries}    Combine Strings    ${entry1}    ${entry2}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check Two Group 4-5
+
+Prefix List Sgt Filtering
+    [Documentation]    Test Prefix List and SGT filter behaviour during filter update
+    ${peers}    Add Peers    127.0.0.2    127.0.0.5
+    Add PeerGroup    GROUP    ${peers}
+    ${entry1}    Get Filter Entry    10    deny    pl=10.10.20.0/24
+    ${entry2}    Get Filter Entry    20    permit    epl=10.10.0.0/16,le,24
+    ${entry3}    Get Filter Entry    30    permit    sgt=30    pl=10.10.10.0/24
+    ${entries}    Combine Strings    ${entry1}    ${entry2}    ${entry3}
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 2-5
+    Delete Filter    GROUP    outbound
+    ${entries}    Get Filter Entry    10    permit    esgt=20,40    pl=10.10.0.0/16
+    Add Filter    GROUP    outbound    ${entries}
+    Wait Until Keyword Succeeds  4   1  Check Two Group 2-5
+
+*** Keywords ***
+Setup Nodes
+    [Arguments]    ${version}=version4    ${password}=none
+    : FOR    ${node}    IN RANGE    1    5
+    \    Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
+    \    Add Binding    ${node}0    10.10.${node}0.0/24    127.0.0.${node}
+    \    Add Binding    ${node}0    10.${node}0.0.0/16    127.0.0.${node}
+    \    Add Binding    ${node}0    ${node}0.0.0.0/8    127.0.0.${node}
+    Add Connection    ${version}    both    127.0.0.1    64999    127.0.0.2    ${password}
+    Add Connection    ${version}    both    127.0.0.2    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    both    127.0.0.2
+    Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    listener    127.0.0.3
+    Add Connection    ${version}    both    127.0.0.1    64999    127.0.0.4    ${password}
+    Add Connection    ${version}    both    127.0.0.4    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    both    127.0.0.4
+    Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.5    ${password}
+    Add Connection    ${version}    speaker    127.0.0.5    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    speaker    127.0.0.5
+
+Check One Group 4-5
+    [Documentation]     Check if only bindings matching filter nodes 4 and 5
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ACL 10.10.10.0 0.0.0.255
+    ...                 deny ACL 10.10.0.0 0.0.255.0
+    ...                 permit ACL 10.0.0.0 0.255.255.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    : FOR    ${node}    IN RANGE    4    6
+    \    ${resp}    Get Bindings Master Database    127.0.0.${node}
+    \    Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    \    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    \    Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    \    Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
+    \    Should Not Contain Binding    ${resp}    20    10.10.20.0/24    sxp
+    \    Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    \    Should Not Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    \    Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    ${resp}    Get Bindings Master Database    127.0.0.2
+    Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
+    Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
+    Should Contain Binding    ${resp}    40    40.0.0.0/8    sxp
+
+Check Two Group 4-5
+    [Documentation]     Check if only bindings matching filter nodes 4 and 5
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ACL 10.20.0.0 0.0.255.255
+    ...                 permit ACL 10.10.0.0 0.0.255.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    : FOR    ${node}    IN RANGE    4    6
+    \    ${resp}    Get Bindings Master Database    127.0.0.${node}
+    \    Should Not Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    \    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    \    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    \    Should Not Contain Binding    ${resp}    20    10.10.10.20/32    sxp
+    \    Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
+    \    Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    20    20.0.0.0/8    sxp
+    \    Should Not Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    ${resp}    Get Bindings Master Database    127.0.0.2
+    Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
+    Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding    ${resp}    40    10.40.0.0/16    sxp
+    Should Contain Binding    ${resp}    40    40.0.0.0/8    sxp
+
+Check One Group 2-5
+    [Documentation]     Check if only bindings matching filter nodes 2 and 5
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 deny ACL 10.10.20.0 0.0.0.255
+    ...                 permit ACL 10.10.0.0 0.0.255.0
+    ...                 permit SGT 30 ACL 10.10.10.0 0.0.0.255
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    @{list}    Create List    127.0.0.2    127.0.0.5
+    : FOR    ${node}    IN    @{list}
+    \    ${resp}    Get Bindings Master Database    ${node}
+    \    Should Not Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    \    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    \    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    \    Should Not Contain Binding    ${resp}    40    10.10.10.40/32    sxp
+    \    Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    40    10.40.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
+    ${resp}    Get Bindings Master Database    127.0.0.4
+    Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
+    Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
+    Should Contain Binding    ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+
+Check Two Group 2-5
+    [Documentation]     Check if only bindings matching filter nodes 2 and 5
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit SGT 20,40 ACL 10.10.0.0 0.0.255.255
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    @{list}    Create List    127.0.0.2    127.0.0.5
+    : FOR    ${node}    IN    @{list}
+    \    ${resp}    Get Bindings Master Database    ${node}
+    \    Should Not Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    \    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+    \    Should Contain Binding    ${resp}    40    10.10.10.40/32    sxp
+    \    Should Contain Binding    ${resp}    40    10.10.40.0/24    sxp
+    \    Should Not Contain Binding    ${resp}    40    10.40.0.0/16    sxp
+    \    Should Not Contain Binding    ${resp}    40    40.0.0.0/8    sxp
+    ${resp}    Get Bindings Master Database    127.0.0.4
+    Should Contain Binding    ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding    ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding    ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding    ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    20    10.10.10.20/32    sxp
+    Should Contain Binding    ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding    ${resp}    20    10.20.0.0/16    sxp
+    Should Contain Binding    ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding    ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding    ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding    ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding    ${resp}    30    30.0.0.0/8    sxp
+
+Clean Nodes
+    Clean Connections    127.0.0.1
+    Clean Connections    127.0.0.2
+    Clean Connections    127.0.0.3
+    Clean Connections    127.0.0.4
+    Clean Connections    127.0.0.5
+    Clean Peer Groups    127.0.0.1
+    Clean Bindings    127.0.0.1
+    Clean Bindings    127.0.0.2
+    Clean Bindings    127.0.0.3
+    Clean Bindings    127.0.0.4
+    Clean Bindings    127.0.0.5
diff --git a/csit/suites/sxp/filtering/030_Inbound_Filtering_Discarding.robot b/csit/suites/sxp/filtering/030_Inbound_Filtering_Discarding.robot
new file mode 100644 (file)
index 0000000..37d37b1
--- /dev/null
@@ -0,0 +1,239 @@
+*** Settings ***
+Documentation     Test suite to verify inbound-discarding filtering functionality
+Suite Setup       Setup SXP Environment
+Suite Teardown    Clean SXP Environment
+Test Teardown     Clean Nodes
+Library           RequestsLibrary
+Library           SSHLibrary
+Library           ../../../libraries/Sxp.py
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/SxpLib.robot
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../variables/Variables.py
+
+*** Variables ***
+
+*** Test Cases ***
+Access List Filtering
+    [Documentation]     Test ACL filter behaviour during filter update
+    Setup Nodes
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+
+Access List Sgt Filtering
+    [Documentation]     Test ACL and SGT filter behaviour during filter update
+    Setup Nodes
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      sgt=50  acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+
+Prefix List Filtering
+    [Documentation]     Test Prefix List filter behaviour during filter update
+    Setup Nodes
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      epl=10.0.0.0/8,le,16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+
+Prefix List Sgt Filtering
+    [Documentation]     Test Prefix List and SGT filter behaviour during filter update
+    Setup Nodes
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      pl=10.50.0.0/16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+
+Access List Filtering Legacy
+    [Documentation]     Test ACL filter behaviour during filter update
+    Setup Nodes Legacy Par Two
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+
+Access List Sgt Filtering Legacy
+    [Documentation]     Test ACL and SGT filter behaviour during filter update
+    Setup Nodes Legacy Par One
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  acl=10.10.10.0,0.0.0.255
+    ${entry2}       Get Filter Entry    20  permit      sgt=50  acl=10.0.0.0,0.254.0.0
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+
+Prefix List Filtering Legacy
+    [Documentation]     Test Prefix List filter behaviour during filter update
+    Setup Nodes Legacy Par Two
+    ${peers}         Add Peers      127.0.0.2       127.0.0.4
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      epl=10.0.0.0/8,le,16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 4-2
+
+Prefix List Sgt Filtering Legacy
+    [Documentation]     Test Prefix List and SGT filter behaviour during filter update
+    Setup Nodes Legacy Par One
+    ${peers}         Add Peers      127.0.0.3       127.0.0.5
+    Add PeerGroup    GROUP      ${peers}
+    ${entry1}       Get Filter Entry    10  permit      sgt=30  pl=10.10.10.0/24
+    ${entry2}       Get Filter Entry    20  permit      pl=10.50.0.0/16
+    ${entries}      Combine Strings     ${entry1}     ${entry2}
+    Add Filter    GROUP    inbound-discarding      ${entries}
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+    Delete Filter   GROUP    inbound-discarding
+    Wait Until Keyword Succeeds  4   1  Check One Group 5-3
+
+*** Keywords ***
+Setup Nodes
+    [Arguments]     ${version}=version4     ${password}=none
+    : FOR    ${node}    IN RANGE    2    5
+    \   Add Connection    ${version}    both    127.0.0.1    64999    127.0.0.${node}    ${password}
+    \   Add Connection    ${version}    both    127.0.0.${node}    64999    127.0.0.1    ${password}
+    \   Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    both    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.${node}0.0/24     127.0.0.${node}
+    \   Add Binding    ${node}0    10.${node}0.0.0/16      127.0.0.${node}
+    \   Add Binding    ${node}0    ${node}0.0.0.0/8        127.0.0.${node}
+    Add Connection    ${version}    both    127.0.0.5    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    both    127.0.0.3    64999    127.0.0.5    ${password}
+    Add Binding    50    10.10.10.50/32    127.0.0.5
+    Add Binding    50    10.10.50.0/24     127.0.0.5
+    Add Binding    50    10.50.0.0/16      127.0.0.5
+    Add Binding    50    50.0.0.0/8        127.0.0.5
+    Add Binding    10    10.10.10.10/32    127.0.0.1
+    Add Binding    10    10.10.10.0/24     127.0.0.1
+    Add Binding    10    10.10.0.0/16      127.0.0.1
+    Add Binding    10    10.0.0.0/8        127.0.0.1
+
+Setup Nodes Legacy Par One
+    [Arguments]     ${version}=version3      ${password}=none
+    : FOR    ${node}    IN RANGE    1    6
+    \   Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.${node}0.0/24     127.0.0.${node}
+    \   Add Binding    ${node}0    10.${node}0.0.0/16      127.0.0.${node}
+    \   Add Binding    ${node}0    ${node}0.0.0.0/8        127.0.0.${node}
+    Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.2    ${password}
+    Add Connection    ${version}    speaker    127.0.0.2    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    speaker    127.0.0.2
+    Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.4    ${password}
+    Add Connection    ${version}    speaker    127.0.0.4    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    speaker    127.0.0.4
+    Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    listener    127.0.0.3
+    Add Connection    ${version}    listener    127.0.0.5    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    speaker    127.0.0.3    64999    127.0.0.5    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    listener    127.0.0.5   64999   127.0.0.3
+
+Setup Nodes Legacy Par Two
+    [Arguments]     ${version}=version3     ${password}=none
+    : FOR    ${node}    IN RANGE    1    6
+    \   Add Binding    ${node}0    10.10.10.${node}0/32    127.0.0.${node}
+    \   Add Binding    ${node}0    10.10.${node}0.0/24     127.0.0.${node}
+    \   Add Binding    ${node}0    10.${node}0.0.0/16      127.0.0.${node}
+    \   Add Binding    ${node}0    ${node}0.0.0.0/8        127.0.0.${node}
+    Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.2    ${password}
+    Add Connection    ${version}    listener    127.0.0.2    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    listener    127.0.0.2
+    Add Connection    ${version}    speaker    127.0.0.1    64999    127.0.0.4    ${password}
+    Add Connection    ${version}    listener    127.0.0.4    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    listener    127.0.0.4
+    Add Connection    ${version}    listener    127.0.0.1    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    speaker    127.0.0.3    64999    127.0.0.1    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    speaker    127.0.0.3
+    Add Connection    ${version}    speaker    127.0.0.5    64999    127.0.0.3    ${password}
+    Add Connection    ${version}    listener    127.0.0.3    64999    127.0.0.5    ${password}
+    Wait Until Keyword Succeeds    15    4    Verify Connection    ${version}    speaker    127.0.0.5  64999   127.0.0.3
+
+Check One Group 4-2
+    [Documentation]     Check if only bindings matching filter from node 4 and 2 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit ACL 10.10.10.0 0.0.0.255
+    ...                 permit ACL 10.0.0.0 0.254.0.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.5
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    20    10.10.10.20/32    sxp
+    Should Not Contain Binding  ${resp}    20    10.10.20.0/24    sxp
+    Should Contain Binding      ${resp}    20    10.20.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    20    20.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Contain Binding      ${resp}    30    10.10.30.0/24    sxp
+    Should Contain Binding      ${resp}    30    10.30.0.0/16    sxp
+    Should Contain Binding      ${resp}    30    30.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    40    10.10.10.40/32    sxp
+    Should Not Contain Binding  ${resp}    40    10.10.40.0/24    sxp
+    Should Contain Binding      ${resp}    40    10.40.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    40    40.0.0.0/8    sxp
+
+Check One Group 5-3
+    [Documentation]     Check if only bindings matching filter from node 5 and 3 are propagated to SXP-DB of other nodes
+    ...                 Database should contains only Bindings regarding to these matches:
+    ...                 permit SGT 30 ACL 10.10.10.0 0.0.0.255
+    ...                 permit SGT 50 ACL 10.0.0.0 0.254.0.0
+    ...                 Info regarding filtering https://wiki.opendaylight.org/view/SXP:Beryllium:Developer_Guide
+    ${resp}    Get Bindings Master Database    127.0.0.4
+    Should Contain Binding      ${resp}    10    10.10.10.10/32    sxp
+    Should Contain Binding      ${resp}    10    10.10.10.0/24    sxp
+    Should Contain Binding      ${resp}    10    10.10.0.0/16    sxp
+    Should Contain Binding      ${resp}    10    10.0.0.0/8    sxp
+    Should Contain Binding      ${resp}    30    10.10.10.30/32    sxp
+    Should Not Contain Binding  ${resp}    30    10.10.30.0/24    sxp
+    Should Not Contain Binding  ${resp}    30    10.30.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    30    30.0.0.0/8    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.10.50/32    sxp
+    Should Not Contain Binding  ${resp}    50    10.10.50.0/24    sxp
+    Should Contain Binding      ${resp}    50    10.50.0.0/16    sxp
+    Should Not Contain Binding  ${resp}    50    50.0.0.0/8    sxp
+
+Clean Nodes
+    Clean Connections    127.0.0.1
+    Clean Connections    127.0.0.2
+    Clean Connections    127.0.0.3
+    Clean Connections    127.0.0.4
+    Clean Connections    127.0.0.5
+    Clean Peer Groups    127.0.0.1
+    Clean Bindings       127.0.0.1
+    Clean Bindings       127.0.0.2
+    Clean Bindings       127.0.0.3
+    Clean Bindings       127.0.0.4
+    Clean Bindings       127.0.0.5
diff --git a/csit/suites/sxp/filtering/22-sxp-controller-one-node.xml b/csit/suites/sxp/filtering/22-sxp-controller-one-node.xml
new file mode 100644 (file)
index 0000000..8510ca0
--- /dev/null
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<snapshot>
+    <required-capabilities>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:sxp:controller:conf?module=sxp-controller-conf&amp;revision=2014-10-02</capability>
+    </required-capabilities>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:sxp:controller:conf">
+                        binding:sxp-controller
+                    </type>
+                    <name>sxp-controller</name>
+
+                    <binding-broker>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+                            binding:binding-broker-osgi-registry
+                        </type>
+                        <name>binding-osgi-broker</name>
+                    </binding-broker>
+
+                    <rpc-registry>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+                            binding:binding-rpc-registry
+                        </type>
+                        <name>binding-rpc-broker</name>
+                    </rpc-registry>
+
+                    <data-broker>
+                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+                            binding:binding-async-data-broker
+                        </type>
+                        <name>binding-data-broker</name>
+                    </data-broker>
+
+                    <sxp-controller>
+                        <sxp-node>
+                            <enabled>true</enabled>
+                            <node-id>127.0.0.1</node-id>
+                            <source-ip>127.0.0.1</source-ip>
+                            <tcp-port>64999</tcp-port>
+                            <version>version4</version>
+                            <security>
+                                <password>kavabonga</password>
+                            </security>
+                            <mapping-expanded>0</mapping-expanded>
+                            <description>ODL SXP Controller</description>
+                            <master-database></master-database>
+                            <timers>
+                                <retry-open-time>5</retry-open-time>
+                                <hold-time-min-acceptable>120</hold-time-min-acceptable>
+                                <keep-alive-time>30</keep-alive-time>
+                                <hold-time>90</hold-time>
+                                <hold-time-min>90</hold-time-min>
+                                <hold-time-max>180</hold-time-max>
+                            </timers>
+                        </sxp-node>
+                        <sxp-node>
+                            <enabled>true</enabled>
+                            <node-id>127.0.0.2</node-id>
+                            <source-ip>127.0.0.2</source-ip>
+                            <tcp-port>64999</tcp-port>
+                            <version>version4</version>
+                            <security>
+                                <password>kavabonga</password>
+                            </security>
+                            <mapping-expanded>0</mapping-expanded>
+                            <description>ODL SXP Controller</description>
+                            <master-database></master-database>
+                            <timers>
+                                <retry-open-time>5</retry-open-time>
+                                <hold-time-min-acceptable>120</hold-time-min-acceptable>
+                                <keep-alive-time>30</keep-alive-time>
+                                <hold-time>90</hold-time>
+                                <hold-time-min>90</hold-time-min>
+                                <hold-time-max>180</hold-time-max>
+                            </timers>
+                        </sxp-node>
+                        <sxp-node>
+                            <enabled>true</enabled>
+                            <node-id>127.0.0.3</node-id>
+                            <source-ip>127.0.0.3</source-ip>
+                            <tcp-port>64999</tcp-port>
+                            <version>version4</version>
+                            <security>
+                                <password>kavabonga</password>
+                            </security>
+                            <mapping-expanded>0</mapping-expanded>
+                            <description>ODL SXP Controller</description>
+                            <master-database></master-database>
+                            <timers>
+                                <retry-open-time>5</retry-open-time>
+                                <hold-time-min-acceptable>120</hold-time-min-acceptable>
+                                <keep-alive-time>30</keep-alive-time>
+                                <hold-time>90</hold-time>
+                                <hold-time-min>90</hold-time-min>
+                                <hold-time-max>180</hold-time-max>
+                            </timers>
+                        </sxp-node>
+                        <sxp-node>
+                            <enabled>true</enabled>
+                            <node-id>127.0.0.4</node-id>
+                            <source-ip>127.0.0.4</source-ip>
+                            <tcp-port>64999</tcp-port>
+                            <version>version4</version>
+                            <security>
+                                <password>kavabonga</password>
+                            </security>
+                            <mapping-expanded>0</mapping-expanded>
+                            <description>ODL SXP Controller</description>
+                            <master-database></master-database>
+                            <timers>
+                                <retry-open-time>5</retry-open-time>
+                                <hold-time-min-acceptable>120</hold-time-min-acceptable>
+                                <keep-alive-time>30</keep-alive-time>
+                                <hold-time>90</hold-time>
+                                <hold-time-min>90</hold-time-min>
+                                <hold-time-max>180</hold-time-max>
+                            </timers>
+                        </sxp-node>
+                        <sxp-node>
+                            <enabled>true</enabled>
+                            <node-id>127.0.0.5</node-id>
+                            <source-ip>127.0.0.5</source-ip>
+                            <tcp-port>64999</tcp-port>
+                            <version>version4</version>
+                            <security>
+                                <password>kavabonga</password>
+                            </security>
+                            <mapping-expanded>0</mapping-expanded>
+                            <description>ODL SXP Controller</description>
+                            <master-database></master-database>
+                            <timers>
+                                <retry-open-time>5</retry-open-time>
+                                <hold-time-min-acceptable>120</hold-time-min-acceptable>
+                                <keep-alive-time>30</keep-alive-time>
+                                <hold-time>90</hold-time>
+                                <hold-time-min>90</hold-time-min>
+                                <hold-time-max>180</hold-time-max>
+                            </timers>
+                        </sxp-node>
+                    </sxp-controller>
+                </module>
+            </modules>
+        </data>
+    </configuration>
+</snapshot>
diff --git a/csit/suites/sxp/scripts/filtering_node_setup.sh b/csit/suites/sxp/scripts/filtering_node_setup.sh
new file mode 100644 (file)
index 0000000..5acf754
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+echo "Setup config to $ODL_SYSTEM_IP}"
+ssh ${ODL_SYSTEM_IP} "mkdir -p /tmp/${BUNDLEFOLDER}/etc/opendaylight/karaf/"
+
+scp ${WORKSPACE}/test/csit/suites/sxp/filtering/22-sxp-controller-one-node.xml ${ODL_SYSTEM_IP}:/tmp/${BUNDLEFOLDER}/etc/opendaylight/karaf/
index d0b3a63980f6e52088515fd8eb14ec786bda22c6..ac52b4080c5261a219de5204917d61626413cc66 100644 (file)
@@ -1,5 +1,5 @@
 *** Settings ***
-Documentation     Test suite to verify Bahaviour in different topologies
+Documentation     Test suite to verify Behaviour in different topologies
 Suite Setup       Setup SXP Environment
 Suite Teardown    Clean SXP Environment
 Test Setup        Clean Nodes
diff --git a/csit/testplans/sxp-filtering.txt b/csit/testplans/sxp-filtering.txt
new file mode 100644 (file)
index 0000000..1731483
--- /dev/null
@@ -0,0 +1,3 @@
+# Place the suites in run order:
+integration/test/csit/suites/sxp/filtering/
+